feat(review): 审稿选章可用——列章端点 + 选章下拉全章可见 + 默认最近章

- 后端新增 GET /projects/{id}/chapters(列真实存在的章 + has_draft/accepted/reviewed_at),TDD 10 测
- gen:api 重生成 TS 客户端(ChapterListItem)
- 选章下拉去掉 hidden(手机/窄屏也可切章);选项以真实章为准 + 大纲结构,
  无草稿章置灰(仅当前章例外),覆盖『写过但不在大纲』的章
- 无 ?chapter 时默认落到最近一个有草稿的章,而非硬编码第 1 章
This commit is contained in:
Yaojia Wang
2026-07-12 17:52:40 +02:00
parent 5f28491ad6
commit 9aa0cddeaf
12 changed files with 652 additions and 18 deletions

View File

@@ -1,5 +1,6 @@
import { serverApiBase } from "./config";
import type {
ChapterListItem,
CharacterListResponse,
DraftView,
ForeshadowBoardResponse,
@@ -150,6 +151,18 @@ export async function fetchOutline(
}
}
// 列章GET .../chapters裸数组审稿选章枚举真实存在的章 + 可审/已审标记。
// 任何错误降级为空列表(进页不阻塞,回退到大纲/当前章导航)。
export async function fetchChapters(
projectId: string,
): Promise<ChapterListItem[]> {
try {
return await getJson<ChapterListItem[]>(`/projects/${projectId}/chapters`);
} catch {
return [];
}
}
// 提示词/模板库列表GET /templates全局只读裸数组
// 任何错误(含后端未上线)降级为空列表,模板页照常渲染(进页不阻塞)。
export async function fetchTemplates(): Promise<TemplateResponse[]> {