📰 资讯中心
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>资讯中心 - 系统之家</title> <link rel="stylesheet" href="/static/css/style.css"> <style> * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); min-height: 100vh; color: #333; } .information-container { max-width: 1400px; margin: 0 auto; padding: 40px 20px; } .page-header { text-align: center; margin-bottom: 40px; } .page-title { font-size: 42px; font-weight: 700; color: #2c3e50; margin-bottom: 12px; text-shadow: 2px 2px 4px rgba(0,0,0,0.1); } .page-subtitle { font-size: 18px; color: #7f8c8d; margin-bottom: 24px; } .search-box { max-width: 600px; margin: 0 auto; position: relative; } .search-box input { width: 100%; padding: 16px 24px; border: none; border-radius: 50px; font-size: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.1); outline: none; transition: all 0.3s; } .search-box input:focus { box-shadow: 0 8px 30px rgba(102, 126, 234, 0.3); transform: translateY(-2px); } .search-box button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); padding: 12px 24px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; border: none; border-radius: 50px; cursor: pointer; font-size: 16px; font-weight: 600; transition: all 0.3s; } .search-box button:hover { background: linear-gradient(135deg, #5a6fd6 0%, #6a4096 100%); transform: translateY(-50%) translateY(-2px); } .category-section { margin-bottom: 40px; } .category-tabs { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; background: #fff; padding: 20px; border-radius: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); } .category-tab { padding: 12px 28px; border: 2px solid #e0e6ed; border-radius: 50px; cursor: pointer; font-size: 15px; font-weight: 600; color: #546e7a; background: #fff; transition: all 0.3s; text-decoration: none; display: flex; align-items: center; gap: 8px; } .category-tab:hover { border-color: #667eea; color: #667eea; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2); } .category-tab.active { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; border-color: transparent; box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4); } .category-tab .count { background: rgba(0,0,0,0.1); padding: 2px 8px; border-radius: 10px; font-size: 12px; } .category-tab.active .count { background: rgba(255,255,255,0.3); } .stats-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; padding: 16px 24px; background: #fff; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); } .stats-info { display: flex; gap: 32px; } .stat-item { display: flex; flex-direction: column; gap: 4px; } .stat-label { font-size: 13px; color: #95a5a6; font-weight: 500; } .stat-value { font-size: 20px; font-weight: 700; color: #2c3e50; } .sort-options { display: flex; gap: 12px; } .sort-btn { padding: 8px 16px; border: 1px solid #e0e6ed; border-radius: 8px; background: #fff; cursor: pointer; font-size: 14px; color: #546e7a; transition: all 0.3s; } .sort-btn:hover { border-color: #667eea; color: #667eea; } .sort-btn.active { background: #667eea; color: #fff; border-color: #667eea; } .information-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 24px; margin-bottom: 40px; } .information-card { background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,0.08); transition: all 0.4s; } .information-card:hover { transform: translateY(-8px); box-shadow: 0 12px 40px rgba(0,0,0,0.15); } .card-image { width: 100%; height: 200px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; } .card-image svg { width: 80px; height: 80px; stroke: #fff; opacity: 0.9; } .card-category-badge { position: absolute; top: 16px; left: 16px; padding: 6px 14px; background: rgba(255,255,255,0.95); border-radius: 20px; font-size: 12px; font-weight: 600; color: #667eea; box-shadow: 0 2px 8px rgba(0,0,0,0.1); } .card-content { padding: 24px; } .card-title { font-size: 18px; font-weight: 700; color: #2c3e50; margin-bottom: 12px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; transition: color 0.3s; } .information-card:hover .card-title { color: #667eea; } .card-title a { color: inherit; text-decoration: none; } .card-description { font-size: 14px; color: #7f8c8d; line-height: 1.6; margin-bottom: 16px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; } .card-meta { display: flex; justify-content: space-between; align-items: center; padding-top: 16px; border-top: 1px solid #f0f2f5; margin-bottom: 16px; } .meta-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #95a5a6; } .meta-item svg { width: 16px; height: 16px; stroke: #95a5a6; } .card-tags { display: flex; gap: 8px; flex-wrap: wrap; } .tag { padding: 6px 12px; background: #f0f2f5; border-radius: 20px; font-size: 12px; color: #667eea; font-weight: 500; transition: all 0.3s; } .tag:hover { background: #667eea; color: #fff; } .information-card.featured { grid-column: span 2; display: grid; grid-template-columns: 1fr 1fr; } .information-card.featured .card-image { height: 100%; min-height: 300px; } .information-card.featured .card-content { display: flex; flex-direction: column; justify-content: center; } .information-card.featured .card-title { font-size: 24px; } .empty-state { text-align: center; padding: 80px 20px; background: #fff; border-radius: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); } .empty-state svg { width: 120px; height: 120px; stroke: #dfe6e9; margin-bottom: 24px; } .empty-state h3 { font-size: 24px; color: #2c3e50; margin-bottom: 12px; } .empty-state p { font-size: 16px; color: #7f8c8d; margin-bottom: 24px; } .empty-state .btn { display: inline-block; padding: 14px 32px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; border-radius: 50px; text-decoration: none; font-weight: 600; transition: all 0.3s; } .empty-state .btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4); } .pagination { display: flex; justify-content: center; gap: 8px; margin-top: 40px; } .pagination button { width: 44px; height: 44px; border: 2px solid #e0e6ed; border-radius: 10px; background: #fff; cursor: pointer; font-size: 15px; font-weight: 600; color: #546e7a; transition: all 0.3s; display: flex; align-items: center; justify-content: center; } .pagination button:hover:not(:disabled) { border-color: #667eea; color: #667eea; } .pagination button.active { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; border-color: transparent; } .pagination button:disabled { opacity: 0.5; cursor: not-allowed; } @media (max-width: 768px) { .information-container { padding: 20px 15px; } .page-title { font-size: 28px; } .information-grid { grid-template-columns: 1fr; } .information-card.featured { grid-column: span 1; grid-template-columns: 1fr; } .information-card.featured .card-image { min-height: 200px; } } </style> </head> <body> <div class="information-container"> <header class="page-header"> <h1 class="page-title">📰 资讯中心</h1> <p class="page-subtitle"><?php echo isset($content) ? htmlspecialchars($content) : '获取最新的科技资讯、行业动态和技术文章'; ?></p> <div class="search-box"> <input type="text" id="searchInput" placeholder="搜索资讯内容..." value="<?php echo isset($keyword) ? htmlspecialchars($keyword) : ''; ?>" autocomplete="off"> <button onclick="performSearch()"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <circle cx="11" cy="11" r="8"></circle> <path d="m21 21-4.35-4.35"></path> </svg> 搜索 </button> </div> </header> <section class="category-section"> <div class="category-tabs" id="categoryTabs"> <a href="/information" class="category-tab <?php echo empty($current_category) ? 'active' : ''; ?>"> <span>📚</span> 全部 <span class="count"><?php echo isset($stats['total_information']) ? $stats['total_information'] : 0; ?></span> </a> <?php if (isset($stats['categories']) && is_array($stats['categories'])): ?> <?php foreach ($stats['categories'] as $key => $name): ?> <a href="/information?category=<?php echo $key; ?>" class="category-tab <?php echo $current_category == $key ? 'active' : ''; ?>"> <span>📖</span> <?php echo htmlspecialchars($name); ?> <span class="count"><?php echo isset($category_counts[$key]) ? $category_counts[$key] : 0; ?></span> </a> <?php endforeach; ?> <?php endif; ?> </div> </section> <div class="stats-bar"> <div class="stats-info"> <div class="stat-item"> <span class="stat-label">当前分类</span> <span class="stat-value" id="currentCategory"><?php echo empty($current_category) ? '全部' : (isset($stats['categories'][$current_category]) ? $stats['categories'][$current_category] : $current_category); ?></span> </div> <div class="stat-item"> <span class="stat-label">文章总数</span> <span class="stat-value" id="totalCount"><?php echo isset($total) ? $total : 0; ?></span> </div> <div class="stat-item"> <span class="stat-label">当前页码</span> <span class="stat-value"><?php echo isset($current_page) ? $current_page : 1; ?> / <?php echo isset($total_pages) ? $total_pages : 1; ?></span> </div> </div> <div class="sort-options"> <button class="sort-btn active" data-sort="latest">最新</button> <button class="sort-btn" data-sort="hot">热门</button> <button class="sort-btn" data-sort="recommend">推荐</button> </div> </div> <?php if (isset($information_list) && !empty($information_list)): ?> <div class="information-grid" id="informationGrid"> <?php $index = 0; ?> <?php foreach ($information_list as $info): ?> <?php $isFeatured = $index === 0; ?> <article class="information-card<?php echo $isFeatured ? ' featured' : ''; ?>"> <div class="card-image" style="background: linear-gradient(135deg, <?php echo ['#667eea,#764ba2', '#ff6b6b,#ee5a6f', '#4facfe,#00f2fe', '#43e97b,#38f9d7', '#f093fb,#f5576c'][($index % 5)]; ?>)"> <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"> <path d="M12 2L2 7l10 5 10-5-10-5z"></path> <path d="M2 17l10 5 10-5"></path> <path d="M2 12l10 5 10-5"></path> </svg> <span class="card-category-badge"><?php echo isset($stats['categories'][$info['category']]) ? $stats['categories'][$info['category']] : $info['category']; ?></span> </div> <div class="card-content"> <h2 class="card-title"> <a href="/information/<?php echo $info['id']; ?>"><?php echo htmlspecialchars($info['title']); ?></a> </h2> <p class="card-description"><?php echo htmlspecialchars($info['description']); ?></p> <div class="card-meta"> <span class="meta-item"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect> <line x1="16" y1="2" x2="16" y2="6"></line> <line x1="8" y1="2" x2="8" y2="6"></line> <line x1="3" y1="10" x2="21" y2="10"></line> </svg> <?php echo htmlspecialchars($info['date']); ?> </span> <span class="meta-item"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path> <circle cx="12" cy="12" r="3"></circle> </svg> <?php echo $info['views']; ?> 阅读 </span> </div> <?php if (isset($info['tags']) && !empty($info['tags'])): ?> <div class="card-tags"> <?php foreach ($info['tags'] as $tag): ?> <span class="tag"><?php echo htmlspecialchars($tag); ?></span> <?php endforeach; ?> </div> <?php endif; ?> </div> </article> <?php $index++; ?> <?php endforeach; ?> </div> <?php if (isset($total_pages) && $total_pages > 1): ?> <div class="pagination" id="pagination"> <button <?php echo (isset($current_page) && $current_page <= 1) ? 'disabled' : ''; ?> onclick="goToPage(<?php echo isset($current_page) ? $current_page - 1 : 0; ?>)"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <polyline points="15 18 9 12 15 6"></polyline> </svg> </button> <?php for ($i = 1; $i <= min(5, $total_pages); $i++): ?> <button <?php echo (isset($current_page) && $current_page == $i) ? 'class="active"' : ''; ?> onclick="goToPage(<?php echo $i; ?>)"><?php echo $i; ?></button> <?php endfor; ?> <button <?php echo (isset($current_page) && $current_page >= $total_pages) ? 'disabled' : ''; ?> onclick="goToPage(<?php echo isset($current_page) ? $current_page + 1 : 2; ?>)"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <polyline points="9 18 15 12 9 6"></polyline> </svg> </button> </div> <?php endif; ?> <?php else: ?> <div class="empty-state"> <svg xmlns="http://www.w3.org/2000/svg" width="120" height="120" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"> <circle cx="11" cy="11" r="8"></circle> <path d="m21 21-4.35-4.35"></path> </svg> <h3>暂无相关资讯</h3> <p>没有找到符合条件的资讯内容</p> <a href="/information" class="btn">查看全部资讯</a> </div> <?php endif; ?> </div> <script> function performSearch() { const keyword = document.getElementById('searchInput').value.trim(); if (keyword) { window.location.href = '/information?keyword=' + encodeURIComponent(keyword); } } document.getElementById('searchInput').addEventListener('keypress', function(e) { if (e.key === 'Enter') { performSearch(); } }); function goToPage(page) { const url = new URL(window.location.href); url.searchParams.set('page', page); window.location.href = url.toString(); } </script> </body> </html>