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
+1973
-736
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";
|
import type { ReactNode } from "react";
|
||||||
|
|
||||||
export function AdminPageHeader({
|
export function AdminPageHeader({
|
||||||
@@ -11,21 +10,12 @@ export function AdminPageHeader({
|
|||||||
extra?: ReactNode;
|
extra?: ReactNode;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<Space
|
<header className="admin-page-header">
|
||||||
align="start"
|
|
||||||
style={{ width: "100%", justifyContent: "space-between", marginBottom: 24 }}
|
|
||||||
>
|
|
||||||
<div>
|
<div>
|
||||||
<Typography.Title level={2} style={{ margin: 0 }}>
|
<h1 className="admin-page-header-title">{title}</h1>
|
||||||
{title}
|
{description ? <p className="admin-page-header-description">{description}</p> : null}
|
||||||
</Typography.Title>
|
|
||||||
{description && (
|
|
||||||
<Typography.Paragraph type="secondary" style={{ margin: "8px 0 0" }}>
|
|
||||||
{description}
|
|
||||||
</Typography.Paragraph>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
{extra}
|
{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 { 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 { useEffect, useMemo, useState } from "react";
|
||||||
import { createApiClient } from "../lib/api.js";
|
import { createApiClient } from "../lib/api.js";
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ export function ImageUrlField({ id, value, onChange, placeholder, scope }: Image
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Space direction="vertical" size={4} style={{ width: "100%" }}>
|
<div className="admin-field-stack-xs admin-block">
|
||||||
{storageStatus !== "ok" ? (
|
{storageStatus !== "ok" ? (
|
||||||
<Alert
|
<Alert
|
||||||
type={storageStatus === "loading" ? "info" : "warning"}
|
type={storageStatus === "loading" ? "info" : "warning"}
|
||||||
@@ -86,33 +86,17 @@ export function ImageUrlField({ id, value, onChange, placeholder, scope }: Image
|
|||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
{imageUrl ? (
|
{imageUrl ? (
|
||||||
<div
|
<div className="admin-media-preview">
|
||||||
style={{
|
|
||||||
position: "relative",
|
|
||||||
width: "100%",
|
|
||||||
minHeight: 140,
|
|
||||||
borderRadius: 8,
|
|
||||||
overflow: "hidden",
|
|
||||||
border: "1px solid #d9d9d9",
|
|
||||||
background: "#f5f5f5",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Image
|
<Image
|
||||||
src={imageUrl}
|
src={imageUrl}
|
||||||
alt={placeholder ?? "图片预览"}
|
alt={placeholder ?? "图片预览"}
|
||||||
width="100%"
|
width="100%"
|
||||||
height={180}
|
height={180}
|
||||||
preview
|
preview
|
||||||
style={{ objectFit: "cover" }}
|
|
||||||
fallback="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="
|
fallback="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="
|
||||||
/>
|
/>
|
||||||
<Popconfirm title="移除这张图片?" onConfirm={() => onChange?.("")}>
|
<Popconfirm title="移除这张图片?" onConfirm={() => onChange?.("")}>
|
||||||
<Button
|
<Button danger size="small" icon={<DeleteOutlined />} className="admin-thumb-remove">
|
||||||
danger
|
|
||||||
size="small"
|
|
||||||
icon={<DeleteOutlined />}
|
|
||||||
style={{ position: "absolute", top: 8, right: 8 }}
|
|
||||||
>
|
|
||||||
移除
|
移除
|
||||||
</Button>
|
</Button>
|
||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
@@ -150,6 +134,6 @@ export function ImageUrlField({ id, value, onChange, placeholder, scope }: Image
|
|||||||
</Button>
|
</Button>
|
||||||
) : null}
|
) : null}
|
||||||
<input {...(id ? { id } : {})} type="hidden" value={imageUrl} />
|
<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";
|
import type { ReactNode } from "react";
|
||||||
|
|
||||||
|
function errorMessage(error: unknown, fallback: string) {
|
||||||
|
return error instanceof Error ? error.message : fallback;
|
||||||
|
}
|
||||||
|
|
||||||
export function QueryState({
|
export function QueryState({
|
||||||
loading,
|
loading,
|
||||||
error,
|
error,
|
||||||
@@ -12,36 +16,50 @@ export function QueryState({
|
|||||||
onRetry?: () => void;
|
onRetry?: () => void;
|
||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
}) {
|
}) {
|
||||||
if (loading)
|
if (loading) return <LoadingStack />;
|
||||||
|
if (error) return <ErrorNote error={error} onRetry={onRetry} />;
|
||||||
|
return <>{children}</>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function LoadingStack({ rows = 3 }: { rows?: number }) {
|
||||||
return (
|
return (
|
||||||
|
<div className="admin-loading-stack">
|
||||||
<Card>
|
<Card>
|
||||||
<Spin />
|
<Skeleton active paragraph={{ rows: 2 }} title={false} />
|
||||||
</Card>
|
</Card>
|
||||||
);
|
{Array.from({ length: rows }).map((_, index) => (
|
||||||
if (error) {
|
<Card key={index}>
|
||||||
return (
|
<Skeleton active paragraph={{ rows: 1 }} title={false} />
|
||||||
<Result
|
</Card>
|
||||||
status="error"
|
))}
|
||||||
title="内容加载失败"
|
</div>
|
||||||
subTitle={error instanceof Error ? error.message : "请检查 API 服务后重试"}
|
|
||||||
extra={onRetry ? <Button onClick={onRetry}>重新加载</Button> : undefined}
|
|
||||||
/>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return <>{children}</>;
|
|
||||||
|
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 }) {
|
export function EmptyState({ description }: { description: string }) {
|
||||||
return <Empty description={description} image={Empty.PRESENTED_IMAGE_SIMPLE} />;
|
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}
|
initialValues={initialValues}
|
||||||
onValuesChange={handleValuesChange}
|
onValuesChange={handleValuesChange}
|
||||||
onFinish={submit}
|
onFinish={submit}
|
||||||
style={{ minHeight: 0, display: "flex", flexDirection: "column" }}
|
className="admin-form-column"
|
||||||
>
|
>
|
||||||
<Alert
|
<Alert
|
||||||
type="info"
|
type="info"
|
||||||
@@ -89,10 +89,10 @@ export function RecordContentEditor({
|
|||||||
/>
|
/>
|
||||||
{save.isPending ? <Typography.Text type="secondary">正在保存内容…</Typography.Text> : null}
|
{save.isPending ? <Typography.Text type="secondary">正在保存内容…</Typography.Text> : null}
|
||||||
<Typography.Paragraph type="secondary">{section.description}</Typography.Paragraph>
|
<Typography.Paragraph type="secondary">{section.description}</Typography.Paragraph>
|
||||||
<div style={{ flex: 1 }}>
|
<div className="admin-flex-1">
|
||||||
<RecordContentFields section={section} />
|
<RecordContentFields section={section} />
|
||||||
</div>
|
</div>
|
||||||
<Space direction="vertical" style={{ width: "100%", marginTop: 24 }}>
|
<div className="admin-actions admin-offset-top-lg">
|
||||||
<MutationError error={save.error} />
|
<MutationError error={save.error} />
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
<Button type="primary" htmlType="submit" loading={save.isPending}>
|
<Button type="primary" htmlType="submit" loading={save.isPending}>
|
||||||
@@ -114,7 +114,7 @@ export function RecordContentEditor({
|
|||||||
</Button>
|
</Button>
|
||||||
) : null}
|
) : null}
|
||||||
</Space>
|
</Space>
|
||||||
</Space>
|
</div>
|
||||||
</Form>
|
</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}
|
value={typeof value === "number" ? value : null}
|
||||||
onChange={(input) => onChange?.(input ?? undefined)}
|
onChange={(input) => onChange?.(input ?? undefined)}
|
||||||
min={0}
|
min={0}
|
||||||
style={{ width: "100%" }}
|
className="admin-block"
|
||||||
placeholder={field.placeholder}
|
placeholder={field.placeholder}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export function TemplateListField({
|
|||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
{(rows, { add, remove, move }, { errors }) => (
|
{(rows, { add, remove, move }, { errors }) => (
|
||||||
<Space direction="vertical" size={12} style={{ width: "100%" }}>
|
<div className="admin-stack admin-stack-tight">
|
||||||
{rows.length === 0 ? (
|
{rows.length === 0 ? (
|
||||||
<Empty
|
<Empty
|
||||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||||
@@ -135,7 +135,7 @@ export function TemplateListField({
|
|||||||
<Button block icon={<PlusOutlined />} onClick={() => add()}>
|
<Button block icon={<PlusOutlined />} onClick={() => add()}>
|
||||||
新增{field.label}
|
新增{field.label}
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Form.List>
|
</Form.List>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|||||||
@@ -1,19 +1,29 @@
|
|||||||
.brand-page__content {
|
|
||||||
max-width: 960px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.brand-page__content[hidden] {
|
.brand-page__content[hidden] {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.brand-page__toolbar {
|
.brand-page__toolbar {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
padding: 16px 0;
|
padding: 8px 12px;
|
||||||
border-bottom: 1px solid #e5e7eb;
|
border: 1px solid var(--admin-border);
|
||||||
margin-bottom: 20px;
|
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) {
|
@media (max-width: 575px) {
|
||||||
.brand-page__toolbar {
|
.brand-page__toolbar {
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
@@ -25,54 +35,22 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.brand-settings-section {
|
.brand-settings-section {
|
||||||
padding: 24px 0;
|
padding: 20px;
|
||||||
border-top: 1px solid #f0f0f0;
|
border: 1px solid var(--admin-border);
|
||||||
|
border-radius: 10px;
|
||||||
|
background: var(--admin-surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
.brand-settings-section:first-child {
|
.brand-settings-section + .brand-settings-section {
|
||||||
padding-top: 8px;
|
margin-top: 16px;
|
||||||
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-page__template-note {
|
.brand-page__template-note {
|
||||||
margin-top: 24px;
|
margin-top: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 1199px) {
|
@media (max-width: 1199px) {
|
||||||
.brand-page__content {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.brand-page__template-note {
|
.brand-page__template-note {
|
||||||
position: static;
|
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 {
|
import { Alert, Button, Col, Form, Input, Row, Select, Segmented, message } from "antd";
|
||||||
Alert,
|
|
||||||
Button,
|
|
||||||
Col,
|
|
||||||
Form,
|
|
||||||
Input,
|
|
||||||
Row,
|
|
||||||
Select,
|
|
||||||
Segmented,
|
|
||||||
Space,
|
|
||||||
Tag,
|
|
||||||
Typography,
|
|
||||||
message,
|
|
||||||
} from "antd";
|
|
||||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Link, useLocation } from "react-router-dom";
|
import { Link, useLocation } from "react-router-dom";
|
||||||
@@ -20,6 +7,7 @@ import { createApiClient } from "../../lib/api.js";
|
|||||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||||
import { ImageUrlField } from "../../components/ImageUrlField.js";
|
import { ImageUrlField } from "../../components/ImageUrlField.js";
|
||||||
import { MutationError, QueryState } from "../../components/QueryState.js";
|
import { MutationError, QueryState } from "../../components/QueryState.js";
|
||||||
|
import { StatusTag } from "../../components/StatusTag.js";
|
||||||
import { PresentationEditor } from "./PresentationEditor.js";
|
import { PresentationEditor } from "./PresentationEditor.js";
|
||||||
import type { PreviewSelection } from "./preview-selection.js";
|
import type { PreviewSelection } from "./preview-selection.js";
|
||||||
import "./BrandPage.css";
|
import "./BrandPage.css";
|
||||||
@@ -72,7 +60,7 @@ export function BrandPage() {
|
|||||||
? `先让访客理解你是谁、服务谁,以及为什么值得信任。${template.data.description}`
|
? `先让访客理解你是谁、服务谁,以及为什么值得信任。${template.data.description}`
|
||||||
: "先让访客理解你是谁、服务谁,以及为什么值得信任。"
|
: "先让访客理解你是谁、服务谁,以及为什么值得信任。"
|
||||||
}
|
}
|
||||||
extra={<Tag color="blue">{template.data?.name ?? "当前模板"}</Tag>}
|
extra={<StatusTag tone="info" label={template.data?.name ?? "当前模板"} />}
|
||||||
/>
|
/>
|
||||||
<div className="brand-page__toolbar">
|
<div className="brand-page__toolbar">
|
||||||
<Segmented
|
<Segmented
|
||||||
@@ -84,12 +72,13 @@ export function BrandPage() {
|
|||||||
{ value: "brand", label: "品牌资料" },
|
{ value: "brand", label: "品牌资料" },
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<Space>
|
<div className="brand-page__toolbar-actions">
|
||||||
<Tag color={dirty ? "orange" : "default"}>
|
<StatusTag
|
||||||
{dirty ? "品牌资料有未保存修改" : "草稿工作区"}
|
tone={dirty ? "warning" : "neutral"}
|
||||||
</Tag>
|
label={dirty ? "品牌资料有未保存修改" : "草稿工作区"}
|
||||||
|
/>
|
||||||
<Link to="/admin/publication">检查与发布 →</Link>
|
<Link to="/admin/publication">检查与发布 →</Link>
|
||||||
</Space>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="brand-page__content" hidden={panel !== "brand"}>
|
<div className="brand-page__content" hidden={panel !== "brand"}>
|
||||||
<div className="brand-page__settings">
|
<div className="brand-page__settings">
|
||||||
@@ -101,14 +90,14 @@ export function BrandPage() {
|
|||||||
onFinish={(values) => save.mutate(values)}
|
onFinish={(values) => save.mutate(values)}
|
||||||
>
|
>
|
||||||
<section className="brand-settings-section" aria-labelledby="brand-identity-title">
|
<section className="brand-settings-section" aria-labelledby="brand-identity-title">
|
||||||
<div className="brand-settings-section__header">
|
<div className="admin-section-head">
|
||||||
<div>
|
<div>
|
||||||
<Typography.Title id="brand-identity-title" level={4}>
|
<h2 id="brand-identity-title" className="admin-section-title">
|
||||||
我是谁
|
我是谁
|
||||||
</Typography.Title>
|
</h2>
|
||||||
<Typography.Text type="secondary">公开展示的品牌身份和定位。</Typography.Text>
|
<p className="admin-section-description">公开展示的品牌身份和定位。</p>
|
||||||
</div>
|
</div>
|
||||||
<Tag>品牌基础信息</Tag>
|
<StatusTag tone="neutral" label="品牌基础信息" />
|
||||||
</div>
|
</div>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="name"
|
name="name"
|
||||||
@@ -136,14 +125,14 @@ export function BrandPage() {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
</section>
|
</section>
|
||||||
<section className="brand-settings-section" aria-labelledby="brand-contact-title">
|
<section className="brand-settings-section" aria-labelledby="brand-contact-title">
|
||||||
<div className="brand-settings-section__header">
|
<div className="admin-section-head">
|
||||||
<div>
|
<div>
|
||||||
<Typography.Title id="brand-contact-title" level={4}>
|
<h2 id="brand-contact-title" className="admin-section-title">
|
||||||
如何联系与合作
|
如何联系与合作
|
||||||
</Typography.Title>
|
</h2>
|
||||||
<Typography.Text type="secondary">
|
<p className="admin-section-description">
|
||||||
让访客知道联系渠道、服务范围和响应预期。
|
让访客知道联系渠道、服务范围和响应预期。
|
||||||
</Typography.Text>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Row gutter={16}>
|
<Row gutter={16}>
|
||||||
@@ -177,14 +166,14 @@ export function BrandPage() {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
</section>
|
</section>
|
||||||
<section className="brand-settings-section" aria-labelledby="brand-visual-title">
|
<section className="brand-settings-section" aria-labelledby="brand-visual-title">
|
||||||
<div className="brand-settings-section__header">
|
<div className="admin-section-head">
|
||||||
<div>
|
<div>
|
||||||
<Typography.Title id="brand-visual-title" level={4}>
|
<h2 id="brand-visual-title" className="admin-section-title">
|
||||||
模板与品牌视觉
|
模板与品牌视觉
|
||||||
</Typography.Title>
|
</h2>
|
||||||
<Typography.Text type="secondary">
|
<p className="admin-section-description">
|
||||||
模板负责业务表达,品牌信息仍由你统一维护。
|
模板负责业务表达,品牌信息仍由你统一维护。
|
||||||
</Typography.Text>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
@@ -221,12 +210,12 @@ export function BrandPage() {
|
|||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</section>
|
</section>
|
||||||
<Space direction="vertical" style={{ width: "100%", marginTop: 24 }}>
|
<div className="admin-actions admin-offset-top-lg">
|
||||||
<MutationError error={save.error} />
|
<MutationError error={save.error} />
|
||||||
<Button type="primary" htmlType="submit" loading={save.isPending} size="large">
|
<Button type="primary" htmlType="submit" loading={save.isPending} size="large">
|
||||||
保存品牌表达
|
保存品牌表达
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
{template.data ? (
|
{template.data ? (
|
||||||
|
|||||||
@@ -6,21 +6,21 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
padding: 8px 12px;
|
padding: 8px 12px;
|
||||||
border-bottom: 1px solid #e8e8e8;
|
border-bottom: 1px solid var(--admin-border);
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.component-template-preview__tools button {
|
.component-template-preview__tools button {
|
||||||
padding: 4px 12px;
|
padding: 4px 12px;
|
||||||
border: 1px solid #d9d9d9;
|
border: 1px solid var(--admin-border);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.component-template-preview__tools button[aria-pressed="true"] {
|
.component-template-preview__tools button[aria-pressed="true"] {
|
||||||
border-color: #1677ff;
|
border-color: var(--admin-primary);
|
||||||
color: #1677ff;
|
color: var(--admin-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.component-template-preview {
|
.component-template-preview {
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
padding: 24px 16px;
|
padding: 24px 16px;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
background: #f3f4f6;
|
background: var(--admin-fill);
|
||||||
}
|
}
|
||||||
|
|
||||||
.component-template-preview__canvas {
|
.component-template-preview__canvas {
|
||||||
@@ -102,13 +102,13 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 5;
|
z-index: 5;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
border: 2px solid #91caff;
|
border: 2px solid var(--admin-primary);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.component-template-preview__outline.is-selected {
|
.component-template-preview__outline.is-selected {
|
||||||
z-index: 6;
|
z-index: 6;
|
||||||
border-color: #1677ff;
|
border-color: var(--admin-primary);
|
||||||
box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.16);
|
box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.16);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,10 +117,10 @@
|
|||||||
z-index: 7;
|
z-index: 7;
|
||||||
width: max-content !important;
|
width: max-content !important;
|
||||||
padding: 2px 8px !important;
|
padding: 2px 8px !important;
|
||||||
border: 1px solid #1677ff !important;
|
border: 1px solid var(--admin-primary) !important;
|
||||||
border-radius: 4px !important;
|
border-radius: 4px !important;
|
||||||
background: #fff !important;
|
background: #fff !important;
|
||||||
color: #0958d9 !important;
|
color: var(--admin-primary) !important;
|
||||||
font-size: 12px !important;
|
font-size: 12px !important;
|
||||||
line-height: 20px !important;
|
line-height: 20px !important;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -135,7 +135,7 @@
|
|||||||
padding: 2px 7px;
|
padding: 2px 7px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-radius: 4px 4px 0 0;
|
border-radius: 4px 4px 0 0;
|
||||||
background: #1677ff;
|
background: var(--admin-primary);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height: 18px;
|
line-height: 18px;
|
||||||
|
|||||||
@@ -128,7 +128,12 @@ export function InquiryPreviewEditor({
|
|||||||
)}
|
)}
|
||||||
</Form.List>
|
</Form.List>
|
||||||
<MutationError error={save.error} />
|
<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>
|
</Button>
|
||||||
</Form>
|
</Form>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
.presentation-editor {
|
.presentation-editor {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
padding-top: 8px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.presentation-editor__header {
|
.presentation-editor__header {
|
||||||
@@ -8,15 +7,7 @@
|
|||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
margin-bottom: 24px;
|
margin-bottom: 16px;
|
||||||
}
|
|
||||||
|
|
||||||
.presentation-editor__header .ant-typography {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.presentation-editor__header .ant-typography + .ant-typography {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.presentation-editor > .ant-space {
|
.presentation-editor > .ant-space {
|
||||||
@@ -24,9 +15,9 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
margin-bottom: 24px !important;
|
margin-bottom: 24px !important;
|
||||||
padding: 6px;
|
padding: 6px;
|
||||||
border: 1px solid #e8e8e8;
|
border: 1px solid var(--admin-border);
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
background: #fafafa;
|
background: var(--admin-fill-quiet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 575px) {
|
@media (max-width: 575px) {
|
||||||
@@ -45,16 +36,16 @@
|
|||||||
grid-template-columns: 200px minmax(300px, 1fr) minmax(280px, 360px);
|
grid-template-columns: 200px minmax(300px, 1fr) minmax(280px, 360px);
|
||||||
grid-template-areas: "outline preview inspector";
|
grid-template-areas: "outline preview inspector";
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
border: 1px solid #e5e7eb;
|
border: 1px solid var(--admin-border);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background: #fff;
|
background: var(--admin-surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
.presentation-editor__preview {
|
.presentation-editor__preview {
|
||||||
grid-area: preview;
|
grid-area: preview;
|
||||||
padding: 20px !important;
|
padding: 20px !important;
|
||||||
background: #f8fafc;
|
background: var(--admin-fill);
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,13 +53,13 @@
|
|||||||
grid-area: inspector;
|
grid-area: inspector;
|
||||||
padding: 24px !important;
|
padding: 24px !important;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
border-left: 1px solid #e5e7eb;
|
border-left: 1px solid var(--admin-border);
|
||||||
}
|
}
|
||||||
|
|
||||||
.presentation-editor__outline {
|
.presentation-editor__outline {
|
||||||
grid-area: outline;
|
grid-area: outline;
|
||||||
padding: 20px 12px;
|
padding: 20px 12px;
|
||||||
border-right: 1px solid #e5e7eb;
|
border-right: 1px solid var(--admin-border);
|
||||||
}
|
}
|
||||||
.presentation-editor__regions {
|
.presentation-editor__regions {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -90,8 +81,8 @@
|
|||||||
padding-left: 24px;
|
padding-left: 24px;
|
||||||
}
|
}
|
||||||
.presentation-editor__regions .ant-btn[aria-pressed="true"] {
|
.presentation-editor__regions .ant-btn[aria-pressed="true"] {
|
||||||
background: #e6f4ff;
|
background: var(--admin-primary-bg);
|
||||||
color: #0958d9;
|
color: var(--admin-primary);
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,26 +108,37 @@
|
|||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.presentation-editor__inspector form > section {
|
.presentation-editor__form {
|
||||||
padding: 16px;
|
display: flex;
|
||||||
border: 1px solid #e5e7eb;
|
flex-direction: column;
|
||||||
border-radius: 12px;
|
min-height: 0;
|
||||||
background: #f8fafc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.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;
|
margin-top: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.presentation-editor__inspector form > .ant-space:last-child {
|
.presentation-editor__form-actions {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
padding: 16px 0 4px;
|
padding: 16px 0 4px;
|
||||||
border-top: 1px solid #e5e7eb;
|
border-top: 1px solid var(--admin-border);
|
||||||
background: #fff;
|
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;
|
min-width: 140px;
|
||||||
}
|
}
|
||||||
.presentation-editor__inspector > .ant-tag {
|
.presentation-editor__inspector > .ant-tag {
|
||||||
@@ -150,11 +152,11 @@
|
|||||||
}
|
}
|
||||||
.presentation-editor__outline {
|
.presentation-editor__outline {
|
||||||
border-right: 0;
|
border-right: 0;
|
||||||
border-bottom: 1px solid #e5e7eb;
|
border-bottom: 1px solid var(--admin-border);
|
||||||
}
|
}
|
||||||
.presentation-editor__inspector {
|
.presentation-editor__inspector {
|
||||||
border-left: 0;
|
border-left: 0;
|
||||||
border-top: 1px solid #e5e7eb;
|
border-top: 1px solid var(--admin-border);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import {
|
|||||||
Select,
|
Select,
|
||||||
Segmented,
|
Segmented,
|
||||||
Space,
|
Space,
|
||||||
Tag,
|
|
||||||
Typography,
|
Typography,
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import { useQueryClient } from "@tanstack/react-query";
|
import { useQueryClient } from "@tanstack/react-query";
|
||||||
@@ -26,6 +25,7 @@ import { projectBrandAliases, projectTrustPresentation } from "@personal-brand/a
|
|||||||
import { TemplateListField } from "../../components/TemplateListField.js";
|
import { TemplateListField } from "../../components/TemplateListField.js";
|
||||||
import { TemplateFieldRenderer } from "../../components/TemplateFieldRenderer.js";
|
import { TemplateFieldRenderer } from "../../components/TemplateFieldRenderer.js";
|
||||||
import { MutationError } from "../../components/QueryState.js";
|
import { MutationError } from "../../components/QueryState.js";
|
||||||
|
import { StatusTag } from "../../components/StatusTag.js";
|
||||||
import { RecordContentEditor } from "../../components/RecordContentEditor.js";
|
import { RecordContentEditor } from "../../components/RecordContentEditor.js";
|
||||||
import { TemplatePreview } from "./TemplatePreview.js";
|
import { TemplatePreview } from "./TemplatePreview.js";
|
||||||
import { InquiryPreviewEditor } from "./InquiryPreviewEditor.js";
|
import { InquiryPreviewEditor } from "./InquiryPreviewEditor.js";
|
||||||
@@ -483,14 +483,14 @@ export function PresentationEditor({
|
|||||||
<section className="presentation-editor" aria-labelledby="presentation-editor-title">
|
<section className="presentation-editor" aria-labelledby="presentation-editor-title">
|
||||||
<div className="presentation-editor__header">
|
<div className="presentation-editor__header">
|
||||||
<div>
|
<div>
|
||||||
<Typography.Title id="presentation-editor-title" level={3}>
|
<h2 id="presentation-editor-title" className="admin-section-title">
|
||||||
小程序页面配置
|
小程序页面配置
|
||||||
</Typography.Title>
|
</h2>
|
||||||
<Typography.Paragraph type="secondary">
|
<p className="admin-section-description">
|
||||||
按页面查找内容。这里修改的是草稿,发布后访客才会看到更新。
|
按页面查找内容。这里修改的是草稿,发布后访客才会看到更新。
|
||||||
</Typography.Paragraph>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{templateContent ? <Tag color="blue">{templateContent.displayName}</Tag> : null}
|
{templateContent ? <StatusTag tone="info" label={templateContent.displayName} /> : null}
|
||||||
</div>
|
</div>
|
||||||
{loading ? <Alert type="info" showIcon message="正在读取当前模板的编辑项目" /> : null}
|
{loading ? <Alert type="info" showIcon message="正在读取当前模板的编辑项目" /> : null}
|
||||||
{error ? (
|
{error ? (
|
||||||
@@ -517,7 +517,7 @@ export function PresentationEditor({
|
|||||||
setActivePage(value);
|
setActivePage(value);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
style={{ minWidth: 180 }}
|
className="admin-field-w-2xl"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<Segmented
|
<Segmented
|
||||||
@@ -542,7 +542,7 @@ export function PresentationEditor({
|
|||||||
{selectedPage === "detail" && draftWorkspace?.offerings.length ? (
|
{selectedPage === "detail" && draftWorkspace?.offerings.length ? (
|
||||||
<Select
|
<Select
|
||||||
aria-label="选择详情页业务内容"
|
aria-label="选择详情页业务内容"
|
||||||
style={{ width: "100%", marginBottom: 12 }}
|
className="admin-block admin-offset-bottom-sm"
|
||||||
value={selectedDetailOfferingId}
|
value={selectedDetailOfferingId}
|
||||||
options={draftWorkspace.offerings.map((item) => ({
|
options={draftWorkspace.offerings.map((item) => ({
|
||||||
value: item.id,
|
value: item.id,
|
||||||
@@ -571,7 +571,7 @@ export function PresentationEditor({
|
|||||||
<Typography.Title level={5}>页面区域</Typography.Title>
|
<Typography.Title level={5}>页面区域</Typography.Title>
|
||||||
<Typography.Paragraph type="secondary">选择区域,编辑对应内容</Typography.Paragraph>
|
<Typography.Paragraph type="secondary">选择区域,编辑对应内容</Typography.Paragraph>
|
||||||
{visibleTargets.length ? (
|
{visibleTargets.length ? (
|
||||||
<Space className="presentation-editor__regions" wrap style={{ marginTop: 16 }}>
|
<Space className="presentation-editor__regions admin-offset-top" wrap>
|
||||||
{visibleTargets.map((target) => (
|
{visibleTargets.map((target) => (
|
||||||
<Button
|
<Button
|
||||||
key={target.key}
|
key={target.key}
|
||||||
@@ -613,15 +613,24 @@ export function PresentationEditor({
|
|||||||
<Typography.Title level={5}>
|
<Typography.Title level={5}>
|
||||||
{selectedTarget?.label ?? pageTitle(selectedPage ?? "home")}
|
{selectedTarget?.label ?? pageTitle(selectedPage ?? "home")}
|
||||||
</Typography.Title>
|
</Typography.Title>
|
||||||
<Tag color={brandDirty || recordDraft || inquiryDraft ? "orange" : "default"}>
|
<StatusTag
|
||||||
{save.isPending
|
tone={
|
||||||
|
save.isError
|
||||||
|
? "error"
|
||||||
|
: save.isPending || brandDirty || recordDraft || inquiryDraft
|
||||||
|
? "warning"
|
||||||
|
: "neutral"
|
||||||
|
}
|
||||||
|
label={
|
||||||
|
save.isPending
|
||||||
? "正在保存"
|
? "正在保存"
|
||||||
: save.isError
|
: save.isError
|
||||||
? "保存失败,请重试"
|
? "保存失败,请重试"
|
||||||
: brandDirty || recordDraft || inquiryDraft
|
: brandDirty || recordDraft || inquiryDraft
|
||||||
? "有未保存修改"
|
? "有未保存修改"
|
||||||
: "草稿已同步"}
|
: "草稿已同步"
|
||||||
</Tag>
|
}
|
||||||
|
/>
|
||||||
{selectedPage === "detail" && !selectedTarget ? (
|
{selectedPage === "detail" && !selectedTarget ? (
|
||||||
<Alert
|
<Alert
|
||||||
type="info"
|
type="info"
|
||||||
@@ -787,9 +796,9 @@ export function PresentationEditor({
|
|||||||
initialValues={initialValues}
|
initialValues={initialValues}
|
||||||
onValuesChange={handleValuesChange}
|
onValuesChange={handleValuesChange}
|
||||||
onFinish={() => save.mutate(form.getFieldsValue(true) as PresentationValues)}
|
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) => (
|
{editableSections.map((section, index) => (
|
||||||
<section key={section.key} aria-labelledby={`section-${section.key}`}>
|
<section key={section.key} aria-labelledby={`section-${section.key}`}>
|
||||||
{selectedTarget && index > 0 ? <Divider /> : null}
|
{selectedTarget && index > 0 ? <Divider /> : null}
|
||||||
@@ -836,7 +845,7 @@ export function PresentationEditor({
|
|||||||
<Alert
|
<Alert
|
||||||
type="info"
|
type="info"
|
||||||
showIcon
|
showIcon
|
||||||
style={{ marginBottom: 24 }}
|
className="admin-offset-bottom-lg"
|
||||||
message="这个页面还有关联内容"
|
message="这个页面还有关联内容"
|
||||||
description={
|
description={
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
@@ -857,7 +866,7 @@ export function PresentationEditor({
|
|||||||
: "/admin/workspace",
|
: "/admin/workspace",
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
style={{ padding: 0 }}
|
className="admin-link-flush"
|
||||||
>
|
>
|
||||||
{item.label}
|
{item.label}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -880,12 +889,12 @@ export function PresentationEditor({
|
|||||||
</Typography.Paragraph>
|
</Typography.Paragraph>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</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} />
|
<MutationError error={save.error} />
|
||||||
<Button type="primary" htmlType="submit" loading={save.isPending}>
|
<Button type="primary" htmlType="submit" loading={save.isPending}>
|
||||||
保存页面内容
|
保存页面内容
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
height: min(72vh, 760px);
|
height: min(72vh, 760px);
|
||||||
min-height: 560px;
|
min-height: 560px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border: 1px solid #e8e8e8;
|
border: 1px solid var(--admin-border);
|
||||||
background: #f3f4f6;
|
background: var(--admin-fill);
|
||||||
}
|
}
|
||||||
|
|
||||||
.template-preview iframe {
|
.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 { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||||
import { QueryState } from "../../components/QueryState.js";
|
import { QueryState } from "../../components/QueryState.js";
|
||||||
import { CapabilityCard } from "./components/CapabilityCard.js";
|
import { CapabilityCard } from "./components/CapabilityCard.js";
|
||||||
@@ -14,7 +14,7 @@ export function CapabilitiesPage() {
|
|||||||
description="以经营者视角调整模板能力的开关与展示设置;保存后进入草稿,发布后生效。"
|
description="以经营者视角调整模板能力的开关与展示设置;保存后进入草稿,发布后生效。"
|
||||||
/>
|
/>
|
||||||
{query.data?.length ? (
|
{query.data?.length ? (
|
||||||
<Row gutter={[16, 16]}>
|
<Row gutter={[16, 16]} className="admin-equal-height">
|
||||||
{query.data.map((capability) => (
|
{query.data.map((capability) => (
|
||||||
<Col key={capability.capabilityKey} xs={24} lg={12}>
|
<Col key={capability.capabilityKey} xs={24} lg={12}>
|
||||||
<CapabilityCard capability={capability} />
|
<CapabilityCard capability={capability} />
|
||||||
@@ -26,9 +26,9 @@ export function CapabilitiesPage() {
|
|||||||
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="当前模板没有可配置能力。" />
|
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="当前模板没有可配置能力。" />
|
||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
<Typography.Text type="secondary" style={{ display: "block", marginTop: 16 }}>
|
<p className="admin-page-header-description admin-offset-top">
|
||||||
技术信息仅用于排查问题,不作为运营判断依据。
|
技术信息仅用于排查问题,不作为运营判断依据。
|
||||||
</Typography.Text>
|
</p>
|
||||||
</QueryState>
|
</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 { useState } from "react";
|
||||||
|
import { ErrorNote } from "../../../components/QueryState.js";
|
||||||
|
import { StatusTag } from "../../../components/StatusTag.js";
|
||||||
import { useCapabilityMutation } from "../hooks/useCapabilityQueries.js";
|
import { useCapabilityMutation } from "../hooks/useCapabilityQueries.js";
|
||||||
import type { AdminCapability, CapabilityStatus } from "../types.js";
|
import type { AdminCapability, CapabilityStatus } from "../types.js";
|
||||||
import { CapabilityStatusControl, CapabilityStatusTag } from "./CapabilityStatusControl.js";
|
import { CapabilityStatusControl, CapabilityStatusTag } from "./CapabilityStatusControl.js";
|
||||||
@@ -46,10 +48,10 @@ export function CapabilityCard({ capability }: { capability: AdminCapability })
|
|||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
title={
|
title={
|
||||||
<span>
|
<span className="admin-row-line">
|
||||||
{capability.displayName ?? "未命名能力"}
|
{capability.displayName ?? "未命名能力"}
|
||||||
<Tag style={{ marginLeft: 8 }}>{sourceLabels[capability.source]}</Tag>
|
|
||||||
<CapabilityStatusTag status={status} />
|
<CapabilityStatusTag status={status} />
|
||||||
|
<StatusTag tone="neutral" label={sourceLabels[capability.source]} />
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
extra={
|
extra={
|
||||||
@@ -59,48 +61,40 @@ export function CapabilityCard({ capability }: { capability: AdminCapability })
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
{mutation.isError ? (
|
{mutation.isError ? (
|
||||||
<Alert
|
<div className="admin-offset-bottom">
|
||||||
type="error"
|
<ErrorNote error={mutation.error} />
|
||||||
showIcon
|
</div>
|
||||||
message="保存失败,已保留当前输入"
|
|
||||||
description={
|
|
||||||
mutation.error instanceof Error ? mutation.error.message : "请检查网络或稍后重试"
|
|
||||||
}
|
|
||||||
style={{ marginBottom: 16 }}
|
|
||||||
/>
|
|
||||||
) : null}
|
) : null}
|
||||||
{capability.description ? (
|
{capability.description ? (
|
||||||
<Typography.Paragraph>{capability.description}</Typography.Paragraph>
|
<p className="admin-section-description">{capability.description}</p>
|
||||||
) : null}
|
) : null}
|
||||||
{capability.impact ? (
|
{capability.impact ? (
|
||||||
<Typography.Paragraph type="secondary">影响:{capability.impact}</Typography.Paragraph>
|
<p className="admin-section-description">影响:{capability.impact}</p>
|
||||||
) : null}
|
) : null}
|
||||||
<div style={{ display: "grid", gap: 12 }}>
|
<div className="admin-field-stack">
|
||||||
<div>
|
<div>
|
||||||
<Typography.Text strong>运行状态</Typography.Text>
|
<span className="admin-field-label">运行状态</span>
|
||||||
<div style={{ marginTop: 8 }}>
|
<div className="admin-offset-top-sm">
|
||||||
<CapabilityStatusControl
|
<CapabilityStatusControl
|
||||||
status={status}
|
status={status}
|
||||||
onChange={setStatus}
|
onChange={setStatus}
|
||||||
disabled={mutation.isPending}
|
disabled={mutation.isPending}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Typography.Paragraph type="secondary" style={{ marginBottom: 0 }}>
|
<p className="admin-section-description admin-flush">保存后进入草稿,发布后生效。</p>
|
||||||
保存后进入草稿,发布后生效。
|
|
||||||
</Typography.Paragraph>
|
|
||||||
{status === "disabled" && capability.disablePolicy ? (
|
{status === "disabled" && capability.disablePolicy ? (
|
||||||
<Typography.Paragraph type="warning" style={{ marginBottom: 0 }}>
|
<p className="admin-section-description admin-flush admin-text-warning">
|
||||||
{disablePolicyLabels[capability.disablePolicy]}
|
{disablePolicyLabels[capability.disablePolicy]}
|
||||||
</Typography.Paragraph>
|
</p>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
{capability.configFields?.length ? (
|
{capability.configFields?.length ? (
|
||||||
<div>
|
<div>
|
||||||
<Typography.Text strong>能力设置</Typography.Text>
|
<span className="admin-field-label">能力设置</span>
|
||||||
<div style={{ display: "grid", gap: 12, marginTop: 8 }}>
|
<div className="admin-field-stack admin-offset-top-sm">
|
||||||
{capability.configFields.map((field) => (
|
{capability.configFields.map((field) => (
|
||||||
<div key={field.key}>
|
<div key={field.key}>
|
||||||
<Typography.Text>{field.label}</Typography.Text>
|
<span className="admin-field-label">{field.label}</span>
|
||||||
{field.input === "switch" ? (
|
{field.input === "switch" ? (
|
||||||
<div>
|
<div>
|
||||||
<Switch
|
<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 type { CapabilityStatus } from "../types.js";
|
||||||
|
import { StatusTag } from "../../../components/StatusTag.js";
|
||||||
|
import type { StatusTone } from "../../../components/StatusTag.js";
|
||||||
|
|
||||||
const statusLabels: Record<CapabilityStatus, string> = {
|
const statusLabels: Record<CapabilityStatus, string> = {
|
||||||
enabled: "启用",
|
enabled: "启用",
|
||||||
@@ -7,14 +9,14 @@ const statusLabels: Record<CapabilityStatus, string> = {
|
|||||||
degraded: "降级",
|
degraded: "降级",
|
||||||
};
|
};
|
||||||
|
|
||||||
const statusColors: Record<CapabilityStatus, string> = {
|
const statusTones: Record<CapabilityStatus, StatusTone> = {
|
||||||
enabled: "green",
|
enabled: "success",
|
||||||
disabled: "default",
|
disabled: "neutral",
|
||||||
degraded: "orange",
|
degraded: "warning",
|
||||||
};
|
};
|
||||||
|
|
||||||
export function CapabilityStatusTag({ status }: { status: CapabilityStatus }) {
|
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({
|
export function CapabilityStatusControl({
|
||||||
|
|||||||
@@ -1,20 +1,13 @@
|
|||||||
import {
|
import { Badge, Button, Descriptions, Drawer, Select, Space, Table, message, Input } from "antd";
|
||||||
Badge,
|
|
||||||
Button,
|
|
||||||
Card,
|
|
||||||
Descriptions,
|
|
||||||
Drawer,
|
|
||||||
Select,
|
|
||||||
Space,
|
|
||||||
Table,
|
|
||||||
Tag,
|
|
||||||
message,
|
|
||||||
Input,
|
|
||||||
} from "antd";
|
|
||||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
import type { AdminBooking, InquirySubmission } from "@personal-brand/api-client";
|
import type { AdminBooking, InquirySubmission } from "@personal-brand/api-client";
|
||||||
import { createApiClient } from "../../lib/api.js";
|
import { createApiClient } from "../../lib/api.js";
|
||||||
import { useState } from "react";
|
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 statuses = ["received", "contacting", "confirmed", "completed", "cancelled"] as const;
|
||||||
const labels: Record<string, string> = {
|
const labels: Record<string, string> = {
|
||||||
@@ -41,6 +34,20 @@ const inquiryLabels: Record<string, string> = {
|
|||||||
closed: "已关闭",
|
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() {
|
export function InquiriesPage() {
|
||||||
const client = createApiClient();
|
const client = createApiClient();
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
@@ -94,14 +101,16 @@ export function InquiriesPage() {
|
|||||||
onError: (error) => message.error(error instanceof Error ? error.message : "更新失败,请重试"),
|
onError: (error) => message.error(error instanceof Error ? error.message : "更新失败,请重试"),
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<Card
|
<>
|
||||||
title="咨询记录"
|
<AdminPageHeader title="咨询记录" description="查看访客提交的咨询和预约,并跟进处理进度。" />
|
||||||
|
<AdminSection
|
||||||
|
title="预约咨询"
|
||||||
extra={
|
extra={
|
||||||
<Space>
|
<Space>
|
||||||
<Select
|
<Select
|
||||||
allowClear
|
allowClear
|
||||||
placeholder="全部状态"
|
placeholder="全部状态"
|
||||||
style={{ width: 130 }}
|
className="admin-field-w-md"
|
||||||
value={status}
|
value={status}
|
||||||
onChange={setStatus}
|
onChange={setStatus}
|
||||||
options={statuses.map((value) => ({ value, label: labels[value] }))}
|
options={statuses.map((value) => ({ value, label: labels[value] }))}
|
||||||
@@ -119,6 +128,7 @@ export function InquiriesPage() {
|
|||||||
<Table
|
<Table
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
loading={query.isLoading}
|
loading={query.isLoading}
|
||||||
|
locale={{ emptyText: "还没有预约咨询。" }}
|
||||||
dataSource={query.data ?? []}
|
dataSource={query.data ?? []}
|
||||||
columns={[
|
columns={[
|
||||||
{
|
{
|
||||||
@@ -139,7 +149,9 @@ export function InquiriesPage() {
|
|||||||
{
|
{
|
||||||
title: "状态",
|
title: "状态",
|
||||||
dataIndex: "status",
|
dataIndex: "status",
|
||||||
render: (value: string) => <Tag>{labels[value] ?? value}</Tag>,
|
render: (value: string) => (
|
||||||
|
<StatusTag tone={statusTones[value] ?? "neutral"} label={labels[value] ?? value} />
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "操作",
|
title: "操作",
|
||||||
@@ -151,7 +163,7 @@ export function InquiriesPage() {
|
|||||||
onChange={(value) => update.mutate({ id: item.id, value: value as never })}
|
onChange={(value) => update.mutate({ id: item.id, value: value as never })}
|
||||||
options={statuses.map((value) => ({ value, label: labels[value] }))}
|
options={statuses.map((value) => ({ value, label: labels[value] }))}
|
||||||
/>
|
/>
|
||||||
<Button size="small" onClick={() => read.mutate(item.id)}>
|
<Button type="link" size="small" onClick={() => read.mutate(item.id)}>
|
||||||
标记已读
|
标记已读
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</Space>
|
||||||
@@ -182,29 +194,26 @@ export function InquiriesPage() {
|
|||||||
</Descriptions>
|
</Descriptions>
|
||||||
)}
|
)}
|
||||||
</Drawer>
|
</Drawer>
|
||||||
<Card
|
</AdminSection>
|
||||||
|
<AdminSection
|
||||||
title={`动态咨询提交${submissions.data ? `(${submissions.data.length})` : ""}`}
|
title={`动态咨询提交${submissions.data ? `(${submissions.data.length})` : ""}`}
|
||||||
style={{ marginTop: 24 }}
|
description="按模板表单提交的咨询记录,字段随表单配置变化。"
|
||||||
extra={
|
extra={
|
||||||
<Button onClick={() => void submissions.refetch()} loading={submissions.isFetching}>
|
<Button onClick={() => void submissions.refetch()} loading={submissions.isFetching}>
|
||||||
刷新提交记录
|
刷新提交记录
|
||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{submissions.isError && (
|
{submissions.isError ? (
|
||||||
<Card type="inner" style={{ marginBottom: 16 }}>
|
<ErrorNote error={submissions.error} onRetry={() => void submissions.refetch()} />
|
||||||
动态咨询提交加载失败:
|
) : null}
|
||||||
{submissions.error instanceof Error ? submissions.error.message : "未知错误"}
|
<Space
|
||||||
<Button type="link" onClick={() => void submissions.refetch()}>
|
className={`admin-offset-bottom-sm ${submissions.isError ? "admin-offset-top" : ""}`}
|
||||||
重试
|
>
|
||||||
</Button>
|
|
||||||
</Card>
|
|
||||||
)}
|
|
||||||
<Space style={{ marginBottom: 12 }}>
|
|
||||||
<Select
|
<Select
|
||||||
allowClear
|
allowClear
|
||||||
placeholder="动态咨询状态"
|
placeholder="动态咨询状态"
|
||||||
style={{ width: 140 }}
|
className="admin-field-w-md"
|
||||||
value={submissionStatus}
|
value={submissionStatus}
|
||||||
onChange={setSubmissionStatus}
|
onChange={setSubmissionStatus}
|
||||||
options={inquiryStatuses.map((value) => ({ value, label: inquiryLabels[value] }))}
|
options={inquiryStatuses.map((value) => ({ value, label: inquiryLabels[value] }))}
|
||||||
@@ -228,7 +237,10 @@ export function InquiriesPage() {
|
|||||||
title: "状态",
|
title: "状态",
|
||||||
dataIndex: "status",
|
dataIndex: "status",
|
||||||
render: (value: InquirySubmission["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}` },
|
{ title: "版本", dataIndex: "formVersion", render: (value) => `v${value}` },
|
||||||
@@ -251,7 +263,7 @@ export function InquiriesPage() {
|
|||||||
title: "跟进",
|
title: "跟进",
|
||||||
render: (_: unknown, item: InquirySubmission) => (
|
render: (_: unknown, item: InquirySubmission) => (
|
||||||
<Space>
|
<Space>
|
||||||
<Button size="small" onClick={() => setSelectedSubmission(item)}>
|
<Button type="link" size="small" onClick={() => setSelectedSubmission(item)}>
|
||||||
查看
|
查看
|
||||||
</Button>
|
</Button>
|
||||||
<Select
|
<Select
|
||||||
@@ -314,7 +326,7 @@ export function InquiriesPage() {
|
|||||||
</Descriptions>
|
</Descriptions>
|
||||||
)}
|
)}
|
||||||
</Drawer>
|
</Drawer>
|
||||||
</Card>
|
</AdminSection>
|
||||||
</Card>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -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 { useQueries, useQuery } from "@tanstack/react-query";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { createApiClient } from "../../lib/api.js";
|
import { createApiClient } from "../../lib/api.js";
|
||||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||||
import { QueryState } from "../../components/QueryState.js";
|
import { QueryState } from "../../components/QueryState.js";
|
||||||
|
import { MetricCard } from "../../components/MetricCard.js";
|
||||||
|
import { StatusTag } from "../../components/StatusTag.js";
|
||||||
|
|
||||||
export function OverviewPage() {
|
export function OverviewPage() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -82,41 +84,32 @@ export function OverviewPage() {
|
|||||||
title="品牌概览"
|
title="品牌概览"
|
||||||
description="从这里检查品牌表达、信任内容和业务承接是否完整。"
|
description="从这里检查品牌表达、信任内容和业务承接是否完整。"
|
||||||
/>
|
/>
|
||||||
<Space direction="vertical" size={24} style={{ width: "100%" }}>
|
<div className="admin-stack">
|
||||||
<Card>
|
<Card>
|
||||||
<Typography.Title level={3} style={{ marginTop: 0 }}>
|
<h2 className="admin-brand-title">{brand?.name || "未命名品牌"}</h2>
|
||||||
{brand?.name || "未命名品牌"}
|
<p className="admin-brand-tagline">{brand?.tagline || "还没有设置一句话定位"}</p>
|
||||||
</Typography.Title>
|
<StatusTag
|
||||||
<Typography.Paragraph type="secondary">
|
tone="info"
|
||||||
{brand?.tagline || "还没有设置一句话定位"}
|
label={`当前模板:${workspace?.templateContent?.displayName ?? "尚未安装模板"}`}
|
||||||
</Typography.Paragraph>
|
/>
|
||||||
<Tag color="blue">
|
|
||||||
当前模板:{workspace?.templateContent?.displayName ?? "尚未安装模板"}
|
|
||||||
</Tag>
|
|
||||||
</Card>
|
</Card>
|
||||||
<Row gutter={[16, 16]}>
|
<Row gutter={[16, 16]}>
|
||||||
<Col xs={24} sm={12} lg={6}>
|
<Col xs={24} sm={8}>
|
||||||
<Card>
|
<MetricCard
|
||||||
<Statistic
|
label="信任证明"
|
||||||
title="信任证明"
|
|
||||||
value={trust?.filter((item) => item.isPublished).length ?? 0}
|
value={trust?.filter((item) => item.isPublished).length ?? 0}
|
||||||
suffix="条已发布"
|
suffix="条已发布"
|
||||||
/>
|
/>
|
||||||
</Card>
|
|
||||||
</Col>
|
</Col>
|
||||||
<Col xs={24} sm={12} lg={6}>
|
<Col xs={24} sm={8}>
|
||||||
<Card>
|
<MetricCard
|
||||||
<Statistic
|
label="业务展示内容"
|
||||||
title="业务展示内容"
|
|
||||||
value={offerings?.filter((item) => item.isEnabled).length ?? 0}
|
value={offerings?.filter((item) => item.isEnabled).length ?? 0}
|
||||||
suffix="项公开"
|
suffix="项公开"
|
||||||
/>
|
/>
|
||||||
</Card>
|
|
||||||
</Col>
|
</Col>
|
||||||
<Col xs={24} sm={12} lg={6}>
|
<Col xs={24} sm={8}>
|
||||||
<Card>
|
<MetricCard label="咨询提交" value={submissions?.length ?? 0} suffix="条" />
|
||||||
<Statistic title="咨询提交" value={submissions?.length ?? 0} suffix="条" />
|
|
||||||
</Card>
|
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<Row gutter={[16, 16]}>
|
<Row gutter={[16, 16]}>
|
||||||
@@ -139,41 +132,10 @@ export function OverviewPage() {
|
|||||||
: `还有 ${incompleteChecks.length} 项需要完善,完成后才能发布。`}
|
: `还有 ${incompleteChecks.length} 项需要完善,完成后才能发布。`}
|
||||||
</Typography.Paragraph>
|
</Typography.Paragraph>
|
||||||
{incompleteChecks.length > 0 && (
|
{incompleteChecks.length > 0 && (
|
||||||
<List
|
<ul className="admin-list">
|
||||||
size="small"
|
{incompleteChecks.slice(0, 4).map((item) => (
|
||||||
dataSource={incompleteChecks.slice(0, 4)}
|
<li key={item.key} className="admin-row">
|
||||||
renderItem={(item) => (
|
<span className="admin-row-title">{item.label}</span>
|
||||||
<List.Item
|
|
||||||
actions={[
|
|
||||||
<Button
|
|
||||||
key={item.key}
|
|
||||||
type="link"
|
|
||||||
size="small"
|
|
||||||
onClick={() => navigate(item.destination ?? "/admin/publication")}
|
|
||||||
>
|
|
||||||
去处理
|
|
||||||
</Button>,
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
{item.label}
|
|
||||||
</List.Item>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</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
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -181,15 +143,40 @@ export function OverviewPage() {
|
|||||||
>
|
>
|
||||||
去处理
|
去处理
|
||||||
</Button>
|
</Button>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
)}
|
)}
|
||||||
</Space>
|
</Card>
|
||||||
</List.Item>
|
</Col>
|
||||||
)}
|
<Col xs={24} lg={12}>
|
||||||
|
<Card title="品牌内容检查">
|
||||||
|
<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>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</Space>
|
</div>
|
||||||
</QueryState>
|
</QueryState>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
import { useEffect, useRef } from "react";
|
import { useEffect, useRef } from "react";
|
||||||
import { Alert, Button, Card, Collapse, Flex, Space, Tag, Tooltip, Typography, theme } from "antd";
|
import { Button, Card, Collapse, Flex, Space, Tooltip, Typography } from "antd";
|
||||||
import { LoadingOutlined } from "@ant-design/icons";
|
|
||||||
import type { MiniAppReleaseTask } from "@personal-brand/api-client";
|
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"];
|
type ReleaseStatus = MiniAppReleaseTask["status"];
|
||||||
|
|
||||||
@@ -13,18 +15,18 @@ function isStaleBuilding(task: MiniAppReleaseTask): boolean {
|
|||||||
return !Number.isNaN(updatedAt) && Date.now() - updatedAt >= STALE_BUILDING_MS;
|
return !Number.isNaN(updatedAt) && Date.now() - updatedAt >= STALE_BUILDING_MS;
|
||||||
}
|
}
|
||||||
|
|
||||||
const statusView: Record<ReleaseStatus, { label: string; color: string; hint: string }> = {
|
const statusView: Record<ReleaseStatus, { label: string; tone: StatusTone; hint: string }> = {
|
||||||
built: { label: "待上传", color: "default", hint: "代码已构建,可上传到微信。" },
|
built: { label: "待上传", tone: "neutral", hint: "代码已构建,可上传到微信。" },
|
||||||
uploaded: { label: "已上传微信", color: "blue", hint: "请在微信后台上传体验版并提交审核。" },
|
uploaded: { label: "已上传微信", tone: "info", hint: "请在微信后台上传体验版并提交审核。" },
|
||||||
under_review: {
|
under_review: {
|
||||||
label: "审核中",
|
label: "审核中",
|
||||||
color: "processing",
|
tone: "warning",
|
||||||
hint: "等待微信审核结果,通过后回到本页标记。",
|
hint: "等待微信审核结果,通过后回到本页标记。",
|
||||||
},
|
},
|
||||||
approved: { label: "审核通过", color: "cyan", hint: "审核已通过,确认无误后标记为已发布。" },
|
approved: { label: "审核通过", tone: "success", hint: "审核已通过,确认无误后标记为已发布。" },
|
||||||
published: { label: "已发布", color: "green", hint: "该版本已发布,可继续编辑内容后再次上传。" },
|
published: { label: "已发布", tone: "success", hint: "该版本已发布,可继续编辑内容后再次上传。" },
|
||||||
rejected: { label: "已驳回", color: "volcano", hint: "微信驳回后需修改内容并重新构建上传。" },
|
rejected: { label: "已驳回", tone: "error", hint: "微信驳回后需修改内容并重新构建上传。" },
|
||||||
failed: { label: "失败", color: "red", hint: "上次构建或上传失败,可直接重试。" },
|
failed: { label: "失败", tone: "error", hint: "上次构建或上传失败,可直接重试。" },
|
||||||
};
|
};
|
||||||
|
|
||||||
function formatTime(value: string): string {
|
function formatTime(value: string): string {
|
||||||
@@ -50,7 +52,6 @@ export function MiniAppReleaseCard({
|
|||||||
onUpload: () => void;
|
onUpload: () => void;
|
||||||
onStatusChange: (status: ReleaseStatus) => void;
|
onStatusChange: (status: ReleaseStatus) => void;
|
||||||
}) {
|
}) {
|
||||||
const { token } = theme.useToken();
|
|
||||||
const logRef = useRef<HTMLPreElement>(null);
|
const logRef = useRef<HTMLPreElement>(null);
|
||||||
const logs = task.buildLogs ?? [];
|
const logs = task.buildLogs ?? [];
|
||||||
const status = statusView[task.status];
|
const status = statusView[task.status];
|
||||||
@@ -104,72 +105,49 @@ export function MiniAppReleaseCard({
|
|||||||
<Space direction="vertical" size={4}>
|
<Space direction="vertical" size={4}>
|
||||||
<Space wrap size={8} align="center">
|
<Space wrap size={8} align="center">
|
||||||
<Typography.Text strong>品牌内容 v{task.version}</Typography.Text>
|
<Typography.Text strong>品牌内容 v{task.version}</Typography.Text>
|
||||||
<Tag color={status.color}>{status.label}</Tag>
|
<StatusTag label={status.label} tone={status.tone} />
|
||||||
{building && (
|
{building && (
|
||||||
<Tag icon={<LoadingOutlined />} color="orange">
|
<StatusTag tone="warning" label={staleBuilding ? "构建已中断" : "构建中"} />
|
||||||
{staleBuilding ? "构建已中断" : "构建中"}
|
|
||||||
</Tag>
|
|
||||||
)}
|
)}
|
||||||
{task.weappUploadId && (
|
{task.weappUploadId && (
|
||||||
<Typography.Text type="secondary">微信版本 {task.weappUploadId}</Typography.Text>
|
<Typography.Text type="secondary">微信版本 {task.weappUploadId}</Typography.Text>
|
||||||
)}
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
|
<span className="admin-text-xs">
|
||||||
{staleBuilding ? "超过 15 分钟没有新的构建输出,可能已中断;可直接重试。" : status.hint}
|
{staleBuilding ? "超过 15 分钟没有新的构建输出,可能已中断;可直接重试。" : status.hint}
|
||||||
</Typography.Text>
|
</span>
|
||||||
<Tooltip title={`创建于 ${formatTime(task.createdAt)}`}>
|
<Tooltip title={`创建于 ${formatTime(task.createdAt)}`}>
|
||||||
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
|
<span className="admin-text-xs-quiet">更新于 {formatTime(task.updatedAt)}</span>
|
||||||
更新于 {formatTime(task.updatedAt)}
|
|
||||||
</Typography.Text>
|
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Space>
|
</Space>
|
||||||
{actions}
|
{actions}
|
||||||
</Flex>
|
</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 && (
|
{logs.length > 0 && (
|
||||||
<Collapse
|
<Collapse
|
||||||
ghost
|
ghost
|
||||||
size="small"
|
size="small"
|
||||||
style={{ marginTop: 8 }}
|
className="admin-offset-top-sm"
|
||||||
{...(building || task.buildStatus === "failed" ? { defaultActiveKey: ["logs"] } : {})}
|
{...(building || task.buildStatus === "failed" ? { defaultActiveKey: ["logs"] } : {})}
|
||||||
items={[
|
items={[
|
||||||
{
|
{
|
||||||
key: "logs",
|
key: "logs",
|
||||||
label: (
|
label: <span className="admin-text-xs">构建日志({logs.length} 行)</span>,
|
||||||
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
|
|
||||||
构建日志({logs.length} 行)
|
|
||||||
</Typography.Text>
|
|
||||||
),
|
|
||||||
children: (
|
children: (
|
||||||
<pre
|
<pre ref={logRef} className="admin-log">
|
||||||
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,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{logs.map((log, index) => (
|
{logs.map((log, index) => (
|
||||||
<div
|
<div
|
||||||
key={`${log.at}-${index}`}
|
key={`${log.at}-${index}`}
|
||||||
style={{
|
className="admin-log__line"
|
||||||
color:
|
data-stream={log.stream}
|
||||||
log.stream === "stderr" ? token.colorError : token.colorTextSecondary,
|
|
||||||
whiteSpace: "pre-wrap",
|
|
||||||
wordBreak: "break-all",
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
|
<span className="admin-log__time">{formatLogTime(log.at)}</span>
|
||||||
{formatLogTime(log.at)}
|
|
||||||
</Typography.Text>
|
|
||||||
{" "}
|
{" "}
|
||||||
{log.message}
|
{log.message}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|||||||
import {
|
import {
|
||||||
Alert,
|
Alert,
|
||||||
Button,
|
Button,
|
||||||
Card,
|
|
||||||
Divider,
|
Divider,
|
||||||
Empty,
|
Empty,
|
||||||
Input,
|
Input,
|
||||||
@@ -13,7 +12,6 @@ import {
|
|||||||
Select,
|
Select,
|
||||||
Space,
|
Space,
|
||||||
Spin,
|
Spin,
|
||||||
Tag,
|
|
||||||
Tabs,
|
Tabs,
|
||||||
Typography,
|
Typography,
|
||||||
message,
|
message,
|
||||||
@@ -21,7 +19,9 @@ import {
|
|||||||
import type { BrandTemplateKey } from "@personal-brand/api-client";
|
import type { BrandTemplateKey } from "@personal-brand/api-client";
|
||||||
import { createApiClient } from "../../lib/api.js";
|
import { createApiClient } from "../../lib/api.js";
|
||||||
import { AdminPageHeader } from "../../components/AdminPageHeader.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";
|
import { MiniAppReleaseCard } from "./MiniAppReleaseCard.js";
|
||||||
|
|
||||||
const client = createApiClient();
|
const client = createApiClient();
|
||||||
@@ -268,17 +268,16 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
|||||||
|
|
||||||
const contentTab = null;
|
const contentTab = null;
|
||||||
const miniAppSettingsTab = (
|
const miniAppSettingsTab = (
|
||||||
<Space direction="vertical" size={24} style={{ width: "100%" }}>
|
<div className="admin-stack admin-stack-lg">
|
||||||
<Card title="小程序上传配置">
|
<AdminSection
|
||||||
<Typography.Paragraph type="secondary">
|
title="小程序上传配置"
|
||||||
AppID 用于服务端调用微信官方上传工具;上传私钥保存前会使用 AES-256-GCM
|
description="AppID 用于服务端调用微信官方上传工具;上传私钥保存前会使用 AES-256-GCM 加密。"
|
||||||
加密。小程序产物目录由系统构建流程决定,不需要手动修改。
|
>
|
||||||
</Typography.Paragraph>
|
|
||||||
{miniAppSettings.data?.buildError ? (
|
{miniAppSettings.data?.buildError ? (
|
||||||
<Alert
|
<Alert
|
||||||
type="warning"
|
type="warning"
|
||||||
showIcon
|
showIcon
|
||||||
style={{ marginBottom: 12 }}
|
className="admin-offset-bottom"
|
||||||
message="小程序构建参数未就绪"
|
message="小程序构建参数未就绪"
|
||||||
description={miniAppSettings.data.buildError}
|
description={miniAppSettings.data.buildError}
|
||||||
/>
|
/>
|
||||||
@@ -286,7 +285,7 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
|||||||
<Alert
|
<Alert
|
||||||
type="info"
|
type="info"
|
||||||
showIcon
|
showIcon
|
||||||
style={{ marginBottom: 12 }}
|
className="admin-offset-bottom"
|
||||||
message={`请求域名 ${miniAppSettings.data?.requestDomain ?? "未确认"}`}
|
message={`请求域名 ${miniAppSettings.data?.requestDomain ?? "未确认"}`}
|
||||||
description="该域名在构建时写入小程序包,必须与微信后台“开发设置 → 服务器域名 → request 合法域名”一致;不一致会导致小程序打开即加载失败。"
|
description="该域名在构建时写入小程序包,必须与微信后台“开发设置 → 服务器域名 → request 合法域名”一致;不一致会导致小程序打开即加载失败。"
|
||||||
/>
|
/>
|
||||||
@@ -337,7 +336,7 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
|||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
spellCheck={false}
|
spellCheck={false}
|
||||||
placeholder={"-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----"}
|
placeholder={"-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----"}
|
||||||
style={{ fontFamily: "monospace", fontSize: 12 }}
|
className="admin-code-input"
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Space>
|
<Space>
|
||||||
@@ -345,15 +344,15 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
|||||||
保存上传配置
|
保存上传配置
|
||||||
</Button>
|
</Button>
|
||||||
{miniAppSettings.data?.hasStoredCredentials ? (
|
{miniAppSettings.data?.hasStoredCredentials ? (
|
||||||
<Tag color="green">已加密保存上传凭据</Tag>
|
<StatusTag tone="success" label="已加密保存上传凭据" />
|
||||||
) : (
|
) : (
|
||||||
<Tag color="warning">未配置上传私钥</Tag>
|
<StatusTag tone="warning" label="未配置上传私钥" />
|
||||||
)}
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
<MutationError error={saveMiniAppSettings.error} />
|
<MutationError error={saveMiniAppSettings.error} />
|
||||||
</Form>
|
</Form>
|
||||||
</Card>
|
</AdminSection>
|
||||||
</Space>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -380,13 +379,15 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
|||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
{activeTab === "content" && (
|
{activeTab === "content" && (
|
||||||
<Space direction="vertical" size={24} style={{ width: "100%" }}>
|
<div className="admin-stack">
|
||||||
<section>
|
<AdminSection
|
||||||
<Typography.Title level={4}>1. 选择表达方式</Typography.Title>
|
title="选择表达方式"
|
||||||
|
description="行业模板决定内容结构,视觉模板决定小程序的排版风格。"
|
||||||
|
>
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
<Select
|
<Select
|
||||||
aria-label="行业模板"
|
aria-label="行业模板"
|
||||||
style={{ width: 220 }}
|
className="admin-field-w-xl"
|
||||||
value={industryKey}
|
value={industryKey}
|
||||||
disabled={!canManageTemplate || Boolean(workspace.data?.installations.length)}
|
disabled={!canManageTemplate || Boolean(workspace.data?.installations.length)}
|
||||||
options={(catalog.data?.industries ?? []).map((item) => ({
|
options={(catalog.data?.industries ?? []).map((item) => ({
|
||||||
@@ -397,7 +398,7 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
|||||||
/>
|
/>
|
||||||
<Select
|
<Select
|
||||||
aria-label="视觉模板"
|
aria-label="视觉模板"
|
||||||
style={{ width: 220 }}
|
className="admin-field-w-xl"
|
||||||
value={visualKey}
|
value={visualKey}
|
||||||
disabled={!canManageTemplate}
|
disabled={!canManageTemplate}
|
||||||
loading={selectVisual.isPending}
|
loading={selectVisual.isPending}
|
||||||
@@ -409,19 +410,20 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
|||||||
)}
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
{workspace.data?.installations.length ? (
|
{workspace.data?.installations.length ? (
|
||||||
<Typography.Paragraph type="secondary" style={{ marginTop: 8 }}>
|
<p className="admin-section-description admin-offset-top-sm">
|
||||||
当前品牌已安装主模板。模板版本与升级在高级设置中管理。
|
当前品牌已安装主模板。模板版本与升级在高级设置中管理。
|
||||||
</Typography.Paragraph>
|
</p>
|
||||||
) : null}
|
) : null}
|
||||||
<MutationError error={install.error || selectVisual.error} />
|
<MutationError error={install.error || selectVisual.error} />
|
||||||
<Divider />
|
<Divider className="admin-divider" />
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
<Typography.Text>示例内容</Typography.Text>
|
<Typography.Text>示例内容</Typography.Text>
|
||||||
{sample.isLoading && <Spin size="small" />}
|
{sample.isLoading && <Spin size="small" />}
|
||||||
{sample.data && (
|
{sample.data && (
|
||||||
<Tag color={sample.data.alreadyImported ? "green" : "blue"}>
|
<StatusTag
|
||||||
{sample.data.alreadyImported ? "已导入" : "可导入"}
|
tone={sample.data.alreadyImported ? "success" : "info"}
|
||||||
</Tag>
|
label={sample.data.alreadyImported ? "已导入" : "可导入"}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
<Button
|
<Button
|
||||||
disabled={!canManageTemplate || !sample.data || sample.data.alreadyImported}
|
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>}
|
{sample.isError && <Button onClick={() => void sample.refetch()}>重试</Button>}
|
||||||
</Space>
|
</Space>
|
||||||
{sample.isError && (
|
{sample.isError && (
|
||||||
<Alert
|
<div className="admin-offset-top-sm">
|
||||||
type="error"
|
<ErrorNote error={sample.error} onRetry={() => void sample.refetch()} />
|
||||||
message={sample.error instanceof Error ? sample.error.message : "示例内容加载失败"}
|
</div>
|
||||||
showIcon
|
|
||||||
style={{ marginTop: 8 }}
|
|
||||||
/>
|
|
||||||
)}
|
)}
|
||||||
{sample.data && !sample.data.alreadyImported && (
|
{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)
|
{Object.entries(sample.data.counts)
|
||||||
.map(([key, count]) => `${key} ${count} 项`)
|
.map(([key, count]) => `${key} ${count} 项`)
|
||||||
.join("、")}
|
.join("、")}
|
||||||
;发布前请替换示例文案和图片。
|
;发布前请替换示例文案和图片。
|
||||||
</Typography.Paragraph>
|
</p>
|
||||||
)}
|
)}
|
||||||
<MutationError error={importSample.error} />
|
<MutationError error={importSample.error} />
|
||||||
</section>
|
</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>
|
||||||
)}
|
</AdminSection>
|
||||||
{activeTab === "content" && (
|
<AdminSection
|
||||||
<Space direction="vertical" size={24} style={{ width: "100%" }}>
|
title="检查并发布"
|
||||||
<section>
|
extra={
|
||||||
<Typography.Title level={4}>3. 检查并发布</Typography.Title>
|
<Space wrap>
|
||||||
<Space wrap style={{ marginBottom: 12 }}>
|
<StatusTag
|
||||||
<Tag color={currentRelease ? "green" : "default"}>
|
tone={currentRelease ? "success" : "neutral"}
|
||||||
{currentRelease ? `已发布 v${currentRelease.version}` : "尚未发布"}
|
label={currentRelease ? `已发布 v${currentRelease.version}` : "尚未发布"}
|
||||||
</Tag>
|
/>
|
||||||
<Button onClick={() => void readiness.refetch()}>重新检查</Button>
|
<Button onClick={() => void readiness.refetch()}>重新检查</Button>
|
||||||
</Space>
|
</Space>
|
||||||
<Space direction="vertical" style={{ width: "100%" }}>
|
}
|
||||||
|
>
|
||||||
|
<ul className="admin-list">
|
||||||
{(readiness.data?.checks ?? []).map((check) => (
|
{(readiness.data?.checks ?? []).map((check) => (
|
||||||
<Space key={check.key}>
|
<li key={check.key} className="admin-row">
|
||||||
<Tag color={check.passed ? "success" : "warning"}>
|
<div className="admin-row-main">
|
||||||
{check.passed ? "已完成" : "待完善"}
|
<div className="admin-row-line">
|
||||||
</Tag>
|
<StatusTag
|
||||||
<Typography.Text>{check.label}</Typography.Text>
|
tone={check.passed ? "success" : "warning"}
|
||||||
{check.help ? (
|
label={check.passed ? "已完成" : "待完善"}
|
||||||
<Typography.Text type="secondary">{check.help}</Typography.Text>
|
/>
|
||||||
) : null}
|
<span className="admin-row-title">{check.label}</span>
|
||||||
{!check.passed && (
|
{check.help ? <span className="admin-row-meta">{check.help}</span> : null}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{!check.passed ? (
|
||||||
<Button
|
<Button
|
||||||
type="link"
|
type="link"
|
||||||
|
size="small"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
navigate(check.destination ?? destinations[check.key] ?? "/admin/overview")
|
navigate(check.destination ?? destinations[check.key] ?? "/admin/overview")
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
去处理
|
去处理
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
) : null}
|
||||||
</Space>
|
</li>
|
||||||
))}
|
))}
|
||||||
</Space>
|
</ul>
|
||||||
<Space wrap style={{ marginTop: 16 }}>
|
<Space wrap className="admin-offset-top">
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
disabled={!readiness.data?.ready}
|
disabled={!readiness.data?.ready}
|
||||||
@@ -501,68 +549,51 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
|||||||
)}
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
<MutationError error={publish.error || revoke.error} />
|
<MutationError error={publish.error || revoke.error} />
|
||||||
<Divider />
|
<Divider className="admin-divider" />
|
||||||
<Typography.Title level={5}>发布记录</Typography.Title>
|
<h3 className="admin-section-title">发布记录</h3>
|
||||||
{releases.data?.length ? (
|
{releases.data?.length ? (
|
||||||
<Space direction="vertical" style={{ width: "100%" }}>
|
<ul className="admin-list admin-offset-top-xs">
|
||||||
{releases.data.map((item) => (
|
{releases.data.map((item) => (
|
||||||
<Space key={item.id} wrap>
|
<li key={item.id} className="admin-row">
|
||||||
<Typography.Text>v{item.version}</Typography.Text>
|
<div className="admin-row-main">
|
||||||
<Tag color={item.status === "published" ? "green" : "default"}>
|
<div className="admin-row-line">
|
||||||
{item.status}
|
<span className="admin-row-title">v{item.version}</span>
|
||||||
</Tag>
|
<StatusTag
|
||||||
<Typography.Text type="secondary">
|
tone={item.status === "published" ? "success" : "neutral"}
|
||||||
|
label={statusLabel(item.status)}
|
||||||
|
/>
|
||||||
|
<span className="admin-row-meta">
|
||||||
{new Date(item.createdAt).toLocaleString("zh-CN")}
|
{new Date(item.createdAt).toLocaleString("zh-CN")}
|
||||||
</Typography.Text>
|
</span>
|
||||||
{item.note && <Typography.Text>{item.note}</Typography.Text>}
|
{item.note ? <span className="admin-row-meta">{item.note}</span> : null}
|
||||||
{item.status === "superseded" && publishedHistory.length > 1 && (
|
</div>
|
||||||
<Button size="small" onClick={() => setRollbackVersion(item.version)}>
|
</div>
|
||||||
|
{item.status === "superseded" && publishedHistory.length > 1 ? (
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
size="small"
|
||||||
|
onClick={() => setRollbackVersion(item.version)}
|
||||||
|
>
|
||||||
恢复此版本
|
恢复此版本
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
) : null}
|
||||||
</Space>
|
</li>
|
||||||
))}
|
))}
|
||||||
</Space>
|
</ul>
|
||||||
) : (
|
) : (
|
||||||
<Empty description="暂无发布记录" />
|
<Empty description="暂无发布记录" image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
||||||
)}
|
)}
|
||||||
<MutationError error={rollback.error} />
|
<MutationError error={rollback.error} />
|
||||||
</section>
|
</AdminSection>
|
||||||
<section>
|
</div>
|
||||||
<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>
|
|
||||||
)}
|
)}
|
||||||
{activeTab === "miniapp" && (
|
{activeTab === "miniapp" && (
|
||||||
<Space direction="vertical" size={24} style={{ width: "100%" }}>
|
<div className="admin-stack admin-stack-lg">
|
||||||
<section>
|
<AdminSection
|
||||||
<Typography.Title level={4}>小程序代码发布</Typography.Title>
|
title="小程序代码发布"
|
||||||
<Typography.Paragraph type="secondary">
|
description="使用微信官方工具上传代码;审核与发布状态需按微信平台结果人工确认。"
|
||||||
使用微信官方 miniprogram-ci 上传代码;审核与发布状态需按微信平台结果人工确认。
|
extra={
|
||||||
</Typography.Paragraph>
|
<Space wrap>
|
||||||
<Space wrap style={{ marginBottom: 12 }}>
|
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
disabled={!currentRelease}
|
disabled={!currentRelease}
|
||||||
@@ -572,14 +603,15 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
|||||||
上传当前版本到微信
|
上传当前版本到微信
|
||||||
</Button>
|
</Button>
|
||||||
{miniAppSettings.data?.hasStoredCredentials ? (
|
{miniAppSettings.data?.hasStoredCredentials ? (
|
||||||
<Tag color="green">已配置上传凭据</Tag>
|
<StatusTag tone="success" label="已配置上传凭据" />
|
||||||
) : (
|
) : (
|
||||||
<Tag color="warning">未配置上传凭据</Tag>
|
<StatusTag tone="warning" label="未配置上传凭据" />
|
||||||
)}
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
<Divider />
|
}
|
||||||
|
>
|
||||||
{miniAppReleases.data?.length ? (
|
{miniAppReleases.data?.length ? (
|
||||||
<Space direction="vertical" size={12} style={{ width: "100%" }}>
|
<div className="admin-stack admin-stack-tight">
|
||||||
{miniAppReleases.data.map((task) => (
|
{miniAppReleases.data.map((task) => (
|
||||||
<MiniAppReleaseCard
|
<MiniAppReleaseCard
|
||||||
key={task.id}
|
key={task.id}
|
||||||
@@ -589,12 +621,12 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
|||||||
onStatusChange={(status) => updateMiniAppStatus.mutate({ id: task.id, status })}
|
onStatusChange={(status) => updateMiniAppStatus.mutate({ id: task.id, status })}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</Space>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<Empty description="暂无小程序发布任务" />
|
<Empty description="暂无小程序发布任务" image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
||||||
)}
|
)}
|
||||||
</section>
|
</AdminSection>
|
||||||
</Space>
|
</div>
|
||||||
)}
|
)}
|
||||||
<Modal
|
<Modal
|
||||||
title={confirmAction === "revoke" ? "确认撤回品牌" : "确认发布品牌"}
|
title={confirmAction === "revoke" ? "确认撤回品牌" : "确认发布品牌"}
|
||||||
@@ -611,7 +643,7 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
|||||||
message="撤回后,小程序将显示品牌尚未发布,新的咨询和预约会停止受理。"
|
message="撤回后,小程序将显示品牌尚未发布,新的咨询和预约会停止受理。"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<Space direction="vertical" style={{ width: "100%" }}>
|
<div className="admin-stack">
|
||||||
<Typography.Text>当前草稿将成为品牌新的公开版本。</Typography.Text>
|
<Typography.Text>当前草稿将成为品牌新的公开版本。</Typography.Text>
|
||||||
<Input
|
<Input
|
||||||
value={note}
|
value={note}
|
||||||
@@ -619,7 +651,7 @@ export function PublicationPage({ canManageTemplate }: { canManageTemplate: bool
|
|||||||
placeholder="发布备注(可选)"
|
placeholder="发布备注(可选)"
|
||||||
maxLength={200}
|
maxLength={200}
|
||||||
/>
|
/>
|
||||||
</Space>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Modal>
|
</Modal>
|
||||||
<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 type { Offering } from "@personal-brand/api-client";
|
||||||
|
import { AdminSection } from "../../components/AdminSection.js";
|
||||||
import { MutationError } from "../../components/QueryState.js";
|
import { MutationError } from "../../components/QueryState.js";
|
||||||
|
import { StatusTag } from "../../components/StatusTag.js";
|
||||||
import type { useOfferingMutations } from "./use-offering-data.js";
|
import type { useOfferingMutations } from "./use-offering-data.js";
|
||||||
|
|
||||||
type OfferingsTableProps = {
|
type OfferingsTableProps = {
|
||||||
@@ -36,22 +38,27 @@ export function OfferingsTable({
|
|||||||
{
|
{
|
||||||
title: "业务类型",
|
title: "业务类型",
|
||||||
dataIndex: "kind",
|
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: "priceText" },
|
||||||
{
|
{
|
||||||
title: "状态",
|
title: "状态",
|
||||||
dataIndex: "isEnabled",
|
dataIndex: "isEnabled",
|
||||||
render: (value: boolean) => (value ? "已启用" : "已停用"),
|
render: (value: boolean) => (
|
||||||
|
<StatusTag tone={value ? "success" : "neutral"} label={value ? "已启用" : "已停用"} />
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "操作",
|
title: "操作",
|
||||||
render: (_: unknown, item: Offering) => (
|
render: (_: unknown, item: Offering) => (
|
||||||
<Space>
|
<Space>
|
||||||
<Button size="small" onClick={() => onEdit(item)}>
|
<Button type="link" size="small" onClick={() => onEdit(item)}>
|
||||||
编辑详情
|
编辑详情
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
loading={toggleOffering.isPending && toggleOffering.variables?.id === item.id}
|
loading={toggleOffering.isPending && toggleOffering.variables?.id === item.id}
|
||||||
onClick={() => toggleOffering.mutate({ id: item.id, isEnabled: !item.isEnabled })}
|
onClick={() => toggleOffering.mutate({ id: item.id, isEnabled: !item.isEnabled })}
|
||||||
@@ -66,6 +73,7 @@ export function OfferingsTable({
|
|||||||
cancelText="取消"
|
cancelText="取消"
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
|
type="link"
|
||||||
danger
|
danger
|
||||||
size="small"
|
size="small"
|
||||||
loading={deleteOffering.isPending && deleteOffering.variables === item.id}
|
loading={deleteOffering.isPending && deleteOffering.variables === item.id}
|
||||||
@@ -79,20 +87,14 @@ export function OfferingsTable({
|
|||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section aria-label="业务提供项列表">
|
<AdminSection
|
||||||
<Space wrap style={{ marginBottom: 16 }}>
|
title={`${pageLabel}中的内容`}
|
||||||
<Typography.Title level={5} style={{ margin: 0 }}>
|
description={
|
||||||
{pageLabel}中的内容
|
detailSectionTitles.length
|
||||||
</Typography.Title>
|
? `编辑单项详情时,附加字段将用于:${detailSectionTitles.join("、")}。列表中的名称、说明、价格和封面也会显示在业务展示页。`
|
||||||
<Tag color="blue">已启用的项目会公开展示</Tag>
|
: "已启用的项目会公开展示。"
|
||||||
</Space>
|
}
|
||||||
{detailSectionTitles.length ? (
|
>
|
||||||
<Typography.Paragraph type="secondary">
|
|
||||||
编辑单项详情时,附加字段将用于:
|
|
||||||
{detailSectionTitles.join("、")}
|
|
||||||
。列表中的名称、说明、价格和封面也会显示在业务展示页。
|
|
||||||
</Typography.Paragraph>
|
|
||||||
) : null}
|
|
||||||
<Table
|
<Table
|
||||||
scroll={{ x: 760 }}
|
scroll={{ x: 760 }}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
@@ -101,13 +103,13 @@ export function OfferingsTable({
|
|||||||
columns={columns}
|
columns={columns}
|
||||||
/>
|
/>
|
||||||
{items.length === 0 && (
|
{items.length === 0 && (
|
||||||
<Typography.Paragraph type="secondary">
|
<p className="admin-empty-inline">
|
||||||
还没有公开业务提供项。创建后,小程序服务页会优先读取这些内容。
|
还没有公开业务提供项。创建后,小程序服务页会优先读取这些内容。
|
||||||
</Typography.Paragraph>
|
</p>
|
||||||
)}
|
)}
|
||||||
<MutationError error={saveError} />
|
<MutationError error={saveError} />
|
||||||
<MutationError error={toggleOffering.error} />
|
<MutationError error={toggleOffering.error} />
|
||||||
<MutationError error={deleteOffering.error} />
|
<MutationError error={deleteOffering.error} />
|
||||||
</section>
|
</AdminSection>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 72vh;
|
height: 72vh;
|
||||||
border: 1px solid #e5e7eb;
|
border: 1px solid var(--admin-border);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
@@ -47,8 +47,8 @@
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding: 20px 16px 24px;
|
padding: 20px 16px 24px;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
background: #f8fafc;
|
background: var(--admin-fill);
|
||||||
border: 1px solid #e5e7eb;
|
border: 1px solid var(--admin-border);
|
||||||
}
|
}
|
||||||
|
|
||||||
.service-offering-editor__form-scroll > .ant-typography:first-child {
|
.service-offering-editor__form-scroll > .ant-typography:first-child {
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
.service-offering-editor__form-scroll .ant-typography h5.ant-typography {
|
.service-offering-editor__form-scroll .ant-typography h5.ant-typography {
|
||||||
margin: 28px 0 4px;
|
margin: 28px 0 4px;
|
||||||
padding-bottom: 8px;
|
padding-bottom: 8px;
|
||||||
border-bottom: 1px solid #e5e7eb;
|
border-bottom: 1px solid var(--admin-border);
|
||||||
}
|
}
|
||||||
|
|
||||||
.service-offering-editor__form-scroll > .ant-typography-secondary {
|
.service-offering-editor__form-scroll > .ant-typography-secondary {
|
||||||
|
|||||||
@@ -1,23 +1,11 @@
|
|||||||
import {
|
import { Alert, Button, Card, Form, Input, Modal, Select, Space, Table, message } from "antd";
|
||||||
Alert,
|
|
||||||
Button,
|
|
||||||
Card,
|
|
||||||
Form,
|
|
||||||
Input,
|
|
||||||
Modal,
|
|
||||||
Select,
|
|
||||||
Space,
|
|
||||||
Table,
|
|
||||||
Tag,
|
|
||||||
Typography,
|
|
||||||
message,
|
|
||||||
} from "antd";
|
|
||||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
import type { AdminBrandMember } from "@personal-brand/api-client";
|
import type { AdminBrandMember } from "@personal-brand/api-client";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { createApiClient } from "../../lib/api.js";
|
import { createApiClient } from "../../lib/api.js";
|
||||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||||
import { MutationError, QueryState } from "../../components/QueryState.js";
|
import { MutationError, QueryState } from "../../components/QueryState.js";
|
||||||
|
import { StatusTag } from "../../components/StatusTag.js";
|
||||||
|
|
||||||
const roleLabels: Record<string, string> = {
|
const roleLabels: Record<string, string> = {
|
||||||
owner: "负责人",
|
owner: "负责人",
|
||||||
@@ -81,9 +69,9 @@ export function MembersPage() {
|
|||||||
<Alert
|
<Alert
|
||||||
type="info"
|
type="info"
|
||||||
showIcon
|
showIcon
|
||||||
|
className="admin-offset-bottom"
|
||||||
message="请将初始账号和密码安全地交给成员"
|
message="请将初始账号和密码安全地交给成员"
|
||||||
description="当前采用负责人手动添加方式;系统不会再次显示成员初始密码。"
|
description="当前采用负责人手动添加方式;系统不会再次显示成员初始密码。"
|
||||||
style={{ marginBottom: 16 }}
|
|
||||||
/>
|
/>
|
||||||
<Table
|
<Table
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
@@ -127,9 +115,12 @@ export function MembersPage() {
|
|||||||
title: "说明",
|
title: "说明",
|
||||||
render: (_: unknown, item: AdminBrandMember) => (
|
render: (_: unknown, item: AdminBrandMember) => (
|
||||||
<Space>
|
<Space>
|
||||||
<Tag>{roleLabels[item.role] ?? item.role}</Tag>
|
<StatusTag
|
||||||
|
tone={item.role === "owner" ? "info" : "neutral"}
|
||||||
|
label={roleLabels[item.role] ?? item.role}
|
||||||
|
/>
|
||||||
{!item.adminUser.isEnabled ? (
|
{!item.adminUser.isEnabled ? (
|
||||||
<Typography.Text type="danger">账号已停用</Typography.Text>
|
<StatusTag tone="warning" label="账号已停用" />
|
||||||
) : null}
|
) : null}
|
||||||
</Space>
|
</Space>
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Button, Divider, Form, Typography } from "antd";
|
import { Button, Form } from "antd";
|
||||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||||
|
import { AdminSection } from "../../components/AdminSection.js";
|
||||||
import { QueryState } from "../../components/QueryState.js";
|
import { QueryState } from "../../components/QueryState.js";
|
||||||
import { TrustContentEditorModal } from "./components/TrustContentEditorModal.js";
|
import { TrustContentEditorModal } from "./components/TrustContentEditorModal.js";
|
||||||
import { TrustContentTable } from "./components/TrustContentTable.js";
|
import { TrustContentTable } from "./components/TrustContentTable.js";
|
||||||
@@ -61,21 +62,18 @@ export function TrustContentPage() {
|
|||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<section aria-labelledby="trust-requirements-title">
|
<AdminSection
|
||||||
<Typography.Title id="trust-requirements-title" level={5}>
|
title="当前模板需要配置的内容"
|
||||||
当前模板需要配置的内容
|
description="标记为「发布必填」的项目需要填写完整后,才能发布小程序。"
|
||||||
</Typography.Title>
|
>
|
||||||
<Typography.Paragraph type="secondary">
|
|
||||||
标记为“发布必填”的项目需要填写完整后,才能发布小程序。
|
|
||||||
</Typography.Paragraph>
|
|
||||||
<TrustRequirementsList
|
<TrustRequirementsList
|
||||||
availableTypes={availableTypes}
|
availableTypes={availableTypes}
|
||||||
contentByType={contentByType}
|
contentByType={contentByType}
|
||||||
items={query.data ?? []}
|
items={query.data ?? []}
|
||||||
onEdit={begin}
|
onEdit={begin}
|
||||||
/>
|
/>
|
||||||
</section>
|
</AdminSection>
|
||||||
<Divider />
|
<AdminSection title="已配置的品牌内容">
|
||||||
<TrustContentTable
|
<TrustContentTable
|
||||||
availableTypes={availableTypes}
|
availableTypes={availableTypes}
|
||||||
items={query.data ?? []}
|
items={query.data ?? []}
|
||||||
@@ -84,6 +82,7 @@ export function TrustContentPage() {
|
|||||||
onEdit={(item) => begin(item)}
|
onEdit={(item) => begin(item)}
|
||||||
onDelete={(id) => remove.mutate(id)}
|
onDelete={(id) => remove.mutate(id)}
|
||||||
/>
|
/>
|
||||||
|
</AdminSection>
|
||||||
<TrustContentEditorModal
|
<TrustContentEditorModal
|
||||||
availableTypes={availableTypes}
|
availableTypes={availableTypes}
|
||||||
editing={editing}
|
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 { TrustContent } from "@personal-brand/api-client";
|
||||||
import type { TrustTypeOption } from "../domain/trust-content-domain.js";
|
import type { TrustTypeOption } from "../domain/trust-content-domain.js";
|
||||||
import { getTrustContentPreview } from "../domain/trust-content-domain.js";
|
import { getTrustContentPreview } from "../domain/trust-content-domain.js";
|
||||||
import { MutationError } from "../../../components/QueryState.js";
|
import { MutationError } from "../../../components/QueryState.js";
|
||||||
|
import { StatusTag } from "../../../components/StatusTag.js";
|
||||||
|
|
||||||
export function TrustContentTable({
|
export function TrustContentTable({
|
||||||
availableTypes,
|
availableTypes,
|
||||||
@@ -30,7 +31,10 @@ export function TrustContentTable({
|
|||||||
title: "内容类型",
|
title: "内容类型",
|
||||||
dataIndex: "type",
|
dataIndex: "type",
|
||||||
render: (value) => (
|
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" },
|
{ title: "标题", dataIndex: "title" },
|
||||||
@@ -47,14 +51,17 @@ export function TrustContentTable({
|
|||||||
title: "发布状态",
|
title: "发布状态",
|
||||||
dataIndex: "isPublished",
|
dataIndex: "isPublished",
|
||||||
render: (value) => (
|
render: (value) => (
|
||||||
<Tag color={value ? "success" : "default"}>{value ? "随发布展示" : "草稿"}</Tag>
|
<StatusTag
|
||||||
|
tone={value ? "success" : "neutral"}
|
||||||
|
label={value ? "随发布展示" : "草稿"}
|
||||||
|
/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "操作",
|
title: "操作",
|
||||||
render: (_: unknown, item: TrustContent) => (
|
render: (_: unknown, item: TrustContent) => (
|
||||||
<Space>
|
<Space>
|
||||||
<Button size="small" onClick={() => onEdit(item)}>
|
<Button type="link" size="small" onClick={() => onEdit(item)}>
|
||||||
编辑
|
编辑
|
||||||
</Button>
|
</Button>
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
@@ -62,7 +69,7 @@ export function TrustContentTable({
|
|||||||
description="删除后需发布品牌,才会更新小程序展示。"
|
description="删除后需发布品牌,才会更新小程序展示。"
|
||||||
onConfirm={() => onDelete(item.id)}
|
onConfirm={() => onDelete(item.id)}
|
||||||
>
|
>
|
||||||
<Button size="small" danger loading={removePending}>
|
<Button type="link" size="small" danger loading={removePending}>
|
||||||
删除
|
删除
|
||||||
</Button>
|
</Button>
|
||||||
</Popconfirm>
|
</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 { isTrustContentComplete } from "@personal-brand/api-client";
|
||||||
import type { TrustContent } from "@personal-brand/api-client";
|
import type { TrustContent } from "@personal-brand/api-client";
|
||||||
import type { TrustTypeOption } from "../domain/trust-content-domain.js";
|
import type { TrustTypeOption } from "../domain/trust-content-domain.js";
|
||||||
|
import { StatusTag } from "../../../components/StatusTag.js";
|
||||||
|
|
||||||
export function TrustRequirementsList({
|
export function TrustRequirementsList({
|
||||||
availableTypes,
|
availableTypes,
|
||||||
@@ -15,10 +16,8 @@ export function TrustRequirementsList({
|
|||||||
onEdit: (item?: TrustContent, type?: string) => void;
|
onEdit: (item?: TrustContent, type?: string) => void;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<List
|
<ul className="admin-list">
|
||||||
size="small"
|
{availableTypes.map((item) => {
|
||||||
dataSource={availableTypes}
|
|
||||||
renderItem={(item) => {
|
|
||||||
const content = contentByType.get(item.type);
|
const content = contentByType.get(item.type);
|
||||||
const publishedCount = items.filter(
|
const publishedCount = items.filter(
|
||||||
(record) => record.type === item.type && record.isPublished,
|
(record) => record.type === item.type && record.isPublished,
|
||||||
@@ -28,38 +27,41 @@ export function TrustRequirementsList({
|
|||||||
const complete = Boolean(content && isTrustContentComplete(content, item) && !tooMany);
|
const complete = Boolean(content && isTrustContentComplete(content, item) && !tooMany);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<List.Item
|
<li key={item.type} className="admin-row">
|
||||||
actions={[
|
<div className="admin-row-main">
|
||||||
<Button
|
<div className="admin-row-line">
|
||||||
key={item.type}
|
<span className="admin-row-title">{item.label}</span>
|
||||||
type="link"
|
{item.required ? <StatusTag tone="warning" label="发布必填" /> : null}
|
||||||
size="small"
|
<StatusTag
|
||||||
onClick={() => (content ? onEdit(content) : onEdit(undefined, item.type))}
|
tone={tooMany ? "error" : complete ? "success" : "neutral"}
|
||||||
>
|
label={
|
||||||
{content ? "编辑" : "新增"}
|
tooMany
|
||||||
</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} 条)`
|
? `公开内容过多(${publishedCount} 条)`
|
||||||
: complete
|
: complete
|
||||||
? "内容完整"
|
? "内容完整"
|
||||||
: content
|
: content
|
||||||
? "需要完善"
|
? "需要完善"
|
||||||
: "尚未填写"}
|
: "尚未填写"
|
||||||
</Tag>
|
}
|
||||||
{item.help && <Typography.Text type="secondary">{item.help}</Typography.Text>}
|
|
||||||
</Space>
|
|
||||||
</List.Item>
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
|
{(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 { useNavigate } from "react-router-dom";
|
||||||
import { ApiClientError } from "@personal-brand/api-client";
|
import { ApiClientError } from "@personal-brand/api-client";
|
||||||
import { createApiClient } from "../../lib/api.js";
|
import { createApiClient } from "../../lib/api.js";
|
||||||
@@ -18,6 +18,7 @@ import {
|
|||||||
import { supportsIndustry, type IndustryTarget } from "./workspace-templates.js";
|
import { supportsIndustry, type IndustryTarget } from "./workspace-templates.js";
|
||||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||||
import { MutationError } from "../../components/QueryState.js";
|
import { MutationError } from "../../components/QueryState.js";
|
||||||
|
import { StatusTag } from "../../components/StatusTag.js";
|
||||||
|
|
||||||
export const inquiryFieldTypes = [
|
export const inquiryFieldTypes = [
|
||||||
{ value: "text", label: "简短文字" },
|
{ value: "text", label: "简短文字" },
|
||||||
@@ -146,12 +147,12 @@ export function WorkspacePage() {
|
|||||||
}
|
}
|
||||||
const { fields, installations } = query.data;
|
const { fields, installations } = query.data;
|
||||||
return (
|
return (
|
||||||
<Space direction="vertical" size="large" style={{ width: "100%" }}>
|
<div className="admin-stack admin-stack-lg">
|
||||||
<AdminPageHeader
|
<AdminPageHeader
|
||||||
title="模板与表单设置"
|
title="模板与表单设置"
|
||||||
description="日常小程序内容请从页面配置、业务展示和信任证明进入;这里主要管理模板、咨询入口和负责人设置。"
|
description="日常小程序内容请从页面配置、业务展示和信任证明进入;这里主要管理模板、咨询入口和负责人设置。"
|
||||||
/>
|
/>
|
||||||
<Card title="先完成日常配置" style={{ marginBottom: 24 }}>
|
<Card title="先完成日常配置">
|
||||||
<Typography.Paragraph type="secondary">
|
<Typography.Paragraph type="secondary">
|
||||||
下面这些入口面向日常经营,不需要理解模板或技术设置。完成后回到“配置与发布”统一检查并上线。
|
下面这些入口面向日常经营,不需要理解模板或技术设置。完成后回到“配置与发布”统一检查并上线。
|
||||||
</Typography.Paragraph>
|
</Typography.Paragraph>
|
||||||
@@ -166,38 +167,45 @@ export function WorkspacePage() {
|
|||||||
</Card>
|
</Card>
|
||||||
<Card title="小程序当前状态" loading={runtimeQuery.isLoading}>
|
<Card title="小程序当前状态" loading={runtimeQuery.isLoading}>
|
||||||
{runtimeQuery.isError ? (
|
{runtimeQuery.isError ? (
|
||||||
<Typography.Text type="danger">公开运行时工作空间暂时无法加载。</Typography.Text>
|
<StatusTag tone="error" label="公开运行时工作空间暂时无法加载" />
|
||||||
) : (
|
) : (
|
||||||
<Space direction="vertical" style={{ width: "100%" }}>
|
<div className="admin-stack">
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
<Tag color="green">小程序数据已同步</Tag>
|
<StatusTag tone="success" label="小程序数据已同步" />
|
||||||
<Tag>公开业务 {runtimeQuery.data?.offerings?.length ?? 0} 项</Tag>
|
<StatusTag
|
||||||
<Tag>已启用能力 {runtimeQuery.data?.capabilities?.length ?? 0} 项</Tag>
|
tone="neutral"
|
||||||
|
label={`公开业务 ${runtimeQuery.data?.offerings?.length ?? 0} 项`}
|
||||||
|
/>
|
||||||
|
<StatusTag
|
||||||
|
tone="neutral"
|
||||||
|
label={`已启用能力 ${runtimeQuery.data?.capabilities?.length ?? 0} 项`}
|
||||||
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
<Typography.Paragraph type="secondary" style={{ marginBottom: 0 }}>
|
<p className="admin-section-description admin-flush-top">
|
||||||
小程序和后台预览会使用同一份已发布内容。这里的能力由当前模板自动提供,通常不需要手动调整。
|
小程序和后台预览会使用同一份已发布内容。这里的能力由当前模板自动提供,通常不需要手动调整。
|
||||||
</Typography.Paragraph>
|
</p>
|
||||||
<Space direction="vertical" style={{ width: "100%" }}>
|
<div className="admin-stack">
|
||||||
<Typography.Text strong>已启用的服务能力</Typography.Text>
|
<h3 className="admin-section-title">已启用的服务能力</h3>
|
||||||
{(runtimeQuery.data?.plugins ?? []).map((plugin) => (
|
{(runtimeQuery.data?.plugins ?? []).map((plugin) => (
|
||||||
<Card key={plugin.key} size="small">
|
<Card key={plugin.key} size="small">
|
||||||
<Space wrap>
|
<div className="admin-row-line">
|
||||||
<Typography.Text strong>{plugin.displayName}</Typography.Text>
|
<span className="admin-row-title">{plugin.displayName}</span>
|
||||||
<Tag color={plugin.status === "enabled" ? "green" : "orange"}>
|
<StatusTag
|
||||||
{plugin.status}
|
tone={plugin.status === "enabled" ? "success" : "warning"}
|
||||||
</Tag>
|
label={plugin.status === "enabled" ? "已启用" : "未启用"}
|
||||||
</Space>
|
/>
|
||||||
<Typography.Paragraph type="secondary" style={{ margin: "8px 0 0" }}>
|
</div>
|
||||||
|
<p className="admin-section-description admin-flush">
|
||||||
这项能力已接入当前小程序流程,无需单独配置技术参数。
|
这项能力已接入当前小程序流程,无需单独配置技术参数。
|
||||||
</Typography.Paragraph>
|
</p>
|
||||||
</Card>
|
</Card>
|
||||||
))}
|
))}
|
||||||
{!runtimeQuery.data?.plugins?.length && (
|
{!runtimeQuery.data?.plugins?.length && (
|
||||||
<Typography.Text type="secondary">当前模板未启用能力插件。</Typography.Text>
|
<p className="admin-empty-inline">当前模板未启用能力插件。</p>
|
||||||
)}
|
)}
|
||||||
</Space>
|
</div>
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
<Typography.Text strong>视觉模板</Typography.Text>
|
<span className="admin-field-label admin-flush">视觉模板</span>
|
||||||
<Select
|
<Select
|
||||||
value={runtimeQuery.data?.visualTemplate?.key}
|
value={runtimeQuery.data?.visualTemplate?.key}
|
||||||
loading={visualTemplate.isPending}
|
loading={visualTemplate.isPending}
|
||||||
@@ -207,28 +215,33 @@ export function WorkspacePage() {
|
|||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
{runtimeQuery.data?.visualTemplate && (
|
{runtimeQuery.data?.visualTemplate && (
|
||||||
<Tag>
|
<StatusTag
|
||||||
v{runtimeQuery.data.visualTemplate.version} ·{" "}
|
tone="neutral"
|
||||||
{Object.values(runtimeQuery.data.visualTemplate.variants).join(" / ")}
|
label={`v${runtimeQuery.data.visualTemplate.version} · ${Object.values(
|
||||||
</Tag>
|
runtimeQuery.data.visualTemplate.variants,
|
||||||
|
).join(" / ")}`}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
<MutationError error={visualTemplate.error} />
|
<MutationError error={visualTemplate.error} />
|
||||||
<Space direction="vertical" style={{ width: "100%" }}>
|
<div className="admin-stack">
|
||||||
<Typography.Text strong>视觉模板切换历史</Typography.Text>
|
<h3 className="admin-section-title">视觉模板切换历史</h3>
|
||||||
{visualHistory.data?.history.length ? (
|
{visualHistory.data?.history.length ? (
|
||||||
visualHistory.data.history.map((item) => (
|
<div className="admin-row-line">
|
||||||
<Tag key={`${item.visualTemplateKey}-${item.savedAt}`}>
|
{visualHistory.data.history.map((item) => (
|
||||||
{item.visualTemplateKey} · {item.savedAt}
|
<StatusTag
|
||||||
</Tag>
|
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 ? (
|
{visualHistory.data?.history.length ? (
|
||||||
<Button
|
<Button
|
||||||
danger
|
danger
|
||||||
size="small"
|
|
||||||
onClick={() => rollbackVisual.mutate()}
|
onClick={() => rollbackVisual.mutate()}
|
||||||
loading={rollbackVisual.isPending}
|
loading={rollbackVisual.isPending}
|
||||||
>
|
>
|
||||||
@@ -236,33 +249,33 @@ export function WorkspacePage() {
|
|||||||
</Button>
|
</Button>
|
||||||
) : null}
|
) : null}
|
||||||
<MutationError error={rollbackVisual.error} />
|
<MutationError error={rollbackVisual.error} />
|
||||||
</Space>
|
</div>
|
||||||
<Space direction="vertical" style={{ width: "100%" }}>
|
<div className="admin-stack">
|
||||||
<Typography.Text strong>可用视觉模板</Typography.Text>
|
<h3 className="admin-section-title">可用视觉模板</h3>
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
{compatibleVisuals.map((visual) => (
|
{compatibleVisuals.map((visual) => (
|
||||||
<Card key={visual.key} size="small" style={{ width: 260 }}>
|
<Card key={visual.key} size="small" className="admin-visual-card">
|
||||||
<Typography.Text strong>{visual.name}</Typography.Text>
|
<span className="admin-row-title">{visual.name}</span>
|
||||||
<Typography.Paragraph type="secondary" ellipsis={{ rows: 2 }}>
|
<p className="admin-row-summary">{visual.description}</p>
|
||||||
{visual.description}
|
<div className="admin-row-line">
|
||||||
</Typography.Paragraph>
|
|
||||||
<Space wrap>
|
|
||||||
{Object.entries(visual.theme.colors).map(([name, color]) => (
|
{Object.entries(visual.theme.colors).map(([name, color]) => (
|
||||||
<Tag key={name} color={color.startsWith("#") ? "default" : "blue"}>
|
<span
|
||||||
{name}
|
key={name}
|
||||||
</Tag>
|
className="admin-swatch"
|
||||||
))}
|
title={`${name} ${color}`}
|
||||||
</Space>
|
style={{ "--swatch-color": color } as React.CSSProperties}
|
||||||
<Typography.Paragraph
|
|
||||||
type="secondary"
|
|
||||||
style={{ marginTop: 12, marginBottom: 0 }}
|
|
||||||
>
|
>
|
||||||
|
{name}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<p className="admin-row-meta admin-flush">
|
||||||
{Object.values(visual.variants).join(" / ")}
|
{Object.values(visual.variants).join(" / ")}
|
||||||
</Typography.Paragraph>
|
</p>
|
||||||
</Card>
|
</Card>
|
||||||
))}
|
))}
|
||||||
</Space>
|
</Space>
|
||||||
</Space>
|
</div>
|
||||||
<Modal
|
<Modal
|
||||||
title="确认切换视觉模板"
|
title="确认切换视觉模板"
|
||||||
open={visualTarget !== null}
|
open={visualTarget !== null}
|
||||||
@@ -281,7 +294,7 @@ export function WorkspacePage() {
|
|||||||
只会替换视觉主题和模块变体,不会覆盖品牌内容、业务提供项或咨询记录。
|
只会替换视觉主题和模块变体,不会覆盖品牌内容、业务提供项或咨询记录。
|
||||||
</Typography.Paragraph>
|
</Typography.Paragraph>
|
||||||
</Modal>
|
</Modal>
|
||||||
</Space>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Card>
|
</Card>
|
||||||
<Card
|
<Card
|
||||||
@@ -303,17 +316,20 @@ export function WorkspacePage() {
|
|||||||
<Typography.Paragraph type="secondary">
|
<Typography.Paragraph type="secondary">
|
||||||
模板只提供行业表达样例,不会替代你的品牌定位、经历、作品和合作方式。
|
模板只提供行业表达样例,不会替代你的品牌定位、经历、作品和合作方式。
|
||||||
</Typography.Paragraph>
|
</Typography.Paragraph>
|
||||||
<Tag>{installations.length ? `已安装 ${installations.length} 个模板` : "尚未安装模板"}</Tag>
|
<StatusTag
|
||||||
|
tone={installations.length ? "info" : "neutral"}
|
||||||
|
label={installations.length ? `已安装 ${installations.length} 个模板` : "尚未安装模板"}
|
||||||
|
/>
|
||||||
{installations.length > 0 && (
|
{installations.length > 0 && (
|
||||||
<Card size="small" style={{ marginTop: 16 }} title="模板版本">
|
<Card size="small" className="admin-offset-top" title="模板版本">
|
||||||
<Space direction="vertical" style={{ width: "100%" }}>
|
<div className="admin-stack">
|
||||||
<Typography.Text>
|
<Typography.Text>
|
||||||
当前版本:{templatePreview.data?.currentVersion ?? "加载中"},最新版本:
|
当前版本:{templatePreview.data?.currentVersion ?? "加载中"},最新版本:
|
||||||
{templatePreview.data?.latestVersion ?? "加载中"}
|
{templatePreview.data?.latestVersion ?? "加载中"}
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
{templatePreview.data?.canUpgrade ? (
|
{templatePreview.data?.canUpgrade ? (
|
||||||
<>
|
<>
|
||||||
<Typography.Paragraph type="secondary" style={{ marginBottom: 0 }}>
|
<Typography.Paragraph type="secondary" className="admin-flush">
|
||||||
可升级内容:新增 {templatePreview.data.missingModules.length} 个模块,新增{" "}
|
可升级内容:新增 {templatePreview.data.missingModules.length} 个模块,新增{" "}
|
||||||
{templatePreview.data.missingFields.length} 个字段。已有内容不会被覆盖。
|
{templatePreview.data.missingFields.length} 个字段。已有内容不会被覆盖。
|
||||||
</Typography.Paragraph>
|
</Typography.Paragraph>
|
||||||
@@ -326,7 +342,9 @@ export function WorkspacePage() {
|
|||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<Tag color="green">已是最新版本</Tag>
|
<div>
|
||||||
|
<StatusTag tone="success" label="已是最新版本" />
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
{templatePreview.data?.canRollback && (
|
{templatePreview.data?.canRollback && (
|
||||||
<Button danger onClick={() => rollback.mutate()} loading={rollback.isPending}>
|
<Button danger onClick={() => rollback.mutate()} loading={rollback.isPending}>
|
||||||
@@ -336,7 +354,7 @@ export function WorkspacePage() {
|
|||||||
<MutationError error={templatePreview.error} />
|
<MutationError error={templatePreview.error} />
|
||||||
<MutationError error={upgrade.error} />
|
<MutationError error={upgrade.error} />
|
||||||
<MutationError error={rollback.error} />
|
<MutationError error={rollback.error} />
|
||||||
</Space>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
<MutationError error={install.error} />
|
<MutationError error={install.error} />
|
||||||
@@ -360,7 +378,6 @@ export function WorkspacePage() {
|
|||||||
</Modal>
|
</Modal>
|
||||||
<Card
|
<Card
|
||||||
title="模板组合预览"
|
title="模板组合预览"
|
||||||
style={{ marginBottom: 24 }}
|
|
||||||
extra={<Typography.Text type="secondary">高级预览</Typography.Text>}
|
extra={<Typography.Text type="secondary">高级预览</Typography.Text>}
|
||||||
>
|
>
|
||||||
<Typography.Paragraph type="secondary">
|
<Typography.Paragraph type="secondary">
|
||||||
@@ -384,19 +401,18 @@ export function WorkspacePage() {
|
|||||||
/>
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
{combinationPreview.isLoading ? (
|
{combinationPreview.isLoading ? (
|
||||||
<Card loading style={{ marginTop: 16 }} />
|
<Card loading className="admin-offset-top" />
|
||||||
) : combinationPreview.data ? (
|
) : combinationPreview.data ? (
|
||||||
<Space direction="vertical" style={{ width: "100%", marginTop: 16 }}>
|
<div className="admin-stack admin-offset-top">
|
||||||
<Typography.Text strong>
|
<Typography.Text strong>
|
||||||
{combinationPreview.data.industry.name} × {combinationPreview.data.visual.name}
|
{combinationPreview.data.industry.name} × {combinationPreview.data.visual.name}
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
<Space wrap></Space>
|
|
||||||
<Typography.Text type="secondary">
|
<Typography.Text type="secondary">
|
||||||
能力:
|
能力:
|
||||||
{combinationPreview.data.runtime.capabilities.map((item) => item.key).join("、") ||
|
{combinationPreview.data.runtime.capabilities.map((item) => item.key).join("、") ||
|
||||||
"无"}
|
"无"}
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
</Space>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</Card>
|
</Card>
|
||||||
<Card
|
<Card
|
||||||
@@ -414,18 +430,29 @@ export function WorkspacePage() {
|
|||||||
locale={{ emptyText: "还没有咨询入口,点击右上角即可从默认表单开始。" }}
|
locale={{ emptyText: "还没有咨询入口,点击右上角即可从默认表单开始。" }}
|
||||||
columns={[
|
columns={[
|
||||||
{ title: "名称", dataIndex: "name" },
|
{ title: "名称", dataIndex: "name" },
|
||||||
{ title: "版本", dataIndex: "version", render: (value) => <Tag>v{value}</Tag> },
|
{
|
||||||
|
title: "版本",
|
||||||
|
dataIndex: "version",
|
||||||
|
render: (value) => <StatusTag tone="neutral" label={`v${value}`} />,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: "字段数",
|
title: "字段数",
|
||||||
dataIndex: "fieldsSnapshot",
|
dataIndex: "fieldsSnapshot",
|
||||||
render: (value: unknown[]) => value?.length ?? 0,
|
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: "操作",
|
title: "操作",
|
||||||
render: (_: unknown, item: InquiryForm) => (
|
render: (_: unknown, item: InquiryForm) => (
|
||||||
<Space>
|
<Space>
|
||||||
<Button
|
<Button
|
||||||
|
type="link"
|
||||||
size="small"
|
size="small"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setEditingForm(item);
|
setEditingForm(item);
|
||||||
@@ -637,7 +664,7 @@ export function WorkspacePage() {
|
|||||||
>
|
>
|
||||||
<Input placeholder="例如:预约上门测量、家庭聚餐预订" />
|
<Input placeholder="例如:预约上门测量、家庭聚餐预订" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Space style={{ display: "flex" }} align="start">
|
<div className="admin-form-row">
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="purpose"
|
name="purpose"
|
||||||
label="客户要做什么"
|
label="客户要做什么"
|
||||||
@@ -645,7 +672,7 @@ export function WorkspacePage() {
|
|||||||
initialValue="inquiry"
|
initialValue="inquiry"
|
||||||
>
|
>
|
||||||
<Select
|
<Select
|
||||||
style={{ width: 160 }}
|
className="admin-field-w-lg"
|
||||||
options={[
|
options={[
|
||||||
{ value: "inquiry", label: "需求咨询" },
|
{ value: "inquiry", label: "需求咨询" },
|
||||||
{ value: "quote-request", label: "获取报价" },
|
{ value: "quote-request", label: "获取报价" },
|
||||||
@@ -656,7 +683,7 @@ export function WorkspacePage() {
|
|||||||
<Form.Item name="offeringId" label="关联哪项业务" help="不选择表示这是品牌通用入口。">
|
<Form.Item name="offeringId" label="关联哪项业务" help="不选择表示这是品牌通用入口。">
|
||||||
<Select
|
<Select
|
||||||
allowClear
|
allowClear
|
||||||
style={{ width: 220 }}
|
className="admin-field-w-xl"
|
||||||
placeholder="品牌级表单"
|
placeholder="品牌级表单"
|
||||||
options={(runtimeQuery.data?.offerings ?? []).map((item) => ({
|
options={(runtimeQuery.data?.offerings ?? []).map((item) => ({
|
||||||
value: item.id,
|
value: item.id,
|
||||||
@@ -664,7 +691,7 @@ export function WorkspacePage() {
|
|||||||
}))}
|
}))}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Space>
|
</div>
|
||||||
<Form.List name="fieldsSnapshot">
|
<Form.List name="fieldsSnapshot">
|
||||||
{(fields, { add, remove }) => (
|
{(fields, { add, remove }) => (
|
||||||
<>
|
<>
|
||||||
@@ -685,36 +712,36 @@ export function WorkspacePage() {
|
|||||||
</Button>
|
</Button>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{fields.map(({ key, name, ...restField }) => (
|
{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>
|
<Form.Item {...restField} name={[name, "key"]} hidden>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Space align="start" style={{ display: "flex" }}>
|
<div className="admin-form-row">
|
||||||
<Form.Item
|
<Form.Item
|
||||||
{...restField}
|
{...restField}
|
||||||
name={[name, "label"]}
|
name={[name, "label"]}
|
||||||
label="要询问客户什么"
|
label="要询问客户什么"
|
||||||
rules={[{ required: true, message: "请填写字段名称" }]}
|
rules={[{ required: true, message: "请填写字段名称" }]}
|
||||||
style={{ flex: 1 }}
|
className="admin-flex-1"
|
||||||
>
|
>
|
||||||
<Input placeholder="例如:联系电话、预计预算、项目地址" />
|
<Input placeholder="例如:联系电话、预计预算、项目地址" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item {...restField} name={[name, "type"]} label="回答方式">
|
<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>
|
||||||
<Form.Item {...restField} name={[name, "required"]} label="必填">
|
<Form.Item {...restField} name={[name, "required"]} label="必填">
|
||||||
<Select
|
<Select
|
||||||
style={{ width: 90 }}
|
className="admin-field-w-sm"
|
||||||
options={[
|
options={[
|
||||||
{ value: true, label: "必填" },
|
{ value: true, label: "必填" },
|
||||||
{ value: false, label: "选填" },
|
{ value: false, label: "选填" },
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Button danger onClick={() => remove(name)} style={{ marginTop: 30 }}>
|
<Button danger onClick={() => remove(name)} className="admin-field-offset">
|
||||||
删除
|
删除
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</div>
|
||||||
<Form.Item noStyle shouldUpdate>
|
<Form.Item noStyle shouldUpdate>
|
||||||
{({ getFieldValue }) =>
|
{({ getFieldValue }) =>
|
||||||
["select", "radio", "multi-select"].includes(
|
["select", "radio", "multi-select"].includes(
|
||||||
@@ -735,32 +762,28 @@ export function WorkspacePage() {
|
|||||||
{(optionFields, { add, remove }, { errors }) => (
|
{(optionFields, { add, remove }, { errors }) => (
|
||||||
<>
|
<>
|
||||||
{optionFields.map((optionField) => (
|
{optionFields.map((optionField) => (
|
||||||
<Space
|
<div key={optionField.key} className="admin-form-row-center">
|
||||||
key={optionField.key}
|
|
||||||
align="center"
|
|
||||||
style={{ display: "flex" }}
|
|
||||||
>
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
{...optionField}
|
{...optionField}
|
||||||
name={[optionField.name, "label"]}
|
name={[optionField.name, "label"]}
|
||||||
initialValue=""
|
initialValue=""
|
||||||
rules={[{ required: true, message: "请填写选项内容" }]}
|
rules={[{ required: true, message: "请填写选项内容" }]}
|
||||||
style={{ flex: 1, minWidth: 240, marginBottom: 8 }}
|
className="admin-flex-1 admin-offset-bottom-xs"
|
||||||
>
|
>
|
||||||
<Input placeholder="例如:预算内" />
|
<Input placeholder="例如:预算内" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Button
|
<Button
|
||||||
danger
|
danger
|
||||||
onClick={() => remove(optionField.name)}
|
onClick={() => remove(optionField.name)}
|
||||||
style={{ marginBottom: 8 }}
|
className="admin-offset-bottom-xs"
|
||||||
>
|
>
|
||||||
删除
|
删除
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</div>
|
||||||
))}
|
))}
|
||||||
<Button
|
<Button
|
||||||
onClick={() => add({ label: "", value: "" })}
|
onClick={() => add({ label: "", value: "" })}
|
||||||
style={{ marginBottom: 8 }}
|
className="admin-offset-bottom-xs"
|
||||||
>
|
>
|
||||||
新增选项
|
新增选项
|
||||||
</Button>
|
</Button>
|
||||||
@@ -778,6 +801,6 @@ export function WorkspacePage() {
|
|||||||
</Form.List>
|
</Form.List>
|
||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</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 });
|
||||||
+69
-41
@@ -6,17 +6,31 @@ import {
|
|||||||
App,
|
App,
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
|
ConfigProvider,
|
||||||
Form,
|
Form,
|
||||||
Input,
|
Input,
|
||||||
Layout,
|
Layout,
|
||||||
Menu,
|
Menu,
|
||||||
Select,
|
Select,
|
||||||
Space,
|
|
||||||
Tag,
|
|
||||||
Typography,
|
|
||||||
message,
|
message,
|
||||||
} from "antd";
|
} 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 { 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(() =>
|
const FeatureInquiriesPage = React.lazy(() =>
|
||||||
import("./features/inquiries/InquiriesPage.js").then((module) => ({
|
import("./features/inquiries/InquiriesPage.js").then((module) => ({
|
||||||
default: module.InquiriesPage,
|
default: module.InquiriesPage,
|
||||||
@@ -88,7 +102,13 @@ function Login({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Card title="个人品牌后台" style={{ maxWidth: 420, margin: "120px auto" }}>
|
<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 form={form} layout="vertical" onFinish={submit}>
|
||||||
<Form.Item name="username" label="账号" initialValue="admin" rules={[{ required: true }]}>
|
<Form.Item name="username" label="账号" initialValue="admin" rules={[{ required: true }]}>
|
||||||
<Input />
|
<Input />
|
||||||
@@ -96,11 +116,13 @@ function Login({
|
|||||||
<Form.Item name="password" label="密码" rules={[{ required: true }]}>
|
<Form.Item name="password" label="密码" rules={[{ required: true }]}>
|
||||||
<Input.Password />
|
<Input.Password />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Button type="primary" htmlType="submit" loading={loading} block>
|
<Button type="primary" size="large" htmlType="submit" loading={loading} block>
|
||||||
登录
|
登录
|
||||||
</Button>
|
</Button>
|
||||||
</Form>
|
</Form>
|
||||||
|
<p className="admin-auth-footnote">仅限授权成员访问。</p>
|
||||||
</Card>
|
</Card>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,8 +155,13 @@ function ChangePassword({ onComplete }: { onComplete: () => void }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Card title="首次登录需要修改密码" style={{ maxWidth: 420, margin: "120px auto" }}>
|
<div className="admin-auth">
|
||||||
<Typography.Paragraph type="secondary">请先设置只有你本人知道的新密码。</Typography.Paragraph>
|
<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 form={form} layout="vertical" onFinish={submit}>
|
||||||
<Form.Item name="currentPassword" label="初始密码" rules={[{ required: true }]}>
|
<Form.Item name="currentPassword" label="初始密码" rules={[{ required: true }]}>
|
||||||
<Input.Password />
|
<Input.Password />
|
||||||
@@ -149,11 +176,12 @@ function ChangePassword({ onComplete }: { onComplete: () => void }) {
|
|||||||
<Form.Item name="confirmPassword" label="确认新密码" rules={[{ required: true }]}>
|
<Form.Item name="confirmPassword" label="确认新密码" rules={[{ required: true }]}>
|
||||||
<Input.Password />
|
<Input.Password />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Button type="primary" htmlType="submit" loading={loading} block>
|
<Button type="primary" size="large" htmlType="submit" loading={loading} block>
|
||||||
保存新密码
|
保存新密码
|
||||||
</Button>
|
</Button>
|
||||||
</Form>
|
</Form>
|
||||||
</Card>
|
</Card>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,12 +211,12 @@ function Dashboard({ onLogout, role }: { onLogout: () => void; role: string }) {
|
|||||||
type: "group" as const,
|
type: "group" as const,
|
||||||
label: "日常经营",
|
label: "日常经营",
|
||||||
children: [
|
children: [
|
||||||
{ key: "overview", label: "当前品牌概览" },
|
{ key: "overview", label: "当前品牌概览", icon: <AppstoreOutlined /> },
|
||||||
{ key: "publication", label: "配置与发布" },
|
{ key: "publication", label: "配置与发布", icon: <CloudUploadOutlined /> },
|
||||||
{ key: "brand", label: "小程序页面" },
|
{ key: "brand", label: "小程序页面", icon: <MobileOutlined /> },
|
||||||
{ key: "trust", label: "信任内容" },
|
{ key: "trust", label: "信任内容", icon: <SafetyCertificateOutlined /> },
|
||||||
{ key: "services", label: "业务提供项" },
|
{ key: "services", label: "业务提供项", icon: <BarsOutlined /> },
|
||||||
{ key: "inquiries", label: "咨询记录" },
|
{ key: "inquiries", label: "咨询记录", icon: <MessageOutlined /> },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
...(role === "editor"
|
...(role === "editor"
|
||||||
@@ -198,43 +226,39 @@ function Dashboard({ onLogout, role }: { onLogout: () => void; role: string }) {
|
|||||||
type: "group" as const,
|
type: "group" as const,
|
||||||
label: "系统管理",
|
label: "系统管理",
|
||||||
children: [
|
children: [
|
||||||
{ key: "workspace", label: "模板与表单设置" },
|
{ key: "workspace", label: "模板与表单设置", icon: <SettingOutlined /> },
|
||||||
{ key: "capabilities", label: "能力插件" },
|
{ key: "capabilities", label: "能力插件", icon: <ThunderboltOutlined /> },
|
||||||
{ key: "members", label: "团队成员" },
|
{ key: "members", label: "团队成员", icon: <TeamOutlined /> },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
];
|
];
|
||||||
return (
|
return (
|
||||||
<Layout style={{ minHeight: "100vh" }}>
|
<Layout className="admin-shell">
|
||||||
<Layout.Sider breakpoint="lg" collapsedWidth={0}>
|
<Layout.Sider className="admin-sider" breakpoint="lg" collapsedWidth={0} width={232}>
|
||||||
<Typography.Title level={4} style={{ color: "white", padding: 20 }}>
|
<div className="admin-sider-brand">
|
||||||
当前品牌工作区
|
<span className="admin-sider-brand-mark">品</span>
|
||||||
</Typography.Title>
|
<span className="admin-sider-brand-name">品牌工作区</span>
|
||||||
|
</div>
|
||||||
<Menu
|
<Menu
|
||||||
theme="dark"
|
|
||||||
selectedKeys={[page]}
|
selectedKeys={[page]}
|
||||||
onClick={({ key }) => navigate(`/admin/${key}`)}
|
onClick={({ key }) => navigate(`/admin/${key}`)}
|
||||||
items={items}
|
items={items}
|
||||||
/>
|
/>
|
||||||
</Layout.Sider>
|
</Layout.Sider>
|
||||||
<Layout>
|
<Layout className="admin-main">
|
||||||
<Layout.Header
|
<Layout.Header className="admin-header">
|
||||||
style={{
|
<div className="admin-header-left">
|
||||||
background: "white",
|
<span className="admin-header-brand">{brand.data?.name || "当前品牌"}</span>
|
||||||
display: "flex",
|
<span className="admin-header-context">品牌工作区</span>
|
||||||
justifyContent: "space-between",
|
<StatusTag
|
||||||
alignItems: "center",
|
tone={role === "owner" ? "info" : "neutral"}
|
||||||
}}
|
label={role === "owner" ? "负责人" : "内容编辑"}
|
||||||
>
|
/>
|
||||||
<Space>
|
|
||||||
<Typography.Text strong>{brand.data?.name || "当前品牌"}</Typography.Text>
|
|
||||||
<Typography.Text type="secondary">品牌工作区</Typography.Text>
|
|
||||||
<Tag color={role === "owner" ? "blue" : "default"}>
|
|
||||||
{role === "owner" ? "负责人" : "内容编辑"}
|
|
||||||
</Tag>
|
|
||||||
<Select
|
<Select
|
||||||
size="small"
|
size="small"
|
||||||
|
variant="outlined"
|
||||||
|
className="admin-brand-switcher"
|
||||||
value={brand.data?.id}
|
value={brand.data?.id}
|
||||||
loading={memberships.isLoading}
|
loading={memberships.isLoading}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
@@ -245,13 +269,14 @@ function Dashboard({ onLogout, role }: { onLogout: () => void; role: string }) {
|
|||||||
label: item.brand.name,
|
label: item.brand.name,
|
||||||
}))}
|
}))}
|
||||||
/>
|
/>
|
||||||
</Space>
|
</div>
|
||||||
<Button type="text" onClick={onLogout}>
|
<Button type="text" onClick={onLogout}>
|
||||||
退出登录
|
退出登录
|
||||||
</Button>
|
</Button>
|
||||||
</Layout.Header>
|
</Layout.Header>
|
||||||
<Layout.Content style={{ padding: 24 }}>
|
<Layout.Content className="admin-content">
|
||||||
<Suspense fallback={<Card loading />}>
|
<div className="admin-content-inner">
|
||||||
|
<Suspense fallback={<LoadingStack />}>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/admin/overview" element={<FeatureOverviewPage />} />
|
<Route path="/admin/overview" element={<FeatureOverviewPage />} />
|
||||||
<Route
|
<Route
|
||||||
@@ -274,6 +299,7 @@ function Dashboard({ onLogout, role }: { onLogout: () => void; role: string }) {
|
|||||||
<Route path="*" element={<Navigate to="/admin/overview" replace />} />
|
<Route path="*" element={<Navigate to="/admin/overview" replace />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
|
</div>
|
||||||
</Layout.Content>
|
</Layout.Content>
|
||||||
</Layout>
|
</Layout>
|
||||||
</Layout>
|
</Layout>
|
||||||
@@ -315,6 +341,7 @@ function Root() {
|
|||||||
}
|
}
|
||||||
createRoot(document.getElementById("app")!).render(
|
createRoot(document.getElementById("app")!).render(
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
|
<ConfigProvider locale={zhCN} theme={adminTheme}>
|
||||||
<QueryClientProvider client={queryClient}>
|
<QueryClientProvider client={queryClient}>
|
||||||
<App>
|
<App>
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
@@ -322,5 +349,6 @@ createRoot(document.getElementById("app")!).render(
|
|||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
</App>
|
</App>
|
||||||
</QueryClientProvider>
|
</QueryClientProvider>
|
||||||
|
</ConfigProvider>
|
||||||
</React.StrictMode>,
|
</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