日程详情卡:补齐行程的出发地/目的地 (#69)

用户 2026-11-05:「点击行程里旅行日历本里的信息时,弹出来的那个框是在首页上
弹出的,还是没有出发地和目的地。」

根因链(三段,缺一段都不显示):

1. FbCalEventFull 没有那四个字段
   #67 只给了 FbCalEvent(列表用),详情卡消费的是 FbCalEventFull。

2. shellOf() 只塞了 location: b.place
   行程节点的 place 是空串 —— 它的位置概念是"从哪到哪",没有单一地点。

3. 最关键:行程条目**永远走 shell,压根不请求详情接口**
   openEvent() 里 `if (!isEditableEvent(e)) { shellOf(e); return; }`,
   行程的 kind 是 trip 不是 custom ⇒ 直接短路。
   而且即使去请求也没意义:Calendar::event($id) 查的是 calendar_events,
   行程节点在 trip_nodes 表,那个 id 查不到东西。
   ⇒ 位置信息**只能**靠 shell 带过去。

改动:

- FbCalEventFull 加 fromPlace/toPlace/fromLng/fromLat/toLng/toLat
- FbCalRepo.toFull() 从接口读(接口给就填,普通日程取到空串)
- 首页 FbHomePage.shellOf()、日程页 FbCalendarPage.shellOf() 两处传递
  (两处是独立实现,只改一处会漏)
- FbEventSheet:
  · navRow 改 navRowRaw(label, place, navTarget) —— 标签不再硬编码「地点」
  · onNavigate 从无参改成 onNavigate(navTarget)
    原来宿主只能读 event.location 猜导航目标,无法区分出发地/目的地
  · 渲染三分支:有 fromPlace 画「出发地」、有 toPlace 画「目的地」、
    有 location 画「地点」(三者互斥:行程条目只有前两个,普通日程只有第三个)
  · 新增 navTargetOf(place, lng, lat):有坐标返回 `lat,lng?地名`
    (同名地点不会搜错城市),没有就只给地名让 FbNav 地理编码
- 首页 navigateEvent / 日程页 navigateDetail 改成接受 navTarget,
  非空直接用,为空退回原来那套推导(底部那颗「导航」按钮传空串)
This commit is contained in:
2026-11-05 16:21:16 +08:00
parent f30ea5b1e4
commit ad9b934760
4 changed files with 137 additions and 17 deletions
+28 -1
View File
@@ -42,6 +42,25 @@ export interface FbCalEventFull {
transp: boolean;
/** 创建者 person_id */
created_by: number;
/**
* 出发地 / 目的地(#69)。
*
* 🔴 用户 2026-11-05:「点击行程里旅行日历本里的信息时,弹出来的那个框…
* 还是没有出发地和目的地。」
*
* 行程派生条目(kind='trip')服务端**不输出 `location`** ——
* 行程没有单一"地点"概念,它有的是"从哪到哪"。
* ⇒ 详情卡必须靠这几个字段才能显示,不能只读 `location`。
*
* 普通日程一律空串。
*/
fromPlace: string;
toPlace: string;
/** 坐标(导航用;老数据可能为空) */
fromLng: string;
fromLat: string;
toLng: string;
toLat: string;
}
/** 写日程时要发的字段(全部可选 —— 只传变化的) */
@@ -226,7 +245,15 @@ export class FbCalRepo {
reminder_minutes: this.remStr(o, 'reminder_minutes'),
status: this.str(o, 'status') !== '' ? this.str(o, 'status') : 'confirmed',
transp: o['transp'] === true || o['transp'] === 1,
created_by: this.num(o, 'created_by')
created_by: this.num(o, 'created_by'),
/* #69:行程条目的「从哪到哪」。接口里只有行程派生条目才给这几个字段,
普通日程取到的是默认空串。 */
fromPlace: this.str(o, 'from_place'),
toPlace: this.str(o, 'to_place'),
fromLng: this.str(o, 'from_lng'),
fromLat: this.str(o, 'from_lat'),
toLng: this.str(o, 'to_lng'),
toLat: this.str(o, 'to_lat')
};
return e;
}