fix: 加固后台日常配置体验
This commit is contained in:
1 parent
34b872a84c
commit
d7e5b64d84
6 files changed
+84
-10
No files matched your search
@@ -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 { useNavigate } from "react-router-dom";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { QueryState } from "../../components/QueryState.js";
|
||||
|
||||
export function OverviewPage() {
|
||||
const navigate = useNavigate();
|
||||
const client = createApiClient();
|
||||
const results = useQueries({
|
||||
queries: [
|
||||
@@ -22,15 +24,32 @@ export function OverviewPage() {
|
||||
const error = results.find((result) => result.isError)?.error;
|
||||
const retry = () => results.forEach((result) => void result.refetch());
|
||||
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 offerings = results[3].data as Array<{ isEnabled?: boolean }> | undefined;
|
||||
const submissions = results[4].data;
|
||||
const checklist = [
|
||||
{ label: "品牌定位已填写", done: Boolean(brand?.name && brand.tagline) },
|
||||
{ label: "信任内容已发布", done: Boolean(trust?.some((item) => item.isPublished)) },
|
||||
{ label: "至少有一个公开业务提供项", done: Boolean(offerings?.some((item) => item.isEnabled)) },
|
||||
{ label: "咨询入口已配置", done: Boolean(workspace?.inquiryForm?.isEnabled) },
|
||||
{ label: "品牌定位已填写", done: Boolean(brand?.name && brand.tagline), path: "/admin/brand" },
|
||||
{
|
||||
label: "信任内容已发布",
|
||||
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 (
|
||||
<QueryState loading={loading} error={error} onRetry={retry}>
|
||||
@@ -47,7 +66,7 @@ export function OverviewPage() {
|
||||
{brand?.tagline || "还没有设置一句话定位"}
|
||||
</Typography.Paragraph>
|
||||
<Tag color="blue">
|
||||
当前模板:{brand?.templateKey === "food" ? "餐饮模板" : "个人品牌"}
|
||||
当前模板:{workspace?.templateContent?.displayName ?? "尚未安装模板"}
|
||||
</Tag>
|
||||
</Card>
|
||||
<Row gutter={[16, 16]}>
|
||||
@@ -87,6 +106,11 @@ export function OverviewPage() {
|
||||
{item.done ? "已完成" : "待完善"}
|
||||
</Tag>
|
||||
<span>{item.label}</span>
|
||||
{!item.done && (
|
||||
<Button type="link" size="small" onClick={() => navigate(item.path)}>
|
||||
去处理
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
</List.Item>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user