zzy
5342554b5f
feat(还车): 拿不到定位时静默兜底,不再弹「三选一」问用户
用户口径:还车/锁车这块不要打断人去选,按地图中心或找个停车点直接还就行。
改法
- getOrderOperationLocation() 改为自动兜底链,全程不问用户:
navigator.geolocation(WGS84,直接用)
→ 页面上的「我」标记(BD09 → GCJ02 → WGS84,位置最贴近用户)
→ 地图中心(BD09 → WGS84)
→ 校园中心(/api/config 的 center_lat/lng,GCJ02 → WGS84)
→ 都没有才返回 null 并中止(仍不伪造 36.67/116.98 这类魔数)
- 走兜底时只给一条 toast:「定位不可用,已用地图中心上报位置」,不阻塞操作
- 删除弹窗相关代码:askOperationLocation / settleOperationLocation /
chooseGeoRetry / chooseGeoMapCenter / cancelGeoChoice 及其状态与超时常量;
templates/map.html 的 #geo-choice-modal 整块、compat/globals.ts 的 3 个 window 挂载
- map/core.ts:校园中心同时镜像到 S.campusCenter(getCampusCenter 会回读 S),
让「地图没加载出来」这条兜底链可测、现场可在控制台看到
测试
- test_ux_p0_rental_return.cjs 的 UX-04 三条改写为新口径:
· 无定位 → 静默用地图中心(校验 BD09→WGS84 数值、source=map-center、toast 有提示)
· 地图没就绪 → 退校园中心(source=campus-center)
· 都没有 → 返回 null 且不发还车请求
- 全量 238 pytest + 43 node 全绿
- 浏览器实测(390px,禁用 geolocation):DOM 里没有 #geo-choice-modal,
window.chooseGeo* 已不存在;取坐标返回 {lat 36.53198, lng 116.77749, source map-center},
toast「定位不可用,已用地图中心上报位置」,JS 异常 0
2026-11-17 14:38:41 +08:00
..
2026-11-17 09:58:16 +08:00
2026-11-17 14:38:41 +08:00
2026-11-16 11:52:34 +08:00
2026-10-29 15:20:39 +08:00
2026-10-29 15:20:39 +08:00
2026-10-29 15:20:39 +08:00
2026-10-29 15:20:39 +08:00
2026-10-29 15:20:39 +08:00
2026-10-29 15:20:39 +08:00
2026-10-29 15:20:39 +08:00
2026-10-29 15:20:39 +08:00
2026-10-29 15:20:39 +08:00