feat: 构建品牌视图与三栏页面编辑工作台

This commit is contained in:
que01 committed 2026-10-10 10:38:47 +08:00
1 parent a2932b1134
commit 860d9266fe
7 files changed
+128 -20

No files matched your search

+31 -10
View File
@@ -6,12 +6,15 @@ import {
Input,
Row,
Select,
Segmented,
Space,
Tag,
Typography,
message,
} from "antd";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { useState } from "react";
import { Link } from "react-router-dom";
import type { BrandProfile } from "@personal-brand/api-client";
import { createApiClient } from "../../lib/api.js";
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
@@ -21,6 +24,7 @@ import { PresentationEditor } from "./PresentationEditor.js";
import "./BrandPage.css";
export function BrandPage() {
const [panel, setPanel] = useState("pages");
const client = createApiClient();
const queryClient = useQueryClient();
const [form] = Form.useForm<BrandProfile>();
@@ -50,7 +54,7 @@ export function BrandPage() {
{!brand.data ? null : (
<>
<AdminPageHeader
title="品牌资料"
title="小程序工作台"
description={
template.data?.description
? `先让访客理解你是谁、服务谁,以及为什么值得信任。${template.data.description}`
@@ -58,7 +62,22 @@ export function BrandPage() {
}
extra={<Tag color="blue">{template.data?.name ?? "当前模板"}</Tag>}
/>
<div className="brand-page__content">
<div className="brand-page__toolbar">
<Segmented
aria-label="工作台视图"
value={panel}
onChange={(value) => setPanel(String(value))}
options={[
{ value: "pages", label: "页面编辑" },
{ value: "brand", label: "品牌资料" },
]}
/>
<Space>
<Tag>草稿工作区</Tag>
<Link to="/admin/publication">检查与发布 →</Link>
</Space>
</div>
<div className="brand-page__content" hidden={panel !== "brand"}>
<div className="brand-page__settings">
<Form
form={form}
@@ -201,14 +220,16 @@ export function BrandPage() {
/>
) : null}
</div>
<PresentationEditor
templateContent={workspace.data?.templateContent}
previewWorkspace={previewWorkspace.data}
config={brand.data.config}
brand={brand.data}
loading={workspace.isLoading}
error={workspace.error}
/>
<div hidden={panel !== "pages"}>
<PresentationEditor
templateContent={workspace.data?.templateContent}
previewWorkspace={previewWorkspace.data}
config={brand.data.config}
brand={brand.data}
loading={workspace.isLoading}
error={workspace.error}
/>
</div>
</>
)}
</QueryState>