feat: 完善信任内容配置流程

This commit is contained in:
que01 committed 2026-09-27 19:33:02 +08:00
1 parent ae2eb08fca
commit 37e898a4b9
4 files changed
+70 -2

No files matched your search

@@ -0,0 +1,7 @@
# 执行记录
- 任务:完善信任内容的模板驱动配置工作流。
- 形态:single-full
- 进度:3/3
- 结果:模板要求、内容状态和新增/编辑动作已在同一页形成闭环。
- 验证:Admin production build、全量 typecheck、lint、format、`git diff --check` 通过。
@@ -0,0 +1,12 @@
# 信任内容配置工作流
## 目标
让普通品牌管理员明确知道当前模板需要哪些信任内容、哪些内容已经完成,以及发布前还缺什么。
## 范围
- 使用模板声明的信任类型、行业化名称、说明和 required 标记。
- 显示每类内容的完整状态,并提供新增/编辑入口。
- 新增内容默认优先选择尚未填写的必需类型。
- 空列表显示明确的下一步说明。
@@ -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,
1 id task status acceptance_criteria validation_command completed_at retry_count notes
2 1 展示模板信任内容要求 DONE 管理员能看到每个类型的业务名称、说明、必需标记和完成状态 pnpm --filter @personal-brand/admin build 2026-09-27 0
3 2 补齐新增编辑入口 DONE 缺失类型可直接新增且默认优先选择未填写必需类型 pnpm typecheck 2026-09-27 0
4 3 完成质量门禁 DONE Admin build、typecheck、lint、format 和 diff 检查通过 pnpm format:check 2026-09-27 0
@@ -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() {
</Button>
}
/>
<Card title="当前模板需要哪些信任内容?" style={{ marginBottom: 24 }}>
<Typography.Paragraph type="secondary">
这些内容会帮助访客判断你是否值得信任。带有“发布必需”的项目需要填写完整后,才能发布小程序。
</Typography.Paragraph>
<List
size="small"
dataSource={availableTypes}
renderItem={(item) => {
const content = contentByType.get(item.type);
const complete = Boolean(content?.title?.trim() && content?.content?.trim());
return (
<List.Item
actions={[
<Button
key={item.type}
type="link"
size="small"
onClick={() => (content ? begin(content) : begin(undefined, item.type))}
>
{content ? "编辑" : "新增"}
</Button>,
]}
>
<Space wrap>
<Typography.Text strong>{item.label}</Typography.Text>
{item.required && <Tag color="orange">发布必需</Tag>}
<Tag color={complete ? "success" : "default"}>
{complete ? "内容完整" : content ? "需要完善" : "尚未填写"}
</Tag>
{item.help && <Typography.Text type="secondary">{item.help}</Typography.Text>}
</Space>
</List.Item>
);
}}
/>
</Card>
<Card>
<Table
rowKey="id"
dataSource={query.data ?? []}
locale={{ emptyText: "还没有信任内容,请先按上方模板要求添加。" }}
columns={[
{
title: "证据类型",