Files
msh-system/scripts/logs/agent-BUG-007-170040.log
scottpan 4be53dcd1b feat: 集成 KieAI 服务,移除 models-integration 子项目
- 添加 Gemini 2.5 Flash 对话接口(流式+非流式)
- 添加 NanoBanana 图像生成/编辑接口
- 添加 Sora2 视频生成接口(文生视频、图生视频、去水印)
- 移除 models-integration 子项目(功能已迁移至主后端)
- 新增测试文档和 Playwright E2E 配置
- 更新前端页面和 API 接口
- 更新后端配置和日志处理
2026-03-03 15:33:50 +08:00

27 lines
2.0 KiB
Plaintext
Raw 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.
BUG-007 已按你的要求修好,修改总结如下:
### 1. **`loadKnowledgeList` 与 API**
- **请求参数**`type` 已按 tab 传 `guide` / `article`(与后端 `type` 一致),并显式用 `typeParam` 传参。
- **响应处理**:用 `Array.isArray(result.data.list)` 判断,只把合法数组赋给列表,否则用 `[]`,避免赋成 `undefined`。
- **列表赋值**:用 `currentTab === 'articles'` 分支给 `articleList` 赋值与「科普文章」tab 一致。
### 2. **错误处理**
- 在 `catch` 里增加 `uni.showToast`,文案为 `error.message` / `error.msg` 或「加载列表失败」。
- 在 `catch` 中**不**对 `guideList` / `articleList` 赋值,保持为初始的 `[]`,避免变成 `undefined`。
### 3. **onLoad 与无 id 时的列表**
- 无 `id` 时不再在 onLoad 里调用 `loadKnowledgeList()`(当前 tab 为 nutrients调用也会直接 return
- 列表只在「切换 tab」时加载`switchTab('guide')` / `switchTab('articles')` 内会调用 `loadKnowledgeList()`,从而加载对应 guide/article 列表。
### 4. **详情跳转 `goToDetail`**
- 先取 `id = item.knowledgeId ?? item.id`,再判断 `id === undefined || id === null || id === ''`。
- 无有效 id 时:`uni.showToast({ title: '暂无详情', icon: 'none' })` 并 return不跳转。
- 有 id 时才 `navigateTo` 到 `/pages/news/news_details/index?id=${id}`。
### 5. **列表展示与后端字段**
- 后端返回 `summary`、`viewCount`、`publishedAt` 等,模板用的是 `desc`、`time`、`views`、`icon`。
- 在赋值前对列表做了一层映射:`desc` ← summary、`time` ← 格式化 `publishedAt`/`createdAt`、`views` ← viewCount、`icon` 默认 `'📄'`,并增加了 `formatKnowledgeTime` 做日期格式化。
按当前逻辑:切换「饮食指南」或「科普文章」会请求 `type=guide` / `type=article` 并正确赋给 `guideList`/`articleList`;请求失败会 toast 且列表保持为 `[]`;只有存在 `knowledgeId` 或 `id` 时才跳转详情,否则提示「暂无详情」。