feat: 大屏幕的页面
This commit is contained in:
parent
d88f64a87b
commit
edf3e93eef
@ -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');
|
||||||
|
const screen = document.querySelector('.screen');
|
||||||
|
const setLevel = (sum) => {
|
||||||
|
const isRed = sum > 1;
|
||||||
|
const isOrange = !isRed && sum > 0 && sum < 1;
|
||||||
if (panel) {
|
if (panel) {
|
||||||
if (futureSum > 0.4) panel.classList.add('alert-on');
|
panel.classList.toggle('alert-red', isRed);
|
||||||
else panel.classList.remove('alert-on');
|
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,∞))---
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user