feat: 统一推荐指数显示格式,移除地图底部免责声明 #11

Merged
zuozhou merged 1 commits from zuozhou into main 2026-07-31 15:29:11 +08:00
Member
No description provided.
zuozhou added 1 commit 2026-07-31 15:28:43 +08:00
feat: 统一推荐指数显示格式,移除地图底部免责声明
AI Code Review / review (pull_request) Successful in 2m31s
09f8ec7ecf
zuozhou merged commit 33b9c53be6 into main 2026-07-31 15:29:11 +08:00
Owner

🔍 审查结论

本次 diff 有两处改动:统一 formatRecommendationLabel 的展示文案(selectors.ts),以及移除地图页底部的免责声明(map/index.vue)。改动方向清晰、范围小,但遗漏了对应用例的单元测试更新,会导致测试失败

严重问题(必须修复)

  • test/poi-domain.test.ts:194-197 — 单元测试与改动后的实现不符,pnpm test 必失败。
    实现侧 src/domain/poi/selectors.ts:21-23 已把返回值统一为 推荐指数 ${index}/5,不再区分来源;但测试仍断言旧文案:
    // test/poi-domain.test.ts:195-196
    expect(formatRecommendationLabel('official_editorial', 5)).toBe('官方推荐指数 5/5')
    expect(formatRecommendationLabel('poc_default', 4)).toBe('POC 推荐指数(待审核) 4/5')
    
    两者现在实际返回 '推荐指数 5/5' / '推荐指数 4/5',断言必然失败。本 PR diff 未包含对该测试的修改,属于回归。建议把用例改为验证"统一文案、与来源无关",例如:
    it('renders the unified recommendation label regardless of source', () => {
      expect(formatRecommendationLabel('official_editorial', 5)).toBe('推荐指数 5/5')
      expect(formatRecommendationLabel('poc_default', 4)).toBe('推荐指数 4/5')
    })
    
    注:本环境无 node_modules/pnpm,未能实跑 vitest 核验,但字符串不一致是确定的。

建议改进

  • src/domain/poi/selectors.ts:21_source 形参已变成死参数。 统一文案后 source 不再被使用(已加 _ 前缀规避 lint,处理得当)。但两处调用方仍在传入 poi.recommendationSourcesrc/pages/poi/detail.vue:134src/components/map/PoiSummaryCard.vue:41)。若短期内不打算恢复"按来源区分文案",更干净的做法是直接去掉该形参并同步更新两个调用点;保留也行,仅为可选清理。

  • src/pages/map/index.vue(原 627-629 行的免责声明块)— 属于产品/合规确认项,非代码缺陷。 被移除的是数据准确性/非权威性声明("…仍需项目方逐点复核,不代表光明区全域权威清单")。代码层面无残留:datasetMeta 仍被本文件其他位置使用(index.vue:22/147/324/547),disclaimer 字段也仍被 src/domain/travel/local-planner.ts:561,620 消费,未产生孤儿字段。但移除对外的免责声明通常需要产品/法务确认,建议在合入前确认这是有意为之。

测试与验证建议

  • 按上面"严重问题"更新 test/poi-domain.test.ts 后,运行 pnpm test(vitest)确认全绿。
  • pnpm run type-check(vue-tsc)与 pnpm lint,确认去掉 _source 相关改动无类型/lint 报错。
  • 手动验证地图页:底部不再渲染免责声明条;原 .map-page__disclaimer 承担了 env(safe-area-inset-bottom) 的底部安全区内边距,需在带 Home Indicator 的机型上确认底部(尤其是 PoiSummaryCard 浮起时)没有与系统手势条重叠或贴边。
  • 真机/模拟器核对 POI 详情页(detail.vue)与摘要卡片(PoiSummaryCard.vue)的推荐指数文案统一展示为"推荐指数 N/5"。
## 🔍 审查结论 本次 diff 有两处改动:统一 `formatRecommendationLabel` 的展示文案(`selectors.ts`),以及移除地图页底部的免责声明(`map/index.vue`)。改动方向清晰、范围小,但**遗漏了对应用例的单元测试更新,会导致测试失败**。 ### 严重问题(必须修复) - **`test/poi-domain.test.ts:194-197` — 单元测试与改动后的实现不符,`pnpm test` 必失败。** 实现侧 `src/domain/poi/selectors.ts:21-23` 已把返回值统一为 `推荐指数 ${index}/5`,不再区分来源;但测试仍断言旧文案: ```ts // test/poi-domain.test.ts:195-196 expect(formatRecommendationLabel('official_editorial', 5)).toBe('官方推荐指数 5/5') expect(formatRecommendationLabel('poc_default', 4)).toBe('POC 推荐指数(待审核) 4/5') ``` 两者现在实际返回 `'推荐指数 5/5'` / `'推荐指数 4/5'`,断言必然失败。本 PR diff 未包含对该测试的修改,属于回归。建议把用例改为验证"统一文案、与来源无关",例如: ```ts it('renders the unified recommendation label regardless of source', () => { expect(formatRecommendationLabel('official_editorial', 5)).toBe('推荐指数 5/5') expect(formatRecommendationLabel('poc_default', 4)).toBe('推荐指数 4/5') }) ``` 注:本环境无 `node_modules`/`pnpm`,未能实跑 vitest 核验,但字符串不一致是确定的。 ### 建议改进 - **`src/domain/poi/selectors.ts:21` — `_source` 形参已变成死参数。** 统一文案后 `source` 不再被使用(已加 `_` 前缀规避 lint,处理得当)。但两处调用方仍在传入 `poi.recommendationSource`(`src/pages/poi/detail.vue:134`、`src/components/map/PoiSummaryCard.vue:41`)。若短期内不打算恢复"按来源区分文案",更干净的做法是直接去掉该形参并同步更新两个调用点;保留也行,仅为可选清理。 - **`src/pages/map/index.vue`(原 627-629 行的免责声明块)— 属于产品/合规确认项,非代码缺陷。** 被移除的是数据准确性/非权威性声明("…仍需项目方逐点复核,不代表光明区全域权威清单")。代码层面无残留:`datasetMeta` 仍被本文件其他位置使用(`index.vue:22/147/324/547`),`disclaimer` 字段也仍被 `src/domain/travel/local-planner.ts:561,620` 消费,未产生孤儿字段。但移除对外的免责声明通常需要产品/法务确认,建议在合入前确认这是有意为之。 ### 测试与验证建议 - 按上面"严重问题"更新 `test/poi-domain.test.ts` 后,运行 `pnpm test`(vitest)确认全绿。 - 跑 `pnpm run type-check`(vue-tsc)与 `pnpm lint`,确认去掉 `_source` 相关改动无类型/lint 报错。 - 手动验证地图页:底部不再渲染免责声明条;原 `.map-page__disclaimer` 承担了 `env(safe-area-inset-bottom)` 的底部安全区内边距,需在带 Home Indicator 的机型上确认底部(尤其是 `PoiSummaryCard` 浮起时)没有与系统手势条重叠或贴边。 - 真机/模拟器核对 POI 详情页(`detail.vue`)与摘要卡片(`PoiSummaryCard.vue`)的推荐指数文案统一展示为"推荐指数 N/5"。
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: team/gmTouringMiniApp#11