优化结果

This commit is contained in:
2025-09-15 19:08:47 +08:00
parent 72084a8782
commit dcfa89e63c
357 changed files with 16156 additions and 1589 deletions

View File

@@ -0,0 +1,107 @@
.background-container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
overflow: hidden;
}
.green-gradient {
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(
135deg,
rgba(240, 20, 20, 0.3) 0%,
rgba(255, 60, 60, 0.2) 25%,
rgba(255, 100, 100, 0.1) 50%,
rgba(255, 150, 150, 0.2) 75%,
rgba(240, 20, 20, 0.3) 100%
);
animation: green-flow 20s ease-in-out infinite;
}
.green-gradient::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: radial-gradient(
circle at 30% 70%,
rgba(255, 45, 45, 0.4) 0%,
transparent 50%
), radial-gradient(
circle at 70% 30%,
rgba(255, 100, 100, 0.3) 0%,
transparent 50%
);
animation: green-pulse 15s ease-in-out infinite alternate;
}
@keyframes green-flow {
0%, 100% {
transform: rotate(0deg) scale(1);
opacity: 0.8;
}
25% {
transform: rotate(90deg) scale(1.1);
opacity: 0.6;
}
50% {
transform: rotate(180deg) scale(0.9);
opacity: 0.9;
}
75% {
transform: rotate(270deg) scale(1.05);
opacity: 0.7;
}
}
@keyframes green-pulse {
0% {
transform: scale(1) rotate(0deg);
opacity: 0.5;
}
50% {
transform: scale(1.2) rotate(180deg);
opacity: 0.8;
}
100% {
transform: scale(1) rotate(360deg);
opacity: 0.6;
}
}
/* 手机端背景优化 */
@media (max-width: 768px) {
.green-gradient {
animation-duration: 25s;
}
.green-gradient::before {
animation-duration: 18s;
}
}
/* 减少动画以节省电池 */
@media (prefers-reduced-motion: reduce) {
.green-gradient,
.green-gradient::before {
animation: none;
}
.green-gradient {
background: linear-gradient(
135deg,
rgba(76, 175, 80, 0.2) 0%,
rgba(165, 214, 167, 0.1) 50%,
rgba(200, 230, 201, 0.15) 100%
);
}
}

View File

