From a612b511b2f343f13dee96d26e12cc7e6e8ddb40 Mon Sep 17 00:00:00 2001 From: yarnom Date: Tue, 2 Sep 2025 17:32:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9A=84=E4=B8=80=E4=BA=9Bbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/js/app.js | 12 +++++++++++- static/js/weather-chart.js | 6 ++---- templates/index.html | 4 ++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/static/js/app.js b/static/js/app.js index 6df910d..94ca198 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -170,10 +170,20 @@ const WeatherApp = { try { const hexID = WeatherUtils.decimalToHex(decimalId); const stationID = `RS485-${hexID}`; + const endPlus3Str = (() => { + try { + const d = new Date(endTime); + if (!isNaN(d)) { + const d2 = new Date(d.getTime() + 3 * 60 * 60 * 1000); + return WeatherUtils.formatDatetimeLocal(d2).replace('T', ' ') + ':00'; + } + } catch (e) {} + return endTime.replace('T', ' ') + ':00'; + })(); const forecastParams = new URLSearchParams({ station_id: stationID, from: startTime.replace('T', ' ') + ':00', - to: endTime.replace('T', ' ') + ':00', + to: endPlus3Str, provider: forecastProvider, versions: '3' }); diff --git a/static/js/weather-chart.js b/static/js/weather-chart.js index 0a5cd95..3a144e0 100644 --- a/static/js/weather-chart.js +++ b/static/js/weather-chart.js @@ -295,9 +295,7 @@ WeatherChart.applyLegendMode = function(mode) { }; switch (mode) { - case 'combo_compact': - setVisible(['temp_actual','hum_actual','rain_actual','rain_fcst_h1']); - break; + case 'verify_all': setVisible(['temp_actual','temp_fcst','hum_actual','hum_fcst','pressure_actual','pressure_fcst','wind_actual','wind_fcst','rain_actual','rain_fcst_h1','rain_fcst_h2','rain_fcst_h3']); break; @@ -318,7 +316,7 @@ WeatherChart.applyLegendMode = function(mode) { break; case 'combo_standard': default: - setVisible(['temp_actual','hum_actual','rain_actual','rain_fcst_h1','rain_fcst_h2','rain_fcst_h3']); + setVisible(['temp_actual','temp_fcst','rain_actual','rain_fcst_h1','rain_fcst_h2','rain_fcst_h3']); break; } this.chart.update(); diff --git a/templates/index.html b/templates/index.html index 97cf34b..c34e574 100644 --- a/templates/index.html +++ b/templates/index.html @@ -67,6 +67,7 @@ display: flex; align-items: center; gap: 5px; + flex-wrap: wrap; flex-shrink: 0; } @@ -487,7 +488,6 @@ 显示历史预报