feat: 完善模板与设置工作台

This commit is contained in:
que01 committed 2026-09-20 17:19:04 +08:00
1 parent 07866f48d0
commit bf5fba9480
1 file changed
+28 -2
@@ -1,9 +1,23 @@
import { Button, Card, Form, Input, Modal, Select, Space, Table, Tag, message } from "antd";
import {
Button,
Card,
Form,
Input,
Modal,
Select,
Space,
Table,
Tag,
Typography,
message,
} from "antd";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { createApiClient } from "../../lib/api.js";
import { ApiClientError } from "@personal-brand/api-client";
import type { BrandFieldDefinition, BrandModule } from "@personal-brand/api-client";
import { useState } from "react";
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
import { MutationError } from "../../components/QueryState.js";
export function WorkspacePage() {
const client = createApiClient();
@@ -90,8 +104,12 @@ export function WorkspacePage() {
const { modules, fields, installations } = query.data;
return (
<Space direction="vertical" size="large" style={{ width: "100%" }}>
<AdminPageHeader
title="模板与设置"
description="用行业模板组织业务表达,同时保留个人品牌定位、信任内容和合作方式的长期扩展空间。"
/>
<Card
title="模板安装"
title="行业模板"
extra={
<Space>
<Button onClick={() => install.mutate("personal")} loading={install.isPending}>
@@ -103,7 +121,11 @@ export function WorkspacePage() {
</Space>
}
>
<Typography.Paragraph type="secondary">
模板只提供行业表达样例,不会替代你的品牌定位、经历、作品和合作方式。
</Typography.Paragraph>
<Tag>{installations.length ? `已安装 ${installations.length} 个模板` : "尚未安装模板"}</Tag>
<MutationError error={install.error} />
</Card>
<Card
title="动态咨询表单"
@@ -128,6 +150,7 @@ export function WorkspacePage() {
{ title: "状态", dataIndex: "isEnabled", render: (value) => (value ? "启用" : "停用") },
]}
/>
<MutationError error={createForm.error} />
</Card>
<Card title="页面模块">
<Table
@@ -173,6 +196,7 @@ export function WorkspacePage() {
},
]}
/>
<MutationError error={updateModule.error} />
</Card>
<Card
title="自定义字段"
@@ -200,6 +224,8 @@ export function WorkspacePage() {
},
]}
/>
<MutationError error={createField.error} />
<MutationError error={removeField.error} />
</Card>
<Modal
open={fieldOpen}