2026-03-24 18:45:27 +08:00

31 lines
2.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 主页 UI 显示逻辑
依赖接口:`GET /v1/user/common_info` 返回的 `data.surge`JSON 字符串)解析为 extConfig结构见 [extConfig.md](extConfig.md)。
## extConfig 与顶部分类栏
- **need_wait**(是否展示 Video 菜单)
- 解析自 `surge.need_wait`,写入 `UserState.needShowVideoMenu`
- **仅 need_wait === true**:展示顶部分类栏(对应 Pencil 设计中的 tabRow节点 bK6o6行为见下。
- **其他情况**need_wait === false、未下发或未解析不展示顶部分类栏列表只展示 **extConfig.items** 的图片列表。
## need_wait === true 时的分类与列表
1. **分类栏**
使用图转视频分类接口数据,在分类列表**末尾**增加一个固定分类「pets」。
2. **列表内容**
- 选中**固定分类 pets**:列表展示 **extConfig.items** 的图片列表(不请求视频任务接口)。
- 选中**其他分类**:按原逻辑请求对应分类的视频任务接口,列表展示接口返回的视频任务。
## 数据流简述
1. **应用启动与登录、归因、common_info 的完整顺序**见 [app_startup.md](app_startup.md)。
2. 登录成功后:两次 `POST /v1/user/referrer``android_adjust``gg`)均返回后,再 **`GET /v1/user/common_info` 一次**;在 `AuthService._saveCommonInfoToState` 中解析 `data.surge`
- 写入 `lucky` 等;
- 解析 `need_wait``items`,通过 `UserState.setExtConfig(needShowVideoMenuValue: needWait, items: items)` 写入。
-`need_wait``items` 相对之前发生结构性变化,会触发 `UserState.requestHomeFullReload()`,首页重走「加载分类 → 加载任务」。
3. 主页 `HomeScreen` 监听 `UserState.needShowVideoMenu``UserState.extConfigItems``homeReloadNonce` 等,据此决定:
- 是否渲染顶部分类栏;
- 当前列表是来自 extConfig.items 还是来自视频任务接口。
4. extConfig 的 **items** 单项字段:`image``cost``title``detail`用于展示卡片并作为生图参数taskType / ext