diff --git a/static/index.html b/static/index.html index bdf9424f..4f0c647d 100644 --- a/static/index.html +++ b/static/index.html @@ -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; }
@@ -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'); }