refactor: 整理品牌配置与小程序编辑工作区
This commit is contained in:
1 parent
849ae5df05
commit
a2932b1134
13 files changed
+416
-63
No files matched your search
@@ -1,4 +1,16 @@
|
||||
import { Button, Card, Col, Form, Input, Row, Select, Space, Tag, Typography, message } from "antd";
|
||||
import {
|
||||
Alert,
|
||||
Button,
|
||||
Col,
|
||||
Form,
|
||||
Input,
|
||||
Row,
|
||||
Select,
|
||||
Space,
|
||||
Tag,
|
||||
Typography,
|
||||
message,
|
||||
} from "antd";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import type { BrandProfile } from "@personal-brand/api-client";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
@@ -6,6 +18,7 @@ import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { ImageUrlField } from "../../components/ImageUrlField.js";
|
||||
import { MutationError, QueryState } from "../../components/QueryState.js";
|
||||
import { PresentationEditor } from "./PresentationEditor.js";
|
||||
import "./BrandPage.css";
|
||||
|
||||
export function BrandPage() {
|
||||
const client = createApiClient();
|
||||
@@ -38,21 +51,31 @@ export function BrandPage() {
|
||||
<>
|
||||
<AdminPageHeader
|
||||
title="品牌资料"
|
||||
description="先让访客理解你是谁、服务谁,以及为什么值得信任。"
|
||||
description={
|
||||
template.data?.description
|
||||
? `先让访客理解你是谁、服务谁,以及为什么值得信任。${template.data.description}`
|
||||
: "先让访客理解你是谁、服务谁,以及为什么值得信任。"
|
||||
}
|
||||
extra={<Tag color="blue">{template.data?.name ?? "当前模板"}</Tag>}
|
||||
/>
|
||||
<Row gutter={[24, 24]} align="top">
|
||||
<Col xs={24} xl={16}>
|
||||
<div className="brand-page__content">
|
||||
<div className="brand-page__settings">
|
||||
<Form
|
||||
form={form}
|
||||
layout="vertical"
|
||||
initialValues={brand.data}
|
||||
onFinish={(values) => save.mutate(values)}
|
||||
>
|
||||
<Card
|
||||
title="我是谁"
|
||||
extra={<Typography.Text type="secondary">公开展示</Typography.Text>}
|
||||
>
|
||||
<section className="brand-settings-section" aria-labelledby="brand-identity-title">
|
||||
<div className="brand-settings-section__header">
|
||||
<div>
|
||||
<Typography.Title id="brand-identity-title" level={4}>
|
||||
我是谁
|
||||
</Typography.Title>
|
||||
<Typography.Text type="secondary">公开展示的品牌身份和定位。</Typography.Text>
|
||||
</div>
|
||||
<Tag>品牌基础信息</Tag>
|
||||
</div>
|
||||
<Form.Item
|
||||
name="name"
|
||||
label="品牌名称"
|
||||
@@ -77,8 +100,18 @@ export function BrandPage() {
|
||||
placeholder="让第一次认识你的人快速建立基本信任。"
|
||||
/>
|
||||
</Form.Item>
|
||||
</Card>
|
||||
<Card title="如何联系与合作" style={{ marginTop: 24 }}>
|
||||
</section>
|
||||
<section className="brand-settings-section" aria-labelledby="brand-contact-title">
|
||||
<div className="brand-settings-section__header">
|
||||
<div>
|
||||
<Typography.Title id="brand-contact-title" level={4}>
|
||||
如何联系与合作
|
||||
</Typography.Title>
|
||||
<Typography.Text type="secondary">
|
||||
让访客知道联系渠道、服务范围和响应预期。
|
||||
</Typography.Text>
|
||||
</div>
|
||||
</div>
|
||||
<Row gutter={16}>
|
||||
<Col xs={24} md={12}>
|
||||
<Form.Item name="hours" label="可联系时间">
|
||||
@@ -108,8 +141,18 @@ export function BrandPage() {
|
||||
>
|
||||
<Input.TextArea rows={3} placeholder="例如:收到咨询后 1 个工作日内回复。" />
|
||||
</Form.Item>
|
||||
</Card>
|
||||
<Card title="模板与品牌视觉" style={{ marginTop: 24 }}>
|
||||
</section>
|
||||
<section className="brand-settings-section" aria-labelledby="brand-visual-title">
|
||||
<div className="brand-settings-section__header">
|
||||
<div>
|
||||
<Typography.Title id="brand-visual-title" level={4}>
|
||||
模板与品牌视觉
|
||||
</Typography.Title>
|
||||
<Typography.Text type="secondary">
|
||||
模板负责业务表达,品牌信息仍由你统一维护。
|
||||
</Typography.Text>
|
||||
</div>
|
||||
</div>
|
||||
<Form.Item
|
||||
name="templateKey"
|
||||
label="业务表达模板"
|
||||
@@ -139,7 +182,7 @@ export function BrandPage() {
|
||||
</Form.Item>
|
||||
</Col>
|
||||
</Row>
|
||||
</Card>
|
||||
</section>
|
||||
<Space direction="vertical" style={{ width: "100%", marginTop: 24 }}>
|
||||
<MutationError error={save.error} />
|
||||
<Button type="primary" htmlType="submit" loading={save.isPending} size="large">
|
||||
@@ -147,26 +190,25 @@ export function BrandPage() {
|
||||
</Button>
|
||||
</Space>
|
||||
</Form>
|
||||
<PresentationEditor
|
||||
templateContent={workspace.data?.templateContent}
|
||||
previewWorkspace={previewWorkspace.data}
|
||||
config={brand.data.config}
|
||||
brand={brand.data}
|
||||
loading={workspace.isLoading}
|
||||
error={workspace.error}
|
||||
</div>
|
||||
{template.data ? (
|
||||
<Alert
|
||||
className="brand-page__template-note"
|
||||
type="info"
|
||||
showIcon
|
||||
message={`当前使用:${template.data.name}`}
|
||||
description={`适用场景:${template.data.serviceCategories.join("、") || "通用品牌展示"}`}
|
||||
/>
|
||||
</Col>
|
||||
<Col xs={24} xl={8}>
|
||||
{template.data && (
|
||||
<Card title="模板说明" style={{ marginTop: 24 }}>
|
||||
<Typography.Paragraph>{template.data.description}</Typography.Paragraph>
|
||||
<Typography.Text type="secondary">
|
||||
服务分类:{template.data.serviceCategories.join("、")}
|
||||
</Typography.Text>
|
||||
</Card>
|
||||
)}
|
||||
</Col>
|
||||
</Row>
|
||||
) : null}
|
||||
</div>
|
||||
<PresentationEditor
|
||||
templateContent={workspace.data?.templateContent}
|
||||
previewWorkspace={previewWorkspace.data}
|
||||
config={brand.data.config}
|
||||
brand={brand.data}
|
||||
loading={workspace.isLoading}
|
||||
error={workspace.error}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</QueryState>
|
||||
|
||||
Reference in new issue
Block a user