feat: 构建品牌视图与三栏页面编辑工作台
This commit is contained in:
1 parent
a2932b1134
commit
860d9266fe
7 files changed
+128
-20
No files matched your search
@@ -1,5 +1,13 @@
|
||||
# Progress
|
||||
|
||||
## 工作台重构补充验收
|
||||
|
||||
- 上一轮将布局整理判为全部完成不准确,补充真正的工作台任务:视图分离、三栏布局和层级区域导航。
|
||||
- 默认显示页面编辑,品牌基础表单在“品牌资料”视图访问;两套组件保持挂载,切换不丢弃草稿。
|
||||
- 区域导航移至左栏,预览居中,属性编辑位于右栏;子区域缩进,选区与导航选中状态同步。
|
||||
- 顶部区分草稿工作区与检查发布入口,保存仍由各内容表单负责,避免错误承诺跨实体统一保存。
|
||||
- 已通过 2 项浏览器回归和五种宽度检查,并查看 1920 宽度实际截图。
|
||||
|
||||
## 2026-10-10
|
||||
|
||||
- 建立 Admin 编辑工作区重构 Epic。
|
||||
|
||||
@@ -2,6 +2,24 @@
|
||||
max-width: 960px;
|
||||
}
|
||||
|
||||
.brand-page__content[hidden] {
|
||||
display: none;
|
||||
}
|
||||
.brand-page__toolbar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 16px 0;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
@media (max-width: 575px) {
|
||||
.brand-page__toolbar {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
|
||||
.brand-page__settings {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
.presentation-editor {
|
||||
margin-top: 40px;
|
||||
padding-top: 28px;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
margin-top: 0;
|
||||
padding-top: 8px;
|
||||
}
|
||||
|
||||
.presentation-editor__header {
|
||||
@@ -42,6 +41,9 @@
|
||||
}
|
||||
|
||||
.presentation-editor__workspace {
|
||||
display: grid;
|
||||
grid-template-columns: 200px minmax(300px, 1fr) minmax(280px, 360px);
|
||||
grid-template-areas: "outline preview inspector";
|
||||
margin: 0 !important;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 12px;
|
||||
@@ -50,17 +52,49 @@
|
||||
}
|
||||
|
||||
.presentation-editor__preview {
|
||||
grid-area: preview;
|
||||
padding: 20px !important;
|
||||
background: #f8fafc;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.presentation-editor__inspector {
|
||||
grid-area: inspector;
|
||||
padding: 24px !important;
|
||||
min-width: 0;
|
||||
border-left: 1px solid #e5e7eb;
|
||||
}
|
||||
|
||||
.presentation-editor__outline {
|
||||
grid-area: outline;
|
||||
padding: 20px 12px;
|
||||
border-right: 1px solid #e5e7eb;
|
||||
}
|
||||
.presentation-editor__regions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
}
|
||||
.presentation-editor__regions .ant-space-item {
|
||||
width: 100%;
|
||||
}
|
||||
.presentation-editor__regions .ant-btn {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
border: 0;
|
||||
box-shadow: none;
|
||||
padding: 10px 12px;
|
||||
}
|
||||
|
||||
.presentation-editor__regions .is-child-region {
|
||||
padding-left: 24px;
|
||||
}
|
||||
.presentation-editor__regions .ant-btn[aria-pressed="true"] {
|
||||
background: #e6f4ff;
|
||||
color: #0958d9;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.presentation-editor__preview .template-preview {
|
||||
height: 680px;
|
||||
min-height: 0;
|
||||
@@ -83,7 +117,15 @@
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
@media (max-width: 1199px) {
|
||||
.presentation-editor__workspace {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
grid-template-areas: "outline" "preview" "inspector";
|
||||
}
|
||||
.presentation-editor__outline {
|
||||
border-right: 0;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
}
|
||||
.presentation-editor__inspector {
|
||||
border-left: 0;
|
||||
border-top: 1px solid #e5e7eb;
|
||||
|
||||
@@ -570,8 +570,8 @@ export function PresentationEditor({
|
||||
/>
|
||||
)}
|
||||
</Space>
|
||||
<Row className="presentation-editor__workspace" gutter={[24, 24]} align="top">
|
||||
<Col className="presentation-editor__preview" xs={24} lg={12}>
|
||||
<div className="presentation-editor__workspace">
|
||||
<div className="presentation-editor__preview">
|
||||
<Typography.Title level={5}>页面预览</Typography.Title>
|
||||
{selectedPage === "detail" && draftWorkspace?.offerings.length ? (
|
||||
<Select
|
||||
@@ -600,11 +600,21 @@ export function PresentationEditor({
|
||||
targets={visibleTargets}
|
||||
onTargetSelected={handleTargetSelected}
|
||||
/>
|
||||
</div>
|
||||
<aside className="presentation-editor__outline" aria-label="页面区域">
|
||||
<Typography.Title level={5}>页面区域</Typography.Title>
|
||||
<Typography.Paragraph type="secondary">选择区域,编辑对应内容</Typography.Paragraph>
|
||||
{visibleTargets.length ? (
|
||||
<Space className="presentation-editor__regions" wrap style={{ marginTop: 16 }}>
|
||||
{visibleTargets.map((target) => (
|
||||
<Button
|
||||
key={target.key}
|
||||
className={
|
||||
visibleTargets.some((parent) => parent.children?.includes(target.key))
|
||||
? "is-child-region"
|
||||
: ""
|
||||
}
|
||||
aria-pressed={activeTarget === target.key}
|
||||
type={activeTarget === target.key ? "primary" : "default"}
|
||||
onClick={() => {
|
||||
const recordId =
|
||||
@@ -628,8 +638,11 @@ export function PresentationEditor({
|
||||
))}
|
||||
</Space>
|
||||
) : null}
|
||||
</Col>
|
||||
<Col className="presentation-editor__inspector" xs={24} lg={12}>
|
||||
{!visibleTargets.length ? (
|
||||
<Typography.Text type="secondary">此页为动态预览</Typography.Text>
|
||||
) : null}
|
||||
</aside>
|
||||
<div className="presentation-editor__inspector">
|
||||
<Typography.Title level={5}>
|
||||
{selectedTarget?.label ?? pageTitle(selectedPage ?? "home")}
|
||||
</Typography.Title>
|
||||
@@ -865,8 +878,8 @@ export function PresentationEditor({
|
||||
</Space>
|
||||
</Form>
|
||||
)}
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
) : null}
|
||||
</section>
|
||||
|
||||
@@ -330,6 +330,10 @@ test("Admin 按通用预览目标筛选字段并同步品牌草稿", async ({ pa
|
||||
await page.getByLabel("密码").fill("fixture-password");
|
||||
await page.locator('button[type="submit"]').click();
|
||||
await expect(page.getByText("小程序页面配置")).toBeVisible();
|
||||
await expect(page.getByLabel("品牌名称", { exact: true })).toBeHidden();
|
||||
await page.getByText("品牌资料", { exact: true }).last().click();
|
||||
await expect(page.getByLabel("品牌名称", { exact: true })).toBeVisible();
|
||||
await page.getByText("页面编辑", { exact: true }).click();
|
||||
const preview = page.locator(".component-template-preview");
|
||||
await expect(preview.locator(".food-home .name")).toContainText("测试主理人");
|
||||
await expect(page.getByText("选择要编辑的区域", { exact: true })).toBeVisible();
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
## 决策
|
||||
|
||||
工作台默认进入页面编辑,通过顶部视图切换访问品牌资料。编辑器采用左侧区域导航、中间预览、右侧属性编辑三栏布局,窄屏堆叠。组合区域的子区域在导航中缩进,并与画布选区同步。视图切换保持组件挂载,避免丢弃未保存输入。发布操作通过顶部入口进入已有发布流程。
|
||||
|
||||
品牌基础资料使用连续的身份、联系合作和视觉分组。模板说明作为基础配置的辅助信息。页面编辑工作区使用完整页面宽度,页面导航位于顶部,预览与选区面板并列,窄屏上下排列。未选择区域时提供明确的点选引导,避免展示整页字段。
|
||||
|
||||
详情页只提供业务记录选择和动态预览,隐藏区域列表和点选工具;业务记录在业务提供项中维护。模板 manifest 的字段声明继续供业务内容编辑器和模板校验使用。
|
||||
|
||||
Reference in new issue
Block a user