fix(announcement): 调整刷新时间显示位置和样式

将刷新时间信息从页面底部移至标题旁,并优化样式。当找不到标题元素时,保留原有样式并显示在页面主体中。
This commit is contained in:
2025-11-23 11:27:51 +08:00
parent f4d9fc6594
commit fe2fa2c597
+11 -2
View File
@@ -449,9 +449,18 @@ try {
refreshInfo.textContent = `北京时间 ${hours}:${minutes}:${seconds} | 下次刷新 ${remMinutes}分${remSeconds}秒`;
}
// 将倒计时添加到页面标题旁边
const pageHeader = document.querySelector('.page-header');
const refreshInfo = document.createElement('div');
refreshInfo.style.cssText = 'position:fixed;bottom:20px;right:20px;font-size:0.9rem;color:#333;background:#fff;padding:8px 12px;border-radius:4px;box-shadow:0 2px 6px rgba(0,0,0,0.2);border:1px solid #ddd;z-index:1000;';
document.body.appendChild(refreshInfo);
refreshInfo.style.cssText = 'font-size:0.9rem;color:#666;margin-top:5px;';
if (pageHeader) {
pageHeader.appendChild(refreshInfo);
} else {
// 如果找不到header,就添加到body
refreshInfo.style.cssText = 'font-size:0.9rem;color:#333;background:#fff;padding:8px 12px;border-radius:4px;box-shadow:0 2px 6px rgba(0,0,0,0.2);border:1px solid #ddd;margin:20px;';
document.body.appendChild(refreshInfo);
}
// 每秒更新一次
setInterval(updateBeijingTime, 1000);