From 65f019ddb561549424a2eabd9f44b0370527232f Mon Sep 17 00:00:00 2001 From: API Changelog Bot Date: Fri, 15 May 2026 09:33:50 +0800 Subject: [PATCH] =?UTF-8?q?frontend[=E7=B4=A7=E6=80=A5]:=20SeasonDrawer=20?= =?UTF-8?q?=E5=88=A0=E6=9C=88=E4=BB=BD=E9=80=89=E6=8B=A9=E5=99=A8=20(?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=20PR=20#2295=20=E5=B7=B2=E4=B8=8A=E7=BA=BF?= =?UTF-8?q?=20+=20=E5=AD=97=E5=85=B8=20product=5Fseason=20=E6=9C=89?= =?UTF-8?q?=E5=85=A8=E5=B1=80=E5=AE=9A=E4=B9=89)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mmg: 之前合并 changelog 把这事埋在了 14_feat_season_month_auto_and_description_dynamic_cover.md B 部分, 没单独发, 你没注意到。本文件单独拎出来, 给精确文件:行号 + 改前/改后代码。 注: 字典 product_season 的 remark 字段已全局定义 spring=3-5月 / summer=6-8月 / autumn=9-11月 / winter=12-2月, 后端硬编码与字典一致, 前端展示可读字典 remark。 notify @mmg --- ...end_season_drawer_remove_month_selector.md | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 changelogs/2026-05/14_frontend_season_drawer_remove_month_selector.md diff --git a/changelogs/2026-05/14_frontend_season_drawer_remove_month_selector.md b/changelogs/2026-05/14_frontend_season_drawer_remove_month_selector.md new file mode 100644 index 0000000..17cf681 --- /dev/null +++ b/changelogs/2026-05/14_frontend_season_drawer_remove_month_selector.md @@ -0,0 +1,146 @@ +# [前端][紧急] SeasonDrawer 删月份选择器 (后端已自动赋值, 字典有全局定义) + +> **服务**: 前端 hl-ui (管理端) +> **后端 PR**: #2295 (Closes #2291) 已上线 +> **日期**: 2026-05-14 +> **影响范围**: 管理端 景区/游玩项目编辑页 SeasonDrawer 季节内容表单 +> **状态**: P1 — 后端已上线, 前端需删 monthStart/monthEnd 选择器 + +--- + +## ⚠️ 关键变化 + +后端 PR #2295 (Closes #2291) 已上线测试服: +- SaveRequest **删了 monthStart/monthEnd 字段**, 前端继续传会被忽略 +- 后端 SeasonMonthRangeUtil 按 seasonType 自动赋值: spring→3-5 / summer→6-8 / autumn→9-11 / winter→12-2 (跨年) +- 字典 `product_season` 的 remark 字段全局定义了 "3-5月/6-8月/9-11月/12-2月", 跟硬编码一致 + +前端 SeasonDrawer.vue 的"时间范围"月份选择器**应删除**, 让用户不再操作月份。 + +--- + +## 精确改法 + +**文件**: `D:/work2/hl-ui/src/views/resource/scenic/SeasonDrawer.vue` + +### 1. 删模板的月份选择器 (line 26 + line 48-60) + +**删 line 26 `v-if="seasonContents[season.value]?.monthStart && seasonContents[season.value]?.monthEnd"`**: +现在不依赖 monthStart/monthEnd 渲染, 改用 seasonType 是否存在配置内容判断, 或者直接显示。 + +**删 line 48-60 整个 `` 块**: + +```vue + + + + + + + + +``` + +可改为只读展示 (可选, 也可不显示): +```vue + + + {{ seasonMonthRangeLabel(season.value) }} + + + +const seasonMonthRangeLabel = (type) => ({ + spring: '3-5月', + summer: '6-8月', + autumn: '9-11月', + winter: '12-2月 (跨年)', +})[type] || '-' +``` + +或者直接读字典 `product_season` 的 `remark` 字段 (推荐, 字典是真相): +```js +const dictStore = useDictStore() +const seasonMonthRangeLabel = (type) => + dictStore.get('product_season')?.find(d => d.value === type)?.remark || '-' +``` + +### 2. 删 form data 初始字段 (line 181-188) + +```js +// 删 line 181 那个 i+1 月份选项数组 (如果只用于月份选择器) +// 删 line 188-189: +monthStart: null, +monthEnd: null, +``` + +### 3. 删保存时的 month 字段提取 (line 247-248, 273-279) + +`saveSeason` 函数里: +```js +// 删 line 247-248 不再从 item 读 month +// 删 line 273-279 不再校验 + 提交 month + +// 改为: +const payload = { + seasonName: form.seasonName, + description: form.description, + highlights: form.highlights, + playGuide: form.playGuide, + tips: form.tips, + // ... 其他字段 + // 不传 monthStart/monthEnd +} +await updateScenicSeason(scenicId, seasonType, payload) +``` + +### 4. 删 line 302 报错文案 + +```js +// 删 message.info('未配置任何季节的时间范围,无需保存') +// 改为基于其他字段是否有内容判断 +``` + +--- + +## 游玩项目同款 (前端待补 SeasonDrawer 落地后) + +`views/resource/playservice/SeasonDrawer.vue` (尚未创建, 见 [14_frontend_playservice_add_season_drawer.md](./14_frontend_playservice_add_season_drawer.md)) **直接照此规范实现, 不要复制旧 scenic SeasonDrawer 的月份选择器**。 + +--- + +## 验证 + +改完后: +1. 景区/游玩项目季节内容编辑表单**不再显示**"时间范围 X月至X月"控件 (或只读显示) +2. PUT 保存季节内容不传 monthStart/monthEnd +3. GET 季节列表后端仍返 monthStart/monthEnd (后端自动赋值), 前端可只读展示 + +测试服 curl 验证 PASS (后端已部署): +``` +PUT /admin/scenic/spot/{id}/season/spring (body 无 month) → 200 +GET /admin/scenic/spot/{id}/seasons → spring 这条 monthStart=3 monthEnd=5 +``` + +--- + +## 不影响范围 + +- 后端 VO 仍返 monthStart/monthEnd 字段, 前端可只读展示 +- DB 字段保留, 老数据兼容 +- 季节内容其他字段 (seasonName/description/highlights/playGuide/tips/封面/轮播/视频) 完全不动 + +--- + +## 相关 PR / Issue + +- 后端 PR #2295: [wx/HL#2295](https://git.1814.love:8443/wx/HL/pulls/2295) +- 后端 Issue #2291: [wx/HL#2291](https://git.1814.love:8443/wx/HL/issues/2291) +- 字典 `product_season` 已有全局月份定义 (remark 字段) +- 与游玩项目 SeasonDrawer 待新建任务关联: [14_frontend_playservice_add_season_drawer.md](./14_frontend_playservice_add_season_drawer.md) +- 与合并 changelog: [14_feat_season_month_auto_and_description_dynamic_cover.md](./14_feat_season_month_auto_and_description_dynamic_cover.md) (B 部分)