feat: 业务化后台高级设置

This commit is contained in:
que01 committed 2026-09-27 19:16:33 +08:00
1 parent 07d3790aa8
commit f603719b2d
4 files changed
+63 -19

No files matched your search

@@ -0,0 +1,7 @@
# 执行记录
- 任务:将后台高级设置默认视图改为普通品牌管理员可理解的业务语言。
- 形态:single-full
- 进度:3/3
- 完成:运行时状态、能力展示、模板预览、自定义字段均已收敛技术细节;内部字段 Key 自动生成。
- 验证:Admin production build、全量 typecheck、lint、format、`git diff --check` 通过。
@@ -0,0 +1,12 @@
# 后台高级设置业务化
## 目标
降低普通品牌管理员使用“模板与设置”页面的技术认知负担,保留负责人需要的高级能力,但默认以业务语言呈现。
## 范围
- 运行时状态展示改为小程序同步状态、公开业务数量和启用能力数量。
- 能力列表不再显示 API contract、Schema、模块依赖等内部实现字段。
- 模板组合预览标注为高级预览并说明日常配置无需使用。
- 自定义字段列表使用业务语言;内部 Key 自动生成,不要求管理员理解技术命名。
@@ -0,0 +1,4 @@
id,task,status,acceptance_criteria,validation_command,completed_at,retry_count,notes
1,业务化运行时与高级设置展示,DONE,默认页面不展示 API contract、Schema 和模块依赖并保留负责人入口,pnpm --filter @personal-brand/admin build,2026-09-27,0,
2,业务化自定义字段编辑,DONE,列表显示业务概念且新增字段自动生成内部 key,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 默认页面不展示 API contract、Schema 和模块依赖并保留负责人入口 pnpm --filter @personal-brand/admin build 2026-09-27 0
3 2 业务化自定义字段编辑 DONE 列表显示业务概念且新增字段自动生成内部 key pnpm typecheck 2026-09-27 0
4 3 完成质量门禁 DONE Admin build、typecheck、lint、format 和 diff 检查通过 pnpm format:check 2026-09-27 0
@@ -249,17 +249,15 @@ export function WorkspacePage() {
) : (
<Space direction="vertical" style={{ width: "100%" }}>
<Space wrap>
<Tag color="blue">Schema {runtimeQuery.data?.schemaVersion ?? "-"}</Tag>
<Tag>能力 {runtimeQuery.data?.capabilities?.length ?? 0}</Tag>
<Tag>公开业务 {runtimeQuery.data?.offerings?.length ?? 0}</Tag>
<Tag>插件 {runtimeQuery.data?.plugins?.length ?? 0}</Tag>
<Tag color="green">小程序数据已同步</Tag>
<Tag>公开业务 {runtimeQuery.data?.offerings?.length ?? 0} 项</Tag>
<Tag>已启用能力 {runtimeQuery.data?.capabilities?.length ?? 0} 项</Tag>
</Space>
<Typography.Paragraph type="secondary" style={{ marginBottom: 0 }}>
小程序和后台预览消费同一份 Runtime Workspace;模板 key
只用于安装和版本管理,不作为客户端业务分支。
小程序和后台预览会使用同一份已发布内容。这里的能力由当前模板自动提供,通常不需要手动调整。
</Typography.Paragraph>
<Space direction="vertical" style={{ width: "100%" }}>
<Typography.Text strong>能力插件</Typography.Text>
<Typography.Text strong>已启用的服务能力</Typography.Text>
{(runtimeQuery.data?.plugins ?? []).map((plugin) => (
<Card key={plugin.key} size="small">
<Space wrap>
@@ -267,11 +265,9 @@ export function WorkspacePage() {
<Tag color={plugin.status === "enabled" ? "green" : "orange"}>
{plugin.status}
</Tag>
<Tag>v{plugin.version}</Tag>
<Typography.Text type="secondary">{plugin.apiContract}</Typography.Text>
</Space>
<Typography.Paragraph type="secondary" style={{ margin: "8px 0 0" }}>
依赖模块:{plugin.requiredModules.join("、")} · Schema:{plugin.configSchema}
这项能力已接入当前小程序流程,无需单独配置技术参数。
</Typography.Paragraph>
</Card>
))}
@@ -441,7 +437,14 @@ export function WorkspacePage() {
{industryTarget?.capabilities.join("、") || "无"}。
</Typography.Paragraph>
</Modal>
<Card title="模板组合预览" style={{ marginBottom: 24 }}>
<Card
title="模板组合预览"
style={{ marginBottom: 24 }}
extra={<Typography.Text type="secondary">高级预览</Typography.Text>}
>
<Typography.Paragraph type="secondary">
用于负责人确认行业表达和视觉风格是否匹配,日常内容配置通常不需要使用这里。
</Typography.Paragraph>
<Space wrap>
<Select
value={previewIndustry}
@@ -548,11 +551,14 @@ export function WorkspacePage() {
<MutationError error={updateForm.error} />
</Card>
<Card
title="自定义字段"
title="高级自定义字段"
extra={
<Button type="primary" onClick={() => setFieldOpen(true)}>
新增字段
</Button>
<Space>
<Typography.Text type="secondary">负责人设置</Typography.Text>
<Button type="primary" onClick={() => setFieldOpen(true)}>
新增字段
</Button>
</Space>
}
>
<Table
@@ -560,9 +566,20 @@ export function WorkspacePage() {
dataSource={fields.filter((item) => item.source === "custom")}
columns={[
{ title: "字段", dataIndex: "label" },
{ title: "Key", dataIndex: "key" },
{ title: "作用域", dataIndex: "scope" },
{ title: "类型", dataIndex: "type" },
{
title: "使用位置",
dataIndex: "scope",
render: (value) =>
({ profile: "品牌资料", service: "业务提供项", inquiry: "咨询表单" })[
String(value)
] ?? "其他",
},
{
title: "填写方式",
dataIndex: "type",
render: (value) =>
inquiryFieldTypes.find((item) => item.value === value)?.label ?? "自定义",
},
{
title: "操作",
render: (_: unknown, item: BrandFieldDefinition) => (
@@ -592,6 +609,10 @@ export function WorkspacePage() {
onFinish={(values) =>
createField.mutate({
...values,
key:
typeof values.key === "string" && values.key.trim()
? values.key.trim()
: `custom_${Date.now()}`,
required: Boolean(values.required),
isVisible: true,
sortOrder: 99,
@@ -607,7 +628,7 @@ export function WorkspacePage() {
]}
/>
</Form.Item>
<Form.Item name="key" label="字段 Key" rules={[{ required: true }]}>
<Form.Item name="key" hidden rules={[{ required: true }]}>
<Input />
</Form.Item>
<Form.Item name="label" label="显示名称" rules={[{ required: true }]}>