chore: sync local changes (2026-03-12)
This commit is contained in:
@@ -1,196 +1,196 @@
|
||||
/* 页面主背景 */
|
||||
body {
|
||||
background: linear-gradient(135deg, #f8fffe 0%, #e8f5e8 50%, #d4f1d4 100%);
|
||||
background-attachment: fixed;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* 背景装饰元素 */
|
||||
body::before {
|
||||
content: '';
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image:
|
||||
radial-gradient(circle at 20% 80%, rgba(39, 174, 96, 0.05) 0%, transparent 50%),
|
||||
radial-gradient(circle at 80% 20%, rgba(46, 204, 113, 0.05) 0%, transparent 50%),
|
||||
radial-gradient(circle at 40% 40%, rgba(168, 230, 207, 0.08) 0%, transparent 50%);
|
||||
pointer-events: none;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
/* 容器背景 */
|
||||
.container {
|
||||
background: rgba(255, 255, 255, 0.7);
|
||||
backdrop-filter: blur(10px);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 8px 32px rgba(39, 174, 96, 0.1);
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* 头部背景 */
|
||||
.header {
|
||||
background: linear-gradient(135deg, rgba(39, 174, 96, 0.05) 0%, rgba(168, 230, 207, 0.05) 100%);
|
||||
border-radius: 16px 16px 0 0;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.header::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background:
|
||||
radial-gradient(circle at 30% 20%, rgba(39, 174, 96, 0.1) 0%, transparent 40%),
|
||||
radial-gradient(circle at 70% 80%, rgba(46, 204, 113, 0.08) 0%, transparent 40%);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* 热搜项目背景 */
|
||||
.hot-item {
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
backdrop-filter: blur(8px);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.hot-item::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 60px;
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, transparent 0%, rgba(39, 174, 96, 0.02) 100%);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* 前三名特殊背景效果 */
|
||||
.hot-item:nth-child(1) {
|
||||
background: linear-gradient(135deg, rgba(231, 76, 60, 0.05) 0%, rgba(255, 255, 255, 0.95) 100%);
|
||||
}
|
||||
|
||||
.hot-item:nth-child(2) {
|
||||
background: linear-gradient(135deg, rgba(243, 156, 18, 0.05) 0%, rgba(255, 255, 255, 0.95) 100%);
|
||||
}
|
||||
|
||||
.hot-item:nth-child(3) {
|
||||
background: linear-gradient(135deg, rgba(52, 152, 219, 0.05) 0%, rgba(255, 255, 255, 0.95) 100%);
|
||||
}
|
||||
|
||||
/* 加载状态背景 */
|
||||
.loading {
|
||||
background: rgba(255, 255, 255, 0.8);
|
||||
backdrop-filter: blur(8px);
|
||||
border-radius: 12px;
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
/* 错误信息背景 */
|
||||
.error-message {
|
||||
background: linear-gradient(135deg, rgba(231, 76, 60, 0.05) 0%, rgba(255, 255, 255, 0.9) 100%);
|
||||
backdrop-filter: blur(8px);
|
||||
border-radius: 12px;
|
||||
border: 1px solid rgba(231, 76, 60, 0.1);
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
/* 底部背景 */
|
||||
.footer {
|
||||
background: linear-gradient(135deg, rgba(39, 174, 96, 0.03) 0%, rgba(168, 230, 207, 0.03) 100%);
|
||||
border-radius: 0 0 16px 16px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.footer::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 60px;
|
||||
height: 1px;
|
||||
background: linear-gradient(90deg, transparent 0%, rgba(39, 174, 96, 0.3) 50%, transparent 100%);
|
||||
}
|
||||
|
||||
/* 响应式背景调整 */
|
||||
@media (max-width: 768px) {
|
||||
.container {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.header {
|
||||
border-radius: 12px 12px 0 0;
|
||||
}
|
||||
|
||||
.footer {
|
||||
border-radius: 0 0 12px 12px;
|
||||
}
|
||||
|
||||
body::before {
|
||||
background-image:
|
||||
radial-gradient(circle at 20% 80%, rgba(39, 174, 96, 0.03) 0%, transparent 40%),
|
||||
radial-gradient(circle at 80% 20%, rgba(46, 204, 113, 0.03) 0%, transparent 40%);
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1025px) {
|
||||
.container {
|
||||
margin-top: 40px;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
body::before {
|
||||
background-image:
|
||||
radial-gradient(circle at 15% 85%, rgba(39, 174, 96, 0.06) 0%, transparent 60%),
|
||||
radial-gradient(circle at 85% 15%, rgba(46, 204, 113, 0.06) 0%, transparent 60%),
|
||||
radial-gradient(circle at 50% 50%, rgba(168, 230, 207, 0.04) 0%, transparent 70%);
|
||||
}
|
||||
}
|
||||
|
||||
/* 动画效果 */
|
||||
@keyframes backgroundShift {
|
||||
0% {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
50% {
|
||||
background-position: 100% 50%;
|
||||
}
|
||||
100% {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
}
|
||||
|
||||
/* 悬浮时的背景变化 */
|
||||
.hot-item:hover {
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
}
|
||||
|
||||
.hot-item:hover::after {
|
||||
background: linear-gradient(90deg, transparent 0%, rgba(39, 174, 96, 0.05) 100%);
|
||||
}
|
||||
|
||||
/* 排名背景渐变 */
|
||||
.rank {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.rank::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(45deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
|
||||
pointer-events: none;
|
||||
/* 页面主背景 */
|
||||
body {
|
||||
background: linear-gradient(135deg, #f8fffe 0%, #e8f5e8 50%, #d4f1d4 100%);
|
||||
background-attachment: fixed;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* 背景装饰元素 */
|
||||
body::before {
|
||||
content: '';
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image:
|
||||
radial-gradient(circle at 20% 80%, rgba(39, 174, 96, 0.05) 0%, transparent 50%),
|
||||
radial-gradient(circle at 80% 20%, rgba(46, 204, 113, 0.05) 0%, transparent 50%),
|
||||
radial-gradient(circle at 40% 40%, rgba(168, 230, 207, 0.08) 0%, transparent 50%);
|
||||
pointer-events: none;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
/* 容器背景 */
|
||||
.container {
|
||||
background: rgba(255, 255, 255, 0.7);
|
||||
backdrop-filter: blur(10px);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 8px 32px rgba(39, 174, 96, 0.1);
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* 头部背景 */
|
||||
.header {
|
||||
background: linear-gradient(135deg, rgba(39, 174, 96, 0.05) 0%, rgba(168, 230, 207, 0.05) 100%);
|
||||
border-radius: 16px 16px 0 0;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.header::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background:
|
||||
radial-gradient(circle at 30% 20%, rgba(39, 174, 96, 0.1) 0%, transparent 40%),
|
||||
radial-gradient(circle at 70% 80%, rgba(46, 204, 113, 0.08) 0%, transparent 40%);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* 热搜项目背景 */
|
||||
.hot-item {
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
backdrop-filter: blur(8px);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.hot-item::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 60px;
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, transparent 0%, rgba(39, 174, 96, 0.02) 100%);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* 前三名特殊背景效果 */
|
||||
.hot-item:nth-child(1) {
|
||||
background: linear-gradient(135deg, rgba(231, 76, 60, 0.05) 0%, rgba(255, 255, 255, 0.95) 100%);
|
||||
}
|
||||
|
||||
.hot-item:nth-child(2) {
|
||||
background: linear-gradient(135deg, rgba(243, 156, 18, 0.05) 0%, rgba(255, 255, 255, 0.95) 100%);
|
||||
}
|
||||
|
||||
.hot-item:nth-child(3) {
|
||||
background: linear-gradient(135deg, rgba(52, 152, 219, 0.05) 0%, rgba(255, 255, 255, 0.95) 100%);
|
||||
}
|
||||
|
||||
/* 加载状态背景 */
|
||||
.loading {
|
||||
background: rgba(255, 255, 255, 0.8);
|
||||
backdrop-filter: blur(8px);
|
||||
border-radius: 12px;
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
/* 错误信息背景 */
|
||||
.error-message {
|
||||
background: linear-gradient(135deg, rgba(231, 76, 60, 0.05) 0%, rgba(255, 255, 255, 0.9) 100%);
|
||||
backdrop-filter: blur(8px);
|
||||
border-radius: 12px;
|
||||
border: 1px solid rgba(231, 76, 60, 0.1);
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
/* 底部背景 */
|
||||
.footer {
|
||||
background: linear-gradient(135deg, rgba(39, 174, 96, 0.03) 0%, rgba(168, 230, 207, 0.03) 100%);
|
||||
border-radius: 0 0 16px 16px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.footer::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 60px;
|
||||
height: 1px;
|
||||
background: linear-gradient(90deg, transparent 0%, rgba(39, 174, 96, 0.3) 50%, transparent 100%);
|
||||
}
|
||||
|
||||
/* 响应式背景调整 */
|
||||
@media (max-width: 768px) {
|
||||
.container {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.header {
|
||||
border-radius: 12px 12px 0 0;
|
||||
}
|
||||
|
||||
.footer {
|
||||
border-radius: 0 0 12px 12px;
|
||||
}
|
||||
|
||||
body::before {
|
||||
background-image:
|
||||
radial-gradient(circle at 20% 80%, rgba(39, 174, 96, 0.03) 0%, transparent 40%),
|
||||
radial-gradient(circle at 80% 20%, rgba(46, 204, 113, 0.03) 0%, transparent 40%);
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1025px) {
|
||||
.container {
|
||||
margin-top: 40px;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
body::before {
|
||||
background-image:
|
||||
radial-gradient(circle at 15% 85%, rgba(39, 174, 96, 0.06) 0%, transparent 60%),
|
||||
radial-gradient(circle at 85% 15%, rgba(46, 204, 113, 0.06) 0%, transparent 60%),
|
||||
radial-gradient(circle at 50% 50%, rgba(168, 230, 207, 0.04) 0%, transparent 70%);
|
||||
}
|
||||
}
|
||||
|
||||
/* 动画效果 */
|
||||
@keyframes backgroundShift {
|
||||
0% {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
50% {
|
||||
background-position: 100% 50%;
|
||||
}
|
||||
100% {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
}
|
||||
|
||||
/* 悬浮时的背景变化 */
|
||||
.hot-item:hover {
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
}
|
||||
|
||||
.hot-item:hover::after {
|
||||
background: linear-gradient(90deg, transparent 0%, rgba(39, 174, 96, 0.05) 100%);
|
||||
}
|
||||
|
||||
/* 排名背景渐变 */
|
||||
.rank {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.rank::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(45deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
|
||||
pointer-events: none;
|
||||
}
|
||||
@@ -1,40 +1,40 @@
|
||||
<!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="styles.css">
|
||||
<link rel="stylesheet" href="background.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<header class="header">
|
||||
<h1 class="title">百度实时热搜榜单</h1>
|
||||
<p class="subtitle">实时热门搜索,掌握网络脉搏</p>
|
||||
</header>
|
||||
|
||||
<main class="main-content">
|
||||
<div class="loading" id="loading">
|
||||
<div class="loading-spinner"></div>
|
||||
<p>正在加载热搜数据...</p>
|
||||
</div>
|
||||
|
||||
<div class="error-message" id="error" style="display: none;">
|
||||
<p>数据加载失败,请稍后重试</p>
|
||||
<button class="retry-btn" onclick="loadData()">重新加载</button>
|
||||
</div>
|
||||
|
||||
<div class="hot-list" id="hotList" style="display: none;">
|
||||
<!-- 热搜列表将通过JavaScript动态生成 -->
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer class="footer">
|
||||
<p class="update-time" id="updateTime"></p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
<!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="styles.css">
|
||||
<link rel="stylesheet" href="background.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<header class="header">
|
||||
<h1 class="title">百度实时热搜榜单</h1>
|
||||
<p class="subtitle">实时热门搜索,掌握网络脉搏</p>
|
||||
</header>
|
||||
|
||||
<main class="main-content">
|
||||
<div class="loading" id="loading">
|
||||
<div class="loading-spinner"></div>
|
||||
<p>正在加载热搜数据...</p>
|
||||
</div>
|
||||
|
||||
<div class="error-message" id="error" style="display: none;">
|
||||
<p>数据加载失败,请稍后重试</p>
|
||||
<button class="retry-btn" onclick="loadData()">重新加载</button>
|
||||
</div>
|
||||
|
||||
<div class="hot-list" id="hotList" style="display: none;">
|
||||
<!-- 热搜列表将通过JavaScript动态生成 -->
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer class="footer">
|
||||
<p class="update-time" id="updateTime"></p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,196 +1,196 @@
|
||||
// DOM元素获取
|
||||
const loadingElement = document.getElementById('loading');
|
||||
const errorElement = document.getElementById('error');
|
||||
const hotListElement = document.getElementById('hotList');
|
||||
const updateTimeElement = document.getElementById('updateTime');
|
||||
|
||||
// 页面加载完成后初始化
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
loadData();
|
||||
|
||||
// 每5分钟自动刷新数据
|
||||
setInterval(loadData, 5 * 60 * 1000);
|
||||
|
||||
// 监听页面可见性变化,页面重新可见时刷新数据
|
||||
document.addEventListener('visibilitychange', function() {
|
||||
if (!document.hidden) {
|
||||
loadData();
|
||||
}
|
||||
});
|
||||
|
||||
// 监听网络状态变化
|
||||
window.addEventListener('online', loadData);
|
||||
});
|
||||
|
||||
// 加载数据函数
|
||||
async function loadData() {
|
||||
try {
|
||||
showLoading();
|
||||
|
||||
// 调用百度实时热搜API
|
||||
const response = await fetch('https://60s.api.shumengya.top/v2/baidu/realtime');
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (data.code === 200 && data.data) {
|
||||
renderHotList(data.data);
|
||||
updateTime();
|
||||
hideLoading();
|
||||
} else {
|
||||
throw new Error(data.message || '数据格式错误');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('加载数据失败:', error);
|
||||
showError();
|
||||
}
|
||||
}
|
||||
|
||||
// 渲染热搜列表
|
||||
function renderHotList(hotData) {
|
||||
if (!hotData || !Array.isArray(hotData)) {
|
||||
showError();
|
||||
return;
|
||||
}
|
||||
|
||||
const listHTML = hotData.map((item, index) => {
|
||||
const rank = index + 1;
|
||||
const rankClass = rank <= 3 ? (rank === 1 ? 'top1' : 'top3') : '';
|
||||
|
||||
// 处理封面图片
|
||||
const coverImg = item.pic ?
|
||||
`<img src="${item.pic}" alt="${item.title}" class="item-cover" onerror="this.style.display='none'">` :
|
||||
'';
|
||||
|
||||
// 处理描述信息
|
||||
const description = item.desc || '';
|
||||
|
||||
// 处理热度值
|
||||
const hotValue = item.hot || '';
|
||||
|
||||
// 处理链接
|
||||
const linkUrl = item.url || '#';
|
||||
|
||||
return `
|
||||
<div class="hot-item" onclick="openLink('${linkUrl}')">
|
||||
<div class="rank ${rankClass}">${rank}</div>
|
||||
${coverImg}
|
||||
<div class="item-content">
|
||||
<div class="item-header">
|
||||
<h3 class="item-title">${item.title || '无标题'}</h3>
|
||||
</div>
|
||||
${description ? `<p class="item-desc">${description}</p>` : ''}
|
||||
<div class="item-footer">
|
||||
${hotValue ? `<span class="item-score">${formatHotValue(hotValue)}</span>` : ''}
|
||||
<div class="item-type">
|
||||
<span class="type-text type-hot">热搜</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}).join('');
|
||||
|
||||
hotListElement.innerHTML = listHTML;
|
||||
hotListElement.style.display = 'block';
|
||||
}
|
||||
|
||||
// 格式化热度值
|
||||
function formatHotValue(value) {
|
||||
if (!value) return '';
|
||||
|
||||
// 如果是数字,进行格式化
|
||||
if (typeof value === 'number') {
|
||||
if (value >= 10000) {
|
||||
return (value / 10000).toFixed(1) + '万';
|
||||
}
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
// 如果是字符串,直接返回
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
// 打开链接
|
||||
function openLink(url) {
|
||||
if (url && url !== '#') {
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
}
|
||||
|
||||
// 显示加载状态
|
||||
function showLoading() {
|
||||
loadingElement.style.display = 'block';
|
||||
errorElement.style.display = 'none';
|
||||
hotListElement.style.display = 'none';
|
||||
}
|
||||
|
||||
// 隐藏加载状态
|
||||
function hideLoading() {
|
||||
loadingElement.style.display = 'none';
|
||||
}
|
||||
|
||||
// 显示错误信息
|
||||
function showError() {
|
||||
loadingElement.style.display = 'none';
|
||||
errorElement.style.display = 'block';
|
||||
hotListElement.style.display = 'none';
|
||||
}
|
||||
|
||||
// 更新时间显示
|
||||
function updateTime() {
|
||||
const now = new Date();
|
||||
const timeString = now.toLocaleString('zh-CN', {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
second: '2-digit'
|
||||
});
|
||||
updateTimeElement.textContent = `最后更新时间: ${timeString}`;
|
||||
}
|
||||
|
||||
// 重试加载数据
|
||||
function retryLoad() {
|
||||
loadData();
|
||||
}
|
||||
|
||||
// 页面滚动优化
|
||||
let ticking = false;
|
||||
|
||||
function updateScrollPosition() {
|
||||
// 可以在这里添加滚动相关的优化逻辑
|
||||
ticking = false;
|
||||
}
|
||||
|
||||
window.addEventListener('scroll', function() {
|
||||
if (!ticking) {
|
||||
requestAnimationFrame(updateScrollPosition);
|
||||
ticking = true;
|
||||
}
|
||||
});
|
||||
|
||||
// 错误处理和日志记录
|
||||
window.addEventListener('error', function(e) {
|
||||
console.error('页面错误:', e.error);
|
||||
});
|
||||
|
||||
window.addEventListener('unhandledrejection', function(e) {
|
||||
console.error('未处理的Promise拒绝:', e.reason);
|
||||
});
|
||||
|
||||
// 性能监控
|
||||
if ('performance' in window) {
|
||||
window.addEventListener('load', function() {
|
||||
setTimeout(function() {
|
||||
const perfData = performance.timing;
|
||||
const loadTime = perfData.loadEventEnd - perfData.navigationStart;
|
||||
console.log('页面加载时间:', loadTime + 'ms');
|
||||
}, 0);
|
||||
});
|
||||
// DOM元素获取
|
||||
const loadingElement = document.getElementById('loading');
|
||||
const errorElement = document.getElementById('error');
|
||||
const hotListElement = document.getElementById('hotList');
|
||||
const updateTimeElement = document.getElementById('updateTime');
|
||||
|
||||
// 页面加载完成后初始化
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
loadData();
|
||||
|
||||
// 每5分钟自动刷新数据
|
||||
setInterval(loadData, 5 * 60 * 1000);
|
||||
|
||||
// 监听页面可见性变化,页面重新可见时刷新数据
|
||||
document.addEventListener('visibilitychange', function() {
|
||||
if (!document.hidden) {
|
||||
loadData();
|
||||
}
|
||||
});
|
||||
|
||||
// 监听网络状态变化
|
||||
window.addEventListener('online', loadData);
|
||||
});
|
||||
|
||||
// 加载数据函数
|
||||
async function loadData() {
|
||||
try {
|
||||
showLoading();
|
||||
|
||||
// 调用百度实时热搜API
|
||||
const response = await fetch('https://60s.api.shumengya.top/v2/baidu/realtime');
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (data.code === 200 && data.data) {
|
||||
renderHotList(data.data);
|
||||
updateTime();
|
||||
hideLoading();
|
||||
} else {
|
||||
throw new Error(data.message || '数据格式错误');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('加载数据失败:', error);
|
||||
showError();
|
||||
}
|
||||
}
|
||||
|
||||
// 渲染热搜列表
|
||||
function renderHotList(hotData) {
|
||||
if (!hotData || !Array.isArray(hotData)) {
|
||||
showError();
|
||||
return;
|
||||
}
|
||||
|
||||
const listHTML = hotData.map((item, index) => {
|
||||
const rank = index + 1;
|
||||
const rankClass = rank <= 3 ? (rank === 1 ? 'top1' : 'top3') : '';
|
||||
|
||||
// 处理封面图片
|
||||
const coverImg = item.pic ?
|
||||
`<img src="${item.pic}" alt="${item.title}" class="item-cover" onerror="this.style.display='none'">` :
|
||||
'';
|
||||
|
||||
// 处理描述信息
|
||||
const description = item.desc || '';
|
||||
|
||||
// 处理热度值
|
||||
const hotValue = item.hot || '';
|
||||
|
||||
// 处理链接
|
||||
const linkUrl = item.url || '#';
|
||||
|
||||
return `
|
||||
<div class="hot-item" onclick="openLink('${linkUrl}')">
|
||||
<div class="rank ${rankClass}">${rank}</div>
|
||||
${coverImg}
|
||||
<div class="item-content">
|
||||
<div class="item-header">
|
||||
<h3 class="item-title">${item.title || '无标题'}</h3>
|
||||
</div>
|
||||
${description ? `<p class="item-desc">${description}</p>` : ''}
|
||||
<div class="item-footer">
|
||||
${hotValue ? `<span class="item-score">${formatHotValue(hotValue)}</span>` : ''}
|
||||
<div class="item-type">
|
||||
<span class="type-text type-hot">热搜</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}).join('');
|
||||
|
||||
hotListElement.innerHTML = listHTML;
|
||||
hotListElement.style.display = 'block';
|
||||
}
|
||||
|
||||
// 格式化热度值
|
||||
function formatHotValue(value) {
|
||||
if (!value) return '';
|
||||
|
||||
// 如果是数字,进行格式化
|
||||
if (typeof value === 'number') {
|
||||
if (value >= 10000) {
|
||||
return (value / 10000).toFixed(1) + '万';
|
||||
}
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
// 如果是字符串,直接返回
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
// 打开链接
|
||||
function openLink(url) {
|
||||
if (url && url !== '#') {
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
}
|
||||
|
||||
// 显示加载状态
|
||||
function showLoading() {
|
||||
loadingElement.style.display = 'block';
|
||||
errorElement.style.display = 'none';
|
||||
hotListElement.style.display = 'none';
|
||||
}
|
||||
|
||||
// 隐藏加载状态
|
||||
function hideLoading() {
|
||||
loadingElement.style.display = 'none';
|
||||
}
|
||||
|
||||
// 显示错误信息
|
||||
function showError() {
|
||||
loadingElement.style.display = 'none';
|
||||
errorElement.style.display = 'block';
|
||||
hotListElement.style.display = 'none';
|
||||
}
|
||||
|
||||
// 更新时间显示
|
||||
function updateTime() {
|
||||
const now = new Date();
|
||||
const timeString = now.toLocaleString('zh-CN', {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
second: '2-digit'
|
||||
});
|
||||
updateTimeElement.textContent = `最后更新时间: ${timeString}`;
|
||||
}
|
||||
|
||||
// 重试加载数据
|
||||
function retryLoad() {
|
||||
loadData();
|
||||
}
|
||||
|
||||
// 页面滚动优化
|
||||
let ticking = false;
|
||||
|
||||
function updateScrollPosition() {
|
||||
// 可以在这里添加滚动相关的优化逻辑
|
||||
ticking = false;
|
||||
}
|
||||
|
||||
window.addEventListener('scroll', function() {
|
||||
if (!ticking) {
|
||||
requestAnimationFrame(updateScrollPosition);
|
||||
ticking = true;
|
||||
}
|
||||
});
|
||||
|
||||
// 错误处理和日志记录
|
||||
window.addEventListener('error', function(e) {
|
||||
console.error('页面错误:', e.error);
|
||||
});
|
||||
|
||||
window.addEventListener('unhandledrejection', function(e) {
|
||||
console.error('未处理的Promise拒绝:', e.reason);
|
||||
});
|
||||
|
||||
// 性能监控
|
||||
if ('performance' in window) {
|
||||
window.addEventListener('load', function() {
|
||||
setTimeout(function() {
|
||||
const perfData = performance.timing;
|
||||
const loadTime = perfData.loadEventEnd - perfData.navigationStart;
|
||||
console.log('页面加载时间:', loadTime + 'ms');
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
@@ -1,371 +1,371 @@
|
||||
/* 基础样式重置 */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
|
||||
line-height: 1.6;
|
||||
color: #2c3e50;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 16px;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* 头部样式 */
|
||||
.header {
|
||||
text-align: center;
|
||||
padding: 24px 0;
|
||||
border-bottom: 2px solid #a8e6cf;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
color: #27ae60;
|
||||
margin-bottom: 8px;
|
||||
text-shadow: 0 2px 4px rgba(39, 174, 96, 0.1);
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 14px;
|
||||
color: #7f8c8d;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
/* 主内容区域 */
|
||||
.main-content {
|
||||
flex: 1;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* 加载状态 */
|
||||
.loading {
|
||||
text-align: center;
|
||||
padding: 60px 20px;
|
||||
color: #27ae60;
|
||||
}
|
||||
|
||||
.loading-spinner {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: 3px solid #a8e6cf;
|
||||
border-top: 3px solid #27ae60;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
margin: 0 auto 16px;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
/* 错误信息 */
|
||||
.error-message {
|
||||
text-align: center;
|
||||
padding: 40px 20px;
|
||||
color: #e74c3c;
|
||||
}
|
||||
|
||||
.retry-btn {
|
||||
background: #27ae60;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 10px 20px;
|
||||
border-radius: 20px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
margin-top: 16px;
|
||||
transition: background 0.3s ease;
|
||||
}
|
||||
|
||||
.retry-btn:hover {
|
||||
background: #219a52;
|
||||
}
|
||||
|
||||
/* 热搜列表 */
|
||||
.hot-list {
|
||||
display: grid;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.hot-item {
|
||||
background: #ffffff;
|
||||
border: 1px solid #e8f5e8;
|
||||
border-radius: 12px;
|
||||
padding: 16px;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 2px 8px rgba(39, 174, 96, 0.08);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.hot-item:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 16px rgba(39, 174, 96, 0.15);
|
||||
border-color: #a8e6cf;
|
||||
}
|
||||
|
||||
.hot-item::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 4px;
|
||||
height: 100%;
|
||||
background: linear-gradient(to bottom, #27ae60, #a8e6cf);
|
||||
}
|
||||
|
||||
/* 排名样式 */
|
||||
.rank {
|
||||
background: linear-gradient(135deg, #27ae60, #2ecc71);
|
||||
color: white;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: 700;
|
||||
font-size: 14px;
|
||||
flex-shrink: 0;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.rank.top3 {
|
||||
background: linear-gradient(135deg, #f39c12, #e67e22);
|
||||
}
|
||||
|
||||
.rank.top1 {
|
||||
background: linear-gradient(135deg, #e74c3c, #c0392b);
|
||||
}
|
||||
|
||||
/* 封面图片 */
|
||||
.item-cover {
|
||||
width: 80px;
|
||||
height: 60px;
|
||||
border-radius: 8px;
|
||||
object-fit: cover;
|
||||
flex-shrink: 0;
|
||||
border: 1px solid #e8f5e8;
|
||||
}
|
||||
|
||||
/* 内容区域 */
|
||||
.item-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
min-height: 60px;
|
||||
}
|
||||
|
||||
.item-header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #2c3e50;
|
||||
line-height: 1.4;
|
||||
margin-bottom: 4px;
|
||||
transition: color 0.3s ease;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.item-title:hover {
|
||||
color: #27ae60;
|
||||
}
|
||||
|
||||
.item-desc {
|
||||
font-size: 13px;
|
||||
color: #7f8c8d;
|
||||
line-height: 1.3;
|
||||
margin-bottom: 8px;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.item-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.item-score {
|
||||
font-size: 14px;
|
||||
color: #27ae60;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.item-type {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.type-icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.type-text {
|
||||
font-size: 12px;
|
||||
padding: 2px 8px;
|
||||
border-radius: 10px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.type-hot {
|
||||
background: #ffe6e6;
|
||||
color: #e74c3c;
|
||||
}
|
||||
|
||||
.type-new {
|
||||
background: #e6f3ff;
|
||||
color: #3498db;
|
||||
}
|
||||
|
||||
.type-default {
|
||||
background: #f8f9fa;
|
||||
color: #6c757d;
|
||||
}
|
||||
|
||||
/* 底部 */
|
||||
.footer {
|
||||
text-align: center;
|
||||
padding: 24px 0;
|
||||
border-top: 1px solid #e8f5e8;
|
||||
margin-top: 32px;
|
||||
}
|
||||
|
||||
.update-time {
|
||||
font-size: 12px;
|
||||
color: #95a5a6;
|
||||
}
|
||||
|
||||
/* 手机端优化 (默认) */
|
||||
@media (max-width: 768px) {
|
||||
.container {
|
||||
padding: 0 12px;
|
||||
}
|
||||
|
||||
.header {
|
||||
padding: 20px 0;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.hot-item {
|
||||
padding: 14px;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.item-cover {
|
||||
width: 60px;
|
||||
height: 45px;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.item-desc {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.rank {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 平板端适配 */
|
||||
@media (min-width: 769px) and (max-width: 1024px) {
|
||||
.container {
|
||||
padding: 0 24px;
|
||||
}
|
||||
|
||||
.hot-list {
|
||||
grid-template-columns: repeat(1, 1fr);
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 32px;
|
||||
}
|
||||
|
||||
.hot-item {
|
||||
padding: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 电脑端适配 */
|
||||
@media (min-width: 1025px) {
|
||||
.container {
|
||||
padding: 0 32px;
|
||||
}
|
||||
|
||||
.hot-list {
|
||||
grid-template-columns: repeat(1, 1fr);
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 36px;
|
||||
}
|
||||
|
||||
.hot-item {
|
||||
padding: 20px;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.item-cover {
|
||||
width: 100px;
|
||||
height: 75px;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
.item-desc {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 大屏幕优化 */
|
||||
@media (min-width: 1400px) {
|
||||
.hot-list {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 24px;
|
||||
}
|
||||
/* 基础样式重置 */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
|
||||
line-height: 1.6;
|
||||
color: #2c3e50;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 16px;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* 头部样式 */
|
||||
.header {
|
||||
text-align: center;
|
||||
padding: 24px 0;
|
||||
border-bottom: 2px solid #a8e6cf;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
color: #27ae60;
|
||||
margin-bottom: 8px;
|
||||
text-shadow: 0 2px 4px rgba(39, 174, 96, 0.1);
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 14px;
|
||||
color: #7f8c8d;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
/* 主内容区域 */
|
||||
.main-content {
|
||||
flex: 1;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* 加载状态 */
|
||||
.loading {
|
||||
text-align: center;
|
||||
padding: 60px 20px;
|
||||
color: #27ae60;
|
||||
}
|
||||
|
||||
.loading-spinner {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: 3px solid #a8e6cf;
|
||||
border-top: 3px solid #27ae60;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
margin: 0 auto 16px;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
/* 错误信息 */
|
||||
.error-message {
|
||||
text-align: center;
|
||||
padding: 40px 20px;
|
||||
color: #e74c3c;
|
||||
}
|
||||
|
||||
.retry-btn {
|
||||
background: #27ae60;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 10px 20px;
|
||||
border-radius: 20px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
margin-top: 16px;
|
||||
transition: background 0.3s ease;
|
||||
}
|
||||
|
||||
.retry-btn:hover {
|
||||
background: #219a52;
|
||||
}
|
||||
|
||||
/* 热搜列表 */
|
||||
.hot-list {
|
||||
display: grid;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.hot-item {
|
||||
background: #ffffff;
|
||||
border: 1px solid #e8f5e8;
|
||||
border-radius: 12px;
|
||||
padding: 16px;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 2px 8px rgba(39, 174, 96, 0.08);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.hot-item:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 16px rgba(39, 174, 96, 0.15);
|
||||
border-color: #a8e6cf;
|
||||
}
|
||||
|
||||
.hot-item::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 4px;
|
||||
height: 100%;
|
||||
background: linear-gradient(to bottom, #27ae60, #a8e6cf);
|
||||
}
|
||||
|
||||
/* 排名样式 */
|
||||
.rank {
|
||||
background: linear-gradient(135deg, #27ae60, #2ecc71);
|
||||
color: white;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: 700;
|
||||
font-size: 14px;
|
||||
flex-shrink: 0;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.rank.top3 {
|
||||
background: linear-gradient(135deg, #f39c12, #e67e22);
|
||||
}
|
||||
|
||||
.rank.top1 {
|
||||
background: linear-gradient(135deg, #e74c3c, #c0392b);
|
||||
}
|
||||
|
||||
/* 封面图片 */
|
||||
.item-cover {
|
||||
width: 80px;
|
||||
height: 60px;
|
||||
border-radius: 8px;
|
||||
object-fit: cover;
|
||||
flex-shrink: 0;
|
||||
border: 1px solid #e8f5e8;
|
||||
}
|
||||
|
||||
/* 内容区域 */
|
||||
.item-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
min-height: 60px;
|
||||
}
|
||||
|
||||
.item-header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #2c3e50;
|
||||
line-height: 1.4;
|
||||
margin-bottom: 4px;
|
||||
transition: color 0.3s ease;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.item-title:hover {
|
||||
color: #27ae60;
|
||||
}
|
||||
|
||||
.item-desc {
|
||||
font-size: 13px;
|
||||
color: #7f8c8d;
|
||||
line-height: 1.3;
|
||||
margin-bottom: 8px;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.item-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.item-score {
|
||||
font-size: 14px;
|
||||
color: #27ae60;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.item-type {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.type-icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.type-text {
|
||||
font-size: 12px;
|
||||
padding: 2px 8px;
|
||||
border-radius: 10px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.type-hot {
|
||||
background: #ffe6e6;
|
||||
color: #e74c3c;
|
||||
}
|
||||
|
||||
.type-new {
|
||||
background: #e6f3ff;
|
||||
color: #3498db;
|
||||
}
|
||||
|
||||
.type-default {
|
||||
background: #f8f9fa;
|
||||
color: #6c757d;
|
||||
}
|
||||
|
||||
/* 底部 */
|
||||
.footer {
|
||||
text-align: center;
|
||||
padding: 24px 0;
|
||||
border-top: 1px solid #e8f5e8;
|
||||
margin-top: 32px;
|
||||
}
|
||||
|
||||
.update-time {
|
||||
font-size: 12px;
|
||||
color: #95a5a6;
|
||||
}
|
||||
|
||||
/* 手机端优化 (默认) */
|
||||
@media (max-width: 768px) {
|
||||
.container {
|
||||
padding: 0 12px;
|
||||
}
|
||||
|
||||
.header {
|
||||
padding: 20px 0;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.hot-item {
|
||||
padding: 14px;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.item-cover {
|
||||
width: 60px;
|
||||
height: 45px;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.item-desc {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.rank {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 平板端适配 */
|
||||
@media (min-width: 769px) and (max-width: 1024px) {
|
||||
.container {
|
||||
padding: 0 24px;
|
||||
}
|
||||
|
||||
.hot-list {
|
||||
grid-template-columns: repeat(1, 1fr);
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 32px;
|
||||
}
|
||||
|
||||
.hot-item {
|
||||
padding: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 电脑端适配 */
|
||||
@media (min-width: 1025px) {
|
||||
.container {
|
||||
padding: 0 32px;
|
||||
}
|
||||
|
||||
.hot-list {
|
||||
grid-template-columns: repeat(1, 1fr);
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 36px;
|
||||
}
|
||||
|
||||
.hot-item {
|
||||
padding: 20px;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.item-cover {
|
||||
width: 100px;
|
||||
height: 75px;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
.item-desc {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 大屏幕优化 */
|
||||
@media (min-width: 1400px) {
|
||||
.hot-list {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 24px;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user