fix(ui): price_monitor 运行监控——开盘期间数据>5分钟未更新则红色闪烁告警

This commit is contained in:
hmo
2026-07-27 09:45:13 +08:00
parent f0407f3a98
commit 3284e14e4b
+28 -1
View File
@@ -35,6 +35,11 @@ body { background: #0f0f13; color: #e2e8f0; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0f0f13; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
@keyframes pulse-warn {
0%, 100% { opacity: 1; }
50% { opacity: 0.3; }
}
.pulse-warn { animation: pulse-warn 1.2s ease-in-out infinite; }
</style>
</head>
<body class="min-h-screen">
@@ -280,8 +285,30 @@ async function refreshAll() {
if (watchData && watchData.data_time) {
const dt = watchData.data_time.slice(5,16);
timeParts.unshift('📡价格 ' + dt);
// 开盘期间检测 price_monitor 是否存(数据>5分钟=可能挂了)
const now = new Date();
const h = now.getHours(), m = now.getMinutes(), d = now.getDay();
const isMarketHours = d >= 1 && d <= 5 && ((h === 9 && m >= 30) || (h >= 10 && h < 15) || (h === 15 && m === 0));
if (isMarketHours) {
const dataDate = new Date(watchData.data_time);
const ageMin = (now - dataDate) / 60000;
if (ageMin > 5) {
timeParts[0] = '🚨价格 ' + dt + '' + Math.round(ageMin) + '分钟未更新)';
}
}
}
document.getElementById('updateTime').innerHTML = timeParts.join(' | ');
// 如果有告警、整行变红闪烁
if (timeParts[0].startsWith('🚨')) {
const el = document.getElementById('updateTime');
el.style.color = '#e53935';
el.style.fontWeight = 'bold';
el.className = 'pulse-warn';
} else {
document.getElementById('updateTime').style.color = '';
document.getElementById('updateTime').style.fontWeight = '';
document.getElementById('updateTime').className = '';
}
document.getElementById('updateTime').textContent = timeParts.join(' | ');
document.getElementById('tab-overview').classList.remove('loading');
renderTab(document.querySelector('.tab-btn.active')?.dataset?.tab || 'overview');
}