@@ -0,0 +1,578 @@
/* 背景样式 */
.background-container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
overflow: hidden;
background-color: #f8f9fa;
}
.modern-gradient {
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(
135deg,
rgba(64, 169, 255, 0.4) 0%,
rgba(120, 192, 255, 0.3) 25%,
rgba(255, 175, 64, 0.2) 50%,
rgba(255, 140, 50, 0.3) 75%,
rgba(255, 122, 69, 0.4) 100%
);
animation: gradient-flow 20s ease-in-out infinite;
border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
}
.modern-gradient::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: radial-gradient(
circle at 30% 70%,
rgba(64, 169, 255, 0.5) 0%,
transparent 50%
), radial-gradient(
circle at 70% 30%,
rgba(255, 140, 50, 0.4) 0%,
transparent 50%
);
animation: pulse-effect 15s ease-in-out infinite alternate;
border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
}
@keyframes gradient-flow {
0%, 100% {
transform: rotate(0deg) scale(1);
opacity: 0.8;
}
25% {
transform: rotate(90deg) scale(1.1);
opacity: 0.6;
}
50% {
transform: rotate(180deg) scale(0.9);
opacity: 0.9;
}
75% {
transform: rotate(270deg) scale(1.05);
opacity: 0.7;
}
}
@keyframes pulse-effect {
0% {
transform: scale(1) rotate(0deg);
opacity: 0.5;
}
50% {
transform: scale(1.2) rotate(180deg);
opacity: 0.8;
}
100% {
transform: scale(1) rotate(360deg);
opacity: 0.6;
}
}
/* 主样式 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
color: #333;
background-color: #f8f9fa;
position: relative;
min-height: 100vh;
}
/* 几何装饰样式 */
.title-container {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 10px;
}
.geometric-decoration {
font-size: 20px;
color: #f04040;
margin: 0 15px;
font-weight: bold;
letter-spacing: 5px;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
animation: float-effect 3s ease-in-out infinite alternate;
}
.geometric-decoration.left {
transform: rotate(-10deg);
}
.geometric-decoration.right {
transform: rotate(10deg);
}
@keyframes float-effect {
0% {
transform: translateY(0) rotate(-10deg);
}
100% {
transform: translateY(-5px) rotate(-8deg);
}
}
.update-time-container {
display: flex;
align-items: center;
justify-content: center;
margin-top: 10px;
}
.time-decoration {
color: #f04040;
font-size: 18px;
margin: 0 10px;
animation: pulse 2s infinite;
}
@keyframes pulse {
0% {
opacity: 0.5;
transform: scale(0.8);
}
50% {
opacity: 1;
transform: scale(1.2);
}
100% {
opacity: 0.5;
transform: scale(0.8);
}
}
.geometric-header, .geometric-footer {
text-align: center;
color: #f04040;
margin: 15px 0;
font-size: 16px;
letter-spacing: 3px;
opacity: 0.8;
}
.geometric-header {
margin-bottom: 20px;
}
.geometric-footer {
margin-top: 20px;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 24px;
position: relative;
z-index: 1;
background-color: rgba(255, 255, 255, 0.85);
border-radius: 16px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
backdrop-filter: blur(10px);
border: 2px solid rgba(240, 64, 64, 0.3);
position: relative;
}
.container::before,
.container::after {
content: '';
position: absolute;
width: 30px;
height: 30px;
border-color: #f04040;
opacity: 0.7;
}
.container::before {
top: 10px;
left: 10px;
border-top: 3px solid;
border-left: 3px solid;
border-radius: 10px 0 0 0;
}
.container::after {
bottom: 10px;
right: 10px;
border-bottom: 3px solid;
border-right: 3px solid;
border-radius: 0 0 10px 0;
}
header {
text-align: center;
margin-bottom: 28px;
padding-bottom: 20px;
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
header h1 {
background: linear-gradient(135deg, #4096ff, #ff7a45);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
margin-bottom: 14px;
font-size: 2.4rem;
font-weight: 700;
letter-spacing: -0.5px;
}
.update-time {
color: #666;
font-size: 0.9rem;
background-color: rgba(0, 0, 0, 0.03);
padding: 8px 16px;
border-radius: 24px;
display: inline-block;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
position: relative;
border: 1px dashed rgba(240, 64, 64, 0.3);
}
.update-time::before {
content: '';
position: absolute;
top: -5px;
left: -5px;
right: -5px;
bottom: -5px;
border: 1px solid rgba(240, 64, 64, 0.3);
border-radius: 28px;
animation: pulse-border 2s infinite;
pointer-events: none;
}
@keyframes pulse-border {
0% {
transform: scale(1);
opacity: 0.7;
}
50% {
transform: scale(1.05);
opacity: 0.3;
}
100% {
transform: scale(1);
opacity: 0.7;
}
}
.hot-list {
list-style: none;
}
.hot-item {
padding: 20px;
margin-bottom: 16px;
border-radius: 12px;
background-color: white;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
transition: all 0.3s ease;
display: flex;
align-items: center;
border: 1px solid rgba(0, 0, 0, 0.03);
position: relative;
overflow: hidden;
}
.hot-item::before {
content: '◆';
position: absolute;
top: 5px;
right: 10px;
color: #f04040;
opacity: 0.2;
font-size: 14px;
}
.hot-item::after {
content: '◆';
position: absolute;
bottom: 5px;
left: 10px;
color: #f04040;
opacity: 0.2;
font-size: 14px;
}
.even-item {
border-left: 3px solid #f04040;
}
.odd-item {
border-right: 3px solid #f04040;
}
.title-decoration {
color: #f04040;
font-weight: bold;
margin-right: 5px;
display: inline-block;
transform: translateY(1px);
}
.source-icon, .time-icon {
color: #f04040;
font-size: 14px;
margin-right: 3px;
opacity: 0.8;
}
.hot-title {
position: relative;
display: inline-flex;
align-items: center;
}
.hot-stats {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-top: 8px;
}
.hot-item:hover {
transform: translateY(-3px);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
border-color: rgba(64, 169, 255, 0.3);
}
.hot-rank {
font-size: 1.2rem;
font-weight: bold;
color: #4096ff;
margin-right: 18px;
min-width: 38px;
text-align: center;
background-color: rgba(64, 169, 255, 0.1);
border-radius: 50%;
width: 38px;
height: 38px;
display: flex;
align-items: center;
justify-content: center;
}
.hot-rank.top-1 {
background: linear-gradient(135deg, #ff4d4f, #ff7a45);
color: white;
}
.hot-rank.top-2 {
background: linear-gradient(135deg, #ff7a45, #ffa940);
color: white;
}
.hot-rank.top-3 {
background: linear-gradient(135deg, #ffa940, #ffec3d);
color: white;
}
.hot-content {
flex: 1;
}
.hot-title {
font-size: 1.15rem;
margin-bottom: 8px;
color: #333;
text-decoration: none;
display: block;
line-height: 1.5;
font-weight: 500;
transition: color 0.2s ease;
}
.hot-title:hover {
color: #4096ff;
text-decoration: none;
}
.loading {
text-align: center;
padding: 40px;
color: #666;
font-size: 1.1rem;
}
footer {
text-align: center;
margin-top: 40px;
padding-top: 20px;
border-top: 1px solid rgba(0, 0, 0, 0.06);
color: #999;
font-size: 0.9rem;
}
.footer-decoration {
display: flex;
justify-content: center;
margin: 10px 0;
gap: 15px;
}
.geo-symbol {
color: #f04040;
font-size: 16px;
opacity: 0.7;
transition: all 0.3s ease;
animation: color-shift 5s infinite alternate;
}
.geo-symbol:hover {
opacity: 1;
transform: scale(1.2) rotate(15deg);
}
@keyframes color-shift {
0% {
color: #f04040;
}
50% {
color: #ff7a45;
}
100% {
color: #ff4d4f;
}
}
/* 响应式设计 */
@media (max-width: 1024px) and (min-width: 768px) {
.container {
max-width: 90%;
padding: 20px;
}
header h1 {
font-size: 2.2rem;
}
.hot-item {
padding: 18px;
}
.hot-title {
font-size: 1.1rem;
}
}
@media (max-width: 768px) {
body {
background-color: #f8f9fa;
}
.container {
max-width: 95%;
margin: 12px auto;
padding: 16px;
border-radius: 12px;
}
header {
margin-bottom: 20px;
padding-bottom: 16px;
}
header h1 {
font-size: 1.8rem;
margin-bottom: 10px;
}
.update-time {
font-size: 0.85rem;
padding: 6px 12px;
}
.hot-item {
padding: 16px;
margin-bottom: 12px;
border-radius: 10px;
flex-direction: row;
align-items: flex-start;
}
.hot-rank {
font-size: 1.1rem;
margin-right: 14px;
min-width: 32px;
width: 32px;
height: 32px;
margin-top: 2px;
}
.hot-title {
font-size: 1rem;
line-height: 1.5;
margin-bottom: 6px;
}
footer {
margin-top: 24px;
padding-top: 16px;
font-size: 0.85rem;
}
}
@media (max-width: 480px) {
.container {
margin: 8px auto;
padding: 14px;
}
header h1 {
font-size: 1.6rem;
}
.hot-item {
padding: 14px;
margin-bottom: 10px;
}
.hot-rank {
font-size: 1rem;
margin-right: 12px;
min-width: 30px;
width: 30px;
height: 30px;
}
.hot-title {
font-size: 0.95rem;
}
}
/* 减少动画以节省电池 */
@media (prefers-reduced-motion: reduce) {
.modern-gradient,
.modern-gradient::before {
animation: none;
}
.modern-gradient {
background: linear-gradient(
135deg,
rgba(64, 169, 255, 0.3) 0%,
rgba(255, 175, 64, 0.2) 50%,
rgba(255, 122, 69, 0.25) 100%
);
}
}

View File

@@ -0,0 +1,62 @@
<!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="./css/style.css">
<link rel="stylesheet" href="./css/background.css">
</head>
<body>
<div class="background-container">
<div class="green-gradient"></div>
</div>
<div class="container">
<header>
<div class="title-container">
<div class="geometric-decoration left">◢ ◣ ▲</div>
<h1>头条热搜榜</h1>
<div class="geometric-decoration right">▼ ◥ ◤</div>
</div>
<div class="update-time-container">
<span class="time-decoration"></span>
<div class="update-time" id="updateTime"></div>
<span class="time-decoration"></span>
</div>
</header>
<main>
<div class="geometric-header">
<span>◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆</span>
</div>
<div class="hot-list" id="hotList">
<div class="loading">加载中...</div>
</div>
<div class="geometric-footer">
<span>◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆ ◆</span>
</div>
</main>
<footer>
<div class="footer-decoration">
<span class="geo-symbol"></span>
<span class="geo-symbol"></span>
<span class="geo-symbol"></span>
<span class="geo-symbol"></span>
<span class="geo-symbol"></span>
</div>
<p>数据来源于头条热搜榜</p>
<div class="footer-decoration">
<span class="geo-symbol"></span>
<span class="geo-symbol"></span>
<span class="geo-symbol"></span>
<span class="geo-symbol"></span>
<span class="geo-symbol"></span>
</div>
</footer>
</div>
<script src="./js/main.js"></script>
</body>
</html>

View File

@@ -0,0 +1,171 @@
// API接口列表
const API_ENDPOINTS = [
"https://60s.api.shumengya.top/v2/toutiao",
];
// 当前使用的API索引
let currentApiIndex = 0;
// DOM元素
const hotListElement = document.getElementById('hotList');
const updateTimeElement = document.getElementById('updateTime');
// 格式化时间
function formatDate(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
// 格式化数字
function formatNumber(num) {
if (num >= 10000) {
return (num / 10000).toFixed(1) + '万';
}
return num.toString();
}
// 渲染热搜列表
function renderHotList(data) {
hotListElement.innerHTML = '';
// 几何装饰符号数组
const geometricSymbols = ['◆', '■', '▲', '●', '★', '◈', '◇', '□', '△', '○'];
data.forEach((item, index) => {
const hotItem = document.createElement('div');
hotItem.className = 'hot-item';
const rankClass = index < 3 ? `top-${index + 1}` : '';
// 随机选择几何符号作为装饰
const randomSymbol = geometricSymbols[index % geometricSymbols.length];
// 处理热度值显示
const hotValueDisplay = item.hot_value ?
`<div class="stat-item"><span class="hot-value">${randomSymbol} ${formatNumber(item.hot_value)} 热度</span></div>` : '';
// 处理标签显示
const tagDisplay = item.tag ?
`<div class="stat-item"><span class="hot-tag">${randomSymbol} ${item.tag}</span></div>` : '';
hotItem.innerHTML = `
<div class="hot-rank ${rankClass}">${index + 1}</div>
<div class="hot-content">
<a href="${item.link}" class="hot-title" target="_blank">
<span class="title-decoration">${randomSymbol}</span> ${item.title}
</a>
<div class="hot-stats">
${hotValueDisplay}
${tagDisplay}
${item.source ? `<div class="stat-item"><span class="source-icon">${randomSymbol}</span> ${item.source}</div>` : ''}
${item.time ? `<div class="stat-item"><span class="time-icon">${randomSymbol}</span> ${item.time}</div>` : ''}
</div>
</div>
`;
hotListElement.appendChild(hotItem);
});
// 添加几何装饰到列表项
const hotItems = document.querySelectorAll('.hot-item');
hotItems.forEach((item, index) => {
// 为奇数和偶数项添加不同的装饰类
if (index % 2 === 0) {
item.classList.add('even-item');
} else {
item.classList.add('odd-item');
}
});
// 更新时间
updateTimeElement.textContent = `更新时间:${formatDate(new Date())}`;
}
// 显示加载状态
function showLoading() {
hotListElement.innerHTML = '<div class="loading">加载中...</div>';
}
// 显示错误状态
function showError(message) {
hotListElement.innerHTML = `<div class="loading">${message}</div>`;
}
// 获取头条热搜数据
async function fetchToutiaoHotList() {
showLoading();
try {
const response = await fetch(API_ENDPOINTS[currentApiIndex]);
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}
const result = await response.json();
if (result.code === 200 && result.data && Array.isArray(result.data)) {
if (result.data.length > 0) {
renderHotList(result.data);
} else {
showError('暂无热搜数据');
}
} else {
throw new Error('数据格式错误或无数据');
}
} catch (error) {
console.error('获取数据失败:', error);
// 尝试切换到下一个API
const nextApiIndex = (currentApiIndex + 1) % API_ENDPOINTS.length;
if (nextApiIndex !== 0) {
// 还有其他API可以尝试
currentApiIndex = nextApiIndex;
showError('获取数据失败,正在尝试其他接口...');
// 延迟后重试
setTimeout(fetchToutiaoHotList, 2000);
} else {
// 所有API都尝试过了
currentApiIndex = 0;
showError('所有接口都无法访问,请稍后再试');
}
}
}
// 手动刷新数据
function refreshData() {
currentApiIndex = 0; // 重置API索引
fetchToutiaoHotList();
}
// 页面加载完成后获取数据
document.addEventListener('DOMContentLoaded', () => {
fetchToutiaoHotList();
// 每隔5分钟刷新一次数据
setInterval(fetchToutiaoHotList, 5 * 60 * 1000);
// 添加键盘快捷键支持按R键刷新
document.addEventListener('keydown', (event) => {
if (event.key === 'r' || event.key === 'R') {
event.preventDefault();
refreshData();
}
});
});
// 页面可见性变化时的处理
document.addEventListener('visibilitychange', () => {
if (!document.hidden) {
// 页面重新可见时刷新数据
refreshData();
}
});

View File

@@ -0,0 +1,3 @@
[
"https://60s.api.shumengya.top"
]

View File

@@ -0,0 +1,30 @@
{
"code": 200,
"message": "获取成功。数据来自官方/权威源头,以确保稳定与实时。开源地址 https://github.com/vikiboss/60s反馈群 595941841",
"data": [
{
"title": "九三阅兵具体安排公布",
"hot_value": 11821633,
"tag": "热",
"source": "头条新闻",
"time": "2小时前",
"link": "https://www.toutiao.com/article/7404567890123456789/"
},
{
"title": "九月第一天",
"hot_value": 11327170,
"tag": "新",
"source": "今日头条",
"time": "1小时前",
"link": "https://www.toutiao.com/article/7404567890123456790/"
},
{
"title": "遇见上合共享津彩",
"hot_value": 11222444,
"tag": "推荐",
"source": "头条资讯",
"time": "3小时前",
"link": "https://www.toutiao.com/article/7404567890123456791/"
}
]
}