diff --git a/.codex-tasks/admin-trust-content-workflow/PROGRESS.md b/.codex-tasks/admin-trust-content-workflow/PROGRESS.md new file mode 100644 index 0000000..15aeb4f --- /dev/null +++ b/.codex-tasks/admin-trust-content-workflow/PROGRESS.md @@ -0,0 +1,7 @@ +# 执行记录 + +- 任务:完善信任内容的模板驱动配置工作流。 +- 形态:single-full +- 进度:3/3 +- 结果:模板要求、内容状态和新增/编辑动作已在同一页形成闭环。 +- 验证:Admin production build、全量 typecheck、lint、format、`git diff --check` 通过。 diff --git a/.codex-tasks/admin-trust-content-workflow/SPEC.md b/.codex-tasks/admin-trust-content-workflow/SPEC.md new file mode 100644 index 0000000..5428864 --- /dev/null +++ b/.codex-tasks/admin-trust-content-workflow/SPEC.md @@ -0,0 +1,12 @@ +# 信任内容配置工作流 + +## 目标 + +让普通品牌管理员明确知道当前模板需要哪些信任内容、哪些内容已经完成,以及发布前还缺什么。 + +## 范围 + +- 使用模板声明的信任类型、行业化名称、说明和 required 标记。 +- 显示每类内容的完整状态,并提供新增/编辑入口。 +- 新增内容默认优先选择尚未填写的必需类型。 +- 空列表显示明确的下一步说明。 diff --git a/.codex-tasks/admin-trust-content-workflow/TODO.csv b/.codex-tasks/admin-trust-content-workflow/TODO.csv new file mode 100644 index 0000000..2375080 --- /dev/null +++ b/.codex-tasks/admin-trust-content-workflow/TODO.csv @@ -0,0 +1,4 @@ +id,task,status,acceptance_criteria,validation_command,completed_at,retry_count,notes +1,展示模板信任内容要求,DONE,管理员能看到每个类型的业务名称、说明、必需标记和完成状态,pnpm --filter @personal-brand/admin build,2026-09-27,0, +2,补齐新增编辑入口,DONE,缺失类型可直接新增且默认优先选择未填写必需类型,pnpm typecheck,2026-09-27,0, +3,完成质量门禁,DONE,Admin build、typecheck、lint、format 和 diff 检查通过,pnpm format:check,2026-09-27,0, diff --git a/apps/admin/src/features/trust-content/TrustContentPage.tsx b/apps/admin/src/features/trust-content/TrustContentPage.tsx index 38e4b60..e7cddcd 100644 --- a/apps/admin/src/features/trust-content/TrustContentPage.tsx +++ b/apps/admin/src/features/trust-content/TrustContentPage.tsx @@ -3,12 +3,14 @@ import { Card, Form, Input, + List, Modal, Popconfirm, Select, Space, Table, Tag, + Typography, message, } from "antd"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; @@ -56,6 +58,7 @@ type TrustTypeOption = { label: string; help?: string; placeholder?: string; + required?: boolean; }; const fallbackTypes: TrustTypeOption[] = types.map(({ value, label, help }) => ({ type: value, @@ -83,6 +86,11 @@ export function TrustContentPage() { ? workspace.data.templateContent.trustContentTypes : fallbackTypes; const selectedTypeMeta = availableTypes.find((item) => item.type === selectedType); + const contentByType = new Map((query.data ?? []).map((item) => [item.type, item])); + const firstMissingRequiredType = + availableTypes.find((item) => item.required && !contentByType.has(item.type))?.type ?? + availableTypes[0]?.type ?? + "credential"; const save = useMutation({ mutationFn: (values: TrustContentInput) => editing @@ -103,7 +111,7 @@ export function TrustContentPage() { void queryClient.invalidateQueries({ queryKey: ["trust-content"] }); }, }); - const begin = (item?: TrustContent) => { + const begin = (item?: TrustContent, type?: string) => { setEditing(item ?? null); setOpen(true); form.setFieldsValue( @@ -116,7 +124,7 @@ export function TrustContentPage() { ...(item.coverUrl ? { coverUrl: item.coverUrl } : {}), isPublished: item.isPublished, } - : { type: "credential", isPublished: false }, + : { type: type ?? firstMissingRequiredType, isPublished: false }, ); }; return ( @@ -134,10 +142,47 @@ export function TrustContentPage() { } /> + + + 这些内容会帮助访客判断你是否值得信任。带有“发布必需”的项目需要填写完整后,才能发布小程序。 + + { + const content = contentByType.get(item.type); + const complete = Boolean(content?.title?.trim() && content?.content?.trim()); + return ( + (content ? begin(content) : begin(undefined, item.type))} + > + {content ? "编辑" : "新增"} + , + ]} + > + + {item.label} + {item.required && 发布必需} + + {complete ? "内容完整" : content ? "需要完善" : "尚未填写"} + + {item.help && {item.help}} + + + ); + }} + /> +