fix: 同步后刷新考勤视图 + 全局错误捕获层(白屏转错误报告)
This commit is contained in:
@@ -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 { /* 浮层失败时保持静默 */ }
|
||||
}
|
||||
Reference in New Issue
Block a user