fix: 修复前端页面的一些bug
This commit is contained in:
parent
a5ddaea5a8
commit
a612b511b2
@ -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'
|
||||
});
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -67,6 +67,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
flex-wrap: wrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@ -487,7 +488,6 @@
|
||||
<label for="legendMode" class="text-sm text-gray-600">图例展示:</label>
|
||||
<select id="legendMode" class="px-2 py-1 border border-gray-300 rounded text-sm">
|
||||
<option value="combo_standard" selected>综合</option>
|
||||
<option value="combo_compact">综合(精简)</option>
|
||||
<option value="verify_all">全部气象要素对比</option>
|
||||
<option value="temp_compare">温度对比</option>
|
||||
<option value="hum_compare">湿度对比</option>
|
||||
@ -534,7 +534,7 @@
|
||||
|
||||
<div class="table-container" id="tableContainer">
|
||||
<div id="forecastToggleContainer" style="padding: 8px 12px;font-size: 12px;color: #666;display: none;display: flex;justify-content: flex-start;align-items: center;align-content: center;">
|
||||
<label style="display: flex; align-items: flex-start; gap: 5px;">
|
||||
<label style="display: flex;align-items: center;gap: 5px;">
|
||||
<input type="checkbox" id="showPastForecast" style="vertical-align: middle;" x-model="showPastForecast" @change="window.WeatherTable.display(window.WeatherApp.cachedHistoryData, window.WeatherApp.cachedForecastData)">
|
||||
显示历史预报
|
||||
</label>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user