feat: 新数据高亮每 30 秒自动清除一次
- 新增独立定时器 startHlAutoClear:每 hlAutoClearSec(默认30)秒扫描一次, 若仍有高亮则清空并重新渲染表格与计数徽标;无高亮时不打扰。 - 既保留'比闪一下停留更久'的可见性,又避免绿色底纹长期堆积失去重点。 - 清除按钮 tooltip 同步说明'每 30 秒自动清除一次'。 - 与手动清除(#btnClearHl)、切换项目重置高亮互不冲突。
This commit is contained in:
+18
-1
@@ -25,7 +25,9 @@
|
||||
connFail: 0,
|
||||
historyDisplay: 'click', // click=点击成员弹窗查看历史;inline=成绩明细内全部展开
|
||||
exportSort: 'time', // time=按提交时间;sid=按学号
|
||||
highlight: new Set(), // 出现过新提交/新数据的学号,绿色底纹常亮直到清除
|
||||
highlight: new Set(), // 出现过新提交/新数据的学号,绿色底纹
|
||||
hlTimer: null, // 自动清除高亮的定时器
|
||||
hlAutoClearSec: 30, // 新数据高亮每隔多少秒自动清除一次
|
||||
};
|
||||
|
||||
/* ---------------- 本地存储 ---------------- */
|
||||
@@ -703,6 +705,20 @@
|
||||
state.timer = setInterval(() => refresh(true), sec * 1000);
|
||||
}
|
||||
|
||||
/* ---------------- 新数据高亮自动清除 ---------------- */
|
||||
// 绿色高亮用于标记"有更新的成员",停留更易察觉(不再只闪一下),
|
||||
// 但长时间堆积会失去重点——故每 hlAutoClearSec 秒自动清除一次。
|
||||
function startHlAutoClear() {
|
||||
if (state.hlTimer) clearInterval(state.hlTimer);
|
||||
const sec = state.hlAutoClearSec || 30;
|
||||
state.hlTimer = setInterval(() => {
|
||||
if (state.highlight.size === 0) return; // 无高亮时不打扰
|
||||
state.highlight = new Set();
|
||||
renderTable();
|
||||
renderHlBadge();
|
||||
}, sec * 1000);
|
||||
}
|
||||
|
||||
/* ---------------- 全屏 ---------------- */
|
||||
function toggleFullscreen() {
|
||||
const el = document.documentElement;
|
||||
@@ -1135,6 +1151,7 @@
|
||||
|
||||
// 启动:主界面在 PHP 端已做会话校验(未登录会跳到 login.php),此处直接加载数据
|
||||
schedule();
|
||||
startHlAutoClear(); // 新数据高亮每 30s 自动清除一次
|
||||
loadProjects();
|
||||
|
||||
// 4) 读取展示偏好(历史成绩展示方式 / 导出排序),避免必须打开设置弹窗才生效
|
||||
|
||||
Reference in New Issue
Block a user