fix: JavaScript变量声明顺序修复

This commit is contained in:
2026-04-23 18:08:57 +08:00
parent 71dd1d3aff
commit a201b0356a
3 changed files with 31 additions and 33 deletions

13
app.py
View File

@@ -1645,6 +1645,13 @@ HTML_TEMPLATE = '''<!DOCTYPE html>
document.getElementById('enableLogs').checked = enableLogs;
// Tab 切换
// 系统资源监控变量(必须先声明)
let realtimeTimer = null;
let realtimeInterval = 2; // 秒
let lastAlertTime = 0; // 上次警告时间
let thresholds = { cpu: 80, memory: 85, disk: 90, interval: 60 };
let desktopNotifyEnabled = false;
function switchTab(tab) {
currentTab = tab;
document.querySelectorAll('.tab-btn').forEach(btn => {
@@ -1673,12 +1680,6 @@ HTML_TEMPLATE = '''<!DOCTYPE html>
}
}
// 系统资源加载
let realtimeTimer = null;
let realtimeInterval = 2; // 秒
let lastAlertTime = 0; // 上次警告时间
let thresholds = { cpu: 80, memory: 85, disk: 90, interval: 60 };
// 加载阈值设置
function loadThresholds() {
const saved = localStorage.getItem('systemThresholds');