feat: 统一 Admin 后台设计语言

用中性灰底 + 单一强调色重做后台视觉,并集中到一套令牌:

- 新增 apps/admin/src/lib/theme.ts,通过 ConfigProvider 注入主题令牌
- 新增 apps/admin/src/styles/admin.css 与 AdminSection、MetricCard、StatusTag 组件
- 侧栏改白底浅色并补图标,顶栏改 56px 白底,内容区最大宽 1200px
- 全部页面接入状态标签,antd 原生彩色 Tag 与内联色值清零
- 登录与改密页、加载态骨架屏、错误提示条统一
- brand 页两个 Tab 统一为白卡片容器,消除双标题与宽度不一致

设计规范见 apps/admin/design.md。
This commit is contained in:
que01 committed 2026-10-14 10:54:05 +08:00
1 parent bb94d80e13
commit 2f26828f09
34 files changed
+2159 -922

No files matched your search

+24 -46
View File
@@ -1,19 +1,29 @@
.brand-page__content {
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;
padding: 8px 12px;
border: 1px solid var(--admin-border);
border-radius: 10px;
background: var(--admin-fill-quiet);
margin-bottom: 16px;
}
.brand-page__toolbar .ant-segmented {
background: var(--admin-surface);
}
.brand-page__toolbar-actions {
display: flex;
align-items: center;
gap: 12px;
}
@media (max-width: 575px) {
.brand-page__toolbar {
flex-wrap: wrap;
@@ -25,54 +35,22 @@
}
.brand-settings-section {
padding: 24px 0;
border-top: 1px solid #f0f0f0;
padding: 20px;
border: 1px solid var(--admin-border);
border-radius: 10px;
background: var(--admin-surface);
}
.brand-settings-section:first-child {
padding-top: 8px;
border-top: 0;
}
.brand-settings-section__header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16px;
margin-bottom: 20px;
}
.brand-settings-section__header .ant-typography {
margin: 0;
}
.brand-settings-section__header .ant-typography + .ant-typography {
display: block;
margin-top: 4px;
.brand-settings-section + .brand-settings-section {
margin-top: 16px;
}
.brand-page__template-note {
margin-top: 24px;
margin-top: 16px;
}
@media (max-width: 1199px) {
.brand-page__content {
display: block;
}
.brand-page__template-note {
position: static;
margin-top: 24px;
}
}
@media (max-width: 575px) {
.brand-settings-section__header {
display: block;
}
.brand-settings-section__header .ant-tag {
display: inline-block;
margin-top: 10px;
}
}
+26 -37
View File
@@ -1,17 +1,4 @@
import {
Alert,
Button,
Col,
Form,
Input,
Row,
Select,
Segmented,
Space,
Tag,
Typography,
message,
} from "antd";
import { Alert, Button, Col, Form, Input, Row, Select, Segmented, message } from "antd";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { useState } from "react";
import { Link, useLocation } from "react-router-dom";
@@ -20,6 +7,7 @@ import { createApiClient } from "../../lib/api.js";
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
import { ImageUrlField } from "../../components/ImageUrlField.js";
import { MutationError, QueryState } from "../../components/QueryState.js";
import { StatusTag } from "../../components/StatusTag.js";
import { PresentationEditor } from "./PresentationEditor.js";
import type { PreviewSelection } from "./preview-selection.js";
import "./BrandPage.css";
@@ -72,7 +60,7 @@ export function BrandPage() {
? `先让访客理解你是谁、服务谁,以及为什么值得信任。${template.data.description}`
: "先让访客理解你是谁、服务谁,以及为什么值得信任。"
}
extra={<Tag color="blue">{template.data?.name ?? "当前模板"}</Tag>}
extra={<StatusTag tone="info" label={template.data?.name ?? "当前模板"} />}
/>
<div className="brand-page__toolbar">
<Segmented
@@ -84,12 +72,13 @@ export function BrandPage() {
{ value: "brand", label: "品牌资料" },
]}
/>
<Space>
<Tag color={dirty ? "orange" : "default"}>
{dirty ? "品牌资料有未保存修改" : "草稿工作区"}
</Tag>
<div className="brand-page__toolbar-actions">
<StatusTag
tone={dirty ? "warning" : "neutral"}
label={dirty ? "品牌资料有未保存修改" : "草稿工作区"}
/>
<Link to="/admin/publication">检查与发布 →</Link>
</Space>
</div>
</div>
<div className="brand-page__content" hidden={panel !== "brand"}>
<div className="brand-page__settings">
@@ -101,14 +90,14 @@ export function BrandPage() {
onFinish={(values) => save.mutate(values)}
>
<section className="brand-settings-section" aria-labelledby="brand-identity-title">
<div className="brand-settings-section__header">
<div className="admin-section-head">
<div>
<Typography.Title id="brand-identity-title" level={4}>
<h2 id="brand-identity-title" className="admin-section-title">
我是谁
</Typography.Title>
<Typography.Text type="secondary">公开展示的品牌身份和定位。</Typography.Text>
</h2>
<p className="admin-section-description">公开展示的品牌身份和定位。</p>
</div>
<Tag>品牌基础信息</Tag>
<StatusTag tone="neutral" label="品牌基础信息" />
</div>
<Form.Item
name="name"
@@ -136,14 +125,14 @@ export function BrandPage() {
</Form.Item>
</section>
<section className="brand-settings-section" aria-labelledby="brand-contact-title">
<div className="brand-settings-section__header">
<div className="admin-section-head">
<div>
<Typography.Title id="brand-contact-title" level={4}>
<h2 id="brand-contact-title" className="admin-section-title">
如何联系与合作
</Typography.Title>
<Typography.Text type="secondary">
</h2>
<p className="admin-section-description">
让访客知道联系渠道、服务范围和响应预期。
</Typography.Text>
</p>
</div>
</div>
<Row gutter={16}>
@@ -177,14 +166,14 @@ export function BrandPage() {
</Form.Item>
</section>
<section className="brand-settings-section" aria-labelledby="brand-visual-title">
<div className="brand-settings-section__header">
<div className="admin-section-head">
<div>
<Typography.Title id="brand-visual-title" level={4}>
<h2 id="brand-visual-title" className="admin-section-title">
模板与品牌视觉
</Typography.Title>
<Typography.Text type="secondary">
</h2>
<p className="admin-section-description">
模板负责业务表达,品牌信息仍由你统一维护。
</Typography.Text>
</p>
</div>
</div>
<Form.Item
@@ -221,12 +210,12 @@ export function BrandPage() {
</Col>
</Row>
</section>
<Space direction="vertical" style={{ width: "100%", marginTop: 24 }}>
<div className="admin-actions admin-offset-top-lg">
<MutationError error={save.error} />
<Button type="primary" htmlType="submit" loading={save.isPending} size="large">
保存品牌表达
</Button>
</Space>
</div>
</Form>
</div>
{template.data ? (
@@ -6,21 +6,21 @@
display: flex;
gap: 8px;
padding: 8px 12px;
border-bottom: 1px solid #e8e8e8;
border-bottom: 1px solid var(--admin-border);
background: #fff;
}
.component-template-preview__tools button {
padding: 4px 12px;
border: 1px solid #d9d9d9;
border: 1px solid var(--admin-border);
border-radius: 6px;
background: #fff;
cursor: pointer;
}
.component-template-preview__tools button[aria-pressed="true"] {
border-color: #1677ff;
color: #1677ff;
border-color: var(--admin-primary);
color: var(--admin-primary);
}
.component-template-preview {
@@ -31,7 +31,7 @@
padding: 24px 16px;
overflow-x: hidden;
overflow-y: auto;
background: #f3f4f6;
background: var(--admin-fill);
}
.component-template-preview__canvas {
@@ -102,13 +102,13 @@
position: absolute;
z-index: 5;
pointer-events: none;
border: 2px solid #91caff;
border: 2px solid var(--admin-primary);
border-radius: 4px;
}
.component-template-preview__outline.is-selected {
z-index: 6;
border-color: #1677ff;
border-color: var(--admin-primary);
box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.16);
}
@@ -117,10 +117,10 @@
z-index: 7;
width: max-content !important;
padding: 2px 8px !important;
border: 1px solid #1677ff !important;
border: 1px solid var(--admin-primary) !important;
border-radius: 4px !important;
background: #fff !important;
color: #0958d9 !important;
color: var(--admin-primary) !important;
font-size: 12px !important;
line-height: 20px !important;
cursor: pointer;
@@ -135,7 +135,7 @@
padding: 2px 7px;
overflow: hidden;
border-radius: 4px 4px 0 0;
background: #1677ff;
background: var(--admin-primary);
color: #fff;
font-size: 12px;
line-height: 18px;
@@ -128,7 +128,12 @@ export function InquiryPreviewEditor({
)}
</Form.List>
<MutationError error={save.error} />
<Button style={{ marginTop: 24 }} type="primary" htmlType="submit" loading={save.isPending}>
<Button
className="admin-offset-top-lg"
type="primary"
htmlType="submit"
loading={save.isPending}
>
保存表单字段
</Button>
</Form>
@@ -1,6 +1,5 @@
.presentation-editor {
margin-top: 0;
padding-top: 8px;
}
.presentation-editor__header {
@@ -8,15 +7,7 @@
align-items: flex-start;
justify-content: space-between;
gap: 16px;
margin-bottom: 24px;
}
.presentation-editor__header .ant-typography {
margin-top: 0;
}
.presentation-editor__header .ant-typography + .ant-typography {
margin-bottom: 0;
margin-bottom: 16px;
}
.presentation-editor > .ant-space {
@@ -24,9 +15,9 @@
width: 100%;
margin-bottom: 24px !important;
padding: 6px;
border: 1px solid #e8e8e8;
border: 1px solid var(--admin-border);
border-radius: 10px;
background: #fafafa;
background: var(--admin-fill-quiet);
}
@media (max-width: 575px) {
@@ -45,16 +36,16 @@
grid-template-columns: 200px minmax(300px, 1fr) minmax(280px, 360px);
grid-template-areas: "outline preview inspector";
margin: 0 !important;
border: 1px solid #e5e7eb;
border: 1px solid var(--admin-border);
border-radius: 12px;
overflow: hidden;
background: #fff;
background: var(--admin-surface);
}
.presentation-editor__preview {
grid-area: preview;
padding: 20px !important;
background: #f8fafc;
background: var(--admin-fill);
min-width: 0;
}
@@ -62,13 +53,13 @@
grid-area: inspector;
padding: 24px !important;
min-width: 0;
border-left: 1px solid #e5e7eb;
border-left: 1px solid var(--admin-border);
}
.presentation-editor__outline {
grid-area: outline;
padding: 20px 12px;
border-right: 1px solid #e5e7eb;
border-right: 1px solid var(--admin-border);
}
.presentation-editor__regions {
display: flex;
@@ -90,8 +81,8 @@
padding-left: 24px;
}
.presentation-editor__regions .ant-btn[aria-pressed="true"] {
background: #e6f4ff;
color: #0958d9;
background: var(--admin-primary-bg);
color: var(--admin-primary);
font-weight: 600;
}
@@ -117,26 +108,37 @@
margin-bottom: 20px;
}
.presentation-editor__inspector form > section {
padding: 16px;
border: 1px solid #e5e7eb;
border-radius: 12px;
background: #f8fafc;
.presentation-editor__form {
display: flex;
flex-direction: column;
min-height: 0;
}
.presentation-editor__inspector form > section + section {
.presentation-editor__form-body {
flex: 1;
}
.presentation-editor__inspector .presentation-editor__form-body > section {
padding: 16px;
border: 1px solid var(--admin-border);
border-radius: 12px;
background: var(--admin-fill);
}
.presentation-editor__inspector .presentation-editor__form-body > section + section {
margin-top: 16px;
}
.presentation-editor__inspector form > .ant-space:last-child {
.presentation-editor__form-actions {
position: sticky;
bottom: 0;
z-index: 2;
padding: 16px 0 4px;
border-top: 1px solid #e5e7eb;
background: #fff;
border-top: 1px solid var(--admin-border);
background: var(--admin-surface);
}
.presentation-editor__inspector form > .ant-space:last-child .ant-btn-primary {
.presentation-editor__form-actions .ant-btn-primary {
min-width: 140px;
}
.presentation-editor__inspector > .ant-tag {
@@ -150,11 +152,11 @@
}
.presentation-editor__outline {
border-right: 0;
border-bottom: 1px solid #e5e7eb;
border-bottom: 1px solid var(--admin-border);
}
.presentation-editor__inspector {
border-left: 0;
border-top: 1px solid #e5e7eb;
border-top: 1px solid var(--admin-border);
}
}
@@ -9,7 +9,6 @@ import {
Select,
Segmented,
Space,
Tag,
Typography,
} from "antd";
import { useQueryClient } from "@tanstack/react-query";
@@ -26,6 +25,7 @@ import { projectBrandAliases, projectTrustPresentation } from "@personal-brand/a
import { TemplateListField } from "../../components/TemplateListField.js";
import { TemplateFieldRenderer } from "../../components/TemplateFieldRenderer.js";
import { MutationError } from "../../components/QueryState.js";
import { StatusTag } from "../../components/StatusTag.js";
import { RecordContentEditor } from "../../components/RecordContentEditor.js";
import { TemplatePreview } from "./TemplatePreview.js";
import { InquiryPreviewEditor } from "./InquiryPreviewEditor.js";
@@ -483,14 +483,14 @@ export function PresentationEditor({
<section className="presentation-editor" aria-labelledby="presentation-editor-title">
<div className="presentation-editor__header">
<div>
<Typography.Title id="presentation-editor-title" level={3}>
<h2 id="presentation-editor-title" className="admin-section-title">
小程序页面配置
</Typography.Title>
<Typography.Paragraph type="secondary">
</h2>
<p className="admin-section-description">
按页面查找内容。这里修改的是草稿,发布后访客才会看到更新。
</Typography.Paragraph>
</p>
</div>
{templateContent ? <Tag color="blue">{templateContent.displayName}</Tag> : null}
{templateContent ? <StatusTag tone="info" label={templateContent.displayName} /> : null}
</div>
{loading ? <Alert type="info" showIcon message="正在读取当前模板的编辑项目" /> : null}
{error ? (
@@ -517,7 +517,7 @@ export function PresentationEditor({
setActivePage(value);
})
}
style={{ minWidth: 180 }}
className="admin-field-w-2xl"
/>
) : (
<Segmented
@@ -542,7 +542,7 @@ export function PresentationEditor({
{selectedPage === "detail" && draftWorkspace?.offerings.length ? (
<Select
aria-label="选择详情页业务内容"
style={{ width: "100%", marginBottom: 12 }}
className="admin-block admin-offset-bottom-sm"
value={selectedDetailOfferingId}
options={draftWorkspace.offerings.map((item) => ({
value: item.id,
@@ -571,7 +571,7 @@ export function PresentationEditor({
<Typography.Title level={5}>页面区域</Typography.Title>
<Typography.Paragraph type="secondary">选择区域,编辑对应内容</Typography.Paragraph>
{visibleTargets.length ? (
<Space className="presentation-editor__regions" wrap style={{ marginTop: 16 }}>
<Space className="presentation-editor__regions admin-offset-top" wrap>
{visibleTargets.map((target) => (
<Button
key={target.key}
@@ -613,15 +613,24 @@ export function PresentationEditor({
<Typography.Title level={5}>
{selectedTarget?.label ?? pageTitle(selectedPage ?? "home")}
</Typography.Title>
<Tag color={brandDirty || recordDraft || inquiryDraft ? "orange" : "default"}>
{save.isPending
? "正在保存"
: save.isError
? "保存失败,请重试"
: brandDirty || recordDraft || inquiryDraft
? "有未保存修改"
: "草稿已同步"}
</Tag>
<StatusTag
tone={
save.isError
? "error"
: save.isPending || brandDirty || recordDraft || inquiryDraft
? "warning"
: "neutral"
}
label={
save.isPending
? "正在保存"
: save.isError
? "保存失败,请重试"
: brandDirty || recordDraft || inquiryDraft
? "有未保存修改"
: "草稿已同步"
}
/>
{selectedPage === "detail" && !selectedTarget ? (
<Alert
type="info"
@@ -787,9 +796,9 @@ export function PresentationEditor({
initialValues={initialValues}
onValuesChange={handleValuesChange}
onFinish={() => save.mutate(form.getFieldsValue(true) as PresentationValues)}
style={{ minHeight: 0, display: "flex", flexDirection: "column" }}
className="presentation-editor__form"
>
<div style={{ flex: 1 }}>
<div className="presentation-editor__form-body">
{editableSections.map((section, index) => (
<section key={section.key} aria-labelledby={`section-${section.key}`}>
{selectedTarget && index > 0 ? <Divider /> : null}
@@ -836,7 +845,7 @@ export function PresentationEditor({
<Alert
type="info"
showIcon
style={{ marginBottom: 24 }}
className="admin-offset-bottom-lg"
message="这个页面还有关联内容"
description={
<Space wrap>
@@ -857,7 +866,7 @@ export function PresentationEditor({
: "/admin/workspace",
);
}}
style={{ padding: 0 }}
className="admin-link-flush"
>
{item.label}
</Button>
@@ -880,12 +889,12 @@ export function PresentationEditor({
</Typography.Paragraph>
) : null}
</div>
<Space direction="vertical" style={{ width: "100%", marginTop: 24 }}>
<div className="presentation-editor__form-actions admin-actions admin-offset-top-lg">
<MutationError error={save.error} />
<Button type="primary" htmlType="submit" loading={save.isPending}>
保存页面内容
</Button>
</Space>
</div>
</Form>
)}
</div>
@@ -4,8 +4,8 @@
height: min(72vh, 760px);
min-height: 560px;
overflow: hidden;
border: 1px solid #e8e8e8;
background: #f3f4f6;
border: 1px solid var(--admin-border);
background: var(--admin-fill);
}
.template-preview iframe {