feat: 抽测风速改为用户可自定义次数(增删按钮)
- models.rs:新增 spot_check_count 字段(默认 5) - db.rs:INSERT/SELECT 添加 spotcheckcount 列 - migrations/007:ALTER TABLE weather_data ADD spotcheckcount - afterbody.js:使用 data.spotCheckCount 动态渲染抽测数据
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
const WeatherReport = (function () {
|
||||
const BASE_WIND_COUNT = 10;
|
||||
const SPOT_CHECK_COUNT = 5;
|
||||
|
||||
const AREA_TYPE_MAP = {
|
||||
urban: "城市",
|
||||
@@ -193,19 +192,20 @@ const WeatherReport = (function () {
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
if (data.hasSpotCheckWindSpeed) {
|
||||
const spotCount = data.spotCheckCount || 5;
|
||||
if (data.hasSpotCheckWindSpeed && spotCount > 0) {
|
||||
html += `
|
||||
<div class="two-column">
|
||||
<div class="field full-width">
|
||||
<div class="field-label">抽测风速值:</div>
|
||||
<div class="field-value">
|
||||
<div class="ten-values">${joinWithComma(data.windSpeed, BASE_WIND_COUNT, BASE_WIND_COUNT + SPOT_CHECK_COUNT)}</div>
|
||||
<div class="ten-values">${joinWithComma(data.windSpeed, BASE_WIND_COUNT, BASE_WIND_COUNT + spotCount)}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field full-width">
|
||||
<div class="field-label">抽测风向值:</div>
|
||||
<div class="field-value">
|
||||
<div class="ten-values">${joinWithComma(data.windDirection, BASE_WIND_COUNT, BASE_WIND_COUNT + SPOT_CHECK_COUNT)}</div>
|
||||
<div class="ten-values">${joinWithComma(data.windDirection, BASE_WIND_COUNT, BASE_WIND_COUNT + spotCount)}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
Reference in New Issue
Block a user