|
@@ -18,9 +18,13 @@ Draft
|
|
|
## Tasks / Subtasks
|
|
## Tasks / Subtasks
|
|
|
- [ ] 修改班次选择页面起点显示格式 (AC: 1, 3)
|
|
- [ ] 修改班次选择页面起点显示格式 (AC: 1, 3)
|
|
|
- [ ] 在 `mini/src/pages/schedule-list/ScheduleListPage.tsx` 中修改起点显示逻辑
|
|
- [ ] 在 `mini/src/pages/schedule-list/ScheduleListPage.tsx` 中修改起点显示逻辑
|
|
|
- - [ ] 使用地区API获取完整的省市区信息
|
|
|
|
|
|
|
+ - [ ] 从路由参数获取省市区信息,避免重复调用API
|
|
|
- [ ] 将地点名称显示改为"省份 城市 区县 → 地点名称"格式
|
|
- [ ] 将地点名称显示改为"省份 城市 区县 → 地点名称"格式
|
|
|
- [ ] 确保终点显示格式保持不变
|
|
- [ ] 确保终点显示格式保持不变
|
|
|
|
|
+- [ ] 更新活动选择页面传递省市区信息 (AC: 1, 3)
|
|
|
|
|
+ - [ ] 修改 `mini/src/pages/select-activity/ActivitySelectPage.tsx` 中的导航逻辑
|
|
|
|
|
+ - [ ] 在导航到班次选择页面时传递完整的省市区名称
|
|
|
|
|
+ - [ ] 确保省市区信息正确传递
|
|
|
- [ ] 优化页面加载逻辑避免默认选择路线 (AC: 2, 4)
|
|
- [ ] 优化页面加载逻辑避免默认选择路线 (AC: 2, 4)
|
|
|
- [ ] 修改 `ScheduleListPage.tsx` 中的页面初始化逻辑
|
|
- [ ] 修改 `ScheduleListPage.tsx` 中的页面初始化逻辑
|
|
|
- [ ] 在没有有效路线数据时不显示默认路线信息
|
|
- [ ] 在没有有效路线数据时不显示默认路线信息
|
|
@@ -52,8 +56,8 @@ Draft
|
|
|
- **测试文件位置**: `mini/tests/pages/schedule-list.test.tsx` [Source: architecture/testing-strategy.md#taro小程序测试体系]
|
|
- **测试文件位置**: `mini/tests/pages/schedule-list.test.tsx` [Source: architecture/testing-strategy.md#taro小程序测试体系]
|
|
|
|
|
|
|
|
### 现有实现分析
|
|
### 现有实现分析
|
|
|
-基于对 `ScheduleListPage.tsx` 的分析:
|
|
|
|
|
-- **当前起点显示** (第216行):
|
|
|
|
|
|
|
+基于对 `ScheduleListPage.tsx` 和 `ActivitySelectPage.tsx` 的分析:
|
|
|
|
|
+- **当前起点显示** (ScheduleListPage.tsx 第216行):
|
|
|
```typescript
|
|
```typescript
|
|
|
<Text className="text-base text-white/90 mt-1 block">
|
|
<Text className="text-base text-white/90 mt-1 block">
|
|
|
{routes[0]?.startLocation.name} → {routes[0]?.endLocation.name}
|
|
{routes[0]?.startLocation.name} → {routes[0]?.endLocation.name}
|
|
@@ -62,41 +66,60 @@ Draft
|
|
|
- 问题:直接使用 `routes[0]` 显示第一条路线,在没有选择路线时也会显示
|
|
- 问题:直接使用 `routes[0]` 显示第一条路线,在没有选择路线时也会显示
|
|
|
- 需要修改为:在没有有效路线时不显示,或者显示提示信息
|
|
- 需要修改为:在没有有效路线时不显示,或者显示提示信息
|
|
|
|
|
|
|
|
-- **地点数据结构** (第16-31行):
|
|
|
|
|
|
|
+- **活动选择页面已有省市区信息** (ActivitySelectPage.tsx 第112-138行):
|
|
|
```typescript
|
|
```typescript
|
|
|
- startLocation: {
|
|
|
|
|
- id: number
|
|
|
|
|
- name: string
|
|
|
|
|
- provinceId: number
|
|
|
|
|
- cityId: number
|
|
|
|
|
- districtId: number
|
|
|
|
|
- address: string
|
|
|
|
|
|
|
+ const getAreaDisplayName = (location: any) => {
|
|
|
|
|
+ if (!location) return ''
|
|
|
|
|
+ const parts: string[] = []
|
|
|
|
|
+ if (location.province?.name) parts.push(location.province.name)
|
|
|
|
|
+ if (location.city?.name) parts.push(location.city.name)
|
|
|
|
|
+ if (location.district?.name) parts.push(location.district.name)
|
|
|
|
|
+ return parts.join('') || ''
|
|
|
}
|
|
}
|
|
|
```
|
|
```
|
|
|
- - 包含完整的省市区ID信息
|
|
|
|
|
- - 需要调用地区API获取对应的省市区名称
|
|
|
|
|
|
|
+ - 已经实现了完整的省市区名称获取逻辑
|
|
|
|
|
+ - 地点数据结构包含完整的省市区对象信息
|
|
|
|
|
|
|
|
-- **地区API可用性**:
|
|
|
|
|
- - 省份接口: `areaClient.provinces.$get()`
|
|
|
|
|
- - 城市接口: `areaClient.cities.$get({ provinceId })`
|
|
|
|
|
- - 区县接口: `areaClient.districts.$get({ cityId })`
|
|
|
|
|
- - 已在 `AreaPicker.tsx` 中实现相关调用
|
|
|
|
|
|
|
+- **导航逻辑** (ActivitySelectPage.tsx 第160-172行):
|
|
|
|
|
+ ```typescript
|
|
|
|
|
+ navigateTo({
|
|
|
|
|
+ url: `/pages/schedule-list/ScheduleListPage?` +
|
|
|
|
|
+ `startAreaIds=${JSON.stringify(searchParams.startAreaIds)}&` +
|
|
|
|
|
+ `endAreaIds=${JSON.stringify(searchParams.endAreaIds)}&` +
|
|
|
|
|
+ `date=${searchParams.date}&` +
|
|
|
|
|
+ `vehicleType=${searchParams.vehicleType}&` +
|
|
|
|
|
+ `travelMode=${searchParams.travelMode}&` +
|
|
|
|
|
+ `activityId=${activity.id}&` +
|
|
|
|
|
+ `routeType=${routeType}`
|
|
|
|
|
+ })
|
|
|
|
|
+ ```
|
|
|
|
|
+ - 当前只传递了地区ID,需要添加省市区名称参数
|
|
|
|
|
|
|
|
### 修改策略
|
|
### 修改策略
|
|
|
- **起点显示格式**: 将 `{startLocation.name}` 改为 `{provinceName} {cityName} {districtName} → {startLocation.name}`
|
|
- **起点显示格式**: 将 `{startLocation.name}` 改为 `{provinceName} {cityName} {districtName} → {startLocation.name}`
|
|
|
- **页面加载逻辑**: 在没有有效路线数据时,不显示路线信息或显示"请选择路线"提示
|
|
- **页面加载逻辑**: 在没有有效路线数据时,不显示路线信息或显示"请选择路线"提示
|
|
|
-- **地区信息获取**: 使用现有的地区API接口获取省市区名称
|
|
|
|
|
-- **数据缓存**: 使用React Query缓存地区数据,避免重复请求
|
|
|
|
|
-- **错误处理**: 添加地区API调用失败时的降级方案
|
|
|
|
|
|
|
+- **地区信息传递**: 从活动选择页面传递完整的省市区名称,避免重复调用API
|
|
|
|
|
+- **数据传递**: 在导航URL中添加 `startAreaName` 和 `endAreaName` 参数
|
|
|
|
|
+- **错误处理**: 如果路由参数中没有省市区名称,则降级使用地点名称显示
|
|
|
|
|
|
|
|
### 数据模型
|
|
### 数据模型
|
|
|
- **Route接口**: 包含 `startLocation` 和 `endLocation` 字段,其中有 `provinceId`, `cityId`, `districtId` [Source: mini/src/pages/schedule-list/ScheduleListPage.tsx:16-31]
|
|
- **Route接口**: 包含 `startLocation` 和 `endLocation` 字段,其中有 `provinceId`, `cityId`, `districtId` [Source: mini/src/pages/schedule-list/ScheduleListPage.tsx:16-31]
|
|
|
-- **地区API响应**:
|
|
|
|
|
- - 省份: `{ id: number, name: string, type: 'province' }`
|
|
|
|
|
- - 城市: `{ id: number, name: string, type: 'city' }`
|
|
|
|
|
- - 区县: `{ id: number, name: string, type: 'district' }`
|
|
|
|
|
- [Source: mini/src/components/AreaPicker.tsx:6-10]
|
|
|
|
|
-- **显示逻辑**: 需要将地点ID映射为对应的省市区名称
|
|
|
|
|
|
|
+- **地点数据结构** (ActivitySelectPage.tsx 第17-44行):
|
|
|
|
|
+ ```typescript
|
|
|
|
|
+ venueLocation: {
|
|
|
|
|
+ id: number
|
|
|
|
|
+ name: string
|
|
|
|
|
+ provinceId: number
|
|
|
|
|
+ cityId: number
|
|
|
|
|
+ districtId: number
|
|
|
|
|
+ address: string
|
|
|
|
|
+ province: { id: number, name: string, level: number, code: string }
|
|
|
|
|
+ city: { id: number, name: string, level: number, code: string }
|
|
|
|
|
+ district: { id: number, name: string, level: number, code: string }
|
|
|
|
|
+ }
|
|
|
|
|
+ ```
|
|
|
|
|
+- **路由参数**: 需要在导航时添加 `startAreaName` 和 `endAreaName` 参数
|
|
|
|
|
+- **显示逻辑**: 优先使用路由参数中的省市区名称,如果没有则降级使用地点名称
|
|
|
|
|
|
|
|
### Testing
|
|
### Testing
|
|
|
- **测试框架**: Jest + @testing-library/react + React Query + Taro API mock [Source: architecture/testing-strategy.md#taro小程序测试体系]
|
|
- **测试框架**: Jest + @testing-library/react + React Query + Taro API mock [Source: architecture/testing-strategy.md#taro小程序测试体系]
|
|
@@ -105,7 +128,7 @@ Draft
|
|
|
- **测试重点**:
|
|
- **测试重点**:
|
|
|
- 验证起点显示格式为省市区格式
|
|
- 验证起点显示格式为省市区格式
|
|
|
- 验证页面加载时不会默认选择路线
|
|
- 验证页面加载时不会默认选择路线
|
|
|
- - 验证地区API调用正确
|
|
|
|
|
|
|
+ - 验证省市区信息正确从路由参数传递
|
|
|
- 验证班次选择功能正常工作
|
|
- 验证班次选择功能正常工作
|
|
|
- 验证拼车和包车服务都正确应用优化
|
|
- 验证拼车和包车服务都正确应用优化
|
|
|
|
|
|
|
@@ -113,6 +136,7 @@ Draft
|
|
|
| Date | Version | Description | Author |
|
|
| Date | Version | Description | Author |
|
|
|
|------|---------|-------------|--------|
|
|
|------|---------|-------------|--------|
|
|
|
| 2025-11-05 | 1.0 | 初始故事创建 | Bob (Scrum Master) |
|
|
| 2025-11-05 | 1.0 | 初始故事创建 | Bob (Scrum Master) |
|
|
|
|
|
+| 2025-11-05 | 1.1 | 优化地区信息传递策略,避免重复API调用 | Bob (Scrum Master) |
|
|
|
|
|
|
|
|
## Dev Agent Record
|
|
## Dev Agent Record
|
|
|
|
|
|