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

@@ -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>