feat: 完善后台配置工作台

This commit is contained in:
que01 committed 2026-09-27 19:11:01 +08:00
1 parent d7e5b64d84
commit 07d3790aa8
4 files changed
+96 -24

No files matched your search

@@ -16,3 +16,10 @@
- 业务提供项启用、停用、删除失败会显示错误;操作期间仅锁定当前条目,成功后提示并刷新列表。
- 信任内容列表使用当前模板声明的行业化类型名称,避免列表文案与编辑表单不一致。
- 验证:Admin production build、typecheck、lint、format、`git diff --check` 通过。
## 二次可用性加固
- 概览页直接读取发布 readiness,显示完成百分比、阻塞发布的具体原因和逐项处理入口,不再使用与发布规则脱节的静态建议。
- readiness 检查和旧版 fallback 检查先归一化为统一显示模型,避免不同数据来源导致页面类型和行为不一致。
- 后台侧栏支持窄屏断点收起,顶部显示当前品牌管理员角色,减少多品牌和多人协作时的上下文误判。
- 验证:Admin production build、全量 typecheck、lint、format、`git diff --check` 通过。
+2 -2
View File
@@ -1,4 +1,4 @@
id,task,status,acceptance_criteria,validation_command,completed_at,retry_count,notes
1,修正概览页品牌与模板语义,DONE,模板名称来自 workspace 声明且完整度条目可跳转处理,pnpm --filter @personal-brand/admin build,2026-09-27,0,
2,补齐业务项和信任内容错误反馈,DONE,启停/删除失败可见且信任类型列表使用当前模板文案,pnpm --filter @personal-brand/admin build,2026-09-27,0,
3,完成后台可用性回归,DONE,Admin build、typecheck、lint、format 和 diff 检查通过,pnpm --filter @personal-brand/admin build,2026-09-27,0,全量 typecheck/lint/format 通过
2,补齐业务项和信任内容错误反馈,DONE,启停/删除失败可见且信任类型列表使用当前模板文案,pnpm --filter @personal-brand/admin build,2026-09-27,0,上一轮已完成
3,完成后台可用性回归,DONE,Admin build、typecheck、lint、format 和 diff 检查通过,pnpm --filter @personal-brand/admin build,2026-09-27,0,本轮增加 readiness 工作台、响应式侧栏和角色上下文;全量门禁通过
1 id task status acceptance_criteria validation_command completed_at retry_count notes
2 1 修正概览页品牌与模板语义 DONE 模板名称来自 workspace 声明且完整度条目可跳转处理 pnpm --filter @personal-brand/admin build 2026-09-27 0
3 2 补齐业务项和信任内容错误反馈 DONE 启停/删除失败可见且信任类型列表使用当前模板文案 pnpm --filter @personal-brand/admin build 2026-09-27 0 上一轮已完成
4 3 完成后台可用性回归 DONE Admin build、typecheck、lint、format 和 diff 检查通过 pnpm --filter @personal-brand/admin build 2026-09-27 0 全量 typecheck/lint/format 通过 本轮增加 readiness 工作台、响应式侧栏和角色上下文;全量门禁通过
@@ -1,5 +1,5 @@
import { Button, Card, Col, List, Row, Space, Statistic, Tag, Typography } from "antd";
import { useQueries } from "@tanstack/react-query";
import { Button, Card, Col, List, Progress, Row, Space, Statistic, Tag, Typography } from "antd";
import { useQueries, useQuery } from "@tanstack/react-query";
import { useNavigate } from "react-router-dom";
import { createApiClient } from "../../lib/api.js";
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
@@ -20,9 +20,16 @@ export function OverviewPage() {
},
],
});
const readiness = useQuery({
queryKey: ["admin-overview-readiness"],
queryFn: () => client.getAdminReleaseReadiness(),
});
const loading = results.some((result) => result.isLoading);
const error = results.find((result) => result.isError)?.error;
const retry = () => results.forEach((result) => void result.refetch());
const error = results.find((result) => result.isError)?.error ?? readiness.error;
const retry = () => {
results.forEach((result) => void result.refetch());
void readiness.refetch();
};
const brand = results[0].data;
const workspace = results[1].data as
| {
@@ -51,8 +58,26 @@ export function OverviewPage() {
path: "/admin/workspace",
},
];
const readinessChecks = readiness.data?.checks ?? [];
const checks = readinessChecks.length
? readinessChecks.map((check) => ({
key: check.key,
label: check.label,
passed: check.passed,
destination: check.destination,
}))
: checklist.map((check) => ({
key: check.path,
label: check.label,
passed: check.done,
destination: check.path,
}));
const incompleteChecks = checks.filter((check) => !check.passed);
const completionPercent = checks.length
? Math.round((checks.filter((check) => check.passed).length / checks.length) * 100)
: 0;
return (
<QueryState loading={loading} error={error} onRetry={retry}>
<QueryState loading={loading || readiness.isLoading} error={error} onRetry={retry}>
<AdminPageHeader
title="品牌概览"
description="从这里检查品牌表达、信任内容和业务承接是否完整。"
@@ -96,18 +121,64 @@ export function OverviewPage() {
</Row>
<Row gutter={[16, 16]}>
<Col xs={24} lg={12}>
<Card title="品牌完整度">
<Card
title="发布准备度"
extra={
<Button type="link" onClick={() => navigate("/admin/publication")}>
查看发布页
</Button>
}
>
<Progress
percent={completionPercent}
status={readiness.data?.ready ? "success" : "active"}
/>
<Typography.Paragraph type="secondary">
{readiness.data?.ready
? "当前草稿已满足发布条件,可以进入发布页上线。"
: `还有 ${incompleteChecks.length} 项需要完善,完成后才能发布。`}
</Typography.Paragraph>
{incompleteChecks.length > 0 && (
<List
size="small"
dataSource={incompleteChecks.slice(0, 4)}
renderItem={(item) => (
<List.Item
actions={[
<Button
key={item.key}
type="link"
size="small"
onClick={() => navigate(item.destination ?? "/admin/publication")}
>
去处理
</Button>,
]}
>
{item.label}
</List.Item>
)}
/>
)}
</Card>
</Col>
<Col xs={24} lg={12}>
<Card title="品牌内容检查">
<List
dataSource={checklist}
dataSource={checks}
renderItem={(item) => (
<List.Item>
<Space>
<Tag color={item.done ? "success" : "default"}>
{item.done ? "已完成" : "待完善"}
<Tag color={item.passed ? "success" : "default"}>
{item.passed ? "已完成" : "待完善"}
</Tag>
<span>{item.label}</span>
{!item.done && (
<Button type="link" size="small" onClick={() => navigate(item.path)}>
{!item.passed && (
<Button
type="link"
size="small"
onClick={() => navigate(item.destination ?? "/admin/publication")}
>
去处理
</Button>
)}
@@ -117,16 +188,6 @@ export function OverviewPage() {
/>
</Card>
</Col>
<Col xs={24} lg={12}>
<Card title="下一步建议">
<Typography.Paragraph>
先完善品牌定位和信任证明,再配置业务提供项与咨询入口。所有内容发布前都应通过小程序预览确认。
</Typography.Paragraph>
<Typography.Paragraph type="secondary" style={{ marginBottom: 0 }}>
餐饮模板只是业务表达样例,品牌信任主线仍应优先维护。
</Typography.Paragraph>
</Card>
</Col>
</Row>
</Space>
</QueryState>
+5 -1
View File
@@ -12,6 +12,7 @@ import {
Menu,
Select,
Space,
Tag,
Typography,
message,
} from "antd";
@@ -206,7 +207,7 @@ function Dashboard({ onLogout, role }: { onLogout: () => void; role: string }) {
];
return (
<Layout style={{ minHeight: "100vh" }}>
<Layout.Sider>
<Layout.Sider breakpoint="lg" collapsedWidth={0}>
<Typography.Title level={4} style={{ color: "white", padding: 20 }}>
当前品牌工作区
</Typography.Title>
@@ -229,6 +230,9 @@ function Dashboard({ onLogout, role }: { onLogout: () => void; role: string }) {
<Space>
<Typography.Text strong>{brand.data?.name || "当前品牌"}</Typography.Text>
<Typography.Text type="secondary">品牌工作区</Typography.Text>
<Tag color={role === "owner" ? "blue" : "default"}>
{role === "owner" ? "负责人" : "内容编辑"}
</Tag>
<Select
size="small"
value={brand.data?.id}