feat: 大屏幕的页面

This commit is contained in:
yarnom 2025-11-03 16:29:30 +08:00
parent d88f64a87b
commit edf3e93eef

View File

@ -300,13 +300,25 @@ WeatherApp.updateSummaryPanel = function(historyData, forecastData){
const futureSum = [r1,r2,r3].reduce((s,v)=> s + (v!=null?Number(v):0), 0); const futureSum = [r1,r2,r3].reduce((s,v)=> s + (v!=null?Number(v):0), 0);
if (elFuture) elFuture.textContent = `未来1~3小时降雨 ${fmt(futureSum)} 毫米`; if (elFuture) elFuture.textContent = `未来1~3小时降雨 ${fmt(futureSum)} 毫米`;
// 超过阈值(>0.4mm)触发 Summary 面板橙色预警样式 // 预警等级:>0.4 红色;>0.0 橙色;否则无
try { try {
const panel = document.getElementById('summaryPanel'); const panel = document.getElementById('summaryPanel');
if (panel) { const screen = document.querySelector('.screen');
if (futureSum > 0.4) panel.classList.add('alert-on'); const setLevel = (sum) => {
else panel.classList.remove('alert-on'); const isRed = sum > 1;
} const isOrange = !isRed && sum > 0 && sum < 1;
if (panel) {
panel.classList.toggle('alert-red', isRed);
panel.classList.toggle('alert-on', isOrange);
if (!isRed && !isOrange) { panel.classList.remove('alert-red','alert-on'); }
}
if (screen) {
screen.classList.toggle('alert-red', isRed);
screen.classList.toggle('alert-on', isOrange);
if (!isRed && !isOrange) { screen.classList.remove('alert-red','alert-on'); }
}
};
setLevel(futureSum);
} catch {} } catch {}
// --- 过去预报准确率(按小时分档 [0,5), [5,10), [10,∞)--- // --- 过去预报准确率(按小时分档 [0,5), [5,10), [10,∞)---