fix: 加固后台日常配置体验
This commit is contained in:
1 parent
34b872a84c
commit
d7e5b64d84
6 files changed
+84
-10
No files matched your search
@@ -0,0 +1,18 @@
|
|||||||
|
# 执行记录
|
||||||
|
|
||||||
|
## 恢复信息
|
||||||
|
|
||||||
|
- 任务:加固后台管理员日常配置路径的可用性。
|
||||||
|
- 形态:single-full
|
||||||
|
- 进度:0/3
|
||||||
|
- 当前:修正概览页品牌与模板语义。
|
||||||
|
- 文件:`.codex-tasks/admin-usability-pass/TODO.csv`
|
||||||
|
- 下一步:完成概览、业务项和信任内容页面改动并运行 Admin 门禁。
|
||||||
|
|
||||||
|
## 结果
|
||||||
|
|
||||||
|
- 概览页从当前 workspace 的模板声明读取模板名称,不再把所有非餐饮模板错误显示为个人品牌。
|
||||||
|
- 完整度检查中的未完成项提供“去处理”入口,直接进入对应品牌、信任内容、业务项或表单配置页面。
|
||||||
|
- 业务提供项启用、停用、删除失败会显示错误;操作期间仅锁定当前条目,成功后提示并刷新列表。
|
||||||
|
- 信任内容列表使用当前模板声明的行业化类型名称,避免列表文案与编辑表单不一致。
|
||||||
|
- 验证:Admin production build、typecheck、lint、format、`git diff --check` 通过。
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# Admin 可用性加固
|
||||||
|
|
||||||
|
## 目标
|
||||||
|
|
||||||
|
改善普通品牌管理员最常用的后台路径,让概览、业务提供项和信任内容页面准确反映当前品牌与模板,并把失败操作明确反馈给用户。
|
||||||
|
|
||||||
|
## 范围
|
||||||
|
|
||||||
|
- 概览页使用 Admin Workspace 的模板声明显示模板名称,不再硬编码行业判断。
|
||||||
|
- 概览完整度检查提供可直接进入对应配置页面的处理按钮。
|
||||||
|
- 业务提供项的启用、停用、删除失败显示可读错误,操作期间避免重复提交。
|
||||||
|
- 信任内容列表使用当前模板声明的类型名称和说明。
|
||||||
|
|
||||||
|
## 非目标
|
||||||
|
|
||||||
|
- 不调整 API 契约和数据库模型。
|
||||||
|
- 不新增视觉模板或公共 runtime 组件。
|
||||||
@@ -0,0 +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 通过
|
||||||
|
@@ -1,10 +1,12 @@
|
|||||||
import { Card, Col, List, Row, Space, Statistic, Tag, Typography } from "antd";
|
import { Button, Card, Col, List, Row, Space, Statistic, Tag, Typography } from "antd";
|
||||||
import { useQueries } from "@tanstack/react-query";
|
import { useQueries } from "@tanstack/react-query";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
import { createApiClient } from "../../lib/api.js";
|
import { createApiClient } from "../../lib/api.js";
|
||||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||||
import { QueryState } from "../../components/QueryState.js";
|
import { QueryState } from "../../components/QueryState.js";
|
||||||
|
|
||||||
export function OverviewPage() {
|
export function OverviewPage() {
|
||||||
|
const navigate = useNavigate();
|
||||||
const client = createApiClient();
|
const client = createApiClient();
|
||||||
const results = useQueries({
|
const results = useQueries({
|
||||||
queries: [
|
queries: [
|
||||||
@@ -22,15 +24,32 @@ export function OverviewPage() {
|
|||||||
const error = results.find((result) => result.isError)?.error;
|
const error = results.find((result) => result.isError)?.error;
|
||||||
const retry = () => results.forEach((result) => void result.refetch());
|
const retry = () => results.forEach((result) => void result.refetch());
|
||||||
const brand = results[0].data;
|
const brand = results[0].data;
|
||||||
const workspace = results[1].data as { inquiryForm?: { isEnabled?: boolean } } | undefined;
|
const workspace = results[1].data as
|
||||||
|
| {
|
||||||
|
inquiryForm?: { isEnabled?: boolean };
|
||||||
|
templateContent?: { displayName?: string } | null;
|
||||||
|
}
|
||||||
|
| undefined;
|
||||||
const trust = results[2].data;
|
const trust = results[2].data;
|
||||||
const offerings = results[3].data as Array<{ isEnabled?: boolean }> | undefined;
|
const offerings = results[3].data as Array<{ isEnabled?: boolean }> | undefined;
|
||||||
const submissions = results[4].data;
|
const submissions = results[4].data;
|
||||||
const checklist = [
|
const checklist = [
|
||||||
{ label: "品牌定位已填写", done: Boolean(brand?.name && brand.tagline) },
|
{ label: "品牌定位已填写", done: Boolean(brand?.name && brand.tagline), path: "/admin/brand" },
|
||||||
{ label: "信任内容已发布", done: Boolean(trust?.some((item) => item.isPublished)) },
|
{
|
||||||
{ label: "至少有一个公开业务提供项", done: Boolean(offerings?.some((item) => item.isEnabled)) },
|
label: "信任内容已发布",
|
||||||
{ label: "咨询入口已配置", done: Boolean(workspace?.inquiryForm?.isEnabled) },
|
done: Boolean(trust?.some((item) => item.isPublished)),
|
||||||
|
path: "/admin/trust",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "至少有一个公开业务提供项",
|
||||||
|
done: Boolean(offerings?.some((item) => item.isEnabled)),
|
||||||
|
path: "/admin/services",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "咨询入口已配置",
|
||||||
|
done: Boolean(workspace?.inquiryForm?.isEnabled),
|
||||||
|
path: "/admin/workspace",
|
||||||
|
},
|
||||||
];
|
];
|
||||||
return (
|
return (
|
||||||
<QueryState loading={loading} error={error} onRetry={retry}>
|
<QueryState loading={loading} error={error} onRetry={retry}>
|
||||||
@@ -47,7 +66,7 @@ export function OverviewPage() {
|
|||||||
{brand?.tagline || "还没有设置一句话定位"}
|
{brand?.tagline || "还没有设置一句话定位"}
|
||||||
</Typography.Paragraph>
|
</Typography.Paragraph>
|
||||||
<Tag color="blue">
|
<Tag color="blue">
|
||||||
当前模板:{brand?.templateKey === "food" ? "餐饮模板" : "个人品牌"}
|
当前模板:{workspace?.templateContent?.displayName ?? "尚未安装模板"}
|
||||||
</Tag>
|
</Tag>
|
||||||
</Card>
|
</Card>
|
||||||
<Row gutter={[16, 16]}>
|
<Row gutter={[16, 16]}>
|
||||||
@@ -87,6 +106,11 @@ export function OverviewPage() {
|
|||||||
{item.done ? "已完成" : "待完善"}
|
{item.done ? "已完成" : "待完善"}
|
||||||
</Tag>
|
</Tag>
|
||||||
<span>{item.label}</span>
|
<span>{item.label}</span>
|
||||||
|
{!item.done && (
|
||||||
|
<Button type="link" size="small" onClick={() => navigate(item.path)}>
|
||||||
|
去处理
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
</List.Item>
|
</List.Item>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -53,7 +53,10 @@ export function ServicesPage() {
|
|||||||
const toggleOffering = useMutation({
|
const toggleOffering = useMutation({
|
||||||
mutationFn: ({ id, isEnabled }: { id: string; isEnabled: boolean }) =>
|
mutationFn: ({ id, isEnabled }: { id: string; isEnabled: boolean }) =>
|
||||||
client.updateAdminOffering(id, { isEnabled }),
|
client.updateAdminOffering(id, { isEnabled }),
|
||||||
onSuccess: () => void queryClient.invalidateQueries({ queryKey: ["admin-offerings"] }),
|
onSuccess: () => {
|
||||||
|
message.success("业务提供项状态已更新");
|
||||||
|
void queryClient.invalidateQueries({ queryKey: ["admin-offerings"] });
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const beginOffering = (item?: Offering) => {
|
const beginOffering = (item?: Offering) => {
|
||||||
setEditingOffering(item ?? null);
|
setEditingOffering(item ?? null);
|
||||||
@@ -92,6 +95,7 @@ export function ServicesPage() {
|
|||||||
/>
|
/>
|
||||||
<Card title="公开业务提供项" extra={<Tag color="blue">小程序优先展示</Tag>}>
|
<Card title="公开业务提供项" extra={<Tag color="blue">小程序优先展示</Tag>}>
|
||||||
<Table
|
<Table
|
||||||
|
scroll={{ x: 760 }}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
loading={offerings.isLoading}
|
loading={offerings.isLoading}
|
||||||
dataSource={offerings.data ?? []}
|
dataSource={offerings.data ?? []}
|
||||||
@@ -128,6 +132,7 @@ export function ServicesPage() {
|
|||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
size="small"
|
size="small"
|
||||||
|
loading={toggleOffering.isPending && toggleOffering.variables?.id === item.id}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
toggleOffering.mutate({ id: item.id, isEnabled: !item.isEnabled })
|
toggleOffering.mutate({ id: item.id, isEnabled: !item.isEnabled })
|
||||||
}
|
}
|
||||||
@@ -141,7 +146,11 @@ export function ServicesPage() {
|
|||||||
okText="删除"
|
okText="删除"
|
||||||
cancelText="取消"
|
cancelText="取消"
|
||||||
>
|
>
|
||||||
<Button danger size="small" loading={deleteOffering.isPending}>
|
<Button
|
||||||
|
danger
|
||||||
|
size="small"
|
||||||
|
loading={deleteOffering.isPending && deleteOffering.variables === item.id}
|
||||||
|
>
|
||||||
删除
|
删除
|
||||||
</Button>
|
</Button>
|
||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
@@ -156,6 +165,8 @@ export function ServicesPage() {
|
|||||||
</Typography.Paragraph>
|
</Typography.Paragraph>
|
||||||
)}
|
)}
|
||||||
<MutationError error={saveOffering.error} />
|
<MutationError error={saveOffering.error} />
|
||||||
|
<MutationError error={toggleOffering.error} />
|
||||||
|
<MutationError error={deleteOffering.error} />
|
||||||
</Card>
|
</Card>
|
||||||
<Modal
|
<Modal
|
||||||
open={offeringOpen}
|
open={offeringOpen}
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ export function TrustContentPage() {
|
|||||||
title: "证据类型",
|
title: "证据类型",
|
||||||
dataIndex: "type",
|
dataIndex: "type",
|
||||||
render: (value) => (
|
render: (value) => (
|
||||||
<Tag>{types.find((item) => item.value === value)?.label ?? value}</Tag>
|
<Tag>{availableTypes.find((item) => item.type === value)?.label ?? value}</Tag>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{ title: "标题", dataIndex: "title" },
|
{ title: "标题", dataIndex: "title" },
|
||||||
|
|||||||
Reference in new issue
Block a user