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:
1 parent
bb94d80e13
commit
2f26828f09
34 files changed
+2159
-922
No files matched your search
@@ -0,0 +1,327 @@
|
||||
# Admin Design Language
|
||||
|
||||
本文件是 `@personal-brand/admin` 管理后台的视觉与交互规范,是后台 UI 的唯一设计来源。
|
||||
|
||||
设计目标:**简洁、干净**。留白充足、层级靠排版建立、装饰最少。信息架构与业务语义不在本文件范围内,如需变更请走产品文档。
|
||||
|
||||
适用范围:`apps/admin/src` 下所有页面、组件与样式。新增 UI 前先读本文件,冲突以本文件为准。
|
||||
|
||||
- 本文件同时作为 AI 设计工具的规范输入:在 MasterGo「AI 快搭」中直接上传本文件即可,无需重复描述视觉规则。生成提示词见 `docs/design/admin-mastergo-guide.md`。
|
||||
- 技术约束:antd 6 + React 19 + React Router 7 + TanStack Query 5。不引入新的 UI 库、状态管理、校验或路由方案。
|
||||
- 主题令牌统一在根节点通过 `ConfigProvider` 注入,页面与组件内不得写零散色值。
|
||||
- 共享视觉元素放 `apps/admin/src/components/`,页面专属组件留在各自的 `features/` 目录。
|
||||
- 中文界面。桌面优先,最小可用宽度 1024px;窄屏允许侧栏折叠,不提供移动端专用布局。
|
||||
|
||||
---
|
||||
|
||||
## 1. 颜色
|
||||
|
||||
中性灰打底,只保留一个强调色。禁止渐变、彩色大面积色块、玻璃拟态。
|
||||
|
||||
### 基础色
|
||||
|
||||
| 用途 | 令牌 | 值 |
|
||||
| ---------------------- | ---------------------- | --------- |
|
||||
| 页面底色 | `colorBgLayout` | `#F7F8FA` |
|
||||
| 卡片/容器底色 | `colorBgContainer` | `#FFFFFF` |
|
||||
| 次级填充(表头、悬停) | `colorFillQuaternary` | `#FAFAFB` |
|
||||
| 悬停底色 | `colorFillTertiary` | `#F7F8FA` |
|
||||
| 容器边框 | `colorBorderSecondary` | `#E7E9EC` |
|
||||
| 行分隔线 | `colorSplit` | `#F0F1F3` |
|
||||
| 控件边框 | `colorBorder` | `#D8DBE0` |
|
||||
|
||||
### 文字色
|
||||
|
||||
| 用途 | 令牌 | 值 |
|
||||
| ------------- | --------------------- | --------- |
|
||||
| 主文字 | `colorText` | `#1C1F23` |
|
||||
| 次要文字 | `colorTextSecondary` | `#6B7280` |
|
||||
| 辅助/占位文字 | `colorTextTertiary` | `#9AA1AC` |
|
||||
| 禁用文字 | `colorTextQuaternary` | `#C3C7CF` |
|
||||
|
||||
### 强调色
|
||||
|
||||
| 用途 | 令牌 | 值 |
|
||||
| ------------- | -------------------- | --------- |
|
||||
| 主色 | `colorPrimary` | `#2563EB` |
|
||||
| 主色悬停 | `colorPrimaryHover` | `#1D4ED8` |
|
||||
| 主色按下 | `colorPrimaryActive` | `#1E40AF` |
|
||||
| 选中底色 | `colorPrimaryBg` | `#EFF4FF` |
|
||||
| 选中/链接文字 | `colorLink` | `#2563EB` |
|
||||
|
||||
强调色只用于:主按钮、选中态、链接、关键数字、聚焦描边。不得用于大面积背景。
|
||||
|
||||
### 状态色
|
||||
|
||||
状态一律用「浅底 + 深字」,不使用 antd 的实心鲜艳 Tag。
|
||||
|
||||
| 语义 | 底色 | 文字色 |
|
||||
| ------------- | --------- | --------- |
|
||||
| 成功 / 已发布 | `#ECFDF3` | `#067647` |
|
||||
| 警告 / 进行中 | `#FFFAEB` | `#B54708` |
|
||||
| 错误 / 失败 | `#FEF3F2` | `#B42318` |
|
||||
| 中性 / 草稿 | `#F2F4F7` | `#475467` |
|
||||
| 信息 / 系统态 | `#EFF4FF` | `#2563EB` |
|
||||
|
||||
---
|
||||
|
||||
## 2. 排版
|
||||
|
||||
系统无衬线字体栈:`Inter`、`PingFang SC`、`Noto Sans SC`、`sans-serif`。
|
||||
|
||||
| 角色 | 字号 | 字重 | 行高 |
|
||||
| ------------------ | ---- | ---- | ---- |
|
||||
| 页面标题 | 24px | 600 | 1.35 |
|
||||
| 区块/卡片标题 | 16px | 600 | 1.45 |
|
||||
| 强调正文、品牌名 | 15px | 600 | 1.5 |
|
||||
| 正文 | 14px | 400 | 1.5 |
|
||||
| 表单标签、次要正文 | 13px | 400 | 1.5 |
|
||||
| 辅助说明、时间戳 | 12px | 400 | 1.5 |
|
||||
| 指标数值 | 28px | 600 | 1.2 |
|
||||
|
||||
- 层级靠字号与字重建立,不靠颜色、下划线、边框。
|
||||
- 中文不使用斜体;英文与数字不加字距。
|
||||
- 一段说明文字最长不超过 2 行,超出应改写或省略。
|
||||
- 中英文与数字之间保留一个空格。
|
||||
|
||||
---
|
||||
|
||||
## 3. 间距与布局
|
||||
|
||||
8pt 网格。间距只使用 `4 / 8 / 12 / 16 / 24 / 32`。
|
||||
|
||||
| 场景 | 值 |
|
||||
| ---------------- | ------------ |
|
||||
| 页面内容区内边距 | 24px |
|
||||
| 内容最大宽度 | 1200px,居中 |
|
||||
| 页面头部到主体 | 24px |
|
||||
| 卡片内边距 | 20px |
|
||||
| 卡片之间 | 16px |
|
||||
| 表单字段之间 | 16px |
|
||||
| 标签与输入框之间 | 6px |
|
||||
| 行内元素之间 | 8px |
|
||||
| 小节标题到内容 | 12px |
|
||||
|
||||
外壳尺寸:
|
||||
|
||||
- 侧栏宽 232px,折叠宽 0(`breakpoint="lg"`)。
|
||||
- 顶栏高 56px,与侧栏品牌区对齐。
|
||||
|
||||
---
|
||||
|
||||
## 4. 形状与层次
|
||||
|
||||
| 元素 | 圆角 | 说明 |
|
||||
| ------------------ | ---- | ------------------------------- |
|
||||
| 卡片 | 10px | 默认 1px `#E7E9EC` 边框,无阴影 |
|
||||
| 弹窗 | 12px | 极轻阴影 |
|
||||
| 按钮、输入框、下拉 | 6px | 统一 |
|
||||
| 状态标签 | 6px | 高 24px,内边距 `2px 8px` |
|
||||
| 图片/头像缩略图 | 8px | 头像用圆形 |
|
||||
| 进度条 | 3px | 高 6px |
|
||||
|
||||
- 层次手段优先级:留白 > 字号字重 > 1px 浅边框 > 阴影。
|
||||
- 阴影仅用于浮层:`0 1px 2px rgba(16, 24, 40, 0.04)`,弹窗可加 `0 8px 24px rgba(16, 24, 40, 0.08)`。
|
||||
- 卡片不使用阴影,不叠加边框与阴影。
|
||||
|
||||
---
|
||||
|
||||
## 5. 组件规范
|
||||
|
||||
### 侧栏导航
|
||||
|
||||
- 白底,右侧 1px `#E7E9EC` 分隔线。不使用深色主题(现有 `theme="dark"` 需移除)。
|
||||
- 顶部品牌区:24x24 圆角 6px 标识 + 品牌名,高 56px。
|
||||
- 分组标题:12px `#9AA1AC`,上下留白 8px,不加图标、不做大写英文。
|
||||
- 菜单项:高 36px,圆角 6px,左侧 16px 线性图标(描边 1.5px),文字 14px。
|
||||
- 三态:默认深灰文字无底色;悬停 `#F7F8FA`;选中 `#EFF4FF` 底 + `#2563EB` 文字与图标 + 字重 500。
|
||||
|
||||
### 顶栏
|
||||
|
||||
- 高 56px,白底,底部 1px 分隔线,左右内边距 24px。
|
||||
- 左侧:品牌名 14px/600 + 灰色 13px「品牌工作区」+ 角色标签。
|
||||
- 角色标签:负责人 `#EFF4FF`/`#2563EB`,内容编辑 `#F2F4F7`/`#475467`。
|
||||
- 右侧:品牌切换下拉(尺寸 `small`、白底细边框)+ 「退出登录」文字按钮。
|
||||
- 顶栏不随机滚动,内容区独立滚动。
|
||||
|
||||
### 页面头部
|
||||
|
||||
统一通过 `AdminPageHeader` 渲染:页面标题 24px/600 + 可选副标题 14px 次要色 + 右侧操作区。底部间距 24px。页面内不得再手写标题层级。
|
||||
|
||||
### 卡片
|
||||
|
||||
- 标题 16px/600,标题区底部间距 12px,标题右侧放次要操作(文字按钮)。
|
||||
- 卡片只承载一个主题;一个页面最多两级卡片嵌套,避免再嵌套。
|
||||
|
||||
### 按钮
|
||||
|
||||
| 类型 | 场景 |
|
||||
| -------------------- | ---------------------------------------- |
|
||||
| 主按钮(实心强调色) | 每个页面/卡片最多一个,用于当前主流程 |
|
||||
| 次按钮(白底细边框) | 并列的次要操作 |
|
||||
| 文字按钮 | 表格行内操作、列表「去处理」、返回类操作 |
|
||||
| 危险按钮 | 删除、撤回、卸载等不可逆操作 |
|
||||
|
||||
- 高度:默认 32px,主流程按钮 40px。
|
||||
- 等待态用 `loading`,禁用态用 `disabled`,禁止用文字变形表达状态。
|
||||
|
||||
### 表单
|
||||
|
||||
- 标签在输入框上方,13px `#475467`,必填星号 `#B42318`。
|
||||
- 帮助文本 12px `#9AA1AC`,错误文本 12px `#B42318`,都显示在字段下方。
|
||||
- 输入框聚焦:1.5px `#2563EB` 描边 + `#EFF4FF` 2px 外发光。
|
||||
- 提交失败必须保留用户输入,错误提示定位到字段或表单顶部,禁止弹窗后清空。
|
||||
|
||||
### 数据表格
|
||||
|
||||
- 无竖线;表头底色 `#FAFAFB`,13px `#6B7280`。
|
||||
- 行高 52px(含头像/双行内容时 60px)。
|
||||
- 行分隔线 `#F0F1F3`;悬停行底色 `#FAFAFB`。
|
||||
- 操作列统一放最右,使用文字按钮,最多 2 个直接操作,更多收进「更多」下拉。
|
||||
- 空数据不显示空表头,改用空状态组件。
|
||||
|
||||
### 状态标签
|
||||
|
||||
- 统一组件,按语义取色,默认 `尺寸 = 24px 高 / 12px 字`。
|
||||
- 发布状态机映射:`building` 信息、`uploaded` 中性、`under_review` 警告、`approved` 成功、`rejected` 错误、`published` 成功、`failed` 错误、`superseded` 中性。
|
||||
- 同一列表内标签宽度尽量对齐,避免视觉跳动。
|
||||
|
||||
### 弹窗
|
||||
|
||||
- 宽 480px(简单表单)或 560px(多字段),圆角 12px。
|
||||
- 标题 16px/600,底部操作右对齐:次按钮在左、主按钮在右。
|
||||
- 提交中禁用关闭与重复提交。
|
||||
|
||||
### 描述列表(键值展示)
|
||||
|
||||
用于咨询详情、版本信息等只读信息:字段名 13px `#6B7280`,值 14px `#1C1F23`,行间距 12px,不使用表格线。
|
||||
|
||||
### Tabs
|
||||
|
||||
- 顶部 1px 分隔线,选中项底部 2px 强调色下划线 + 深色文字,未选中 14px `#6B7280`。
|
||||
- 不超过 5 个 Tab,超出改用左侧分段导航。
|
||||
|
||||
### 进度
|
||||
|
||||
- 高 6px,圆角 3px,轨道 `#F0F1F3`,进度条强调色;完成态用成功色。
|
||||
- 进度条上方 14px 文案说明当前含义,不允许只有一根进度条。
|
||||
|
||||
---
|
||||
|
||||
## 6. 状态设计
|
||||
|
||||
每个远程数据页面必须显式实现四种状态,不得出现无反馈的白屏。
|
||||
|
||||
| 状态 | 规范 |
|
||||
| -------- | ----------------------------------------------------------------------------------- |
|
||||
| 加载中 | 骨架屏,形状与最终内容一致;不用居中转圈 |
|
||||
| 空数据 | 居中:极简线性图形 + 15px/600 标题 + 13px 灰色说明 + 主操作按钮 |
|
||||
| 请求失败 | 卡片内错误条:`#FEF3F2` 底 + 1px 浅红边框 + 圆角 8px + 文案 14px + 「重试」文字按钮 |
|
||||
| 成功反馈 | 右上角轻量 toast,白底圆角 8px,280–320px 宽 |
|
||||
|
||||
- 行内操作使用按钮 `loading` 表达进行中,不用全局遮罩。
|
||||
- 提交成功后:关闭弹窗、重置表单、刷新受影响列表;提交失败保持原状。
|
||||
- 幂等写操作要防止重复点击(提交中禁用)。
|
||||
|
||||
---
|
||||
|
||||
## 7. 页面结构
|
||||
|
||||
以下为各页面的视觉结构约定,业务逻辑不变。
|
||||
|
||||
| 页面 | 结构要点 |
|
||||
| -------------- | ------------------------------------------------------------------------------ |
|
||||
| 登录 | 居中 400px 卡片,标识 + 说明 + 表单 + 通栏主按钮;错误态展示在字段下方 |
|
||||
| 首次改密 | 同登录卡片形态,说明文案 + 三个密码字段 + 「保存新密码」 |
|
||||
| 品牌概览 | 品牌卡 + 三张指标卡(等宽一行)+ 两栏(发布准备度 / 品牌内容检查) |
|
||||
| 配置与发布 | 三 Tab(内容发布 / 小程序发布 / 小程序配置);发布状态卡 + 草稿卡 + 历史版本表 |
|
||||
| 小程序页面 | 左右两栏:左 380px 编辑面板,右预览画布;预览内选中区域虚线高亮 + 区域名气泡 |
|
||||
| 信任内容 | 列表卡片(缩略图 + 标题 + 两行摘要 + 状态标签 + 行内操作),不用表格 |
|
||||
| 业务提供项 | 表格(名称 / 价格 / 状态开关 / 排序 / 操作)+ 新增弹窗 |
|
||||
| 咨询记录 | 顶部三指标 + 左 380px 列表 + 右详情的主从布局 |
|
||||
| 模板与表单设置 | 行业模板网格(三列)+ 咨询表单字段编辑器 + 底部危险操作区 |
|
||||
| 能力插件 | 插件卡片列表(图标 + 名称 + 说明 + 开关),停用态降低对比度 |
|
||||
| 团队成员 | 表格(成员 / 角色 / 状态 / 最近登录 / 操作)+ 邀请弹窗 |
|
||||
|
||||
两栏页面在小屏下折叠为单列,编辑/预览改为上下排列。
|
||||
|
||||
---
|
||||
|
||||
## 8. 无障碍与细节
|
||||
|
||||
- 正文与背景对比度不低于 4.5:1;标签文字与标签底色不低于 4.5:1。
|
||||
- 可点击元素最小热区 32x32px;纯图标按钮必须带 `aria-label`。
|
||||
- 焦点可见:所有可交互元素保留 1.5px 强调色聚焦描边。
|
||||
- 状态不能只靠颜色区分,需同时有文字。
|
||||
- 数字使用等宽数字排版(`font-variant-numeric: tabular-nums`),避免指标和价格跳动。
|
||||
|
||||
---
|
||||
|
||||
## 9. 禁止项
|
||||
|
||||
- 渐变、玻璃拟态、拟物纹理、装饰性插画铺满界面。
|
||||
- 深色侧栏、彩色大面积色块、实心鲜艳 Tag。
|
||||
- 重阴影、多重边框、卡片再套卡片超过两级。
|
||||
- emoji 作为图标;图标与文字混排时不对齐基线。
|
||||
- 页面内写死色值、圆角、间距魔法数字。
|
||||
- 一个页面出现多个主按钮竞争视觉焦点。
|
||||
|
||||
---
|
||||
|
||||
## 10. antd 令牌映射
|
||||
|
||||
落地时在 Admin 根节点用 `ConfigProvider` 注入,不逐页覆盖。
|
||||
|
||||
```ts
|
||||
const theme = {
|
||||
token: {
|
||||
colorPrimary: "#2563EB",
|
||||
colorLink: "#2563EB",
|
||||
colorText: "#1C1F23",
|
||||
colorTextSecondary: "#6B7280",
|
||||
colorTextTertiary: "#9AA1AC",
|
||||
colorBgLayout: "#F7F8FA",
|
||||
colorBgContainer: "#FFFFFF",
|
||||
colorBorder: "#D8DBE0",
|
||||
colorBorderSecondary: "#E7E9EC",
|
||||
colorSplit: "#F0F1F3",
|
||||
borderRadius: 6,
|
||||
borderRadiusLG: 10,
|
||||
borderRadiusSM: 4,
|
||||
fontSize: 14,
|
||||
fontFamily:
|
||||
"Inter, 'PingFang SC', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif",
|
||||
controlHeight: 32,
|
||||
controlHeightLG: 40,
|
||||
boxShadow: "0 1px 2px rgba(16, 24, 40, 0.04)",
|
||||
boxShadowSecondary: "0 8px 24px rgba(16, 24, 40, 0.08)",
|
||||
wireframe: false,
|
||||
},
|
||||
components: {
|
||||
Layout: { headerHeight: 56, siderBg: "#FFFFFF", bodyBg: "#F7F8FA" },
|
||||
Menu: {
|
||||
itemHeight: 36,
|
||||
itemBorderRadius: 6,
|
||||
itemSelectedBg: "#EFF4FF",
|
||||
itemSelectedColor: "#2563EB",
|
||||
itemHoverBg: "#F7F8FA",
|
||||
itemMarginInline: 8,
|
||||
itemMarginBlock: 2,
|
||||
groupTitleFontSize: 12,
|
||||
},
|
||||
Card: { paddingLG: 20, headerFontSize: 16 },
|
||||
Table: {
|
||||
headerBg: "#FAFAFB",
|
||||
headerColor: "#6B7280",
|
||||
rowHoverBg: "#FAFAFB",
|
||||
cellPaddingBlock: 16,
|
||||
},
|
||||
Button: { primaryShadow: "none", defaultShadow: "none", fontWeight: 500 },
|
||||
Progress: { defaultColor: "#2563EB", lineBorderRadius: 3 },
|
||||
Tag: { defaultBg: "#F2F4F7", defaultColor: "#475467" },
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
- 新增页面优先使用令牌与共享组件,禁止在 JSX 内写内联色值(现有顶栏/侧栏的内联样式需迁移)。
|
||||
- 共享视觉组件清单:`AdminPageHeader`、`QueryState`,以及后续新增的状态标签、空状态、卡片区块、指标卡。
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Space, Typography } from "antd";
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
export function AdminPageHeader({
|
||||
@@ -11,21 +10,12 @@ export function AdminPageHeader({
|
||||
extra?: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<Space
|
||||
align="start"
|
||||
style={{ width: "100%", justifyContent: "space-between", marginBottom: 24 }}
|
||||
>
|
||||
<header className="admin-page-header">
|
||||
<div>
|
||||
<Typography.Title level={2} style={{ margin: 0 }}>
|
||||
{title}
|
||||
</Typography.Title>
|
||||
{description && (
|
||||
<Typography.Paragraph type="secondary" style={{ margin: "8px 0 0" }}>
|
||||
{description}
|
||||
</Typography.Paragraph>
|
||||
)}
|
||||
<h1 className="admin-page-header-title">{title}</h1>
|
||||
{description ? <p className="admin-page-header-description">{description}</p> : null}
|
||||
</div>
|
||||
{extra}
|
||||
</Space>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
export function AdminSection({
|
||||
title,
|
||||
description,
|
||||
extra,
|
||||
children,
|
||||
}: {
|
||||
title?: ReactNode;
|
||||
description?: ReactNode;
|
||||
extra?: ReactNode;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<section className="admin-section">
|
||||
{title ? (
|
||||
<div className="admin-section-head">
|
||||
<div>
|
||||
<h2 className="admin-section-title">{title}</h2>
|
||||
{description ? <p className="admin-section-description">{description}</p> : null}
|
||||
</div>
|
||||
{extra}
|
||||
</div>
|
||||
) : null}
|
||||
{children}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { CloudUploadOutlined, DeleteOutlined, PictureOutlined } from "@ant-design/icons";
|
||||
import { Alert, Button, Image, Popconfirm, Space, Spin, Upload, message } from "antd";
|
||||
import { Alert, Button, Image, Popconfirm, Spin, Upload, message } from "antd";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { createApiClient } from "../lib/api.js";
|
||||
|
||||
@@ -71,7 +71,7 @@ export function ImageUrlField({ id, value, onChange, placeholder, scope }: Image
|
||||
}
|
||||
|
||||
return (
|
||||
<Space direction="vertical" size={4} style={{ width: "100%" }}>
|
||||
<div className="admin-field-stack-xs admin-block">
|
||||
{storageStatus !== "ok" ? (
|
||||
<Alert
|
||||
type={storageStatus === "loading" ? "info" : "warning"}
|
||||
@@ -86,33 +86,17 @@ export function ImageUrlField({ id, value, onChange, placeholder, scope }: Image
|
||||
/>
|
||||
) : null}
|
||||
{imageUrl ? (
|
||||
<div
|
||||
style={{
|
||||
position: "relative",
|
||||
width: "100%",
|
||||
minHeight: 140,
|
||||
borderRadius: 8,
|
||||
overflow: "hidden",
|
||||
border: "1px solid #d9d9d9",
|
||||
background: "#f5f5f5",
|
||||
}}
|
||||
>
|
||||
<div className="admin-media-preview">
|
||||
<Image
|
||||
src={imageUrl}
|
||||
alt={placeholder ?? "图片预览"}
|
||||
width="100%"
|
||||
height={180}
|
||||
preview
|
||||
style={{ objectFit: "cover" }}
|
||||
fallback="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="
|
||||
/>
|
||||
<Popconfirm title="移除这张图片?" onConfirm={() => onChange?.("")}>
|
||||
<Button
|
||||
danger
|
||||
size="small"
|
||||
icon={<DeleteOutlined />}
|
||||
style={{ position: "absolute", top: 8, right: 8 }}
|
||||
>
|
||||
<Button danger size="small" icon={<DeleteOutlined />} className="admin-thumb-remove">
|
||||
移除
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
@@ -150,6 +134,6 @@ export function ImageUrlField({ id, value, onChange, placeholder, scope }: Image
|
||||
</Button>
|
||||
) : null}
|
||||
<input {...(id ? { id } : {})} type="hidden" value={imageUrl} />
|
||||
</Space>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { Card } from "antd";
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
export function MetricCard({
|
||||
label,
|
||||
value,
|
||||
suffix,
|
||||
extra,
|
||||
}: {
|
||||
label: ReactNode;
|
||||
value: ReactNode;
|
||||
suffix?: ReactNode;
|
||||
extra?: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<Card>
|
||||
<div className="admin-metric-label">{label}</div>
|
||||
<div className="admin-metric-value">
|
||||
{value}
|
||||
{suffix ? <span className="admin-metric-suffix">{suffix}</span> : null}
|
||||
</div>
|
||||
{extra}
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
import { Alert, Button, Card, Empty, Result, Spin } from "antd";
|
||||
import { Button, Card, Empty, Skeleton } from "antd";
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
function errorMessage(error: unknown, fallback: string) {
|
||||
return error instanceof Error ? error.message : fallback;
|
||||
}
|
||||
|
||||
export function QueryState({
|
||||
loading,
|
||||
error,
|
||||
@@ -12,36 +16,50 @@ export function QueryState({
|
||||
onRetry?: () => void;
|
||||
children?: ReactNode;
|
||||
}) {
|
||||
if (loading)
|
||||
return (
|
||||
<Card>
|
||||
<Spin />
|
||||
</Card>
|
||||
);
|
||||
if (error) {
|
||||
return (
|
||||
<Result
|
||||
status="error"
|
||||
title="内容加载失败"
|
||||
subTitle={error instanceof Error ? error.message : "请检查 API 服务后重试"}
|
||||
extra={onRetry ? <Button onClick={onRetry}>重新加载</Button> : undefined}
|
||||
/>
|
||||
);
|
||||
}
|
||||
if (loading) return <LoadingStack />;
|
||||
if (error) return <ErrorNote error={error} onRetry={onRetry} />;
|
||||
return <>{children}</>;
|
||||
}
|
||||
|
||||
export function LoadingStack({ rows = 3 }: { rows?: number }) {
|
||||
return (
|
||||
<div className="admin-loading-stack">
|
||||
<Card>
|
||||
<Skeleton active paragraph={{ rows: 2 }} title={false} />
|
||||
</Card>
|
||||
{Array.from({ length: rows }).map((_, index) => (
|
||||
<Card key={index}>
|
||||
<Skeleton active paragraph={{ rows: 1 }} title={false} />
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function ErrorNote({
|
||||
error,
|
||||
onRetry,
|
||||
}: {
|
||||
error?: unknown;
|
||||
onRetry?: (() => void) | undefined;
|
||||
}) {
|
||||
if (!error) return null;
|
||||
return (
|
||||
<div className="admin-error-note" role="alert">
|
||||
<span>{errorMessage(error, "操作失败,请重试")}</span>
|
||||
{onRetry ? (
|
||||
<Button type="link" size="small" onClick={onRetry}>
|
||||
重试
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function MutationError({ error }: { error?: unknown }) {
|
||||
return <ErrorNote error={error} />;
|
||||
}
|
||||
|
||||
export function EmptyState({ description }: { description: string }) {
|
||||
return <Empty description={description} image={Empty.PRESENTED_IMAGE_SIMPLE} />;
|
||||
}
|
||||
|
||||
export function MutationError({ error }: { error?: unknown }) {
|
||||
if (!error) return null;
|
||||
return (
|
||||
<Alert
|
||||
type="error"
|
||||
showIcon
|
||||
message={error instanceof Error ? error.message : "操作失败,请重试"}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -71,7 +71,7 @@ export function RecordContentEditor({
|
||||
initialValues={initialValues}
|
||||
onValuesChange={handleValuesChange}
|
||||
onFinish={submit}
|
||||
style={{ minHeight: 0, display: "flex", flexDirection: "column" }}
|
||||
className="admin-form-column"
|
||||
>
|
||||
<Alert
|
||||
type="info"
|
||||
@@ -89,10 +89,10 @@ export function RecordContentEditor({
|
||||
/>
|
||||
{save.isPending ? <Typography.Text type="secondary">正在保存内容…</Typography.Text> : null}
|
||||
<Typography.Paragraph type="secondary">{section.description}</Typography.Paragraph>
|
||||
<div style={{ flex: 1 }}>
|
||||
<div className="admin-flex-1">
|
||||
<RecordContentFields section={section} />
|
||||
</div>
|
||||
<Space direction="vertical" style={{ width: "100%", marginTop: 24 }}>
|
||||
<div className="admin-actions admin-offset-top-lg">
|
||||
<MutationError error={save.error} />
|
||||
<Space wrap>
|
||||
<Button type="primary" htmlType="submit" loading={save.isPending}>
|
||||
@@ -114,7 +114,7 @@ export function RecordContentEditor({
|
||||
</Button>
|
||||
) : null}
|
||||
</Space>
|
||||
</Space>
|
||||
</div>
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
export type StatusTone = "success" | "warning" | "error" | "info" | "neutral";
|
||||
|
||||
const TONE_BY_STATUS: Record<string, StatusTone> = {
|
||||
published: "success",
|
||||
approved: "success",
|
||||
completed: "success",
|
||||
active: "success",
|
||||
enabled: "success",
|
||||
building: "info",
|
||||
built: "neutral",
|
||||
uploaded: "info",
|
||||
pending: "neutral",
|
||||
draft: "neutral",
|
||||
superseded: "neutral",
|
||||
disabled: "neutral",
|
||||
review: "warning",
|
||||
reviewing: "warning",
|
||||
under_review: "warning",
|
||||
processing: "warning",
|
||||
rejected: "error",
|
||||
failed: "error",
|
||||
error: "error",
|
||||
};
|
||||
|
||||
const LABELS: Record<string, string> = {
|
||||
published: "已发布",
|
||||
approved: "已通过",
|
||||
completed: "已完成",
|
||||
active: "已启用",
|
||||
enabled: "已公开",
|
||||
building: "构建中",
|
||||
built: "待上传",
|
||||
uploaded: "已上传微信",
|
||||
pending: "待处理",
|
||||
draft: "草稿",
|
||||
superseded: "已过期",
|
||||
disabled: "已停用",
|
||||
review: "审核中",
|
||||
reviewing: "审核中",
|
||||
under_review: "审核中",
|
||||
processing: "处理中",
|
||||
rejected: "已拒绝",
|
||||
failed: "失败",
|
||||
error: "异常",
|
||||
};
|
||||
|
||||
export function statusLabel(status: string | null | undefined, fallback = "未知"): string {
|
||||
if (!status) return fallback;
|
||||
return LABELS[status] ?? status;
|
||||
}
|
||||
|
||||
export function StatusTag({
|
||||
status,
|
||||
label,
|
||||
tone,
|
||||
}: {
|
||||
status?: string | null;
|
||||
label?: string;
|
||||
tone?: StatusTone;
|
||||
}) {
|
||||
const resolvedTone = tone ?? (status ? TONE_BY_STATUS[status] : undefined) ?? "neutral";
|
||||
return (
|
||||
<span className="admin-status-tag" data-tone={resolvedTone}>
|
||||
{label ?? statusLabel(status)}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -51,7 +51,7 @@ export function TemplateFieldRenderer({
|
||||
value={typeof value === "number" ? value : null}
|
||||
onChange={(input) => onChange?.(input ?? undefined)}
|
||||
min={0}
|
||||
style={{ width: "100%" }}
|
||||
className="admin-block"
|
||||
placeholder={field.placeholder}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -28,7 +28,7 @@ export function TemplateListField({
|
||||
]}
|
||||
>
|
||||
{(rows, { add, remove, move }, { errors }) => (
|
||||
<Space direction="vertical" size={12} style={{ width: "100%" }}>
|
||||
<div className="admin-stack admin-stack-tight">
|
||||
{rows.length === 0 ? (
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
@@ -135,7 +135,7 @@ export function TemplateListField({
|
||||
<Button block icon={<PlusOutlined />} onClick={() => add()}>
|
||||
新增{field.label}
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
)}
|
||||
</Form.List>
|
||||
</Form.Item>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Card, Col, Empty, Row, Typography } from "antd";
|
||||
import { Card, Col, Empty, Row } from "antd";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { QueryState } from "../../components/QueryState.js";
|
||||
import { CapabilityCard } from "./components/CapabilityCard.js";
|
||||
@@ -14,7 +14,7 @@ export function CapabilitiesPage() {
|
||||
description="以经营者视角调整模板能力的开关与展示设置;保存后进入草稿,发布后生效。"
|
||||
/>
|
||||
{query.data?.length ? (
|
||||
<Row gutter={[16, 16]}>
|
||||
<Row gutter={[16, 16]} className="admin-equal-height">
|
||||
{query.data.map((capability) => (
|
||||
<Col key={capability.capabilityKey} xs={24} lg={12}>
|
||||
<CapabilityCard capability={capability} />
|
||||
@@ -26,9 +26,9 @@ export function CapabilitiesPage() {
|
||||
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="当前模板没有可配置能力。" />
|
||||
</Card>
|
||||
)}
|
||||
<Typography.Text type="secondary" style={{ display: "block", marginTop: 16 }}>
|
||||
<p className="admin-page-header-description admin-offset-top">
|
||||
技术信息仅用于排查问题,不作为运营判断依据。
|
||||
</Typography.Text>
|
||||
</p>
|
||||
</QueryState>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
import { Alert, Button, Card, Input, Switch, Tag, Typography } from "antd";
|
||||
import { Button, Card, Input, Switch, Typography } from "antd";
|
||||
import { useState } from "react";
|
||||
import { ErrorNote } from "../../../components/QueryState.js";
|
||||
import { StatusTag } from "../../../components/StatusTag.js";
|
||||
import { useCapabilityMutation } from "../hooks/useCapabilityQueries.js";
|
||||
import type { AdminCapability, CapabilityStatus } from "../types.js";
|
||||
import { CapabilityStatusControl, CapabilityStatusTag } from "./CapabilityStatusControl.js";
|
||||
@@ -46,10 +48,10 @@ export function CapabilityCard({ capability }: { capability: AdminCapability })
|
||||
return (
|
||||
<Card
|
||||
title={
|
||||
<span>
|
||||
<span className="admin-row-line">
|
||||
{capability.displayName ?? "未命名能力"}
|
||||
<Tag style={{ marginLeft: 8 }}>{sourceLabels[capability.source]}</Tag>
|
||||
<CapabilityStatusTag status={status} />
|
||||
<StatusTag tone="neutral" label={sourceLabels[capability.source]} />
|
||||
</span>
|
||||
}
|
||||
extra={
|
||||
@@ -59,48 +61,40 @@ export function CapabilityCard({ capability }: { capability: AdminCapability })
|
||||
}
|
||||
>
|
||||
{mutation.isError ? (
|
||||
<Alert
|
||||
type="error"
|
||||
showIcon
|
||||
message="保存失败,已保留当前输入"
|
||||
description={
|
||||
mutation.error instanceof Error ? mutation.error.message : "请检查网络或稍后重试"
|
||||
}
|
||||
style={{ marginBottom: 16 }}
|
||||
/>
|
||||
<div className="admin-offset-bottom">
|
||||
<ErrorNote error={mutation.error} />
|
||||
</div>
|
||||
) : null}
|
||||
{capability.description ? (
|
||||
<Typography.Paragraph>{capability.description}</Typography.Paragraph>
|
||||
<p className="admin-section-description">{capability.description}</p>
|
||||
) : null}
|
||||
{capability.impact ? (
|
||||
<Typography.Paragraph type="secondary">影响:{capability.impact}</Typography.Paragraph>
|
||||
<p className="admin-section-description">影响:{capability.impact}</p>
|
||||
) : null}
|
||||
<div style={{ display: "grid", gap: 12 }}>
|
||||
<div className="admin-field-stack">
|
||||
<div>
|
||||
<Typography.Text strong>运行状态</Typography.Text>
|
||||
<div style={{ marginTop: 8 }}>
|
||||
<span className="admin-field-label">运行状态</span>
|
||||
<div className="admin-offset-top-sm">
|
||||
<CapabilityStatusControl
|
||||
status={status}
|
||||
onChange={setStatus}
|
||||
disabled={mutation.isPending}
|
||||
/>
|
||||
</div>
|
||||
<Typography.Paragraph type="secondary" style={{ marginBottom: 0 }}>
|
||||
保存后进入草稿,发布后生效。
|
||||
</Typography.Paragraph>
|
||||
<p className="admin-section-description admin-flush">保存后进入草稿,发布后生效。</p>
|
||||
{status === "disabled" && capability.disablePolicy ? (
|
||||
<Typography.Paragraph type="warning" style={{ marginBottom: 0 }}>
|
||||
<p className="admin-section-description admin-flush admin-text-warning">
|
||||
{disablePolicyLabels[capability.disablePolicy]}
|
||||
</Typography.Paragraph>
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
{capability.configFields?.length ? (
|
||||
<div>
|
||||
<Typography.Text strong>能力设置</Typography.Text>
|
||||
<div style={{ display: "grid", gap: 12, marginTop: 8 }}>
|
||||
<span className="admin-field-label">能力设置</span>
|
||||
<div className="admin-field-stack admin-offset-top-sm">
|
||||
{capability.configFields.map((field) => (
|
||||
<div key={field.key}>
|
||||
<Typography.Text>{field.label}</Typography.Text>
|
||||
<span className="admin-field-label">{field.label}</span>
|
||||
{field.input === "switch" ? (
|
||||
<div>
|
||||
<Switch
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { Segmented, Space, Switch, Tag, Typography } from "antd";
|
||||
import { Segmented, Space, Switch, Typography } from "antd";
|
||||
import type { CapabilityStatus } from "../types.js";
|
||||
import { StatusTag } from "../../../components/StatusTag.js";
|
||||
import type { StatusTone } from "../../../components/StatusTag.js";
|
||||
|
||||
const statusLabels: Record<CapabilityStatus, string> = {
|
||||
enabled: "启用",
|
||||
@@ -7,14 +9,14 @@ const statusLabels: Record<CapabilityStatus, string> = {
|
||||
degraded: "降级",
|
||||
};
|
||||
|
||||
const statusColors: Record<CapabilityStatus, string> = {
|
||||
enabled: "green",
|
||||
disabled: "default",
|
||||
degraded: "orange",
|
||||
const statusTones: Record<CapabilityStatus, StatusTone> = {
|
||||
enabled: "success",
|
||||
disabled: "neutral",
|
||||
degraded: "warning",
|
||||
};
|
||||
|
||||
export function CapabilityStatusTag({ status }: { status: CapabilityStatus }) {
|
||||
return <Tag color={statusColors[status]}>{statusLabels[status]}</Tag>;
|
||||
return <StatusTag tone={statusTones[status]} label={statusLabels[status]} />;
|
||||
}
|
||||
|
||||
export function CapabilityStatusControl({
|
||||
|
||||
@@ -1,20 +1,13 @@
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
Card,
|
||||
Descriptions,
|
||||
Drawer,
|
||||
Select,
|
||||
Space,
|
||||
Table,
|
||||
Tag,
|
||||
message,
|
||||
Input,
|
||||
} from "antd";
|
||||
import { Badge, Button, Descriptions, Drawer, Select, Space, Table, message, Input } from "antd";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import type { AdminBooking, InquirySubmission } from "@personal-brand/api-client";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
import { useState } from "react";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { AdminSection } from "../../components/AdminSection.js";
|
||||
import { ErrorNote } from "../../components/QueryState.js";
|
||||
import { StatusTag } from "../../components/StatusTag.js";
|
||||
import type { StatusTone } from "../../components/StatusTag.js";
|
||||
|
||||
const statuses = ["received", "contacting", "confirmed", "completed", "cancelled"] as const;
|
||||
const labels: Record<string, string> = {
|
||||
@@ -41,6 +34,20 @@ const inquiryLabels: Record<string, string> = {
|
||||
closed: "已关闭",
|
||||
};
|
||||
|
||||
const statusTones: Record<string, StatusTone> = {
|
||||
received: "info",
|
||||
new: "info",
|
||||
contacting: "warning",
|
||||
reviewing: "warning",
|
||||
confirmed: "success",
|
||||
replied: "success",
|
||||
qualified: "success",
|
||||
converted: "success",
|
||||
completed: "success",
|
||||
cancelled: "error",
|
||||
closed: "neutral",
|
||||
};
|
||||
|
||||
export function InquiriesPage() {
|
||||
const client = createApiClient();
|
||||
const queryClient = useQueryClient();
|
||||
@@ -94,117 +101,119 @@ export function InquiriesPage() {
|
||||
onError: (error) => message.error(error instanceof Error ? error.message : "更新失败,请重试"),
|
||||
});
|
||||
return (
|
||||
<Card
|
||||
title="咨询记录"
|
||||
extra={
|
||||
<Space>
|
||||
<Select
|
||||
allowClear
|
||||
placeholder="全部状态"
|
||||
style={{ width: 130 }}
|
||||
value={status}
|
||||
onChange={setStatus}
|
||||
options={statuses.map((value) => ({ value, label: labels[value] }))}
|
||||
/>
|
||||
<Badge
|
||||
count={
|
||||
query.data?.filter((item) => !(item as AdminBooking & { isRead?: boolean }).isRead)
|
||||
.length ?? 0
|
||||
}
|
||||
showZero
|
||||
/>
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<Table
|
||||
rowKey="id"
|
||||
loading={query.isLoading}
|
||||
dataSource={query.data ?? []}
|
||||
columns={[
|
||||
{
|
||||
title: "编号",
|
||||
dataIndex: "bookingNo",
|
||||
render: (value: string, item: AdminBooking) => (
|
||||
<Button type="link" onClick={() => setSelectedId(item.id)}>
|
||||
{value}
|
||||
</Button>
|
||||
),
|
||||
},
|
||||
{ title: "联系人", dataIndex: "customerName" },
|
||||
{
|
||||
title: "提交时间",
|
||||
dataIndex: "createdAt",
|
||||
render: (value: string) => new Date(value).toLocaleString("zh-CN"),
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
dataIndex: "status",
|
||||
render: (value: string) => <Tag>{labels[value] ?? value}</Tag>,
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
render: (_: unknown, item: AdminBooking) => (
|
||||
<Space>
|
||||
<Select
|
||||
size="small"
|
||||
value={item.status}
|
||||
onChange={(value) => update.mutate({ id: item.id, value: value as never })}
|
||||
options={statuses.map((value) => ({ value, label: labels[value] }))}
|
||||
/>
|
||||
<Button size="small" onClick={() => read.mutate(item.id)}>
|
||||
标记已读
|
||||
</Button>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<Drawer
|
||||
title="咨询详情"
|
||||
open={Boolean(selectedId)}
|
||||
onClose={() => setSelectedId(undefined)}
|
||||
loading={detail.isLoading}
|
||||
width={520}
|
||||
<>
|
||||
<AdminPageHeader title="咨询记录" description="查看访客提交的咨询和预约,并跟进处理进度。" />
|
||||
<AdminSection
|
||||
title="预约咨询"
|
||||
extra={
|
||||
<Space>
|
||||
<Select
|
||||
allowClear
|
||||
placeholder="全部状态"
|
||||
className="admin-field-w-md"
|
||||
value={status}
|
||||
onChange={setStatus}
|
||||
options={statuses.map((value) => ({ value, label: labels[value] }))}
|
||||
/>
|
||||
<Badge
|
||||
count={
|
||||
query.data?.filter((item) => !(item as AdminBooking & { isRead?: boolean }).isRead)
|
||||
.length ?? 0
|
||||
}
|
||||
showZero
|
||||
/>
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
{detail.data && (
|
||||
<Descriptions column={1} bordered size="small">
|
||||
<Descriptions.Item label="编号">{detail.data.bookingNo}</Descriptions.Item>
|
||||
<Descriptions.Item label="联系人">{detail.data.customerName}</Descriptions.Item>
|
||||
<Descriptions.Item label="状态">
|
||||
{labels[detail.data.status] ?? detail.data.status}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="提交时间">
|
||||
{new Date(detail.data.createdAt).toLocaleString("zh-CN")}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="管理员备注">
|
||||
{detail.data.adminNote || "暂无"}
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
)}
|
||||
</Drawer>
|
||||
<Card
|
||||
<Table
|
||||
rowKey="id"
|
||||
loading={query.isLoading}
|
||||
locale={{ emptyText: "还没有预约咨询。" }}
|
||||
dataSource={query.data ?? []}
|
||||
columns={[
|
||||
{
|
||||
title: "编号",
|
||||
dataIndex: "bookingNo",
|
||||
render: (value: string, item: AdminBooking) => (
|
||||
<Button type="link" onClick={() => setSelectedId(item.id)}>
|
||||
{value}
|
||||
</Button>
|
||||
),
|
||||
},
|
||||
{ title: "联系人", dataIndex: "customerName" },
|
||||
{
|
||||
title: "提交时间",
|
||||
dataIndex: "createdAt",
|
||||
render: (value: string) => new Date(value).toLocaleString("zh-CN"),
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
dataIndex: "status",
|
||||
render: (value: string) => (
|
||||
<StatusTag tone={statusTones[value] ?? "neutral"} label={labels[value] ?? value} />
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
render: (_: unknown, item: AdminBooking) => (
|
||||
<Space>
|
||||
<Select
|
||||
size="small"
|
||||
value={item.status}
|
||||
onChange={(value) => update.mutate({ id: item.id, value: value as never })}
|
||||
options={statuses.map((value) => ({ value, label: labels[value] }))}
|
||||
/>
|
||||
<Button type="link" size="small" onClick={() => read.mutate(item.id)}>
|
||||
标记已读
|
||||
</Button>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<Drawer
|
||||
title="咨询详情"
|
||||
open={Boolean(selectedId)}
|
||||
onClose={() => setSelectedId(undefined)}
|
||||
loading={detail.isLoading}
|
||||
width={520}
|
||||
>
|
||||
{detail.data && (
|
||||
<Descriptions column={1} bordered size="small">
|
||||
<Descriptions.Item label="编号">{detail.data.bookingNo}</Descriptions.Item>
|
||||
<Descriptions.Item label="联系人">{detail.data.customerName}</Descriptions.Item>
|
||||
<Descriptions.Item label="状态">
|
||||
{labels[detail.data.status] ?? detail.data.status}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="提交时间">
|
||||
{new Date(detail.data.createdAt).toLocaleString("zh-CN")}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="管理员备注">
|
||||
{detail.data.adminNote || "暂无"}
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
)}
|
||||
</Drawer>
|
||||
</AdminSection>
|
||||
<AdminSection
|
||||
title={`动态咨询提交${submissions.data ? `(${submissions.data.length})` : ""}`}
|
||||
style={{ marginTop: 24 }}
|
||||
description="按模板表单提交的咨询记录,字段随表单配置变化。"
|
||||
extra={
|
||||
<Button onClick={() => void submissions.refetch()} loading={submissions.isFetching}>
|
||||
刷新提交记录
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
{submissions.isError && (
|
||||
<Card type="inner" style={{ marginBottom: 16 }}>
|
||||
动态咨询提交加载失败:
|
||||
{submissions.error instanceof Error ? submissions.error.message : "未知错误"}
|
||||
<Button type="link" onClick={() => void submissions.refetch()}>
|
||||
重试
|
||||
</Button>
|
||||
</Card>
|
||||
)}
|
||||
<Space style={{ marginBottom: 12 }}>
|
||||
{submissions.isError ? (
|
||||
<ErrorNote error={submissions.error} onRetry={() => void submissions.refetch()} />
|
||||
) : null}
|
||||
<Space
|
||||
className={`admin-offset-bottom-sm ${submissions.isError ? "admin-offset-top" : ""}`}
|
||||
>
|
||||
<Select
|
||||
allowClear
|
||||
placeholder="动态咨询状态"
|
||||
style={{ width: 140 }}
|
||||
className="admin-field-w-md"
|
||||
value={submissionStatus}
|
||||
onChange={setSubmissionStatus}
|
||||
options={inquiryStatuses.map((value) => ({ value, label: inquiryLabels[value] }))}
|
||||
@@ -228,7 +237,10 @@ export function InquiriesPage() {
|
||||
title: "状态",
|
||||
dataIndex: "status",
|
||||
render: (value: InquirySubmission["status"]) => (
|
||||
<Tag>{inquiryLabels[value] ?? value}</Tag>
|
||||
<StatusTag
|
||||
tone={statusTones[value] ?? "neutral"}
|
||||
label={inquiryLabels[value] ?? value}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{ title: "版本", dataIndex: "formVersion", render: (value) => `v${value}` },
|
||||
@@ -251,7 +263,7 @@ export function InquiriesPage() {
|
||||
title: "跟进",
|
||||
render: (_: unknown, item: InquirySubmission) => (
|
||||
<Space>
|
||||
<Button size="small" onClick={() => setSelectedSubmission(item)}>
|
||||
<Button type="link" size="small" onClick={() => setSelectedSubmission(item)}>
|
||||
查看
|
||||
</Button>
|
||||
<Select
|
||||
@@ -314,7 +326,7 @@ export function InquiriesPage() {
|
||||
</Descriptions>
|
||||
)}
|
||||
</Drawer>
|
||||
</Card>
|
||||
</Card>
|
||||
</AdminSection>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
import { Button, Card, Col, List, Progress, Row, Space, Statistic, Tag, Typography } from "antd";
|
||||
import { Button, Card, Col, Progress, Row, Typography } from "antd";
|
||||
import { useQueries, useQuery } from "@tanstack/react-query";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { QueryState } from "../../components/QueryState.js";
|
||||
import { MetricCard } from "../../components/MetricCard.js";
|
||||
import { StatusTag } from "../../components/StatusTag.js";
|
||||
|
||||
export function OverviewPage() {
|
||||
const navigate = useNavigate();
|
||||
@@ -82,41 +84,32 @@ export function OverviewPage() {
|
||||
title="品牌概览"
|
||||
description="从这里检查品牌表达、信任内容和业务承接是否完整。"
|
||||
/>
|
||||
<Space direction="vertical" size={24} style={{ width: "100%" }}>
|
||||
<div className="admin-stack">
|
||||
<Card>
|
||||
<Typography.Title level={3} style={{ marginTop: 0 }}>
|
||||
{brand?.name || "未命名品牌"}
|
||||
</Typography.Title>
|
||||
<Typography.Paragraph type="secondary">
|
||||
{brand?.tagline || "还没有设置一句话定位"}
|
||||
</Typography.Paragraph>
|
||||
<Tag color="blue">
|
||||
当前模板:{workspace?.templateContent?.displayName ?? "尚未安装模板"}
|
||||
</Tag>
|
||||
<h2 className="admin-brand-title">{brand?.name || "未命名品牌"}</h2>
|
||||
<p className="admin-brand-tagline">{brand?.tagline || "还没有设置一句话定位"}</p>
|
||||
<StatusTag
|
||||
tone="info"
|
||||
label={`当前模板:${workspace?.templateContent?.displayName ?? "尚未安装模板"}`}
|
||||
/>
|
||||
</Card>
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col xs={24} sm={12} lg={6}>
|
||||
<Card>
|
||||
<Statistic
|
||||
title="信任证明"
|
||||
value={trust?.filter((item) => item.isPublished).length ?? 0}
|
||||
suffix="条已发布"
|
||||
/>
|
||||
</Card>
|
||||
<Col xs={24} sm={8}>
|
||||
<MetricCard
|
||||
label="信任证明"
|
||||
value={trust?.filter((item) => item.isPublished).length ?? 0}
|
||||
suffix="条已发布"
|
||||
/>
|
||||
</Col>
|
||||
<Col xs={24} sm={12} lg={6}>
|
||||
<Card>
|
||||
<Statistic
|
||||
title="业务展示内容"
|
||||
value={offerings?.filter((item) => item.isEnabled).length ?? 0}
|
||||
suffix="项公开"
|
||||
/>
|
||||
</Card>
|
||||
<Col xs={24} sm={8}>
|
||||
<MetricCard
|
||||
label="业务展示内容"
|
||||
value={offerings?.filter((item) => item.isEnabled).length ?? 0}
|
||||
suffix="项公开"
|
||||
/>
|
||||
</Col>
|
||||
<Col xs={24} sm={12} lg={6}>
|
||||
<Card>
|
||||
<Statistic title="咨询提交" value={submissions?.length ?? 0} suffix="条" />
|
||||
</Card>
|
||||
<Col xs={24} sm={8}>
|
||||
<MetricCard label="咨询提交" value={submissions?.length ?? 0} suffix="条" />
|
||||
</Col>
|
||||
</Row>
|
||||
<Row gutter={[16, 16]}>
|
||||
@@ -139,57 +132,51 @@ export function OverviewPage() {
|
||||
: `还有 ${incompleteChecks.length} 项需要完善,完成后才能发布。`}
|
||||
</Typography.Paragraph>
|
||||
{incompleteChecks.length > 0 && (
|
||||
<List
|
||||
size="small"
|
||||
dataSource={incompleteChecks.slice(0, 4)}
|
||||
renderItem={(item) => (
|
||||
<List.Item
|
||||
actions={[
|
||||
<Button
|
||||
key={item.key}
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() => navigate(item.destination ?? "/admin/publication")}
|
||||
>
|
||||
去处理
|
||||
</Button>,
|
||||
]}
|
||||
>
|
||||
{item.label}
|
||||
</List.Item>
|
||||
)}
|
||||
/>
|
||||
<ul className="admin-list">
|
||||
{incompleteChecks.slice(0, 4).map((item) => (
|
||||
<li key={item.key} className="admin-row">
|
||||
<span className="admin-row-title">{item.label}</span>
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() => navigate(item.destination ?? "/admin/publication")}
|
||||
>
|
||||
去处理
|
||||
</Button>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</Card>
|
||||
</Col>
|
||||
<Col xs={24} lg={12}>
|
||||
<Card title="品牌内容检查">
|
||||
<List
|
||||
dataSource={checks}
|
||||
renderItem={(item) => (
|
||||
<List.Item>
|
||||
<Space>
|
||||
<Tag color={item.passed ? "success" : "default"}>
|
||||
{item.passed ? "已完成" : "待完善"}
|
||||
</Tag>
|
||||
<span>{item.label}</span>
|
||||
{!item.passed && (
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() => navigate(item.destination ?? "/admin/publication")}
|
||||
>
|
||||
去处理
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
</List.Item>
|
||||
)}
|
||||
/>
|
||||
<ul className="admin-list">
|
||||
{checks.map((item) => (
|
||||
<li key={item.key} className="admin-row">
|
||||
<div className="admin-row-line">
|
||||
<StatusTag
|
||||
tone={item.passed ? "success" : "neutral"}
|
||||
label={item.passed ? "已完成" : "待完善"}
|
||||
/>
|
||||
<span className="admin-row-title">{item.label}</span>
|
||||
</div>
|
||||
{!item.passed ? (
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() => navigate(item.destination ?? "/admin/publication")}
|
||||
>
|
||||
去处理
|
||||
</Button>
|
||||
) : null}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
</Space>
|
||||
</div>
|
||||
</QueryState>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
import { useEffect, useRef } from "react";
|
||||
import { Alert, Button, Card, Collapse, Flex, Space, Tag, Tooltip, Typography, theme } from "antd";
|
||||
import { LoadingOutlined } from "@ant-design/icons";
|
||||
import { Button, Card, Collapse, Flex, Space, Tooltip, Typography } from "antd";
|
||||
import type { MiniAppReleaseTask } from "@personal-brand/api-client";
|
||||
import { ErrorNote } from "../../components/QueryState.js";
|
||||
import { StatusTag } from "../../components/StatusTag.js";
|
||||
import type { StatusTone } from "../../components/StatusTag.js";
|
||||
|
||||
type ReleaseStatus = MiniAppReleaseTask["status"];
|
||||
|
||||
@@ -13,18 +15,18 @@ function isStaleBuilding(task: MiniAppReleaseTask): boolean {
|
||||
return !Number.isNaN(updatedAt) && Date.now() - updatedAt >= STALE_BUILDING_MS;
|
||||
}
|
||||
|
||||
const statusView: Record<ReleaseStatus, { label: string; color: string; hint: string }> = {
|
||||
built: { label: "待上传", color: "default", hint: "代码已构建,可上传到微信。" },
|
||||
uploaded: { label: "已上传微信", color: "blue", hint: "请在微信后台上传体验版并提交审核。" },
|
||||
const statusView: Record<ReleaseStatus, { label: string; tone: StatusTone; hint: string }> = {
|
||||
built: { label: "待上传", tone: "neutral", hint: "代码已构建,可上传到微信。" },
|
||||
uploaded: { label: "已上传微信", tone: "info", hint: "请在微信后台上传体验版并提交审核。" },
|
||||
under_review: {
|
||||
label: "审核中",
|
||||
color: "processing",
|
||||
tone: "warning",
|
||||
hint: "等待微信审核结果,通过后回到本页标记。",
|
||||
},
|
||||
approved: { label: "审核通过", color: "cyan", hint: "审核已通过,确认无误后标记为已发布。" },
|
||||
published: { label: "已发布", color: "green", hint: "该版本已发布,可继续编辑内容后再次上传。" },
|
||||
rejected: { label: "已驳回", color: "volcano", hint: "微信驳回后需修改内容并重新构建上传。" },
|
||||
failed: { label: "失败", color: "red", hint: "上次构建或上传失败,可直接重试。" },
|
||||
approved: { label: "审核通过", tone: "success", hint: "审核已通过,确认无误后标记为已发布。" },
|
||||
published: { label: "已发布", tone: "success", hint: "该版本已发布,可继续编辑内容后再次上传。" },
|
||||
rejected: { label: "已驳回", tone: "error", hint: "微信驳回后需修改内容并重新构建上传。" },
|
||||
failed: { label: "失败", tone: "error", hint: "上次构建或上传失败,可直接重试。" },
|
||||
};
|
||||
|
||||
function formatTime(value: string): string {
|
||||
@@ -50,7 +52,6 @@ export function MiniAppReleaseCard({
|
||||
onUpload: () => void;
|
||||
onStatusChange: (status: ReleaseStatus) => void;
|
||||
}) {
|
||||
const { token } = theme.useToken();
|
||||
const logRef = useRef<HTMLPreElement>(null);
|
||||
const logs = task.buildLogs ?? [];
|
||||
const status = statusView[task.status];
|
||||
@@ -104,72 +105,49 @@ export function MiniAppReleaseCard({
|
||||
<Space direction="vertical" size={4}>
|
||||
<Space wrap size={8} align="center">
|
||||
<Typography.Text strong>品牌内容 v{task.version}</Typography.Text>
|
||||
<Tag color={status.color}>{status.label}</Tag>
|
||||
<StatusTag label={status.label} tone={status.tone} />
|
||||
{building && (
|
||||
<Tag icon={<LoadingOutlined />} color="orange">
|
||||
{staleBuilding ? "构建已中断" : "构建中"}
|
||||
</Tag>
|
||||
<StatusTag tone="warning" label={staleBuilding ? "构建已中断" : "构建中"} />
|
||||
)}
|
||||
{task.weappUploadId && (
|
||||
<Typography.Text type="secondary">微信版本 {task.weappUploadId}</Typography.Text>
|
||||
)}
|
||||
</Space>
|
||||
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
|
||||
<span className="admin-text-xs">
|
||||
{staleBuilding ? "超过 15 分钟没有新的构建输出,可能已中断;可直接重试。" : status.hint}
|
||||
</Typography.Text>
|
||||
</span>
|
||||
<Tooltip title={`创建于 ${formatTime(task.createdAt)}`}>
|
||||
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
|
||||
更新于 {formatTime(task.updatedAt)}
|
||||
</Typography.Text>
|
||||
<span className="admin-text-xs-quiet">更新于 {formatTime(task.updatedAt)}</span>
|
||||
</Tooltip>
|
||||
</Space>
|
||||
{actions}
|
||||
</Flex>
|
||||
|
||||
{task.error && <Alert type="error" showIcon message={task.error} style={{ marginTop: 12 }} />}
|
||||
{task.error && (
|
||||
<div className="admin-offset-top-md">
|
||||
<ErrorNote error={new Error(task.error)} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{logs.length > 0 && (
|
||||
<Collapse
|
||||
ghost
|
||||
size="small"
|
||||
style={{ marginTop: 8 }}
|
||||
className="admin-offset-top-sm"
|
||||
{...(building || task.buildStatus === "failed" ? { defaultActiveKey: ["logs"] } : {})}
|
||||
items={[
|
||||
{
|
||||
key: "logs",
|
||||
label: (
|
||||
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
|
||||
构建日志({logs.length} 行)
|
||||
</Typography.Text>
|
||||
),
|
||||
label: <span className="admin-text-xs">构建日志({logs.length} 行)</span>,
|
||||
children: (
|
||||
<pre
|
||||
ref={logRef}
|
||||
style={{
|
||||
margin: 0,
|
||||
padding: 12,
|
||||
maxHeight: 220,
|
||||
overflow: "auto",
|
||||
fontSize: 12,
|
||||
lineHeight: 1.7,
|
||||
borderRadius: token.borderRadius,
|
||||
border: `1px solid ${token.colorBorderSecondary}`,
|
||||
background: token.colorFillQuaternary,
|
||||
}}
|
||||
>
|
||||
<pre ref={logRef} className="admin-log">
|
||||
{logs.map((log, index) => (
|
||||
<div
|
||||
key={`${log.at}-${index}`}
|
||||
style={{
|
||||
color:
|
||||
log.stream === "stderr" ? token.colorError : token.colorTextSecondary,
|
||||
whiteSpace: "pre-wrap",
|
||||
wordBreak: "break-all",
|
||||
}}
|
||||
className="admin-log__line"
|
||||
data-stream={log.stream}
|
||||
>
|
||||
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
|
||||
{formatLogTime(log.at)}
|
||||
</Typography.Text>
|
||||
<span className="admin-log__time">{formatLogTime(log.at)}</span>
|
||||
{" "}
|
||||
{log.message}
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,6 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import {
|
||||
Alert,
|
||||
Button,
|
||||
Card,
|
||||
Divider,
|
||||
Empty,
|
||||
Input,
|
||||
@@ -13,7 +12,6 @@ import {
|
||||
Select,
|
||||
Space,
|
||||
Spin,
|
||||
Tag,
|
||||
Tabs,
|
||||
Typography,
|
||||
message,
|
||||
@@ -21,7 +19,9 @@ import {
|
||||
import type { BrandTemplateKey } from "@personal-brand/api-client";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { MutationError, QueryState } from "../../components/QueryState.js";
|
||||
import { AdminSection } from "../../components/AdminSection.js";
|
||||
import { ErrorNote, MutationError, QueryState } from "../../components/QueryState.js";
|
||||
import { StatusTag, statusLabel } from "../../components/StatusTag.js";
|
||||
import { MiniAppReleaseCard } from "./MiniAppReleaseCard.js";
|
||||
|
||||
const client = createApiClient();
|
||||
@@ -268,17 +268,16 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
|
||||
const contentTab = null;
|
||||
const miniAppSettingsTab = (
|
||||
<Space direction="vertical" size={24} style={{ width: "100%" }}>
|
||||
<Card title="小程序上传配置">
|
||||
<Typography.Paragraph type="secondary">
|
||||
AppID 用于服务端调用微信官方上传工具;上传私钥保存前会使用 AES-256-GCM
|
||||
加密。小程序产物目录由系统构建流程决定,不需要手动修改。
|
||||
</Typography.Paragraph>
|
||||
<div className="admin-stack admin-stack-lg">
|
||||
<AdminSection
|
||||
title="小程序上传配置"
|
||||
description="AppID 用于服务端调用微信官方上传工具;上传私钥保存前会使用 AES-256-GCM 加密。"
|
||||
>
|
||||
{miniAppSettings.data?.buildError ? (
|
||||
<Alert
|
||||
type="warning"
|
||||
showIcon
|
||||
style={{ marginBottom: 12 }}
|
||||
className="admin-offset-bottom"
|
||||
message="小程序构建参数未就绪"
|
||||
description={miniAppSettings.data.buildError}
|
||||
/>
|
||||
@@ -286,7 +285,7 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
<Alert
|
||||
type="info"
|
||||
showIcon
|
||||
style={{ marginBottom: 12 }}
|
||||
className="admin-offset-bottom"
|
||||
message={`请求域名 ${miniAppSettings.data?.requestDomain ?? "未确认"}`}
|
||||
description="该域名在构建时写入小程序包,必须与微信后台“开发设置 → 服务器域名 → request 合法域名”一致;不一致会导致小程序打开即加载失败。"
|
||||
/>
|
||||
@@ -337,7 +336,7 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
autoComplete="off"
|
||||
spellCheck={false}
|
||||
placeholder={"-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----"}
|
||||
style={{ fontFamily: "monospace", fontSize: 12 }}
|
||||
className="admin-code-input"
|
||||
/>
|
||||
</Form.Item>
|
||||
<Space>
|
||||
@@ -345,15 +344,15 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
保存上传配置
|
||||
</Button>
|
||||
{miniAppSettings.data?.hasStoredCredentials ? (
|
||||
<Tag color="green">已加密保存上传凭据</Tag>
|
||||
<StatusTag tone="success" label="已加密保存上传凭据" />
|
||||
) : (
|
||||
<Tag color="warning">未配置上传私钥</Tag>
|
||||
<StatusTag tone="warning" label="未配置上传私钥" />
|
||||
)}
|
||||
</Space>
|
||||
<MutationError error={saveMiniAppSettings.error} />
|
||||
</Form>
|
||||
</Card>
|
||||
</Space>
|
||||
</AdminSection>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -380,13 +379,15 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
]}
|
||||
/>
|
||||
{activeTab === "content" && (
|
||||
<Space direction="vertical" size={24} style={{ width: "100%" }}>
|
||||
<section>
|
||||
<Typography.Title level={4}>1. 选择表达方式</Typography.Title>
|
||||
<div className="admin-stack">
|
||||
<AdminSection
|
||||
title="选择表达方式"
|
||||
description="行业模板决定内容结构,视觉模板决定小程序的排版风格。"
|
||||
>
|
||||
<Space wrap>
|
||||
<Select
|
||||
aria-label="行业模板"
|
||||
style={{ width: 220 }}
|
||||
className="admin-field-w-xl"
|
||||
value={industryKey}
|
||||
disabled={!canManageTemplate || Boolean(workspace.data?.installations.length)}
|
||||
options={(catalog.data?.industries ?? []).map((item) => ({
|
||||
@@ -397,7 +398,7 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
/>
|
||||
<Select
|
||||
aria-label="视觉模板"
|
||||
style={{ width: 220 }}
|
||||
className="admin-field-w-xl"
|
||||
value={visualKey}
|
||||
disabled={!canManageTemplate}
|
||||
loading={selectVisual.isPending}
|
||||
@@ -409,19 +410,20 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
)}
|
||||
</Space>
|
||||
{workspace.data?.installations.length ? (
|
||||
<Typography.Paragraph type="secondary" style={{ marginTop: 8 }}>
|
||||
<p className="admin-section-description admin-offset-top-sm">
|
||||
当前品牌已安装主模板。模板版本与升级在高级设置中管理。
|
||||
</Typography.Paragraph>
|
||||
</p>
|
||||
) : null}
|
||||
<MutationError error={install.error || selectVisual.error} />
|
||||
<Divider />
|
||||
<Divider className="admin-divider" />
|
||||
<Space wrap>
|
||||
<Typography.Text>示例内容</Typography.Text>
|
||||
{sample.isLoading && <Spin size="small" />}
|
||||
{sample.data && (
|
||||
<Tag color={sample.data.alreadyImported ? "green" : "blue"}>
|
||||
{sample.data.alreadyImported ? "已导入" : "可导入"}
|
||||
</Tag>
|
||||
<StatusTag
|
||||
tone={sample.data.alreadyImported ? "success" : "info"}
|
||||
label={sample.data.alreadyImported ? "已导入" : "可导入"}
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
disabled={!canManageTemplate || !sample.data || sample.data.alreadyImported}
|
||||
@@ -433,60 +435,106 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
{sample.isError && <Button onClick={() => void sample.refetch()}>重试</Button>}
|
||||
</Space>
|
||||
{sample.isError && (
|
||||
<Alert
|
||||
type="error"
|
||||
message={sample.error instanceof Error ? sample.error.message : "示例内容加载失败"}
|
||||
showIcon
|
||||
style={{ marginTop: 8 }}
|
||||
/>
|
||||
<div className="admin-offset-top-sm">
|
||||
<ErrorNote error={sample.error} onRetry={() => void sample.refetch()} />
|
||||
</div>
|
||||
)}
|
||||
{sample.data && !sample.data.alreadyImported && (
|
||||
<Typography.Paragraph type="secondary" style={{ marginTop: 8 }}>
|
||||
<p className="admin-section-description admin-offset-top-sm">
|
||||
将向草稿添加{" "}
|
||||
{Object.entries(sample.data.counts)
|
||||
.map(([key, count]) => `${key} ${count} 项`)
|
||||
.join("、")}
|
||||
;发布前请替换示例文案和图片。
|
||||
</Typography.Paragraph>
|
||||
</p>
|
||||
)}
|
||||
<MutationError error={importSample.error} />
|
||||
</section>
|
||||
</Space>
|
||||
)}
|
||||
{activeTab === "content" && (
|
||||
<Space direction="vertical" size={24} style={{ width: "100%" }}>
|
||||
<section>
|
||||
<Typography.Title level={4}>3. 检查并发布</Typography.Title>
|
||||
<Space wrap style={{ marginBottom: 12 }}>
|
||||
<Tag color={currentRelease ? "green" : "default"}>
|
||||
{currentRelease ? `已发布 v${currentRelease.version}` : "尚未发布"}
|
||||
</Tag>
|
||||
<Button onClick={() => void readiness.refetch()}>重新检查</Button>
|
||||
</AdminSection>
|
||||
<AdminSection
|
||||
title="核对草稿内容"
|
||||
description="此处核对的是待发布内容,不是小程序视觉预览。"
|
||||
>
|
||||
<ul className="admin-list">
|
||||
<li className="admin-row">
|
||||
<div className="admin-row-main">
|
||||
<div className="admin-row-line">
|
||||
<span className="admin-row-title">{brand.data?.name || "未命名品牌"}</span>
|
||||
<span className="admin-row-meta">
|
||||
{brand.data?.tagline || "尚未填写品牌定位"}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li className="admin-row">
|
||||
<div className="admin-row-main">
|
||||
<div className="admin-row-line">
|
||||
<span className="admin-row-title">已启用业务项</span>
|
||||
<span className="admin-row-meta">
|
||||
{draftOfferings.map((item) => item.name).join("、") || "无"}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li className="admin-row">
|
||||
<div className="admin-row-main">
|
||||
<div className="admin-row-line">
|
||||
<span className="admin-row-title">已启用咨询表单</span>
|
||||
<span className="admin-row-meta">
|
||||
{draftForms
|
||||
.filter((item) => item.isEnabled)
|
||||
.map((item) => item.name)
|
||||
.join("、") || "无"}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<Space wrap className="admin-offset-top">
|
||||
<Button onClick={() => navigate("/admin/brand")}>编辑小程序页面</Button>
|
||||
<Button onClick={() => navigate("/admin/services")}>编辑业务展示和详情</Button>
|
||||
<Button onClick={() => navigate("/admin/trust")}>编辑信任证明</Button>
|
||||
</Space>
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
</AdminSection>
|
||||
<AdminSection
|
||||
title="检查并发布"
|
||||
extra={
|
||||
<Space wrap>
|
||||
<StatusTag
|
||||
tone={currentRelease ? "success" : "neutral"}
|
||||
label={currentRelease ? `已发布 v${currentRelease.version}` : "尚未发布"}
|
||||
/>
|
||||
<Button onClick={() => void readiness.refetch()}>重新检查</Button>
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<ul className="admin-list">
|
||||
{(readiness.data?.checks ?? []).map((check) => (
|
||||
<Space key={check.key}>
|
||||
<Tag color={check.passed ? "success" : "warning"}>
|
||||
{check.passed ? "已完成" : "待完善"}
|
||||
</Tag>
|
||||
<Typography.Text>{check.label}</Typography.Text>
|
||||
{check.help ? (
|
||||
<Typography.Text type="secondary">{check.help}</Typography.Text>
|
||||
) : null}
|
||||
{!check.passed && (
|
||||
<li key={check.key} className="admin-row">
|
||||
<div className="admin-row-main">
|
||||
<div className="admin-row-line">
|
||||
<StatusTag
|
||||
tone={check.passed ? "success" : "warning"}
|
||||
label={check.passed ? "已完成" : "待完善"}
|
||||
/>
|
||||
<span className="admin-row-title">{check.label}</span>
|
||||
{check.help ? <span className="admin-row-meta">{check.help}</span> : null}
|
||||
</div>
|
||||
</div>
|
||||
{!check.passed ? (
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() =>
|
||||
navigate(check.destination ?? destinations[check.key] ?? "/admin/overview")
|
||||
}
|
||||
>
|
||||
去处理
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
) : null}
|
||||
</li>
|
||||
))}
|
||||
</Space>
|
||||
<Space wrap style={{ marginTop: 16 }}>
|
||||
</ul>
|
||||
<Space wrap className="admin-offset-top">
|
||||
<Button
|
||||
type="primary"
|
||||
disabled={!readiness.data?.ready}
|
||||
@@ -501,85 +549,69 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
)}
|
||||
</Space>
|
||||
<MutationError error={publish.error || revoke.error} />
|
||||
<Divider />
|
||||
<Typography.Title level={5}>发布记录</Typography.Title>
|
||||
<Divider className="admin-divider" />
|
||||
<h3 className="admin-section-title">发布记录</h3>
|
||||
{releases.data?.length ? (
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<ul className="admin-list admin-offset-top-xs">
|
||||
{releases.data.map((item) => (
|
||||
<Space key={item.id} wrap>
|
||||
<Typography.Text>v{item.version}</Typography.Text>
|
||||
<Tag color={item.status === "published" ? "green" : "default"}>
|
||||
{item.status}
|
||||
</Tag>
|
||||
<Typography.Text type="secondary">
|
||||
{new Date(item.createdAt).toLocaleString("zh-CN")}
|
||||
</Typography.Text>
|
||||
{item.note && <Typography.Text>{item.note}</Typography.Text>}
|
||||
{item.status === "superseded" && publishedHistory.length > 1 && (
|
||||
<Button size="small" onClick={() => setRollbackVersion(item.version)}>
|
||||
<li key={item.id} className="admin-row">
|
||||
<div className="admin-row-main">
|
||||
<div className="admin-row-line">
|
||||
<span className="admin-row-title">v{item.version}</span>
|
||||
<StatusTag
|
||||
tone={item.status === "published" ? "success" : "neutral"}
|
||||
label={statusLabel(item.status)}
|
||||
/>
|
||||
<span className="admin-row-meta">
|
||||
{new Date(item.createdAt).toLocaleString("zh-CN")}
|
||||
</span>
|
||||
{item.note ? <span className="admin-row-meta">{item.note}</span> : null}
|
||||
</div>
|
||||
</div>
|
||||
{item.status === "superseded" && publishedHistory.length > 1 ? (
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() => setRollbackVersion(item.version)}
|
||||
>
|
||||
恢复此版本
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
) : null}
|
||||
</li>
|
||||
))}
|
||||
</Space>
|
||||
</ul>
|
||||
) : (
|
||||
<Empty description="暂无发布记录" />
|
||||
<Empty description="暂无发布记录" image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
||||
)}
|
||||
<MutationError error={rollback.error} />
|
||||
</section>
|
||||
<section>
|
||||
<Typography.Title level={4}>2. 核对草稿内容</Typography.Title>
|
||||
<Typography.Paragraph type="secondary">
|
||||
此处核对的是待发布内容,不是小程序视觉预览。
|
||||
</Typography.Paragraph>
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<Typography.Text strong>{brand.data?.name || "未命名品牌"}</Typography.Text>
|
||||
<Typography.Text>{brand.data?.tagline || "尚未填写品牌定位"}</Typography.Text>
|
||||
<Typography.Text>
|
||||
已启用业务项:{draftOfferings.map((item) => item.name).join("、") || "无"}
|
||||
</Typography.Text>
|
||||
<Typography.Text>
|
||||
已启用咨询表单:
|
||||
{draftForms
|
||||
.filter((item) => item.isEnabled)
|
||||
.map((item) => item.name)
|
||||
.join("、") || "无"}
|
||||
</Typography.Text>
|
||||
<Space wrap>
|
||||
<Button onClick={() => navigate("/admin/brand")}>编辑小程序页面</Button>
|
||||
<Button onClick={() => navigate("/admin/services")}>编辑业务展示和详情</Button>
|
||||
<Button onClick={() => navigate("/admin/trust")}>编辑信任证明</Button>
|
||||
</Space>
|
||||
</Space>
|
||||
</section>
|
||||
</Space>
|
||||
</AdminSection>
|
||||
</div>
|
||||
)}
|
||||
{activeTab === "miniapp" && (
|
||||
<Space direction="vertical" size={24} style={{ width: "100%" }}>
|
||||
<section>
|
||||
<Typography.Title level={4}>小程序代码发布</Typography.Title>
|
||||
<Typography.Paragraph type="secondary">
|
||||
使用微信官方 miniprogram-ci 上传代码;审核与发布状态需按微信平台结果人工确认。
|
||||
</Typography.Paragraph>
|
||||
<Space wrap style={{ marginBottom: 12 }}>
|
||||
<Button
|
||||
type="primary"
|
||||
disabled={!currentRelease}
|
||||
loading={uploadLatestMiniAppRelease.isPending}
|
||||
onClick={() => uploadLatestMiniAppRelease.mutate()}
|
||||
>
|
||||
上传当前版本到微信
|
||||
</Button>
|
||||
{miniAppSettings.data?.hasStoredCredentials ? (
|
||||
<Tag color="green">已配置上传凭据</Tag>
|
||||
) : (
|
||||
<Tag color="warning">未配置上传凭据</Tag>
|
||||
)}
|
||||
</Space>
|
||||
<Divider />
|
||||
<div className="admin-stack admin-stack-lg">
|
||||
<AdminSection
|
||||
title="小程序代码发布"
|
||||
description="使用微信官方工具上传代码;审核与发布状态需按微信平台结果人工确认。"
|
||||
extra={
|
||||
<Space wrap>
|
||||
<Button
|
||||
type="primary"
|
||||
disabled={!currentRelease}
|
||||
loading={uploadLatestMiniAppRelease.isPending}
|
||||
onClick={() => uploadLatestMiniAppRelease.mutate()}
|
||||
>
|
||||
上传当前版本到微信
|
||||
</Button>
|
||||
{miniAppSettings.data?.hasStoredCredentials ? (
|
||||
<StatusTag tone="success" label="已配置上传凭据" />
|
||||
) : (
|
||||
<StatusTag tone="warning" label="未配置上传凭据" />
|
||||
)}
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
{miniAppReleases.data?.length ? (
|
||||
<Space direction="vertical" size={12} style={{ width: "100%" }}>
|
||||
<div className="admin-stack admin-stack-tight">
|
||||
{miniAppReleases.data.map((task) => (
|
||||
<MiniAppReleaseCard
|
||||
key={task.id}
|
||||
@@ -589,12 +621,12 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
onStatusChange={(status) => updateMiniAppStatus.mutate({ id: task.id, status })}
|
||||
/>
|
||||
))}
|
||||
</Space>
|
||||
</div>
|
||||
) : (
|
||||
<Empty description="暂无小程序发布任务" />
|
||||
<Empty description="暂无小程序发布任务" image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
||||
)}
|
||||
</section>
|
||||
</Space>
|
||||
</AdminSection>
|
||||
</div>
|
||||
)}
|
||||
<Modal
|
||||
title={confirmAction === "revoke" ? "确认撤回品牌" : "确认发布品牌"}
|
||||
@@ -611,7 +643,7 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
message="撤回后,小程序将显示品牌尚未发布,新的咨询和预约会停止受理。"
|
||||
/>
|
||||
) : (
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<div className="admin-stack">
|
||||
<Typography.Text>当前草稿将成为品牌新的公开版本。</Typography.Text>
|
||||
<Input
|
||||
value={note}
|
||||
@@ -619,7 +651,7 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
||||
placeholder="发布备注(可选)"
|
||||
maxLength={200}
|
||||
/>
|
||||
</Space>
|
||||
</div>
|
||||
)}
|
||||
</Modal>
|
||||
<Modal
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { Button, Popconfirm, Space, Table, Tag, Typography } from "antd";
|
||||
import { Button, Popconfirm, Space, Table } from "antd";
|
||||
import type { Offering } from "@personal-brand/api-client";
|
||||
import { AdminSection } from "../../components/AdminSection.js";
|
||||
import { MutationError } from "../../components/QueryState.js";
|
||||
import { StatusTag } from "../../components/StatusTag.js";
|
||||
import type { useOfferingMutations } from "./use-offering-data.js";
|
||||
|
||||
type OfferingsTableProps = {
|
||||
@@ -36,22 +38,27 @@ export function OfferingsTable({
|
||||
{
|
||||
title: "业务类型",
|
||||
dataIndex: "kind",
|
||||
render: (value: unknown) => <Tag>{offeringKindLabels[String(value)] ?? String(value)}</Tag>,
|
||||
render: (value: unknown) => (
|
||||
<StatusTag tone="neutral" label={offeringKindLabels[String(value)] ?? String(value)} />
|
||||
),
|
||||
},
|
||||
{ title: "价格", dataIndex: "priceText" },
|
||||
{
|
||||
title: "状态",
|
||||
dataIndex: "isEnabled",
|
||||
render: (value: boolean) => (value ? "已启用" : "已停用"),
|
||||
render: (value: boolean) => (
|
||||
<StatusTag tone={value ? "success" : "neutral"} label={value ? "已启用" : "已停用"} />
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
render: (_: unknown, item: Offering) => (
|
||||
<Space>
|
||||
<Button size="small" onClick={() => onEdit(item)}>
|
||||
<Button type="link" size="small" onClick={() => onEdit(item)}>
|
||||
编辑详情
|
||||
</Button>
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
loading={toggleOffering.isPending && toggleOffering.variables?.id === item.id}
|
||||
onClick={() => toggleOffering.mutate({ id: item.id, isEnabled: !item.isEnabled })}
|
||||
@@ -66,6 +73,7 @@ export function OfferingsTable({
|
||||
cancelText="取消"
|
||||
>
|
||||
<Button
|
||||
type="link"
|
||||
danger
|
||||
size="small"
|
||||
loading={deleteOffering.isPending && deleteOffering.variables === item.id}
|
||||
@@ -79,20 +87,14 @@ export function OfferingsTable({
|
||||
];
|
||||
|
||||
return (
|
||||
<section aria-label="业务提供项列表">
|
||||
<Space wrap style={{ marginBottom: 16 }}>
|
||||
<Typography.Title level={5} style={{ margin: 0 }}>
|
||||
{pageLabel}中的内容
|
||||
</Typography.Title>
|
||||
<Tag color="blue">已启用的项目会公开展示</Tag>
|
||||
</Space>
|
||||
{detailSectionTitles.length ? (
|
||||
<Typography.Paragraph type="secondary">
|
||||
编辑单项详情时,附加字段将用于:
|
||||
{detailSectionTitles.join("、")}
|
||||
。列表中的名称、说明、价格和封面也会显示在业务展示页。
|
||||
</Typography.Paragraph>
|
||||
) : null}
|
||||
<AdminSection
|
||||
title={`${pageLabel}中的内容`}
|
||||
description={
|
||||
detailSectionTitles.length
|
||||
? `编辑单项详情时,附加字段将用于:${detailSectionTitles.join("、")}。列表中的名称、说明、价格和封面也会显示在业务展示页。`
|
||||
: "已启用的项目会公开展示。"
|
||||
}
|
||||
>
|
||||
<Table
|
||||
scroll={{ x: 760 }}
|
||||
rowKey="id"
|
||||
@@ -101,13 +103,13 @@ export function OfferingsTable({
|
||||
columns={columns}
|
||||
/>
|
||||
{items.length === 0 && (
|
||||
<Typography.Paragraph type="secondary">
|
||||
<p className="admin-empty-inline">
|
||||
还没有公开业务提供项。创建后,小程序服务页会优先读取这些内容。
|
||||
</Typography.Paragraph>
|
||||
</p>
|
||||
)}
|
||||
<MutationError error={saveError} />
|
||||
<MutationError error={toggleOffering.error} />
|
||||
<MutationError error={deleteOffering.error} />
|
||||
</section>
|
||||
</AdminSection>
|
||||
);
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 72vh;
|
||||
border: 1px solid #e5e7eb;
|
||||
border: 1px solid var(--admin-border);
|
||||
border-radius: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
@@ -47,8 +47,8 @@
|
||||
overflow-y: auto;
|
||||
padding: 20px 16px 24px;
|
||||
border-radius: 12px;
|
||||
background: #f8fafc;
|
||||
border: 1px solid #e5e7eb;
|
||||
background: var(--admin-fill);
|
||||
border: 1px solid var(--admin-border);
|
||||
}
|
||||
|
||||
.service-offering-editor__form-scroll > .ant-typography:first-child {
|
||||
@@ -62,7 +62,7 @@
|
||||
.service-offering-editor__form-scroll .ant-typography h5.ant-typography {
|
||||
margin: 28px 0 4px;
|
||||
padding-bottom: 8px;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
border-bottom: 1px solid var(--admin-border);
|
||||
}
|
||||
|
||||
.service-offering-editor__form-scroll > .ant-typography-secondary {
|
||||
|
||||
@@ -1,23 +1,11 @@
|
||||
import {
|
||||
Alert,
|
||||
Button,
|
||||
Card,
|
||||
Form,
|
||||
Input,
|
||||
Modal,
|
||||
Select,
|
||||
Space,
|
||||
Table,
|
||||
Tag,
|
||||
Typography,
|
||||
message,
|
||||
} from "antd";
|
||||
import { Alert, Button, Card, Form, Input, Modal, Select, Space, Table, message } from "antd";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import type { AdminBrandMember } from "@personal-brand/api-client";
|
||||
import { useState } from "react";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { MutationError, QueryState } from "../../components/QueryState.js";
|
||||
import { StatusTag } from "../../components/StatusTag.js";
|
||||
|
||||
const roleLabels: Record<string, string> = {
|
||||
owner: "负责人",
|
||||
@@ -81,9 +69,9 @@ export function MembersPage() {
|
||||
<Alert
|
||||
type="info"
|
||||
showIcon
|
||||
className="admin-offset-bottom"
|
||||
message="请将初始账号和密码安全地交给成员"
|
||||
description="当前采用负责人手动添加方式;系统不会再次显示成员初始密码。"
|
||||
style={{ marginBottom: 16 }}
|
||||
/>
|
||||
<Table
|
||||
rowKey="id"
|
||||
@@ -127,9 +115,12 @@ export function MembersPage() {
|
||||
title: "说明",
|
||||
render: (_: unknown, item: AdminBrandMember) => (
|
||||
<Space>
|
||||
<Tag>{roleLabels[item.role] ?? item.role}</Tag>
|
||||
<StatusTag
|
||||
tone={item.role === "owner" ? "info" : "neutral"}
|
||||
label={roleLabels[item.role] ?? item.role}
|
||||
/>
|
||||
{!item.adminUser.isEnabled ? (
|
||||
<Typography.Text type="danger">账号已停用</Typography.Text>
|
||||
<StatusTag tone="warning" label="账号已停用" />
|
||||
) : null}
|
||||
</Space>
|
||||
),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Button, Divider, Form, Typography } from "antd";
|
||||
import { Button, Form } from "antd";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { AdminSection } from "../../components/AdminSection.js";
|
||||
import { QueryState } from "../../components/QueryState.js";
|
||||
import { TrustContentEditorModal } from "./components/TrustContentEditorModal.js";
|
||||
import { TrustContentTable } from "./components/TrustContentTable.js";
|
||||
@@ -61,29 +62,27 @@ export function TrustContentPage() {
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
<section aria-labelledby="trust-requirements-title">
|
||||
<Typography.Title id="trust-requirements-title" level={5}>
|
||||
当前模板需要配置的内容
|
||||
</Typography.Title>
|
||||
<Typography.Paragraph type="secondary">
|
||||
标记为“发布必填”的项目需要填写完整后,才能发布小程序。
|
||||
</Typography.Paragraph>
|
||||
<AdminSection
|
||||
title="当前模板需要配置的内容"
|
||||
description="标记为「发布必填」的项目需要填写完整后,才能发布小程序。"
|
||||
>
|
||||
<TrustRequirementsList
|
||||
availableTypes={availableTypes}
|
||||
contentByType={contentByType}
|
||||
items={query.data ?? []}
|
||||
onEdit={begin}
|
||||
/>
|
||||
</section>
|
||||
<Divider />
|
||||
<TrustContentTable
|
||||
availableTypes={availableTypes}
|
||||
items={query.data ?? []}
|
||||
removeError={remove.error}
|
||||
removePending={remove.isPending}
|
||||
onEdit={(item) => begin(item)}
|
||||
onDelete={(id) => remove.mutate(id)}
|
||||
/>
|
||||
</AdminSection>
|
||||
<AdminSection title="已配置的品牌内容">
|
||||
<TrustContentTable
|
||||
availableTypes={availableTypes}
|
||||
items={query.data ?? []}
|
||||
removeError={remove.error}
|
||||
removePending={remove.isPending}
|
||||
onEdit={(item) => begin(item)}
|
||||
onDelete={(id) => remove.mutate(id)}
|
||||
/>
|
||||
</AdminSection>
|
||||
<TrustContentEditorModal
|
||||
availableTypes={availableTypes}
|
||||
editing={editing}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { Button, Popconfirm, Space, Table, Tag } from "antd";
|
||||
import { Button, Popconfirm, Space, Table } from "antd";
|
||||
import type { TrustContent } from "@personal-brand/api-client";
|
||||
import type { TrustTypeOption } from "../domain/trust-content-domain.js";
|
||||
import { getTrustContentPreview } from "../domain/trust-content-domain.js";
|
||||
import { MutationError } from "../../../components/QueryState.js";
|
||||
import { StatusTag } from "../../../components/StatusTag.js";
|
||||
|
||||
export function TrustContentTable({
|
||||
availableTypes,
|
||||
@@ -30,7 +31,10 @@ export function TrustContentTable({
|
||||
title: "内容类型",
|
||||
dataIndex: "type",
|
||||
render: (value) => (
|
||||
<Tag>{availableTypes.find((item) => item.type === value)?.label ?? value}</Tag>
|
||||
<StatusTag
|
||||
tone="neutral"
|
||||
label={availableTypes.find((item) => item.type === value)?.label ?? String(value)}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{ title: "标题", dataIndex: "title" },
|
||||
@@ -47,14 +51,17 @@ export function TrustContentTable({
|
||||
title: "发布状态",
|
||||
dataIndex: "isPublished",
|
||||
render: (value) => (
|
||||
<Tag color={value ? "success" : "default"}>{value ? "随发布展示" : "草稿"}</Tag>
|
||||
<StatusTag
|
||||
tone={value ? "success" : "neutral"}
|
||||
label={value ? "随发布展示" : "草稿"}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
render: (_: unknown, item: TrustContent) => (
|
||||
<Space>
|
||||
<Button size="small" onClick={() => onEdit(item)}>
|
||||
<Button type="link" size="small" onClick={() => onEdit(item)}>
|
||||
编辑
|
||||
</Button>
|
||||
<Popconfirm
|
||||
@@ -62,7 +69,7 @@ export function TrustContentTable({
|
||||
description="删除后需发布品牌,才会更新小程序展示。"
|
||||
onConfirm={() => onDelete(item.id)}
|
||||
>
|
||||
<Button size="small" danger loading={removePending}>
|
||||
<Button type="link" size="small" danger loading={removePending}>
|
||||
删除
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Button, List, Space, Tag, Typography } from "antd";
|
||||
import { Button } from "antd";
|
||||
import { isTrustContentComplete } from "@personal-brand/api-client";
|
||||
import type { TrustContent } from "@personal-brand/api-client";
|
||||
import type { TrustTypeOption } from "../domain/trust-content-domain.js";
|
||||
import { StatusTag } from "../../../components/StatusTag.js";
|
||||
|
||||
export function TrustRequirementsList({
|
||||
availableTypes,
|
||||
@@ -15,10 +16,8 @@ export function TrustRequirementsList({
|
||||
onEdit: (item?: TrustContent, type?: string) => void;
|
||||
}) {
|
||||
return (
|
||||
<List
|
||||
size="small"
|
||||
dataSource={availableTypes}
|
||||
renderItem={(item) => {
|
||||
<ul className="admin-list">
|
||||
{availableTypes.map((item) => {
|
||||
const content = contentByType.get(item.type);
|
||||
const publishedCount = items.filter(
|
||||
(record) => record.type === item.type && record.isPublished,
|
||||
@@ -28,38 +27,41 @@ export function TrustRequirementsList({
|
||||
const complete = Boolean(content && isTrustContentComplete(content, item) && !tooMany);
|
||||
|
||||
return (
|
||||
<List.Item
|
||||
actions={[
|
||||
<Button
|
||||
key={item.type}
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() => (content ? onEdit(content) : onEdit(undefined, item.type))}
|
||||
>
|
||||
{content ? "编辑" : "新增"}
|
||||
</Button>,
|
||||
]}
|
||||
>
|
||||
<Space wrap>
|
||||
<Typography.Text strong>{item.label}</Typography.Text>
|
||||
{item.required && <Tag color="orange">发布必填</Tag>}
|
||||
{(item.pages ?? []).map((page) => (
|
||||
<Tag key={page}>{page}</Tag>
|
||||
))}
|
||||
<Tag color={complete ? "success" : "default"}>
|
||||
{tooMany
|
||||
? `公开内容过多(${publishedCount} 条)`
|
||||
: complete
|
||||
? "内容完整"
|
||||
: content
|
||||
? "需要完善"
|
||||
: "尚未填写"}
|
||||
</Tag>
|
||||
{item.help && <Typography.Text type="secondary">{item.help}</Typography.Text>}
|
||||
</Space>
|
||||
</List.Item>
|
||||
<li key={item.type} className="admin-row">
|
||||
<div className="admin-row-main">
|
||||
<div className="admin-row-line">
|
||||
<span className="admin-row-title">{item.label}</span>
|
||||
{item.required ? <StatusTag tone="warning" label="发布必填" /> : null}
|
||||
<StatusTag
|
||||
tone={tooMany ? "error" : complete ? "success" : "neutral"}
|
||||
label={
|
||||
tooMany
|
||||
? `公开内容过多(${publishedCount} 条)`
|
||||
: complete
|
||||
? "内容完整"
|
||||
: content
|
||||
? "需要完善"
|
||||
: "尚未填写"
|
||||
}
|
||||
/>
|
||||
{(item.pages ?? []).map((page) => (
|
||||
<span key={page} className="admin-row-meta">
|
||||
{page}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
{item.help ? <p className="admin-row-help">{item.help}</p> : null}
|
||||
</div>
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() => (content ? onEdit(content) : onEdit(undefined, item.type))}
|
||||
>
|
||||
{content ? "编辑" : "新增"}
|
||||
</Button>
|
||||
</li>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
})}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Button, Card, Form, Input, Modal, Select, Space, Table, Tag, Typography } from "antd";
|
||||
import { Button, Card, Form, Input, Modal, Select, Space, Table, Typography } from "antd";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { ApiClientError } from "@personal-brand/api-client";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
import { supportsIndustry, type IndustryTarget } from "./workspace-templates.js";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { MutationError } from "../../components/QueryState.js";
|
||||
import { StatusTag } from "../../components/StatusTag.js";
|
||||
|
||||
export const inquiryFieldTypes = [
|
||||
{ value: "text", label: "简短文字" },
|
||||
@@ -146,12 +147,12 @@ export function WorkspacePage() {
|
||||
}
|
||||
const { fields, installations } = query.data;
|
||||
return (
|
||||
<Space direction="vertical" size="large" style={{ width: "100%" }}>
|
||||
<div className="admin-stack admin-stack-lg">
|
||||
<AdminPageHeader
|
||||
title="模板与表单设置"
|
||||
description="日常小程序内容请从页面配置、业务展示和信任证明进入;这里主要管理模板、咨询入口和负责人设置。"
|
||||
/>
|
||||
<Card title="先完成日常配置" style={{ marginBottom: 24 }}>
|
||||
<Card title="先完成日常配置">
|
||||
<Typography.Paragraph type="secondary">
|
||||
下面这些入口面向日常经营,不需要理解模板或技术设置。完成后回到“配置与发布”统一检查并上线。
|
||||
</Typography.Paragraph>
|
||||
@@ -166,38 +167,45 @@ export function WorkspacePage() {
|
||||
</Card>
|
||||
<Card title="小程序当前状态" loading={runtimeQuery.isLoading}>
|
||||
{runtimeQuery.isError ? (
|
||||
<Typography.Text type="danger">公开运行时工作空间暂时无法加载。</Typography.Text>
|
||||
<StatusTag tone="error" label="公开运行时工作空间暂时无法加载" />
|
||||
) : (
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<div className="admin-stack">
|
||||
<Space wrap>
|
||||
<Tag color="green">小程序数据已同步</Tag>
|
||||
<Tag>公开业务 {runtimeQuery.data?.offerings?.length ?? 0} 项</Tag>
|
||||
<Tag>已启用能力 {runtimeQuery.data?.capabilities?.length ?? 0} 项</Tag>
|
||||
<StatusTag tone="success" label="小程序数据已同步" />
|
||||
<StatusTag
|
||||
tone="neutral"
|
||||
label={`公开业务 ${runtimeQuery.data?.offerings?.length ?? 0} 项`}
|
||||
/>
|
||||
<StatusTag
|
||||
tone="neutral"
|
||||
label={`已启用能力 ${runtimeQuery.data?.capabilities?.length ?? 0} 项`}
|
||||
/>
|
||||
</Space>
|
||||
<Typography.Paragraph type="secondary" style={{ marginBottom: 0 }}>
|
||||
<p className="admin-section-description admin-flush-top">
|
||||
小程序和后台预览会使用同一份已发布内容。这里的能力由当前模板自动提供,通常不需要手动调整。
|
||||
</Typography.Paragraph>
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<Typography.Text strong>已启用的服务能力</Typography.Text>
|
||||
</p>
|
||||
<div className="admin-stack">
|
||||
<h3 className="admin-section-title">已启用的服务能力</h3>
|
||||
{(runtimeQuery.data?.plugins ?? []).map((plugin) => (
|
||||
<Card key={plugin.key} size="small">
|
||||
<Space wrap>
|
||||
<Typography.Text strong>{plugin.displayName}</Typography.Text>
|
||||
<Tag color={plugin.status === "enabled" ? "green" : "orange"}>
|
||||
{plugin.status}
|
||||
</Tag>
|
||||
</Space>
|
||||
<Typography.Paragraph type="secondary" style={{ margin: "8px 0 0" }}>
|
||||
<div className="admin-row-line">
|
||||
<span className="admin-row-title">{plugin.displayName}</span>
|
||||
<StatusTag
|
||||
tone={plugin.status === "enabled" ? "success" : "warning"}
|
||||
label={plugin.status === "enabled" ? "已启用" : "未启用"}
|
||||
/>
|
||||
</div>
|
||||
<p className="admin-section-description admin-flush">
|
||||
这项能力已接入当前小程序流程,无需单独配置技术参数。
|
||||
</Typography.Paragraph>
|
||||
</p>
|
||||
</Card>
|
||||
))}
|
||||
{!runtimeQuery.data?.plugins?.length && (
|
||||
<Typography.Text type="secondary">当前模板未启用能力插件。</Typography.Text>
|
||||
<p className="admin-empty-inline">当前模板未启用能力插件。</p>
|
||||
)}
|
||||
</Space>
|
||||
</div>
|
||||
<Space wrap>
|
||||
<Typography.Text strong>视觉模板</Typography.Text>
|
||||
<span className="admin-field-label admin-flush">视觉模板</span>
|
||||
<Select
|
||||
value={runtimeQuery.data?.visualTemplate?.key}
|
||||
loading={visualTemplate.isPending}
|
||||
@@ -207,28 +215,33 @@ export function WorkspacePage() {
|
||||
]}
|
||||
/>
|
||||
{runtimeQuery.data?.visualTemplate && (
|
||||
<Tag>
|
||||
v{runtimeQuery.data.visualTemplate.version} ·{" "}
|
||||
{Object.values(runtimeQuery.data.visualTemplate.variants).join(" / ")}
|
||||
</Tag>
|
||||
<StatusTag
|
||||
tone="neutral"
|
||||
label={`v${runtimeQuery.data.visualTemplate.version} · ${Object.values(
|
||||
runtimeQuery.data.visualTemplate.variants,
|
||||
).join(" / ")}`}
|
||||
/>
|
||||
)}
|
||||
</Space>
|
||||
<MutationError error={visualTemplate.error} />
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<Typography.Text strong>视觉模板切换历史</Typography.Text>
|
||||
<div className="admin-stack">
|
||||
<h3 className="admin-section-title">视觉模板切换历史</h3>
|
||||
{visualHistory.data?.history.length ? (
|
||||
visualHistory.data.history.map((item) => (
|
||||
<Tag key={`${item.visualTemplateKey}-${item.savedAt}`}>
|
||||
{item.visualTemplateKey} · {item.savedAt}
|
||||
</Tag>
|
||||
))
|
||||
<div className="admin-row-line">
|
||||
{visualHistory.data.history.map((item) => (
|
||||
<StatusTag
|
||||
key={`${item.visualTemplateKey}-${item.savedAt}`}
|
||||
tone="neutral"
|
||||
label={`${item.visualTemplateKey} · ${item.savedAt}`}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<Typography.Text type="secondary">暂无历史版本</Typography.Text>
|
||||
<p className="admin-empty-inline">暂无历史版本</p>
|
||||
)}
|
||||
{visualHistory.data?.history.length ? (
|
||||
<Button
|
||||
danger
|
||||
size="small"
|
||||
onClick={() => rollbackVisual.mutate()}
|
||||
loading={rollbackVisual.isPending}
|
||||
>
|
||||
@@ -236,33 +249,33 @@ export function WorkspacePage() {
|
||||
</Button>
|
||||
) : null}
|
||||
<MutationError error={rollbackVisual.error} />
|
||||
</Space>
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<Typography.Text strong>可用视觉模板</Typography.Text>
|
||||
</div>
|
||||
<div className="admin-stack">
|
||||
<h3 className="admin-section-title">可用视觉模板</h3>
|
||||
<Space wrap>
|
||||
{compatibleVisuals.map((visual) => (
|
||||
<Card key={visual.key} size="small" style={{ width: 260 }}>
|
||||
<Typography.Text strong>{visual.name}</Typography.Text>
|
||||
<Typography.Paragraph type="secondary" ellipsis={{ rows: 2 }}>
|
||||
{visual.description}
|
||||
</Typography.Paragraph>
|
||||
<Space wrap>
|
||||
<Card key={visual.key} size="small" className="admin-visual-card">
|
||||
<span className="admin-row-title">{visual.name}</span>
|
||||
<p className="admin-row-summary">{visual.description}</p>
|
||||
<div className="admin-row-line">
|
||||
{Object.entries(visual.theme.colors).map(([name, color]) => (
|
||||
<Tag key={name} color={color.startsWith("#") ? "default" : "blue"}>
|
||||
<span
|
||||
key={name}
|
||||
className="admin-swatch"
|
||||
title={`${name} ${color}`}
|
||||
style={{ "--swatch-color": color } as React.CSSProperties}
|
||||
>
|
||||
{name}
|
||||
</Tag>
|
||||
</span>
|
||||
))}
|
||||
</Space>
|
||||
<Typography.Paragraph
|
||||
type="secondary"
|
||||
style={{ marginTop: 12, marginBottom: 0 }}
|
||||
>
|
||||
</div>
|
||||
<p className="admin-row-meta admin-flush">
|
||||
{Object.values(visual.variants).join(" / ")}
|
||||
</Typography.Paragraph>
|
||||
</p>
|
||||
</Card>
|
||||
))}
|
||||
</Space>
|
||||
</Space>
|
||||
</div>
|
||||
<Modal
|
||||
title="确认切换视觉模板"
|
||||
open={visualTarget !== null}
|
||||
@@ -281,7 +294,7 @@ export function WorkspacePage() {
|
||||
只会替换视觉主题和模块变体,不会覆盖品牌内容、业务提供项或咨询记录。
|
||||
</Typography.Paragraph>
|
||||
</Modal>
|
||||
</Space>
|
||||
</div>
|
||||
)}
|
||||
</Card>
|
||||
<Card
|
||||
@@ -303,17 +316,20 @@ export function WorkspacePage() {
|
||||
<Typography.Paragraph type="secondary">
|
||||
模板只提供行业表达样例,不会替代你的品牌定位、经历、作品和合作方式。
|
||||
</Typography.Paragraph>
|
||||
<Tag>{installations.length ? `已安装 ${installations.length} 个模板` : "尚未安装模板"}</Tag>
|
||||
<StatusTag
|
||||
tone={installations.length ? "info" : "neutral"}
|
||||
label={installations.length ? `已安装 ${installations.length} 个模板` : "尚未安装模板"}
|
||||
/>
|
||||
{installations.length > 0 && (
|
||||
<Card size="small" style={{ marginTop: 16 }} title="模板版本">
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<Card size="small" className="admin-offset-top" title="模板版本">
|
||||
<div className="admin-stack">
|
||||
<Typography.Text>
|
||||
当前版本:{templatePreview.data?.currentVersion ?? "加载中"},最新版本:
|
||||
{templatePreview.data?.latestVersion ?? "加载中"}
|
||||
</Typography.Text>
|
||||
{templatePreview.data?.canUpgrade ? (
|
||||
<>
|
||||
<Typography.Paragraph type="secondary" style={{ marginBottom: 0 }}>
|
||||
<Typography.Paragraph type="secondary" className="admin-flush">
|
||||
可升级内容:新增 {templatePreview.data.missingModules.length} 个模块,新增{" "}
|
||||
{templatePreview.data.missingFields.length} 个字段。已有内容不会被覆盖。
|
||||
</Typography.Paragraph>
|
||||
@@ -326,7 +342,9 @@ export function WorkspacePage() {
|
||||
</Button>
|
||||
</>
|
||||
) : (
|
||||
<Tag color="green">已是最新版本</Tag>
|
||||
<div>
|
||||
<StatusTag tone="success" label="已是最新版本" />
|
||||
</div>
|
||||
)}
|
||||
{templatePreview.data?.canRollback && (
|
||||
<Button danger onClick={() => rollback.mutate()} loading={rollback.isPending}>
|
||||
@@ -336,7 +354,7 @@ export function WorkspacePage() {
|
||||
<MutationError error={templatePreview.error} />
|
||||
<MutationError error={upgrade.error} />
|
||||
<MutationError error={rollback.error} />
|
||||
</Space>
|
||||
</div>
|
||||
</Card>
|
||||
)}
|
||||
<MutationError error={install.error} />
|
||||
@@ -360,7 +378,6 @@ export function WorkspacePage() {
|
||||
</Modal>
|
||||
<Card
|
||||
title="模板组合预览"
|
||||
style={{ marginBottom: 24 }}
|
||||
extra={<Typography.Text type="secondary">高级预览</Typography.Text>}
|
||||
>
|
||||
<Typography.Paragraph type="secondary">
|
||||
@@ -384,19 +401,18 @@ export function WorkspacePage() {
|
||||
/>
|
||||
</Space>
|
||||
{combinationPreview.isLoading ? (
|
||||
<Card loading style={{ marginTop: 16 }} />
|
||||
<Card loading className="admin-offset-top" />
|
||||
) : combinationPreview.data ? (
|
||||
<Space direction="vertical" style={{ width: "100%", marginTop: 16 }}>
|
||||
<div className="admin-stack admin-offset-top">
|
||||
<Typography.Text strong>
|
||||
{combinationPreview.data.industry.name} × {combinationPreview.data.visual.name}
|
||||
</Typography.Text>
|
||||
<Space wrap></Space>
|
||||
<Typography.Text type="secondary">
|
||||
能力:
|
||||
{combinationPreview.data.runtime.capabilities.map((item) => item.key).join("、") ||
|
||||
"无"}
|
||||
</Typography.Text>
|
||||
</Space>
|
||||
</div>
|
||||
) : null}
|
||||
</Card>
|
||||
<Card
|
||||
@@ -414,18 +430,29 @@ export function WorkspacePage() {
|
||||
locale={{ emptyText: "还没有咨询入口,点击右上角即可从默认表单开始。" }}
|
||||
columns={[
|
||||
{ title: "名称", dataIndex: "name" },
|
||||
{ title: "版本", dataIndex: "version", render: (value) => <Tag>v{value}</Tag> },
|
||||
{
|
||||
title: "版本",
|
||||
dataIndex: "version",
|
||||
render: (value) => <StatusTag tone="neutral" label={`v${value}`} />,
|
||||
},
|
||||
{
|
||||
title: "字段数",
|
||||
dataIndex: "fieldsSnapshot",
|
||||
render: (value: unknown[]) => value?.length ?? 0,
|
||||
},
|
||||
{ title: "状态", dataIndex: "isEnabled", render: (value) => (value ? "启用" : "停用") },
|
||||
{
|
||||
title: "状态",
|
||||
dataIndex: "isEnabled",
|
||||
render: (value: boolean) => (
|
||||
<StatusTag tone={value ? "success" : "neutral"} label={value ? "启用" : "停用"} />
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
render: (_: unknown, item: InquiryForm) => (
|
||||
<Space>
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
setEditingForm(item);
|
||||
@@ -637,7 +664,7 @@ export function WorkspacePage() {
|
||||
>
|
||||
<Input placeholder="例如:预约上门测量、家庭聚餐预订" />
|
||||
</Form.Item>
|
||||
<Space style={{ display: "flex" }} align="start">
|
||||
<div className="admin-form-row">
|
||||
<Form.Item
|
||||
name="purpose"
|
||||
label="客户要做什么"
|
||||
@@ -645,7 +672,7 @@ export function WorkspacePage() {
|
||||
initialValue="inquiry"
|
||||
>
|
||||
<Select
|
||||
style={{ width: 160 }}
|
||||
className="admin-field-w-lg"
|
||||
options={[
|
||||
{ value: "inquiry", label: "需求咨询" },
|
||||
{ value: "quote-request", label: "获取报价" },
|
||||
@@ -656,7 +683,7 @@ export function WorkspacePage() {
|
||||
<Form.Item name="offeringId" label="关联哪项业务" help="不选择表示这是品牌通用入口。">
|
||||
<Select
|
||||
allowClear
|
||||
style={{ width: 220 }}
|
||||
className="admin-field-w-xl"
|
||||
placeholder="品牌级表单"
|
||||
options={(runtimeQuery.data?.offerings ?? []).map((item) => ({
|
||||
value: item.id,
|
||||
@@ -664,7 +691,7 @@ export function WorkspacePage() {
|
||||
}))}
|
||||
/>
|
||||
</Form.Item>
|
||||
</Space>
|
||||
</div>
|
||||
<Form.List name="fieldsSnapshot">
|
||||
{(fields, { add, remove }) => (
|
||||
<>
|
||||
@@ -685,36 +712,36 @@ export function WorkspacePage() {
|
||||
</Button>
|
||||
</Form.Item>
|
||||
{fields.map(({ key, name, ...restField }) => (
|
||||
<Card key={key} size="small" style={{ marginBottom: 12 }}>
|
||||
<Card key={key} size="small" className="admin-offset-bottom-sm">
|
||||
<Form.Item {...restField} name={[name, "key"]} hidden>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Space align="start" style={{ display: "flex" }}>
|
||||
<div className="admin-form-row">
|
||||
<Form.Item
|
||||
{...restField}
|
||||
name={[name, "label"]}
|
||||
label="要询问客户什么"
|
||||
rules={[{ required: true, message: "请填写字段名称" }]}
|
||||
style={{ flex: 1 }}
|
||||
className="admin-flex-1"
|
||||
>
|
||||
<Input placeholder="例如:联系电话、预计预算、项目地址" />
|
||||
</Form.Item>
|
||||
<Form.Item {...restField} name={[name, "type"]} label="回答方式">
|
||||
<Select style={{ width: 150 }} options={inquiryFieldTypes} />
|
||||
<Select className="admin-field-w-md" options={inquiryFieldTypes} />
|
||||
</Form.Item>
|
||||
<Form.Item {...restField} name={[name, "required"]} label="必填">
|
||||
<Select
|
||||
style={{ width: 90 }}
|
||||
className="admin-field-w-sm"
|
||||
options={[
|
||||
{ value: true, label: "必填" },
|
||||
{ value: false, label: "选填" },
|
||||
]}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Button danger onClick={() => remove(name)} style={{ marginTop: 30 }}>
|
||||
<Button danger onClick={() => remove(name)} className="admin-field-offset">
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
<Form.Item noStyle shouldUpdate>
|
||||
{({ getFieldValue }) =>
|
||||
["select", "radio", "multi-select"].includes(
|
||||
@@ -735,32 +762,28 @@ export function WorkspacePage() {
|
||||
{(optionFields, { add, remove }, { errors }) => (
|
||||
<>
|
||||
{optionFields.map((optionField) => (
|
||||
<Space
|
||||
key={optionField.key}
|
||||
align="center"
|
||||
style={{ display: "flex" }}
|
||||
>
|
||||
<div key={optionField.key} className="admin-form-row-center">
|
||||
<Form.Item
|
||||
{...optionField}
|
||||
name={[optionField.name, "label"]}
|
||||
initialValue=""
|
||||
rules={[{ required: true, message: "请填写选项内容" }]}
|
||||
style={{ flex: 1, minWidth: 240, marginBottom: 8 }}
|
||||
className="admin-flex-1 admin-offset-bottom-xs"
|
||||
>
|
||||
<Input placeholder="例如:预算内" />
|
||||
</Form.Item>
|
||||
<Button
|
||||
danger
|
||||
onClick={() => remove(optionField.name)}
|
||||
style={{ marginBottom: 8 }}
|
||||
className="admin-offset-bottom-xs"
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
))}
|
||||
<Button
|
||||
onClick={() => add({ label: "", value: "" })}
|
||||
style={{ marginBottom: 8 }}
|
||||
className="admin-offset-bottom-xs"
|
||||
>
|
||||
新增选项
|
||||
</Button>
|
||||
@@ -778,6 +801,6 @@ export function WorkspacePage() {
|
||||
</Form.List>
|
||||
</Form>
|
||||
</Modal>
|
||||
</Space>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
import { ConfigProvider } from "antd";
|
||||
import type { ThemeConfig } from "antd";
|
||||
|
||||
export const adminTheme: ThemeConfig = {
|
||||
token: {
|
||||
colorPrimary: "#2563EB",
|
||||
colorLink: "#2563EB",
|
||||
colorText: "#1C1F23",
|
||||
colorTextSecondary: "#6B7280",
|
||||
colorTextTertiary: "#9AA1AC",
|
||||
colorTextQuaternary: "#C3C7CF",
|
||||
colorBgLayout: "#F7F8FA",
|
||||
colorBgContainer: "#FFFFFF",
|
||||
colorBorder: "#D8DBE0",
|
||||
colorBorderSecondary: "#E7E9EC",
|
||||
colorSplit: "#F0F1F3",
|
||||
colorFillTertiary: "#F7F8FA",
|
||||
colorFillQuaternary: "#FAFAFB",
|
||||
borderRadius: 6,
|
||||
borderRadiusLG: 10,
|
||||
borderRadiusSM: 4,
|
||||
fontSize: 14,
|
||||
fontFamily:
|
||||
"Inter, 'PingFang SC', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
||||
controlHeight: 32,
|
||||
controlHeightLG: 40,
|
||||
boxShadow: "0 1px 2px rgba(16, 24, 40, 0.04)",
|
||||
boxShadowSecondary: "0 8px 24px rgba(16, 24, 40, 0.08)",
|
||||
wireframe: false,
|
||||
},
|
||||
components: {
|
||||
Layout: {
|
||||
headerHeight: 56,
|
||||
headerBg: "#FFFFFF",
|
||||
headerPadding: "0 24px",
|
||||
siderBg: "#FFFFFF",
|
||||
bodyBg: "#F7F8FA",
|
||||
triggerBg: "#FFFFFF",
|
||||
triggerColor: "#475467",
|
||||
triggerHeight: 40,
|
||||
},
|
||||
Menu: {
|
||||
itemHeight: 36,
|
||||
itemBorderRadius: 6,
|
||||
itemBg: "transparent",
|
||||
itemColor: "#475467",
|
||||
itemHoverBg: "#F7F8FA",
|
||||
itemHoverColor: "#1C1F23",
|
||||
itemSelectedBg: "#EFF4FF",
|
||||
itemSelectedColor: "#2563EB",
|
||||
itemMarginInline: 8,
|
||||
itemMarginBlock: 2,
|
||||
groupTitleColor: "#9AA1AC",
|
||||
groupTitleFontSize: 12,
|
||||
collapsedWidth: 0,
|
||||
subMenuItemBg: "transparent",
|
||||
},
|
||||
Card: {
|
||||
paddingLG: 20,
|
||||
headerFontSize: 16,
|
||||
headerHeight: 52,
|
||||
headerHeightSM: 44,
|
||||
},
|
||||
Table: {
|
||||
headerBg: "#FAFAFB",
|
||||
headerColor: "#6B7280",
|
||||
rowHoverBg: "#FAFAFB",
|
||||
headerSplitColor: "transparent",
|
||||
borderColor: "#F0F1F3",
|
||||
cellPaddingBlock: 16,
|
||||
headerBorderRadius: 8,
|
||||
},
|
||||
Button: { fontWeight: 500, primaryShadow: "none", defaultShadow: "none" },
|
||||
Progress: { defaultColor: "#2563EB", remainingColor: "#F0F1F3", lineBorderRadius: 3 },
|
||||
Tag: { defaultBg: "#F2F4F7", defaultColor: "#475467", borderRadiusSM: 6 },
|
||||
Tabs: { inkBarColor: "#2563EB", itemSelectedColor: "#1C1F23", itemColor: "#6B7280" },
|
||||
Form: { labelColor: "#475467", labelFontSize: 13, verticalLabelPadding: "0 0 6px" },
|
||||
Modal: { borderRadiusLG: 12 },
|
||||
Statistic: { titleFontSize: 12, contentFontSize: 28 },
|
||||
},
|
||||
};
|
||||
|
||||
ConfigProvider.config({ theme: adminTheme });
|
||||
+127
-99
@@ -6,17 +6,31 @@ import {
|
||||
App,
|
||||
Button,
|
||||
Card,
|
||||
ConfigProvider,
|
||||
Form,
|
||||
Input,
|
||||
Layout,
|
||||
Menu,
|
||||
Select,
|
||||
Space,
|
||||
Tag,
|
||||
Typography,
|
||||
message,
|
||||
} from "antd";
|
||||
import zhCN from "antd/locale/zh_CN";
|
||||
import {
|
||||
AppstoreOutlined,
|
||||
BarsOutlined,
|
||||
CloudUploadOutlined,
|
||||
MessageOutlined,
|
||||
MobileOutlined,
|
||||
SafetyCertificateOutlined,
|
||||
SettingOutlined,
|
||||
TeamOutlined,
|
||||
ThunderboltOutlined,
|
||||
} from "@ant-design/icons";
|
||||
import { createApiClient } from "./lib/api.js";
|
||||
import { adminTheme } from "./lib/theme.js";
|
||||
import { LoadingStack } from "./components/QueryState.js";
|
||||
import { StatusTag } from "./components/StatusTag.js";
|
||||
import "./styles/admin.css";
|
||||
const FeatureInquiriesPage = React.lazy(() =>
|
||||
import("./features/inquiries/InquiriesPage.js").then((module) => ({
|
||||
default: module.InquiriesPage,
|
||||
@@ -88,19 +102,27 @@ function Login({
|
||||
}
|
||||
}
|
||||
return (
|
||||
<Card title="个人品牌后台" style={{ maxWidth: 420, margin: "120px auto" }}>
|
||||
<Form form={form} layout="vertical" onFinish={submit}>
|
||||
<Form.Item name="username" label="账号" initialValue="admin" rules={[{ required: true }]}>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item name="password" label="密码" rules={[{ required: true }]}>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Button type="primary" htmlType="submit" loading={loading} block>
|
||||
登录
|
||||
</Button>
|
||||
</Form>
|
||||
</Card>
|
||||
<div className="admin-auth">
|
||||
<Card className="admin-auth-card">
|
||||
<div className="admin-auth-brand">
|
||||
<span className="admin-sider-brand-mark">品</span>
|
||||
<span className="admin-header-brand">个人品牌后台</span>
|
||||
</div>
|
||||
<p className="admin-auth-hint">管理你的品牌表达、内容发布与客户咨询。</p>
|
||||
<Form form={form} layout="vertical" onFinish={submit}>
|
||||
<Form.Item name="username" label="账号" initialValue="admin" rules={[{ required: true }]}>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item name="password" label="密码" rules={[{ required: true }]}>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Button type="primary" size="large" htmlType="submit" loading={loading} block>
|
||||
登录
|
||||
</Button>
|
||||
</Form>
|
||||
<p className="admin-auth-footnote">仅限授权成员访问。</p>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -133,27 +155,33 @@ function ChangePassword({ onComplete }: { onComplete: () => void }) {
|
||||
}
|
||||
}
|
||||
return (
|
||||
<Card title="首次登录需要修改密码" style={{ maxWidth: 420, margin: "120px auto" }}>
|
||||
<Typography.Paragraph type="secondary">请先设置只有你本人知道的新密码。</Typography.Paragraph>
|
||||
<Form form={form} layout="vertical" onFinish={submit}>
|
||||
<Form.Item name="currentPassword" label="初始密码" rules={[{ required: true }]}>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="newPassword"
|
||||
label="新密码"
|
||||
rules={[{ required: true, min: 8, message: "请输入至少 8 位新密码" }]}
|
||||
>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Form.Item name="confirmPassword" label="确认新密码" rules={[{ required: true }]}>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Button type="primary" htmlType="submit" loading={loading} block>
|
||||
保存新密码
|
||||
</Button>
|
||||
</Form>
|
||||
</Card>
|
||||
<div className="admin-auth">
|
||||
<Card className="admin-auth-card">
|
||||
<div className="admin-auth-brand">
|
||||
<span className="admin-sider-brand-mark">品</span>
|
||||
<span className="admin-header-brand">首次登录需要修改密码</span>
|
||||
</div>
|
||||
<p className="admin-auth-hint">请先设置只有你本人知道的新密码。</p>
|
||||
<Form form={form} layout="vertical" onFinish={submit}>
|
||||
<Form.Item name="currentPassword" label="初始密码" rules={[{ required: true }]}>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="newPassword"
|
||||
label="新密码"
|
||||
rules={[{ required: true, min: 8, message: "请输入至少 8 位新密码" }]}
|
||||
>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Form.Item name="confirmPassword" label="确认新密码" rules={[{ required: true }]}>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Button type="primary" size="large" htmlType="submit" loading={loading} block>
|
||||
保存新密码
|
||||
</Button>
|
||||
</Form>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -183,12 +211,12 @@ function Dashboard({ onLogout, role }: { onLogout: () => void; role: string }) {
|
||||
type: "group" as const,
|
||||
label: "日常经营",
|
||||
children: [
|
||||
{ key: "overview", label: "当前品牌概览" },
|
||||
{ key: "publication", label: "配置与发布" },
|
||||
{ key: "brand", label: "小程序页面" },
|
||||
{ key: "trust", label: "信任内容" },
|
||||
{ key: "services", label: "业务提供项" },
|
||||
{ key: "inquiries", label: "咨询记录" },
|
||||
{ key: "overview", label: "当前品牌概览", icon: <AppstoreOutlined /> },
|
||||
{ key: "publication", label: "配置与发布", icon: <CloudUploadOutlined /> },
|
||||
{ key: "brand", label: "小程序页面", icon: <MobileOutlined /> },
|
||||
{ key: "trust", label: "信任内容", icon: <SafetyCertificateOutlined /> },
|
||||
{ key: "services", label: "业务提供项", icon: <BarsOutlined /> },
|
||||
{ key: "inquiries", label: "咨询记录", icon: <MessageOutlined /> },
|
||||
],
|
||||
},
|
||||
...(role === "editor"
|
||||
@@ -198,43 +226,39 @@ function Dashboard({ onLogout, role }: { onLogout: () => void; role: string }) {
|
||||
type: "group" as const,
|
||||
label: "系统管理",
|
||||
children: [
|
||||
{ key: "workspace", label: "模板与表单设置" },
|
||||
{ key: "capabilities", label: "能力插件" },
|
||||
{ key: "members", label: "团队成员" },
|
||||
{ key: "workspace", label: "模板与表单设置", icon: <SettingOutlined /> },
|
||||
{ key: "capabilities", label: "能力插件", icon: <ThunderboltOutlined /> },
|
||||
{ key: "members", label: "团队成员", icon: <TeamOutlined /> },
|
||||
],
|
||||
},
|
||||
]),
|
||||
];
|
||||
return (
|
||||
<Layout style={{ minHeight: "100vh" }}>
|
||||
<Layout.Sider breakpoint="lg" collapsedWidth={0}>
|
||||
<Typography.Title level={4} style={{ color: "white", padding: 20 }}>
|
||||
当前品牌工作区
|
||||
</Typography.Title>
|
||||
<Layout className="admin-shell">
|
||||
<Layout.Sider className="admin-sider" breakpoint="lg" collapsedWidth={0} width={232}>
|
||||
<div className="admin-sider-brand">
|
||||
<span className="admin-sider-brand-mark">品</span>
|
||||
<span className="admin-sider-brand-name">品牌工作区</span>
|
||||
</div>
|
||||
<Menu
|
||||
theme="dark"
|
||||
selectedKeys={[page]}
|
||||
onClick={({ key }) => navigate(`/admin/${key}`)}
|
||||
items={items}
|
||||
/>
|
||||
</Layout.Sider>
|
||||
<Layout>
|
||||
<Layout.Header
|
||||
style={{
|
||||
background: "white",
|
||||
display: "flex",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Space>
|
||||
<Typography.Text strong>{brand.data?.name || "当前品牌"}</Typography.Text>
|
||||
<Typography.Text type="secondary">品牌工作区</Typography.Text>
|
||||
<Tag color={role === "owner" ? "blue" : "default"}>
|
||||
{role === "owner" ? "负责人" : "内容编辑"}
|
||||
</Tag>
|
||||
<Layout className="admin-main">
|
||||
<Layout.Header className="admin-header">
|
||||
<div className="admin-header-left">
|
||||
<span className="admin-header-brand">{brand.data?.name || "当前品牌"}</span>
|
||||
<span className="admin-header-context">品牌工作区</span>
|
||||
<StatusTag
|
||||
tone={role === "owner" ? "info" : "neutral"}
|
||||
label={role === "owner" ? "负责人" : "内容编辑"}
|
||||
/>
|
||||
<Select
|
||||
size="small"
|
||||
variant="outlined"
|
||||
className="admin-brand-switcher"
|
||||
value={brand.data?.id}
|
||||
loading={memberships.isLoading}
|
||||
onChange={(value) => {
|
||||
@@ -245,35 +269,37 @@ function Dashboard({ onLogout, role }: { onLogout: () => void; role: string }) {
|
||||
label: item.brand.name,
|
||||
}))}
|
||||
/>
|
||||
</Space>
|
||||
</div>
|
||||
<Button type="text" onClick={onLogout}>
|
||||
退出登录
|
||||
</Button>
|
||||
</Layout.Header>
|
||||
<Layout.Content style={{ padding: 24 }}>
|
||||
<Suspense fallback={<Card loading />}>
|
||||
<Routes>
|
||||
<Route path="/admin/overview" element={<FeatureOverviewPage />} />
|
||||
<Route
|
||||
path="/admin/publication"
|
||||
element={<FeaturePublicationPage canManageTemplate={role !== "editor"} />}
|
||||
/>
|
||||
<Route path="/admin/brand" element={<FeatureBrandPage />} />
|
||||
{role === "editor" ? null : (
|
||||
<Route path="/admin/workspace" element={<FeatureWorkspacePage />} />
|
||||
)}
|
||||
{role === "editor" ? null : (
|
||||
<Route path="/admin/capabilities" element={<FeatureCapabilitiesPage />} />
|
||||
)}
|
||||
{role === "editor" ? null : (
|
||||
<Route path="/admin/members" element={<FeatureMembersPage />} />
|
||||
)}
|
||||
<Route path="/admin/trust" element={<FeatureTrustContentPage />} />
|
||||
<Route path="/admin/services" element={<FeatureServicesPage />} />
|
||||
<Route path="/admin/inquiries" element={<FeatureInquiriesPage />} />
|
||||
<Route path="*" element={<Navigate to="/admin/overview" replace />} />
|
||||
</Routes>
|
||||
</Suspense>
|
||||
<Layout.Content className="admin-content">
|
||||
<div className="admin-content-inner">
|
||||
<Suspense fallback={<LoadingStack />}>
|
||||
<Routes>
|
||||
<Route path="/admin/overview" element={<FeatureOverviewPage />} />
|
||||
<Route
|
||||
path="/admin/publication"
|
||||
element={<FeaturePublicationPage canManageTemplate={role !== "editor"} />}
|
||||
/>
|
||||
<Route path="/admin/brand" element={<FeatureBrandPage />} />
|
||||
{role === "editor" ? null : (
|
||||
<Route path="/admin/workspace" element={<FeatureWorkspacePage />} />
|
||||
)}
|
||||
{role === "editor" ? null : (
|
||||
<Route path="/admin/capabilities" element={<FeatureCapabilitiesPage />} />
|
||||
)}
|
||||
{role === "editor" ? null : (
|
||||
<Route path="/admin/members" element={<FeatureMembersPage />} />
|
||||
)}
|
||||
<Route path="/admin/trust" element={<FeatureTrustContentPage />} />
|
||||
<Route path="/admin/services" element={<FeatureServicesPage />} />
|
||||
<Route path="/admin/inquiries" element={<FeatureInquiriesPage />} />
|
||||
<Route path="*" element={<Navigate to="/admin/overview" replace />} />
|
||||
</Routes>
|
||||
</Suspense>
|
||||
</div>
|
||||
</Layout.Content>
|
||||
</Layout>
|
||||
</Layout>
|
||||
@@ -315,12 +341,14 @@ function Root() {
|
||||
}
|
||||
createRoot(document.getElementById("app")!).render(
|
||||
<React.StrictMode>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<App>
|
||||
<BrowserRouter>
|
||||
<Root />
|
||||
</BrowserRouter>
|
||||
</App>
|
||||
</QueryClientProvider>
|
||||
<ConfigProvider locale={zhCN} theme={adminTheme}>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<App>
|
||||
<BrowserRouter>
|
||||
<Root />
|
||||
</BrowserRouter>
|
||||
</App>
|
||||
</QueryClientProvider>
|
||||
</ConfigProvider>
|
||||
</React.StrictMode>,
|
||||
);
|
||||
@@ -0,0 +1,675 @@
|
||||
/*
|
||||
* 后台全局样式。视觉规则见 apps/admin/design.md。
|
||||
* 颜色令牌与 apps/admin/src/lib/theme.ts 保持一致,改动需同步。
|
||||
*/
|
||||
:root {
|
||||
--admin-bg: #f7f8fa;
|
||||
--admin-surface: #ffffff;
|
||||
--admin-border: #e7e9ec;
|
||||
--admin-divider: #f0f1f3;
|
||||
--admin-text: #1c1f23;
|
||||
--admin-text-secondary: #6b7280;
|
||||
--admin-text-tertiary: #9aa1ac;
|
||||
--admin-primary: #2563eb;
|
||||
--admin-primary-bg: #eff4ff;
|
||||
--admin-fill: #f7f8fa;
|
||||
--admin-fill-quiet: #fafafb;
|
||||
|
||||
--admin-tone-success-bg: #ecfdf3;
|
||||
--admin-tone-success-fg: #067647;
|
||||
--admin-tone-warning-bg: #fffaeb;
|
||||
--admin-tone-warning-fg: #b54708;
|
||||
--admin-tone-error-bg: #fef3f2;
|
||||
--admin-tone-error-fg: #b42318;
|
||||
--admin-tone-neutral-bg: #f2f4f7;
|
||||
--admin-tone-neutral-fg: #475467;
|
||||
--admin-tone-info-bg: #eff4ff;
|
||||
--admin-tone-info-fg: #2563eb;
|
||||
}
|
||||
|
||||
html,
|
||||
body,
|
||||
#app {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
background: var(--admin-bg);
|
||||
color: var(--admin-text);
|
||||
font-variant-numeric: tabular-nums;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
:where(a, button, [tabindex]):focus-visible {
|
||||
outline: 2px solid var(--admin-primary);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* 外壳 */
|
||||
.admin-shell {
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.admin-sider,
|
||||
.admin-sider .ant-layout-sider-children {
|
||||
border-right: 1px solid var(--admin-border);
|
||||
}
|
||||
|
||||
.admin-sider.ant-layout-sider-collapsed,
|
||||
.admin-sider.ant-layout-sider-zero-width,
|
||||
.admin-sider.ant-layout-sider-zero-width .ant-layout-sider-children {
|
||||
border-right: 0;
|
||||
}
|
||||
|
||||
.admin-sider .ant-layout-sider-zero-width-trigger {
|
||||
border: 1px solid var(--admin-border);
|
||||
border-left: 0;
|
||||
border-radius: 0 6px 6px 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.admin-sider-brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
height: 56px;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.admin-sider-brand-mark {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border-radius: 6px;
|
||||
background: var(--admin-primary);
|
||||
color: #fff;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.admin-sider-brand-name {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--admin-text);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.admin-sider .ant-menu {
|
||||
border-inline-end: 0;
|
||||
padding: 4px 0 12px;
|
||||
}
|
||||
|
||||
.admin-sider .ant-menu-item-group-title {
|
||||
padding: 16px 24px 6px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.admin-main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100vh;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.admin-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
border-bottom: 1px solid var(--admin-border);
|
||||
}
|
||||
|
||||
.admin-header-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.admin-header-brand {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--admin-text);
|
||||
}
|
||||
|
||||
.admin-header-context {
|
||||
font-size: 13px;
|
||||
color: var(--admin-text-tertiary);
|
||||
}
|
||||
|
||||
.admin-brand-switcher {
|
||||
min-width: 140px;
|
||||
}
|
||||
|
||||
.admin-equal-height > .ant-col > .ant-card {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.admin-content {
|
||||
flex: 1;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.admin-content-inner {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* 页面头部 */
|
||||
.admin-page-header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.admin-page-header-title {
|
||||
margin: 0;
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
line-height: 1.35;
|
||||
color: var(--admin-text);
|
||||
}
|
||||
|
||||
.admin-page-header-description {
|
||||
margin: 8px 0 0;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
color: var(--admin-text-secondary);
|
||||
}
|
||||
|
||||
/* 区块与列表 */
|
||||
.admin-section {
|
||||
padding: 20px;
|
||||
border: 1px solid var(--admin-border);
|
||||
border-radius: 10px;
|
||||
background: var(--admin-surface);
|
||||
}
|
||||
|
||||
.admin-section + .admin-section {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.admin-section-head {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.admin-section-head:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.admin-section-title {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
line-height: 1.45;
|
||||
color: var(--admin-text);
|
||||
}
|
||||
|
||||
.admin-section-description {
|
||||
margin: 6px 0 0;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
color: var(--admin-text-secondary);
|
||||
}
|
||||
|
||||
.admin-stack {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.admin-stack-lg {
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.admin-stack-tight {
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.admin-actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.admin-row-title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--admin-text);
|
||||
}
|
||||
|
||||
.admin-row-meta {
|
||||
font-size: 12px;
|
||||
color: var(--admin-text-tertiary);
|
||||
}
|
||||
|
||||
.admin-row-summary {
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
color: var(--admin-text-secondary);
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.admin-empty-inline {
|
||||
padding: 24px 0;
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
color: var(--admin-text-tertiary);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* 列表行 */
|
||||
.admin-list {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.admin-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
padding: 14px 0;
|
||||
border-bottom: 1px solid var(--admin-divider);
|
||||
}
|
||||
|
||||
.admin-row:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.admin-row-main {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.admin-row-line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.admin-row-help {
|
||||
margin: 6px 0 0;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
color: var(--admin-text-secondary);
|
||||
}
|
||||
|
||||
.admin-field-stack {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.admin-field-label {
|
||||
display: block;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: var(--admin-text-secondary);
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.admin-offset-top {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.admin-offset-top-xs {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.admin-divider {
|
||||
margin: 16px 0;
|
||||
}
|
||||
|
||||
.admin-offset-top-sm {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.admin-offset-top-md {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.admin-offset-bottom {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.admin-text-xs {
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
color: var(--admin-text-secondary);
|
||||
}
|
||||
|
||||
.admin-text-xs-quiet {
|
||||
font-size: 12px;
|
||||
color: var(--admin-text-tertiary);
|
||||
}
|
||||
|
||||
.admin-text-warning {
|
||||
color: var(--admin-tone-warning-fg);
|
||||
}
|
||||
|
||||
.admin-flush {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.admin-flush-top {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.admin-block {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.admin-offset-bottom-sm {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.admin-offset-bottom-lg {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.admin-offset-top-lg {
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.admin-link-flush {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.admin-form-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 16px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.admin-form-row-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.admin-flex-1 {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.admin-field-w-sm {
|
||||
width: 90px;
|
||||
}
|
||||
|
||||
.admin-field-w-md {
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
.admin-field-w-lg {
|
||||
width: 160px;
|
||||
}
|
||||
|
||||
.admin-field-w-xl {
|
||||
width: 220px;
|
||||
}
|
||||
|
||||
.admin-field-w-2xl {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
.admin-field-stack-xs {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.admin-form-column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.admin-brand-title {
|
||||
margin: 0;
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
line-height: 1.4;
|
||||
color: var(--admin-text);
|
||||
}
|
||||
|
||||
.admin-brand-tagline {
|
||||
margin: 6px 0 12px;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
color: var(--admin-text-secondary);
|
||||
}
|
||||
|
||||
.admin-field-offset {
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.admin-offset-bottom-xs {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.admin-visual-card {
|
||||
width: 260px;
|
||||
}
|
||||
|
||||
.admin-swatch {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
height: 24px;
|
||||
padding: 0 8px;
|
||||
border-radius: 6px;
|
||||
background: var(--admin-fill);
|
||||
color: var(--admin-text-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.admin-swatch::before {
|
||||
content: "";
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 3px;
|
||||
border: 1px solid var(--admin-border);
|
||||
background: var(--swatch-color, transparent);
|
||||
}
|
||||
|
||||
/* 状态标签 */
|
||||
.admin-status-tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
height: 24px;
|
||||
padding: 0 8px;
|
||||
border-radius: 6px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
line-height: 1;
|
||||
white-space: nowrap;
|
||||
background: var(--admin-tone-neutral-bg);
|
||||
color: var(--admin-tone-neutral-fg);
|
||||
}
|
||||
|
||||
.admin-status-tag[data-tone="success"] {
|
||||
background: var(--admin-tone-success-bg);
|
||||
color: var(--admin-tone-success-fg);
|
||||
}
|
||||
|
||||
.admin-status-tag[data-tone="warning"] {
|
||||
background: var(--admin-tone-warning-bg);
|
||||
color: var(--admin-tone-warning-fg);
|
||||
}
|
||||
|
||||
.admin-status-tag[data-tone="error"] {
|
||||
background: var(--admin-tone-error-bg);
|
||||
color: var(--admin-tone-error-fg);
|
||||
}
|
||||
|
||||
.admin-status-tag[data-tone="info"] {
|
||||
background: var(--admin-tone-info-bg);
|
||||
color: var(--admin-tone-info-fg);
|
||||
}
|
||||
|
||||
/* 指标卡 */
|
||||
.admin-metric-label {
|
||||
font-size: 12px;
|
||||
color: var(--admin-text-tertiary);
|
||||
}
|
||||
|
||||
.admin-metric-value {
|
||||
margin-top: 8px;
|
||||
font-size: 28px;
|
||||
font-weight: 600;
|
||||
line-height: 1.2;
|
||||
color: var(--admin-text);
|
||||
}
|
||||
|
||||
.admin-metric-suffix {
|
||||
margin-left: 6px;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
color: var(--admin-text-tertiary);
|
||||
}
|
||||
|
||||
/* 反馈 */
|
||||
.admin-error-note {
|
||||
padding: 12px 16px;
|
||||
border: 1px solid #fbd5d1;
|
||||
border-radius: 8px;
|
||||
background: var(--admin-tone-error-bg);
|
||||
color: var(--admin-tone-error-fg);
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.admin-loading-stack {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.admin-log {
|
||||
margin: 0;
|
||||
padding: 16px;
|
||||
border-radius: 8px;
|
||||
background: #1c1f23;
|
||||
color: #e4e7ec;
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
font-size: 12px;
|
||||
line-height: 1.7;
|
||||
max-height: 280px;
|
||||
overflow: auto;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.admin-log__line {
|
||||
color: #e4e7ec;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.admin-log__line[data-stream="stderr"] {
|
||||
color: #fda29b;
|
||||
}
|
||||
|
||||
.admin-log__time {
|
||||
color: #98a2b3;
|
||||
}
|
||||
|
||||
.admin-code-input {
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.admin-thumb {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
object-fit: cover;
|
||||
border-radius: 8px;
|
||||
border: 1px solid var(--admin-border);
|
||||
}
|
||||
|
||||
.admin-thumb-remove {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 8px;
|
||||
}
|
||||
|
||||
.admin-thumb-wrap {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.admin-media-preview {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
min-height: 140px;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--admin-border);
|
||||
background: var(--admin-fill);
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
.admin-content {
|
||||
padding: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 登录与改密 */
|
||||
.admin-auth {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 24px;
|
||||
background: var(--admin-bg);
|
||||
}
|
||||
|
||||
.admin-auth-card {
|
||||
width: 100%;
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
.admin-auth-card .ant-card-body {
|
||||
padding: 32px;
|
||||
}
|
||||
|
||||
.admin-auth-brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.admin-auth-hint {
|
||||
margin: 8px 0 20px;
|
||||
font-size: 13px;
|
||||
color: var(--admin-text-secondary);
|
||||
}
|
||||
|
||||
.admin-auth-footnote {
|
||||
margin: 16px 0 0;
|
||||
font-size: 12px;
|
||||
color: var(--admin-text-tertiary);
|
||||
text-align: center;
|
||||
}
|
||||
Reference in new issue
Block a user