refactor: 拆分品牌业务类型与页面方案
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled

This commit is contained in:
que01 committed 2026-10-20 17:04:30 +08:00
1 parent f02e2cafbb
commit 0d9f4a7d6f
86 files changed
+4111 -1543

No files matched your search

+17 -21
View File
@@ -1,4 +1,4 @@
import { Alert, Button, Col, Form, Input, Row, Select, Segmented, message } from "antd";
import { Alert, Button, Col, Form, Input, Row, Segmented, message } from "antd";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { useState } from "react";
import { Link, useLocation } from "react-router-dom";
@@ -36,10 +36,6 @@ export function BrandPage() {
queryFn: () => client.getPublicTemplate(brand.data!.templateKey),
enabled: Boolean(brand.data?.templateKey),
});
const templateCatalog = useQuery({
queryKey: ["template-catalog"],
queryFn: () => client.listPublicTemplates(),
});
const save = useMutation({
mutationFn: (values: Partial<BrandProfile>) => client.updateAdminBrand(values),
onSuccess: () => {
@@ -60,7 +56,12 @@ export function BrandPage() {
? `先让访客理解你是谁、服务谁,以及为什么值得信任。${template.data.description}`
: "先让访客理解你是谁、服务谁,以及为什么值得信任。"
}
extra={<StatusTag tone="info" label={template.data?.name ?? "当前模板"} />}
extra={
<StatusTag
tone="info"
label={workspace.data?.templateContent?.displayName ?? "当前页面方案"}
/>
}
/>
<div className="brand-page__toolbar">
<Segmented
@@ -169,25 +170,20 @@ export function BrandPage() {
<div className="admin-section-head">
<div>
<h2 id="brand-visual-title" className="admin-section-title">
模板与品牌视觉
品牌视觉
</h2>
<p className="admin-section-description">
模板负责业务表达,品牌信息仍由你统一维护。
头像和封面会用于品牌身份展示;页面结构和资源位由页面方案统一管理。
</p>
</div>
</div>
<Form.Item
name="templateKey"
label="业务表达模板"
help="模板只改变业务表达,不改变个人品牌主线。"
>
<Select
disabled
options={(templateCatalog.data?.industries ?? []).map((item) => ({
value: item.key,
label: item.name,
}))}
/>
<Form.Item label="当前页面方案">
<div>
<strong>{workspace.data?.templateContent?.displayName ?? "尚未安装"}</strong>
<p className="admin-section-description">
页面方案的版本、升级和资源位由品牌负责人统一维护。
</p>
</div>
</Form.Item>
<Row gutter={16}>
<Col xs={24} md={12}>
@@ -223,7 +219,7 @@ export function BrandPage() {
className="brand-page__template-note"
type="info"
showIcon
message={`当前使用:${template.data.name}`}
message={`当前页面方案:${workspace.data?.templateContent?.displayName ?? template.data.name}`}
description={`适用场景:${template.data.serviceCategories.join("、") || "通用品牌展示"}`}
/>
) : null}
@@ -311,12 +311,12 @@ export function PresentationEditor({
</div>
{templateContent ? <StatusTag tone="info" label={templateContent.displayName} /> : null}
</div>
{loading ? <Alert type="info" showIcon message="正在读取当前模板的编辑项目" /> : null}
{loading ? <Alert type="info" showIcon message="正在读取当前页面方案的编辑项目" /> : null}
{error ? (
<Alert type="warning" showIcon message="模板编辑项目读取失败,请刷新后重试。" />
<Alert type="warning" showIcon message="页面方案编辑项目读取失败,请刷新后重试。" />
) : null}
{!loading && !error && !templateContent ? (
<Alert type="warning" showIcon message="当前模板暂未提供可编辑的页面内容。" />
<Alert type="warning" showIcon message="当前页面方案暂未提供可编辑的页面内容。" />
) : null}
{templateContent ? (
<>
@@ -46,8 +46,8 @@ export function useBrandPresentationSections(
return [
...[...new Set(declaredTemplateFields.map((field) => field.page ?? "home"))].map((page) => ({
key: `template-data:${page}`,
title: "模板专属内容",
description: "这些字段由当前小程序模板定义,保存后发布才会对外展示。",
title: "页面方案专属内容",
description: "这些字段由当前页面方案定义,保存后发布才会对外展示。",
page,
target: "brand" as const,
fields: declaredTemplateFields.filter((field) => (field.page ?? "home") === page),