feat: 默认开启自动刷新并显示上次刷新时间
将自动刷新功能从用户确认改为默认开启,并添加显示上次刷新时间的元素,提升用户体验
This commit is contained in:
+11
-6
@@ -425,12 +425,17 @@ try {
|
||||
document.body.classList.add('mobile-device');
|
||||
}
|
||||
|
||||
// 自动刷新功能(可选,每5分钟刷新一次)
|
||||
if (confirm('是否开启自动刷新功能?(每5分钟自动更新页面)')) {
|
||||
setInterval(function() {
|
||||
window.location.reload();
|
||||
}, 5 * 60 * 1000);
|
||||
}
|
||||
// 自动刷新功能(默认开启,每5分钟刷新一次)
|
||||
setInterval(function() {
|
||||
window.location.reload();
|
||||
}, 5 * 60 * 1000);
|
||||
|
||||
// 显示上次刷新时间
|
||||
const lastRefresh = new Date().toLocaleString('zh-CN');
|
||||
const refreshInfo = document.createElement('div');
|
||||
refreshInfo.style.cssText = 'position:fixed;bottom:10px;right:10px;font-size:0.75rem;color:#999;background:#fff;padding:4px 8px;border-radius:4px;box-shadow:0 1px 3px rgba(0,0,0,0.1);z-index:1000;';
|
||||
refreshInfo.textContent = '上次刷新: ' + lastRefresh;
|
||||
document.body.appendChild(refreshInfo);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user