feat: 新增3h预报

This commit is contained in:
yarnom 2025-08-29 20:41:18 +08:00
parent 701292c54b
commit 3799b9fac8
2 changed files with 4 additions and 4 deletions

View File

@ -123,9 +123,9 @@ const WeatherChart = {
if (forecastData.length > 0) { if (forecastData.length > 0) {
// 雨量 仅显示 -1h/-2h/-3h // 雨量 仅显示 -1h/-2h/-3h
datasets.push( datasets.push(
{ label: '雨量 (mm) - 预报 (-1h)', data: forecastRainfallsH1, type: 'bar', backgroundColor: 'rgba(255, 99, 71, 0.55)', borderColor: 'rgb(255, 99, 71)', yAxisID: 'y-rainfall' }, { label: '雨量 (mm) - 预报 (+1h)', data: forecastRainfallsH1, type: 'bar', backgroundColor: 'rgba(255, 99, 71, 0.55)', borderColor: 'rgb(255, 99, 71)', yAxisID: 'y-rainfall' },
{ label: '雨量 (mm) - 预报 (-2h)', data: forecastRainfallsH2, type: 'bar', backgroundColor: 'rgba(255, 205, 86, 0.55)', borderColor: 'rgb(255, 205, 86)', yAxisID: 'y-rainfall' }, { label: '雨量 (mm) - 预报 (+2h)', data: forecastRainfallsH2, type: 'bar', backgroundColor: 'rgba(255, 205, 86, 0.55)', borderColor: 'rgb(255, 205, 86)', yAxisID: 'y-rainfall' },
{ label: '雨量 (mm) - 预报 (-3h)', data: forecastRainfallsH3, type: 'bar', backgroundColor: 'rgba(76, 175, 80, 0.55)', borderColor: 'rgb(76, 175, 80)', yAxisID: 'y-rainfall' } { label: '雨量 (mm) - 预报 (+3h)', data: forecastRainfallsH3, type: 'bar', backgroundColor: 'rgba(76, 175, 80, 0.55)', borderColor: 'rgb(76, 175, 80)', yAxisID: 'y-rainfall' }
); );
// 温度 取最接近的预报0h>1h>2h>3h // 温度 取最接近的预报0h>1h>2h>3h

View File

@ -77,7 +77,7 @@ const WeatherTable = {
const issuedBadge = (() => { const issuedBadge = (() => {
if (item.source !== '预报') return ''; if (item.source !== '预报') return '';
const lead = (typeof item.lead_hours === 'number' && item.lead_hours >= 0) ? ` -${item.lead_hours}h` : ''; const lead = (typeof item.lead_hours === 'number' && item.lead_hours >= 0) ? ` +${item.lead_hours}h` : '';
const issued = item.issued_at ? new Date(item.issued_at.replace(' ', 'T')) : null; const issued = item.issued_at ? new Date(item.issued_at.replace(' ', 'T')) : null;
const issuedStr = issued ? `${String(issued.getHours()).padStart(2,'0')}:${String(issued.getMinutes()).padStart(2,'0')}` : '-'; const issuedStr = issued ? `${String(issued.getHours()).padStart(2,'0')}:${String(issued.getMinutes()).padStart(2,'0')}` : '-';
return `<span style="font-size: 12px; color: #6b7280;">(发布: ${issuedStr}${lead}</span>`; return `<span style="font-size: 12px; color: #6b7280;">(发布: ${issuedStr}${lead}</span>`;