fix: 同步后刷新考勤视图 + 全局错误捕获层(白屏转错误报告)

This commit is contained in:
root
2026-10-16 14:10:21 +08:00
parent 8c9f2f0c8b
commit 8a0fde507f
7 changed files with 58 additions and 16 deletions
+20
View File
@@ -0,0 +1,20 @@
// 全局错误浮层:捕获会导致白屏的致命错误并显示在屏幕上,
// 便于远程定位(点击浮层空白处关闭,可叠加多条)
export function showFatalError(title: string, detail: string): void {
try {
let el = document.getElementById('fatal-overlay')
if (!el) {
el = document.createElement('div')
el.id = 'fatal-overlay'
el.style.cssText = 'position:fixed;inset:0;z-index:99999;background:#FFFFFF;color:#1D2129;padding:20px;overflow:auto;font:13px/1.7 -apple-system,PingFang SC,Microsoft YaHei,sans-serif;'
el.addEventListener('click', e => {
if (e.target === el && el.parentElement) el.parentElement.removeChild(el)
})
document.body.appendChild(el)
}
const box = document.createElement('div')
box.style.cssText = 'border:1px solid #E5484D;border-radius:8px;padding:12px;margin-bottom:12px;word-break:break-all;white-space:pre-wrap;'
box.textContent = title + '\n' + detail
el.appendChild(box)
} catch { /* 浮层失败时保持静默 */ }
}