Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64b6f5c27c | ||
|
|
a3730ee8fc | ||
|
|
d0a0eeea8c | ||
|
|
e75c524343 | ||
|
|
1a4f71996a | ||
|
|
a2fa6c3c31 | ||
|
|
015947f8fb | ||
|
|
072a1037ac | ||
|
|
447c224fce | ||
|
|
f2fc1e0810 | ||
|
|
12a3bf2f3b | ||
|
|
ca6d1712bd | ||
|
|
e7ef0b3ce5 | ||
|
|
b82aa12875 | ||
|
|
b43b6f2785 | ||
|
|
965dd10219 | ||
|
|
371689484e | ||
|
|
d923b8cea9 | ||
|
|
a1b29cedee | ||
|
|
34504c0b44 | ||
|
|
3af5611da5 | ||
|
|
2fe108d66a | ||
|
|
4cd3749806 | ||
|
|
00aeaa3cb1 | ||
|
|
b190f2758a | ||
|
|
4d9c84defc | ||
|
|
b4e3e86dcd | ||
|
|
5051839986 | ||
|
|
84522a8908 | ||
|
|
18bcdbeb00 | ||
|
|
040504774d | ||
|
|
1001c43af6 | ||
|
|
121148f6cf | ||
|
|
a08a2f0f98 | ||
|
|
669d4a7de6 | ||
|
|
ec0cf78d69 | ||
|
|
658c94a4e9 | ||
|
|
261a33a5ca | ||
|
|
f28332f49a | ||
|
|
c33c9cbd63 | ||
|
|
b742fc70b5 | ||
|
|
6bd91d5ee8 | ||
|
|
cdc7b407bc | ||
|
|
9bfa4bb736 | ||
|
|
c04ab1ef60 | ||
|
|
4a6bc42635 | ||
|
|
b86c661af5 | ||
|
|
71c068966e | ||
|
|
784b9cbac8 | ||
|
|
2325214078 | ||
|
|
e194e605f9 | ||
|
|
82381a5e93 | ||
|
|
ec6b0dee3e | ||
|
|
060bad2df0 | ||
|
|
adcaa12970 | ||
|
|
330d67adc1 | ||
|
|
737010ea03 | ||
|
|
ec84988e57 | ||
|
|
f266bda3a9 | ||
|
|
88ab2561bd | ||
|
|
98c7701ccd | ||
|
|
e752a3b7ed | ||
|
|
9389235a6c | ||
|
|
a293591dba | ||
|
|
8c5860699f | ||
|
|
06619a191f | ||
|
|
3a0099e674 | ||
|
|
ca1b873a50 | ||
|
|
c2bd956b07 | ||
|
|
b101d169c9 | ||
|
|
ab17f80607 | ||
|
|
6df4e1d72b | ||
|
|
cb046a4c27 | ||
|
|
3738be884b | ||
|
|
193858c727 | ||
|
|
ea81c754ed | ||
|
|
16fd827634 | ||
|
|
38e9d59864 | ||
|
|
fb072d844b | ||
|
|
0d9f4a7d6f | ||
|
|
f02e2cafbb | ||
|
|
5d88cb2040 | ||
|
|
8e29932bc6 | ||
|
|
4ef4be2071 | ||
|
|
0788480ce3 | ||
|
|
bd129a3069 | ||
|
|
3017e3eb49 | ||
|
|
4f0b50c7f1 | ||
|
|
456171aa85 | ||
|
|
50b87e48de | ||
|
|
cd2992c00a | ||
|
|
e6d843b4a7 | ||
|
|
5a93d38437 | ||
|
|
bba20c5b28 | ||
|
|
b47cf5badc | ||
|
|
71c528de34 | ||
|
|
ec16fff70e | ||
|
|
6420b85019 | ||
|
|
c1633fb6f3 | ||
|
|
d1958a7d7f | ||
|
|
b1e8012ded | ||
|
|
5bf54096be | ||
|
|
d38dbe02aa | ||
|
|
b60174885e | ||
|
|
6edde5a8d6 | ||
|
|
413413efda | ||
|
|
553a07c4ec | ||
|
|
cddf836f4f | ||
|
|
58370224b5 | ||
|
|
b6713ea34c | ||
|
|
1918dae36b | ||
|
|
3989fbd39e | ||
|
|
cfd42e17f8 | ||
|
|
f12003004b | ||
|
|
6de7dd8d9e | ||
|
|
0862a4c01d | ||
|
|
18eb8bb9b0 | ||
|
|
a933e1feb6 | ||
|
|
f7be18a35e | ||
|
|
714cbd55f2 | ||
|
|
50753db79d | ||
|
|
5313fd9d32 | ||
|
|
34bd8142de | ||
|
|
04e42b3a80 | ||
|
|
bf4bbf81c7 | ||
|
|
0f6ad8b993 | ||
|
|
2ad009f5c0 | ||
|
|
6f18c67315 | ||
|
|
b23120477f | ||
|
|
12bc263d3b | ||
|
|
7c0f22ad7a | ||
|
|
8973338c64 | ||
|
|
476e3d93dd | ||
|
|
3ae7b462f5 | ||
|
|
f158f906d5 | ||
|
|
aaeec14733 | ||
|
|
6073e72940 | ||
|
|
896f3240f9 | ||
|
|
7b1e9eee47 | ||
|
|
47d6309cba | ||
|
|
ebab77057a | ||
|
|
3ef46b0aa8 | ||
|
|
2f26828f09 | ||
|
|
bb94d80e13 | ||
|
|
29e5666d74 | ||
|
|
d34cb182e3 | ||
|
|
4d1cd8f365 | ||
|
|
9ad2776515 | ||
|
|
53713e5935 | ||
|
|
ac3f433ee6 | ||
|
|
44fe7a0142 | ||
|
|
f52577ff9e | ||
|
|
8e90b8ca09 | ||
|
|
998e32e49c | ||
|
|
8b4d27b0ee | ||
|
|
26f1157083 | ||
|
|
ad949ab370 | ||
|
|
d5a84b51a7 | ||
|
|
760f41a584 | ||
|
|
20f880a761 | ||
|
|
ab1531d9b0 | ||
|
|
3d0252d187 | ||
|
|
526a9db789 | ||
|
|
9b35b8e7a7 | ||
|
|
14b6541bee | ||
|
|
00edcedbcf | ||
|
|
dcf1d76944 | ||
|
|
7f67f4d685 | ||
|
|
d2ca528543 | ||
|
|
47a24e0d53 | ||
|
|
c78deafee3 | ||
|
|
3330b536dc | ||
|
|
07629a4596 | ||
|
|
5c6ad02f46 | ||
|
|
048c42207c | ||
|
|
67735afd45 | ||
|
|
0574a85632 | ||
|
|
18ddf125be | ||
|
|
bb0709b8cc | ||
|
|
076c6124c8 | ||
|
|
89fdfd7d83 | ||
|
|
f87b26b201 | ||
|
|
466dc66907 | ||
|
|
357f271639 | ||
|
|
f3adf7bc15 | ||
|
|
4512d2601d | ||
|
|
d0902d6568 | ||
|
|
7e1dd543fb | ||
|
|
3003e7801d | ||
|
|
567921e726 | ||
|
|
03f947e9b8 | ||
|
|
6ac2d9421b | ||
|
|
aa42e7b866 | ||
|
|
e09b56e0f3 | ||
|
|
84956b8fe2 | ||
|
|
f57c0ca0ea | ||
|
|
9c15a822e9 | ||
|
|
85f37d2eae | ||
|
|
222055595c | ||
|
|
b1d5c2b4b0 | ||
|
|
787a50369f | ||
|
|
422162e580 | ||
|
|
26bcb2b66e | ||
|
|
91322fa9a0 | ||
|
|
bfbcee45bb | ||
|
|
46b1690f6c | ||
|
|
0e0ca201a7 | ||
|
|
569156c977 | ||
|
|
20e7e8bb81 | ||
|
|
20eb160abf | ||
|
|
d0ef25cfb3 | ||
|
|
d2ce2d2a84 | ||
|
|
f57e1b1336 | ||
|
|
22a82dbfba | ||
|
|
fa6b492bce | ||
|
|
860d9266fe | ||
|
|
a2932b1134 | ||
|
|
849ae5df05 | ||
|
|
df2b1f6031 | ||
|
|
66dbba5748 | ||
|
|
c5db30f817 | ||
|
|
541304a763 | ||
|
|
fd2e970d8b | ||
|
|
5b85fe769f | ||
|
|
0b14b5a814 | ||
|
|
c5af790554 |
No files matched your search
@@ -0,0 +1,30 @@
|
||||
# Admin 编辑工作区重构
|
||||
|
||||
## 目标
|
||||
|
||||
把 Admin 的品牌配置与小程序页面编辑整理成一个层级清晰、可持续扩展的工作区。用户能够明确区分品牌基础资料、模板内容、业务记录和页面预览;页面预览、区域选择和字段编辑保持统一行为。
|
||||
|
||||
## 交付边界
|
||||
|
||||
- 品牌资料页面减少 Card 堆叠,形成连续的配置分组。
|
||||
- 小程序页面配置成为主要编辑工作区,使用页面导航、预览画布和编辑面板的稳定布局。
|
||||
- 详情页只提供业务记录选择和动态预览,不出现品牌级详情编辑表单。
|
||||
- 预览选区、高亮、编辑状态、空状态和错误状态保持一致。
|
||||
- 不改变后端数据模型和小程序业务语义;模板仍通过 manifest 声明页面、区域和字段。
|
||||
|
||||
## 设计原则
|
||||
|
||||
- 基础品牌事实只提供一个编辑入口。
|
||||
- 模板专属字段由模板 manifest 驱动,不在共享页面中写行业逻辑。
|
||||
- 预览是编辑上下文的一部分,不单独启动每个模板服务。
|
||||
- 详情页数据来自选中的业务记录,视觉文案只能作为模板配置存在。
|
||||
- 页面区块使用平面分组和分隔线,只有真正需要独立操作的区域使用 Card。
|
||||
|
||||
## 验收标准
|
||||
|
||||
- 1920、1280、1024、768 和 390 宽度下布局无横向溢出。
|
||||
- 品牌资料、页面配置和发布状态的层级可以在首屏理解。
|
||||
- 首页、业务、服务、详情、咨询、成功和记录页面均可切换并保持稳定高度。
|
||||
- 点击模板区域后,选区高亮和右侧编辑面板始终同步。
|
||||
- 详情页只能选择业务记录并预览,不能出现品牌级详情字段编辑。
|
||||
- 通过 Admin/Taro typecheck、模板契约测试、生产构建和关键浏览器交互测试。
|
||||
@@ -0,0 +1,40 @@
|
||||
# Progress
|
||||
|
||||
## 保存体验收尾
|
||||
|
||||
- 品牌资料、页面字段、记录和咨询字段暴露未保存状态;保存成功清除对应状态,失败保留输入。
|
||||
- 切换页面/记录提供取消或放弃确认,刷新关闭窗口提供提醒,工作区内链接离开提供确认。
|
||||
- 保存操作区采用统一的面板底部样式;业务记录与品牌配置继续分别保存到原有接口。
|
||||
- 浏览器测试补充未保存取消切换与失败重试场景;测试采用独立接口 fixture,不冒充当前数据库的端到端验收。
|
||||
- 本轮没有重构品牌切换器或新增跨实体批量保存 API,这些不作为已验证能力。
|
||||
|
||||
## 工作台重构补充验收
|
||||
|
||||
- 上一轮将布局整理判为全部完成不准确,补充真正的工作台任务:视图分离、三栏布局和层级区域导航。
|
||||
- 默认显示页面编辑,品牌基础表单在“品牌资料”视图访问;两套组件保持挂载,切换不丢弃草稿。
|
||||
- 区域导航移至左栏,预览居中,属性编辑位于右栏;子区域缩进,选区与导航选中状态同步。
|
||||
- 顶部区分草稿工作区与检查发布入口,保存仍由各内容表单负责,避免错误承诺跨实体统一保存。
|
||||
- 已通过 2 项浏览器回归和五种宽度检查,并查看 1920 宽度实际截图。
|
||||
|
||||
## 2026-10-10
|
||||
|
||||
- 建立 Admin 编辑工作区重构 Epic。
|
||||
- 当前已知问题:品牌资料上方存在多个连续 Card;小程序页面配置仍是普通 Card;预览区和编辑面板层级不够明确;详情页需要保持动态只读预览;选区高亮需要继续验证真实鼠标路径。
|
||||
- 当前基线能力:模板 manifest、Taro renderer、RuntimeWorkspace 和 Admin 字段绑定已经形成契约;本 Epic 主要调整 Admin 信息架构与视觉层。
|
||||
- 第 1 项已完成:确认 `BrandPage` 的两列 Card 结构、页面配置固定最小高度、模板说明右栏和编辑器内部重复导航。
|
||||
- 第 2 项开始:先整理品牌资料页面层级,减少 Card 作为页面区块容器的使用。
|
||||
- 第 2 项阶段性完成:`BrandPage` 已将品牌身份、联系合作、模板视觉改为连续分组,模板说明改为右侧辅助 `Alert`,并增加移动端断点。
|
||||
- 验证:Admin typecheck 通过,`admin-editor.spec.ts` 2 项通过。
|
||||
- 第 2 项完成,第 3 项开始:`PresentationEditor` 已移除外层 Card 和固定最小高度,改为独立工作区标题区;下一步处理工作区内部布局和视觉状态。
|
||||
|
||||
- 工作区完成:品牌配置使用连续分组;模板辅助信息移入基础资料尾部;编辑器使用完整宽度两栏布局,窄屏上下排列。
|
||||
- 未选中时显示引导,详情页目标列表为空且不显示点选工具。
|
||||
- 新增 1920/1280/1024/768/390 宽度无溢出断言和截图,已人工查看 1280 与 390 截图。
|
||||
- 验证通过:Admin/Taro typecheck、Admin lint、全仓 format:check、19 项模板契约测试、Admin build、2 项浏览器测试。
|
||||
- lint 暴露已有 InquiryPreviewEditor 类型问题,已通过 Form 泛型和普通对象传入修复。
|
||||
- 保留已知构建 api chunk 超过 500 kB 提示,后续由 Admin 前端打包优化任务负责;记录在 ADR 0021。
|
||||
- 本轮不涉及新增 API 或数据迁移。
|
||||
|
||||
- 最终收尾完成:新增全局未保存离开提醒、切换确认、保存状态和失败保留输入;属性面板保存按钮固定在底部。
|
||||
- 验证通过:Admin/Taro typecheck、Admin lint、format:check、19 项模板契约、Admin build、浏览器 2 项(含未保存取消切换与失败重试)。
|
||||
- 构建仍有 api chunk 超过 500 kB 的提示,属于后续打包优化项,不影响构建结果。
|
||||
@@ -0,0 +1,6 @@
|
||||
id,title,status,task_type,depends_on,acceptance_criteria,validation_command,task_dir,notes
|
||||
1,建立现状基线与页面覆盖清单,DONE,single-full,,记录当前布局层级、Card 使用、响应式问题和关键交互,测试基线截图与 DOM 检查,.codex-tasks/admin-editor-workspace/tasks/01-baseline/,已完成代码结构基线与验证记录
|
||||
2,重构品牌配置的信息架构,DONE,single-full,1,品牌资料按身份联系模板视觉分组且减少卡片嵌套,Admin typecheck; browser brand page test,.codex-tasks/admin-editor-workspace/tasks/02-information-architecture/,已完成分组与模板说明层级调整
|
||||
3,重构小程序页面编辑工作区,DONE,single-full,1;2,页面导航预览画布编辑面板形成稳定三栏或响应式两栏布局,Admin build; browser editor test,.codex-tasks/admin-editor-workspace/tasks/03-workspace-ui/,完整宽度两栏工作区,窄屏堆叠;详情页只读;未选中显示引导
|
||||
4,统一编辑器视觉系统与状态样式,DONE,single-full,3,间距层级按钮选区空状态错误状态统一且无 Card 堆叠,Prettier; Admin build; screenshot review,.codex-tasks/admin-editor-workspace/tasks/04-visual-system/,统一导航工具条、画布边界、区域按钮和面板间距;已检查 1280 与 390 截图
|
||||
5,全页面回归与交付验收,DONE,single-full,2;3;4,关键页面交互和响应式检查通过并记录残余风险,validate:templates; typecheck; build; browser tests,.codex-tasks/admin-editor-workspace/tasks/05-regression/,5 种宽度无溢出;浏览器 2 项、契约 19 项、格式、lint、类型和构建通过
|
||||
|
@@ -0,0 +1,32 @@
|
||||
# 当前基线
|
||||
|
||||
## 页面结构
|
||||
|
||||
- `BrandPage` 使用两列布局:左侧 `xl=16`,右侧 `xl=8`。
|
||||
- 左侧依次渲染“我是谁”“如何联系与合作”“模板与品牌视觉”三个 `Card`。
|
||||
- 左侧表单之后渲染“小程序页面配置” `Card`。
|
||||
- 右侧单独渲染“模板说明” `Card`。
|
||||
- 页面配置内部还有页面导航、页面预览、详情业务选择器、预览目标按钮和右侧编辑表单。
|
||||
|
||||
## 已确认问题
|
||||
|
||||
- 配置 Card 与页面编辑 Card 在视觉上处于同一层级,用户难以判断基础资料和页面编辑的关系。
|
||||
- “模板说明”占据右侧固定列,但对编辑流程帮助有限,造成首屏空间浪费。
|
||||
- 页面配置使用 `minHeight: 760/620`,内容较少的页面会出现大面积空白。
|
||||
- 页面配置内部的预览目标按钮与画布选区重复表达同一件事。
|
||||
- 详情页已经改为动态预览提示,但页面整体仍沿用通用编辑器的表单布局。
|
||||
- 品牌资料表单保存按钮位于所有配置分组之后,长页面中不够容易发现。
|
||||
|
||||
## 现有可复用能力
|
||||
|
||||
- 模板 manifest 声明页面、区域、字段和 preview target。
|
||||
- `RuntimeWorkspace` 为组件预览提供品牌、业务记录、信任内容和咨询表单数据。
|
||||
- `ComponentTemplatePreview` 支持点选、高亮、组合区域和浏览模式。
|
||||
- `PresentationEditor` 已支持业务记录编辑、信任内容编辑和咨询字段编辑。
|
||||
|
||||
## 基线验证
|
||||
|
||||
- `pnpm --filter @personal-brand/admin typecheck`:通过。
|
||||
- `pnpm --filter @personal-brand/taro typecheck`:通过。
|
||||
- `pnpm validate:templates`:19 项模板契约测试通过。
|
||||
- 已有 `admin-editor.spec.ts` 覆盖页面切换、预览选区、业务记录、信任内容、咨询表单和详情页动态预览。
|
||||
@@ -0,0 +1,64 @@
|
||||
# 本轮执行进度
|
||||
|
||||
## 当前恢复点
|
||||
|
||||
- 任务:现有两模板按通用规则诊断、修复、验收。
|
||||
- 形态:single-full。
|
||||
- 进度:7/7;任务真源为 TODO.csv。
|
||||
- 当前:本轮审计修复和证据归档完成,详见 docs/template-audit-2026-10-10.md。
|
||||
- 验证:真实数据库集成 41 项通过,覆盖 193 个声明绑定;真实 manifest 浏览器逐页/320 与 390 宽布局、全部实际存在目标的画布内部点选、方法和流程子字段修改重载共 2 项通过(42.3 秒)。
|
||||
- 静态报告:两模板 blocker 均为 0,food review 55,linjing review 23;命令仍退出 1,保留原报告 completionStatus=unverified。
|
||||
- 动态审查:raw/manual-review.json 为每条 review 保存来源、只读理由和证据;条件组合未穷举,不将源码审查冒充浏览器全分支验证。
|
||||
- 数据:只在随机独立 schema 做 integration;没有生产 migration 或 seed 改写。
|
||||
- 下一步:当前无剩余实现任务;保持未提交 diff,后续模板按相同规则验收。静态 completionStatus 不自动改为完整通过。
|
||||
|
||||
## 本轮新增故障与修复
|
||||
|
||||
1. 新 config 被旧完整品牌对象覆盖:仅发送改变的标准字段和新 config,剔除模板选择字段。
|
||||
2. 保存后 Admin 预览读取旧发布快照:从当前品牌记录构建内存草稿,与公开投影共用服务;公开仍读取发布快照。
|
||||
3. 旧 config.avatarUrl 覆盖共享头像:标准列优先,主动清空后旧别名不得复活。
|
||||
4. templateFields 错页、templateData 未同步:按 page 分组并同步专属草稿。
|
||||
5. 列表只检查 binding:补逐个 itemFields 检查及排序;空区域提供内容管理入口。
|
||||
6. 详情正文与底部按钮共用目标:拆为两个公共编辑区,业务记录仍仅选择预览。
|
||||
|
||||
## 画布检查的失败记录
|
||||
|
||||
新增检查先后发现测试命中点不正确:圆角透明角落、父容器采样落在子区、装饰图片被遮罩覆盖。原始失败保留 raw/browser-*-failure.log;最终也发现林境 fixture 缺少所有介绍标题,使父区域没有显示文字,补真实结构的标题内容后验收通过。重新审查测试输入后,改为点击目标内有文字的叶子内容,并先确认浏览器真实 elementFromPoint 命中的最近目标。没有强制点击、删业务断言或改变模板视觉。
|
||||
|
||||
## 前轮历史(已被本轮验证补充)
|
||||
|
||||
# 本轮审计结果
|
||||
|
||||
本轮按 skill 完成诊断、修复、回归与剩余项归档;模板整体验收仍为 unverified。
|
||||
|
||||
## 静态结果
|
||||
|
||||
- acheng-campus-food:blocker 11 → 2;review 120
|
||||
- linjing-editorial:blocker 26 → 2;review 65
|
||||
|
||||
## 已验证
|
||||
|
||||
- 林境真实 manifest:主理人完整字段、最近选区、统计 2×2、数值编辑保存重载、共享简介保存重载、侧栏信任记录定位、主理人页不出现首页统计目标。
|
||||
- 餐饮现有浏览器回归通过,新增共享字段未逐一完成端到端验证。
|
||||
- 浏览器 2 项通过;模板契约 19 项、诊断器 15 项通过;Admin 单元测试、Admin/Taro 类型、Admin lint 与生产构建、全仓格式及 diff 检查通过。
|
||||
- 独立随机 schema 的 API 集成 40 项通过;不等于所有新模板字段发布流程逐项已验证。
|
||||
|
||||
## 未完成与限制
|
||||
|
||||
- 两模板详情页公共按钮文案仍由品牌配置读取,与只读详情预览边界需进一步明确,4 条静态 blocker 保留。
|
||||
- 动态循环、条件分支等 review 仍需逐项核对,不能用静态报告证明完整。
|
||||
- 林境截图验证 2×2,使用 fixture 主图且头像未加载,不能作为真实原型视觉一致性证明;原型全量对照未完成。
|
||||
- 未对每个新增共享字段执行真实数据库发布后公开读取;现有集成通过不能替代该覆盖。
|
||||
- Admin 构建仍有已有大于 500 kB chunk 提示。
|
||||
|
||||
## 经验沉淀
|
||||
|
||||
新增多入口绑定同步及未挂载字段保留规则,补入 skill 和回归。未提交 commit,未迁移生产数据。
|
||||
|
||||
## 最终门槛
|
||||
|
||||
- browser-current.log:2/2 通过,42.3 秒;实际画布目标检查没有使用 force 或 dispatchEvent。
|
||||
- integration-final.log:41/41 通过,193 个真实绑定保存/草稿/发布验证。
|
||||
- API Client 3/3、模板契约 19/19、诊断器 19/19;API/Admin/Taro 类型检查通过。
|
||||
- API/Admin lint、Admin 构建、两模板 H5 与 weapp 构建通过;格式和 diff 检查通过。
|
||||
- 完整范围、78 条动态映射 review 的源码审阅和视觉限制保留在最终文档及 raw/manual-review.json;没有将静态退出 1 隐藏为通过。
|
||||
@@ -0,0 +1,3 @@
|
||||
# 按 template-completion-audit 执行现有模板审计
|
||||
|
||||
范围:自动发现两个模板,修复共享字段入口、选区、信任页作用域与实际绑定,运行真实 manifest 浏览器及隔离数据库回归,记录未完成证据。没有生产数据迁移或自动提交。
|
||||
@@ -0,0 +1,8 @@
|
||||
id,task,status,acceptance_criteria,validation_command,completed_at,retry_count,notes
|
||||
1,采集真实基线,DONE,before 报告已存档,node scripts/template-doctor.mjs,2026-10-10,0,退出 1 保留实际问题
|
||||
2,修复公共编辑和字段绑定,DONE,真实 manifest 修改保存重载测试通过,playwright admin-editor.spec.ts,2026-10-10,1,修复共享字段未挂载覆盖
|
||||
3,执行审计验证并归档边界,DONE,保留未验证和失败项,pnpm format:check,2026-10-10,0,详情按钮与原型全量验收未完成
|
||||
4,补齐详情公共文案和真实卡片字段,DONE,所有展示字段有对应入口,pnpm validate:templates,2026-10-10,0,详情正文与底部按钮独立目标;真实卡片字段补齐;模板契约 19 项通过
|
||||
5,验证真实声明的浏览器编辑闭环,DONE,两个模板真实声明保存重载测试通过,playwright admin-editor.spec.ts,2026-10-10,0,2 项真实 manifest 浏览器通过;含逐页画布内部点击、字段面板、列表子项修改重载和多宽检查
|
||||
6,验证数据库保存发布隔离,DONE,新增字段真实持久化发布回归通过,pnpm --filter @personal-brand/api test:integration,2026-10-10,0,41 项集成通过;193 个真实绑定隔离数据库保存草稿发布验证
|
||||
7,归档动态映射和视觉验收,DONE,逐项证据与门槛验证完成,pnpm template:doctor,2026-10-10,4,78 条动态审查归档;最终画布检查通过;原型结构与视觉边界详见 docs/template-audit-2026-10-10.md
|
||||
|
@@ -0,0 +1,260 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"scope": "模板完成证据登记,保留命令、日志与产物哈希",
|
||||
"generatedAt": "2026-10-24T02:02:12.474Z",
|
||||
"templates": {
|
||||
"acheng-campus-food": {
|
||||
"real-manifest-interaction": {
|
||||
"status": "passed",
|
||||
"commands": [
|
||||
"pnpm --filter @personal-brand/api test:integration",
|
||||
"ADMIN_URL=http://localhost:3000 pnpm --filter @personal-brand/taro exec playwright test test/browser/admin-editor.spec.ts"
|
||||
],
|
||||
"artifacts": [
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/evidence-2026-10-20-final/api-integration.log",
|
||||
"sha256": "1efcc2e20c32dc9b42f960a6967a6e94a32aa9e49ca855c17d61b2bc7f6ab891"
|
||||
},
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/evidence-2026-10-20/admin-editor.log",
|
||||
"sha256": "281c1bba68b5f6e30438d925ea58d8454bd98cf538fab8217710c7dc4402d103"
|
||||
}
|
||||
],
|
||||
"exitCode": 0
|
||||
},
|
||||
"save-reload-publish-isolation": {
|
||||
"status": "passed",
|
||||
"commands": [
|
||||
"pnpm --filter @personal-brand/api test:integration"
|
||||
],
|
||||
"artifacts": [
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/evidence-2026-10-20-final/api-integration.log",
|
||||
"sha256": "1efcc2e20c32dc9b42f960a6967a6e94a32aa9e49ca855c17d61b2bc7f6ab891"
|
||||
},
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/evidence-2026-10-20-final/api-unit.log",
|
||||
"sha256": "8a7a4bbd46be04b7c89318b702886d75acdb3707d9035c789e1d0550fd052b6e"
|
||||
}
|
||||
],
|
||||
"exitCode": 0
|
||||
},
|
||||
"visual-reference": {
|
||||
"status": "passed",
|
||||
"commands": [
|
||||
"TEMPLATE_PREVIEW_VISUAL_EVIDENCE=/home/que01/Project/persionalBrand/.codex-tasks/template-audit-execution/raw/visual-matrix-final ADMIN_URL=http://localhost:3000 pnpm --filter @personal-brand/taro exec playwright test test/browser/template-preview-media.spec.ts"
|
||||
],
|
||||
"artifacts": [
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/evidence-2026-10-20/template-preview-media.log",
|
||||
"sha256": "3eb8132e3fae6c95e2820d2979422ab63ab93e52426de8bcd528fd16b36eba3c"
|
||||
},
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/visual-matrix-final/01-acheng-campus-food-food-320.png",
|
||||
"sha256": "3aa442379e6847eeda18b97df78fadb077f6b678ee09f99d692b8fd357d37422"
|
||||
},
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/visual-matrix-final/01-acheng-campus-food-food-375.png",
|
||||
"sha256": "a0cc26679391dc851056551dcd5b31f50603bfd0dc44a59bc5182ea377a2747f"
|
||||
},
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/visual-matrix-final/01-acheng-campus-food-food-390.png",
|
||||
"sha256": "f5d517380140ed62bb306a79fdbf818e1846c7ff58ebf229c2c8ed1142221537"
|
||||
}
|
||||
],
|
||||
"exitCode": 0
|
||||
},
|
||||
"empty-error-branches": {
|
||||
"status": "passed",
|
||||
"commands": [
|
||||
"TEMPLATE_PREVIEW_VISUAL_EVIDENCE=/home/que01/Project/persionalBrand/.codex-tasks/template-audit-execution/raw/visual-matrix-final ADMIN_URL=http://localhost:3000 pnpm --filter @personal-brand/taro exec playwright test test/browser/template-preview-media.spec.ts",
|
||||
"ADMIN_URL=http://localhost:3000 pnpm --filter @personal-brand/taro exec playwright test test/browser/admin-editor.spec.ts"
|
||||
],
|
||||
"artifacts": [
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/evidence-2026-10-20/template-preview-media.log",
|
||||
"sha256": "3eb8132e3fae6c95e2820d2979422ab63ab93e52426de8bcd528fd16b36eba3c"
|
||||
},
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/evidence-2026-10-20/admin-editor.log",
|
||||
"sha256": "281c1bba68b5f6e30438d925ea58d8454bd98cf538fab8217710c7dc4402d103"
|
||||
},
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/visual-matrix-final/empty-01-acheng-campus-food-food.png",
|
||||
"sha256": "2a8279db468ab65426f1cf5e13ff8dcffa6ef625bf9f3dd563165b8905a79043"
|
||||
}
|
||||
],
|
||||
"exitCode": 0
|
||||
}
|
||||
},
|
||||
"atelier-solopreneur": {
|
||||
"real-manifest-interaction": {
|
||||
"status": "passed",
|
||||
"commands": [
|
||||
"pnpm --filter @personal-brand/api test:integration",
|
||||
"ADMIN_URL=http://localhost:3000 pnpm --filter @personal-brand/taro exec playwright test test/browser/admin-editor.spec.ts"
|
||||
],
|
||||
"artifacts": [
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/evidence-2026-10-20-final/api-integration.log",
|
||||
"sha256": "1efcc2e20c32dc9b42f960a6967a6e94a32aa9e49ca855c17d61b2bc7f6ab891"
|
||||
},
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/evidence-2026-10-20/admin-editor.log",
|
||||
"sha256": "281c1bba68b5f6e30438d925ea58d8454bd98cf538fab8217710c7dc4402d103"
|
||||
}
|
||||
],
|
||||
"exitCode": 0
|
||||
},
|
||||
"save-reload-publish-isolation": {
|
||||
"status": "passed",
|
||||
"commands": [
|
||||
"pnpm --filter @personal-brand/api test:integration"
|
||||
],
|
||||
"artifacts": [
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/evidence-2026-10-20-final/api-integration.log",
|
||||
"sha256": "1efcc2e20c32dc9b42f960a6967a6e94a32aa9e49ca855c17d61b2bc7f6ab891"
|
||||
},
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/evidence-2026-10-20-final/api-unit.log",
|
||||
"sha256": "8a7a4bbd46be04b7c89318b702886d75acdb3707d9035c789e1d0550fd052b6e"
|
||||
}
|
||||
],
|
||||
"exitCode": 0
|
||||
},
|
||||
"visual-reference": {
|
||||
"status": "passed",
|
||||
"commands": [
|
||||
"TEMPLATE_PREVIEW_VISUAL_EVIDENCE=/home/que01/Project/persionalBrand/.codex-tasks/template-audit-execution/raw/visual-matrix-final ADMIN_URL=http://localhost:3000 pnpm --filter @personal-brand/taro exec playwright test test/browser/template-preview-media.spec.ts"
|
||||
],
|
||||
"artifacts": [
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/evidence-2026-10-20/template-preview-media.log",
|
||||
"sha256": "3eb8132e3fae6c95e2820d2979422ab63ab93e52426de8bcd528fd16b36eba3c"
|
||||
},
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/visual-matrix-final/02-atelier-solopreneur-personal-320.png",
|
||||
"sha256": "e55af9899393c7f9cfba9bb2b5c6ad6c447f90cf28dddd94da8feb6702fc8477"
|
||||
},
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/visual-matrix-final/02-atelier-solopreneur-personal-375.png",
|
||||
"sha256": "70d251ab829ebfc85dba7fd65ac423272af4af54b39f76d1bea9ebbe0f89bc2d"
|
||||
},
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/visual-matrix-final/02-atelier-solopreneur-personal-390.png",
|
||||
"sha256": "a430e7c72f794d62f9f0248c52307b6f644ea5b6099ba6c8b929f365504c3b07"
|
||||
}
|
||||
],
|
||||
"exitCode": 0
|
||||
},
|
||||
"empty-error-branches": {
|
||||
"status": "passed",
|
||||
"commands": [
|
||||
"TEMPLATE_PREVIEW_VISUAL_EVIDENCE=/home/que01/Project/persionalBrand/.codex-tasks/template-audit-execution/raw/visual-matrix-final ADMIN_URL=http://localhost:3000 pnpm --filter @personal-brand/taro exec playwright test test/browser/template-preview-media.spec.ts",
|
||||
"ADMIN_URL=http://localhost:3000 pnpm --filter @personal-brand/taro exec playwright test test/browser/admin-editor.spec.ts"
|
||||
],
|
||||
"artifacts": [
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/evidence-2026-10-20/template-preview-media.log",
|
||||
"sha256": "3eb8132e3fae6c95e2820d2979422ab63ab93e52426de8bcd528fd16b36eba3c"
|
||||
},
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/evidence-2026-10-20/admin-editor.log",
|
||||
"sha256": "281c1bba68b5f6e30438d925ea58d8454bd98cf538fab8217710c7dc4402d103"
|
||||
},
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/visual-matrix-final/empty-02-atelier-solopreneur-personal.png",
|
||||
"sha256": "78982dd7aa7a8751e29969de9f68c6c3eab0bcdb2403f1a5442f10cc03b9a843"
|
||||
}
|
||||
],
|
||||
"exitCode": 0
|
||||
}
|
||||
},
|
||||
"linjing-editorial": {
|
||||
"real-manifest-interaction": {
|
||||
"status": "passed",
|
||||
"commands": [
|
||||
"pnpm --filter @personal-brand/api test:integration",
|
||||
"ADMIN_URL=http://localhost:3000 pnpm --filter @personal-brand/taro exec playwright test test/browser/admin-editor.spec.ts"
|
||||
],
|
||||
"artifacts": [
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/evidence-2026-10-20-final/api-integration.log",
|
||||
"sha256": "1efcc2e20c32dc9b42f960a6967a6e94a32aa9e49ca855c17d61b2bc7f6ab891"
|
||||
},
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/evidence-2026-10-20/admin-editor.log",
|
||||
"sha256": "281c1bba68b5f6e30438d925ea58d8454bd98cf538fab8217710c7dc4402d103"
|
||||
}
|
||||
],
|
||||
"exitCode": 0
|
||||
},
|
||||
"save-reload-publish-isolation": {
|
||||
"status": "passed",
|
||||
"commands": [
|
||||
"pnpm --filter @personal-brand/api test:integration"
|
||||
],
|
||||
"artifacts": [
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/evidence-2026-10-20-final/api-integration.log",
|
||||
"sha256": "1efcc2e20c32dc9b42f960a6967a6e94a32aa9e49ca855c17d61b2bc7f6ab891"
|
||||
},
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/evidence-2026-10-20-final/api-unit.log",
|
||||
"sha256": "8a7a4bbd46be04b7c89318b702886d75acdb3707d9035c789e1d0550fd052b6e"
|
||||
}
|
||||
],
|
||||
"exitCode": 0
|
||||
},
|
||||
"visual-reference": {
|
||||
"status": "passed",
|
||||
"commands": [
|
||||
"TEMPLATE_PREVIEW_VISUAL_EVIDENCE=/home/que01/Project/persionalBrand/.codex-tasks/template-audit-execution/raw/visual-matrix-final ADMIN_URL=http://localhost:3000 pnpm --filter @personal-brand/taro exec playwright test test/browser/template-preview-media.spec.ts"
|
||||
],
|
||||
"artifacts": [
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/evidence-2026-10-20/template-preview-media.log",
|
||||
"sha256": "3eb8132e3fae6c95e2820d2979422ab63ab93e52426de8bcd528fd16b36eba3c"
|
||||
},
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/visual-matrix-final/03-linjing-editorial-doors-320.png",
|
||||
"sha256": "d1569323ca5514b2348338a4c6f37bc3078c2e827e17943437efe8f437dd1188"
|
||||
},
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/visual-matrix-final/03-linjing-editorial-doors-375.png",
|
||||
"sha256": "48960348d896631b6c0c788a5528a21e7eefe3339dfffdbff43330c062f7b983"
|
||||
},
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/visual-matrix-final/03-linjing-editorial-doors-390.png",
|
||||
"sha256": "dd893c5958c3f4165ae988fef7be6882b27ccb3260112676ae296f2e6fef6be6"
|
||||
}
|
||||
],
|
||||
"exitCode": 0
|
||||
},
|
||||
"empty-error-branches": {
|
||||
"status": "passed",
|
||||
"commands": [
|
||||
"TEMPLATE_PREVIEW_VISUAL_EVIDENCE=/home/que01/Project/persionalBrand/.codex-tasks/template-audit-execution/raw/visual-matrix-final ADMIN_URL=http://localhost:3000 pnpm --filter @personal-brand/taro exec playwright test test/browser/template-preview-media.spec.ts",
|
||||
"ADMIN_URL=http://localhost:3000 pnpm --filter @personal-brand/taro exec playwright test test/browser/admin-editor.spec.ts"
|
||||
],
|
||||
"artifacts": [
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/evidence-2026-10-20/template-preview-media.log",
|
||||
"sha256": "3eb8132e3fae6c95e2820d2979422ab63ab93e52426de8bcd528fd16b36eba3c"
|
||||
},
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/evidence-2026-10-20/admin-editor.log",
|
||||
"sha256": "281c1bba68b5f6e30438d925ea58d8454bd98cf538fab8217710c7dc4402d103"
|
||||
},
|
||||
{
|
||||
"path": ".codex-tasks/template-audit-execution/raw/visual-matrix-final/empty-03-linjing-editorial-doors.png",
|
||||
"sha256": "d7b2b3197e426f1dd9b2ef99cd8682cb4c34531163b8ba5ebc90453438521970"
|
||||
}
|
||||
],
|
||||
"exitCode": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
"sourceTreeHash": "9d33ce8dbbddd34b91f045f49dc2316e36738ffec1429a93733d45d1b7b2a356"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
Running 2 tests using 1 worker
|
||||
|
||||
(node:633537) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
(node:633537) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
✓ 1 test/browser/admin-editor.spec.ts:235:5 › Admin 按通用预览目标筛选字段并同步品牌草稿 (26.4s)
|
||||
✓ 2 test/browser/admin-editor.spec.ts:637:5 › 林境模板支持首页和主理人区域点选 (27.8s)
|
||||
|
||||
2 passed (55.7s)
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
Running 1 test using 1 worker
|
||||
|
||||
(node:632552) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
(node:632552) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
(node:632689) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
(node:632799) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
(node:632867) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
(node:632924) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
✓ 1 test/browser/template-preview-media.spec.ts:155:5 › 导入包预览矩阵展示身份、资源和完整媒体槽位 (12.7s)
|
||||
|
||||
1 passed (14.2s)
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
Running 2 tests using 1 worker
|
||||
|
||||
(node:12847) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
(node:12847) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
✓ 1 test/browser/admin-editor.spec.ts:235:5 › Admin 按通用预览目标筛选字段并同步品牌草稿 (21.0s)
|
||||
✓ 2 test/browser/admin-editor.spec.ts:654:5 › 林境模板支持首页和主理人区域点选 (22.2s)
|
||||
|
||||
2 passed (44.1s)
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
Running 1 test using 1 worker
|
||||
|
||||
(node:12338) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
(node:12338) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
(node:12435) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
(node:12543) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
(node:12607) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
(node:12662) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
✓ 1 test/browser/template-preview-media.spec.ts:155:5 › 导入包预览矩阵展示身份、资源和完整媒体槽位 (9.1s)
|
||||
|
||||
1 passed (10.0s)
|
||||
@@ -0,0 +1,440 @@
|
||||
|
||||
> @personal-brand/api@ test /home/que01/Project/persionalBrand/apps/api
|
||||
> tsx --test test/**/*.test.ts
|
||||
|
||||
TAP version 13
|
||||
# Subtest: 构建 worker 异常退出时返回明确非零结果
|
||||
ok 1 - 构建 worker 异常退出时返回明确非零结果
|
||||
---
|
||||
duration_ms: 80.679734
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 构建 worker watchdog 超时会终止子进程并返回 timedOut
|
||||
ok 2 - 构建 worker watchdog 超时会终止子进程并返回 timedOut
|
||||
---
|
||||
duration_ms: 36.587105
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 构建进度更新不触发发布状态机的顺序校验
|
||||
ok 3 - 构建进度更新不触发发布状态机的顺序校验
|
||||
---
|
||||
duration_ms: 1.684099
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 构建进度更新按品牌隔离,任务不存在时抛出 404
|
||||
ok 4 - 构建进度更新按品牌隔离,任务不存在时抛出 404
|
||||
---
|
||||
duration_ms: 0.989713
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 重新构建时可以清除上一次遗留的错误信息
|
||||
ok 5 - 重新构建时可以清除上一次遗留的错误信息
|
||||
---
|
||||
duration_ms: 0.32377
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 发布状态机仍拒绝越级变更并允许合法上传流转
|
||||
ok 6 - 发布状态机仍拒绝越级变更并允许合法上传流转
|
||||
---
|
||||
duration_ms: 0.879665
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 失败任务重试时可回到 built 并清除错误
|
||||
ok 7 - 失败任务重试时可回到 built 并清除错误
|
||||
---
|
||||
duration_ms: 0.423466
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: settings presentation never exposes plaintext credentials
|
||||
ok 8 - settings presentation never exposes plaintext credentials
|
||||
---
|
||||
duration_ms: 2.507469
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: update validates URL and private key before persistence
|
||||
ok 9 - update validates URL and private key before persistence
|
||||
---
|
||||
duration_ms: 2.477873
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: update encrypts a valid private key and preserves existing settings
|
||||
ok 10 - update encrypts a valid private key and preserves existing settings
|
||||
---
|
||||
duration_ms: 2.609961
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: upload blocks a currently building task before credentials are read
|
||||
ok 11 - upload blocks a currently building task before credentials are read
|
||||
---
|
||||
duration_ms: 2.803565
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: upload rejects invalid app configuration before building
|
||||
ok 12 - upload rejects invalid app configuration before building
|
||||
---
|
||||
duration_ms: 0.739001
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: failed build records logs and build failure state
|
||||
ok 13 - failed build records logs and build failure state
|
||||
---
|
||||
duration_ms: 11.162244
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: missing artifact records build failure without invoking upload
|
||||
ok 14 - missing artifact records build failure without invoking upload
|
||||
---
|
||||
duration_ms: 1.657659
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: upload rejects missing credentials before build
|
||||
ok 15 - upload rejects missing credentials before build
|
||||
---
|
||||
duration_ms: 0.580422
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: local mode reports configuration and returns a relative local upload URL
|
||||
ok 16 - local mode reports configuration and returns a relative local upload URL
|
||||
---
|
||||
duration_ms: 19.254692
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: upload service validates media type and traversal keys before persistence
|
||||
ok 17 - upload service validates media type and traversal keys before persistence
|
||||
---
|
||||
duration_ms: 5.35153
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: refactored admin controllers preserve their declared API routes
|
||||
ok 18 - refactored admin controllers preserve their declared API routes
|
||||
---
|
||||
duration_ms: 2.171245
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: root module composes bounded feature modules only
|
||||
ok 19 - root module composes bounded feature modules only
|
||||
---
|
||||
duration_ms: 0.224672
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 创建普通套餐订单时保存价格快照和预计金额
|
||||
ok 20 - 创建普通套餐订单时保存价格快照和预计金额
|
||||
---
|
||||
duration_ms: 3.15675
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 普通套餐不能在没有明细时创建
|
||||
ok 21 - 普通套餐不能在没有明细时创建
|
||||
---
|
||||
duration_ms: 1.103406
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 客户只能取消自己的 received 订单
|
||||
ok 22 - 客户只能取消自己的 received 订单
|
||||
---
|
||||
duration_ms: 0.528334
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 取消不存在或不属于当前客户的订单返回不存在
|
||||
ok 23 - 取消不存在或不属于当前客户的订单返回不存在
|
||||
---
|
||||
duration_ms: 0.329831
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 订单状态只能按定义的状态机流转
|
||||
ok 24 - 订单状态只能按定义的状态机流转
|
||||
---
|
||||
duration_ms: 0.789666
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 更新订单标签时拒绝其他品牌的标签
|
||||
ok 25 - 更新订单标签时拒绝其他品牌的标签
|
||||
---
|
||||
duration_ms: 0.44106
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 开发 seed 引用的本地媒体都有随仓库分发的源文件
|
||||
ok 26 - 开发 seed 引用的本地媒体都有随仓库分发的源文件
|
||||
---
|
||||
duration_ms: 1.65813
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 小程序产物根目录锚定仓库根目录,不随 API 进程工作目录变化
|
||||
ok 27 - 小程序产物根目录锚定仓库根目录,不随 API 进程工作目录变化
|
||||
---
|
||||
duration_ms: 1.317639
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 按模板包 key 生成唯一的微信小程序产物目录
|
||||
ok 28 - 按模板包 key 生成唯一的微信小程序产物目录
|
||||
---
|
||||
duration_ms: 0.275849
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 显式配置的产物根目录按仓库根目录解析相对路径
|
||||
ok 29 - 显式配置的产物根目录按仓库根目录解析相对路径
|
||||
---
|
||||
duration_ms: 0.170942
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 发布产物路径隔离品牌、模板版本和 attempt
|
||||
ok 30 - 发布产物路径隔离品牌、模板版本和 attempt
|
||||
---
|
||||
duration_ms: 0.400984
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 发布产物路径拒绝可能越界的品牌或模板字段
|
||||
ok 31 - 发布产物路径拒绝可能越界的品牌或模板字段
|
||||
---
|
||||
duration_ms: 0.578859
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 后台配置的请求地址优先于环境变量,改域名不需要动服务端配置
|
||||
ok 32 - 后台配置的请求地址优先于环境变量,改域名不需要动服务端配置
|
||||
---
|
||||
duration_ms: 1.515873
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 后台地址允许带路径前缀,保存前会去掉结尾斜杠
|
||||
ok 33 - 后台地址允许带路径前缀,保存前会去掉结尾斜杠
|
||||
---
|
||||
duration_ms: 0.593416
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 优先使用 MINIAPP_API_BASE_URL,去掉结尾斜杠
|
||||
ok 34 - 优先使用 MINIAPP_API_BASE_URL,去掉结尾斜杠
|
||||
---
|
||||
duration_ms: 0.192292
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 没有显式配置时由 PUBLIC_BASE_URL 加默认 /api 推导
|
||||
ok 35 - 没有显式配置时由 PUBLIC_BASE_URL 加默认 /api 推导
|
||||
---
|
||||
duration_ms: 0.18611
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 非 https 的公网地址必须被拒绝,避免再次打出 localhost 包
|
||||
ok 36 - 非 https 的公网地址必须被拒绝,避免再次打出 localhost 包
|
||||
---
|
||||
duration_ms: 0.437694
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 本地调试地址允许 http,方便开发环境构建
|
||||
ok 37 - 本地调试地址允许 http,方便开发环境构建
|
||||
---
|
||||
duration_ms: 0.195187
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: AppID 取品牌配置优先,回落 WEAPP_APP_ID,并拒绝占位值
|
||||
ok 38 - AppID 取品牌配置优先,回落 WEAPP_APP_ID,并拒绝占位值
|
||||
---
|
||||
duration_ms: 0.381347
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 构建中的任务在超过阈值未更新时视为已中断
|
||||
ok 39 - 构建中的任务在超过阈值未更新时视为已中断
|
||||
---
|
||||
duration_ms: 1.370659
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 非 building 状态永远不算中断,避免误伤正常流程
|
||||
ok 40 - 非 building 状态永远不算中断,避免误伤正常流程
|
||||
---
|
||||
duration_ms: 0.278604
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 时间戳异常时按未中断处理,宁可挡住重试也不允许并发构建
|
||||
ok 41 - 时间戳异常时按未中断处理,宁可挡住重试也不允许并发构建
|
||||
---
|
||||
duration_ms: 0.20209
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 阈值可通过环境变量覆盖,非法值回退到默认 30 分钟
|
||||
ok 42 - 阈值可通过环境变量覆盖,非法值回退到默认 30 分钟
|
||||
---
|
||||
duration_ms: 0.285577
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 构建超时阈值支持环境变量并有独立默认值
|
||||
ok 43 - 构建超时阈值支持环境变量并有独立默认值
|
||||
---
|
||||
duration_ms: 0.203984
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: CommonJS 形态的 miniprogram-ci 从 default 上取 Project 与 upload
|
||||
ok 44 - CommonJS 形态的 miniprogram-ci 从 default 上取 Project 与 upload
|
||||
---
|
||||
duration_ms: 1.180822
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 已是命名导出的模块可以直接使用
|
||||
ok 45 - 已是命名导出的模块可以直接使用
|
||||
---
|
||||
duration_ms: 0.218942
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 缺少 Project 或 upload 时抛出明确错误,而不是 undefined is not a constructor
|
||||
ok 46 - 缺少 Project 或 upload 时抛出明确错误,而不是 undefined is not a constructor
|
||||
---
|
||||
duration_ms: 0.67514
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 单行私钥(换行被输入框吞掉)可以还原为合法 PEM 并恢复签名能力
|
||||
ok 47 - 单行私钥(换行被输入框吞掉)可以还原为合法 PEM 并恢复签名能力
|
||||
---
|
||||
duration_ms: 46.62352
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 字面量 \\n 转义的私钥同样可以还原
|
||||
ok 48 - 字面量 \\n 转义的私钥同样可以还原
|
||||
---
|
||||
duration_ms: 35.171352
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 规范化是幂等的,不会反复改写已正确的 PEM
|
||||
ok 49 - 规范化是幂等的,不会反复改写已正确的 PEM
|
||||
---
|
||||
duration_ms: 93.585148
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 损坏或非 PEM 内容会被判定为无效,而不是静默保存
|
||||
ok 50 - 损坏或非 PEM 内容会被判定为无效,而不是静默保存
|
||||
---
|
||||
duration_ms: 45.896122
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 同一任务同一阶段的有效 lease 拒绝并发操作
|
||||
ok 51 - 同一任务同一阶段的有效 lease 拒绝并发操作
|
||||
---
|
||||
duration_ms: 2.956083
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 过期 lease 会先收敛为 timed_out,再允许新的 attempt 接管
|
||||
ok 52 - 过期 lease 会先收敛为 timed_out,再允许新的 attempt 接管
|
||||
---
|
||||
duration_ms: 0.652408
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 服务进程重建后从持久化记录恢复,并接管已过期的 build attempt
|
||||
ok 53 - 服务进程重建后从持久化记录恢复,并接管已过期的 build attempt
|
||||
---
|
||||
duration_ms: 0.790237
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: heartbeat 遇到过期上传 lease 时将任务阶段收敛为 timed_out
|
||||
ok 54 - heartbeat 遇到过期上传 lease 时将任务阶段收敛为 timed_out
|
||||
---
|
||||
duration_ms: 0.830002
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 错误 lease 不能结束操作,正确 lease 结束上传后更新阶段状态
|
||||
ok 55 - 错误 lease 不能结束操作,正确 lease 结束上传后更新阶段状态
|
||||
---
|
||||
duration_ms: 0.85031
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: heartbeat 续租并更新日志,结束后的 attempt 拒绝迟到 heartbeat
|
||||
ok 56 - heartbeat 续租并更新日志,结束后的 attempt 拒绝迟到 heartbeat
|
||||
---
|
||||
duration_ms: 1.451821
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 执行结束时 lease 已过期会持久化 timed_out,而不是回滚为 running
|
||||
ok 57 - 执行结束时 lease 已过期会持久化 timed_out,而不是回滚为 running
|
||||
---
|
||||
duration_ms: 0.48344
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 上传工作目录位于系统临时目录,不会落在仓库内
|
||||
ok 58 - 上传工作目录位于系统临时目录,不会落在仓库内
|
||||
---
|
||||
duration_ms: 1.278095
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: miniprogram-ci 的相对路径缓存目录落在临时工作目录而不是仓库
|
||||
ok 59 - miniprogram-ci 的相对路径缓存目录落在临时工作目录而不是仓库
|
||||
---
|
||||
duration_ms: 889.708804
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 上传会在临时工作目录下启动,失败也不会在仓库留下目录
|
||||
ok 60 - 上传会在临时工作目录下启动,失败也不会在仓库留下目录
|
||||
---
|
||||
duration_ms: 35.854056
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 上传在独立进程执行,失败时返回可读错误且不抛出未捕获异常
|
||||
ok 61 - 上传在独立进程执行,失败时返回可读错误且不抛出未捕获异常
|
||||
---
|
||||
duration_ms: 64.635283
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 上传超时会终止子进程并返回明确错误
|
||||
ok 62 - 上传超时会终止子进程并返回明确错误
|
||||
---
|
||||
duration_ms: 5.145082
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: miniprogram-ci compatibility patches keep overridden runtime APIs usable
|
||||
ok 63 - miniprogram-ci compatibility patches keep overridden runtime APIs usable
|
||||
---
|
||||
duration_ms: 681.182262
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: public default brand context fails fast when configuration is missing
|
||||
ok 64 - public default brand context fails fast when configuration is missing
|
||||
---
|
||||
duration_ms: 2.103899
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: every API route has an explicit authorization and success coverage contract
|
||||
ok 65 - every API route has an explicit authorization and success coverage contract
|
||||
---
|
||||
duration_ms: 503.725354
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: preview resources verify raster content and diagnose invalid or oversized assets
|
||||
ok 66 - preview resources verify raster content and diagnose invalid or oversized assets
|
||||
---
|
||||
duration_ms: 84.808494
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: preview resources reject image checksum drift and unavailable archives
|
||||
ok 67 - preview resources reject image checksum drift and unavailable archives
|
||||
---
|
||||
duration_ms: 63.867568
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: template preview matrix discovers newly added package manifests
|
||||
ok 68 - template preview matrix discovers newly added package manifests
|
||||
---
|
||||
duration_ms: 14.07272
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: template preview matrix keeps every deployed package, industry, and version isolated
|
||||
ok 69 - template preview matrix keeps every deployed package, industry, and version isolated
|
||||
---
|
||||
duration_ms: 923.427842
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 模板版本按 SemVer 而不是导入时间判断最新版
|
||||
ok 70 - 模板版本按 SemVer 而不是导入时间判断最新版
|
||||
---
|
||||
duration_ms: 1.899655
|
||||
type: 'test'
|
||||
...
|
||||
# Subtest: 模板版本排序正确处理预发布版本和同版本稳定性
|
||||
ok 71 - 模板版本排序正确处理预发布版本和同版本稳定性
|
||||
---
|
||||
duration_ms: 0.468962
|
||||
type: 'test'
|
||||
...
|
||||
1..71
|
||||
# tests 71
|
||||
# suites 0
|
||||
# pass 71
|
||||
# fail 0
|
||||
# cancelled 0
|
||||
# skipped 0
|
||||
# todo 0
|
||||
# duration_ms 2561.461139
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
Running 2 tests using 1 worker
|
||||
|
||||
(node:297051) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
(node:297051) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
✓ 1 test/browser/admin-editor.spec.ts:235:1 › Admin 按通用预览目标筛选字段并同步品牌草稿 (22.4s)
|
||||
✓ 2 test/browser/admin-editor.spec.ts:654:1 › 林境模板支持首页和主理人区域点选 (22.9s)
|
||||
|
||||
2 passed (46.2s)
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
Running 1 test using 1 worker
|
||||
|
||||
(node:297457) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
(node:297457) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
(node:297554) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
(node:297665) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
(node:297714) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
|
||||
(Use `node --trace-warnings ...` to show where the warning was created)
|
||||
✓ 1 test/browser/template-preview-media.spec.ts:154:1 › 导入包预览矩阵展示身份、资源和完整媒体槽位 (7.0s)
|
||||
|
||||
1 passed (7.9s)
|
||||
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 94 KiB |
|
After Width: | Height: | Size: 90 KiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 73 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 79 KiB |
|
After Width: | Height: | Size: 107 KiB |
|
After Width: | Height: | Size: 95 KiB |
|
After Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 108 KiB |
|
After Width: | Height: | Size: 107 KiB |
|
After Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 104 KiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 73 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 89 KiB |
@@ -0,0 +1,7 @@
|
||||
# 可视化编辑闭环
|
||||
|
||||
执行方案:docs/visual-editor-next-steps.md。
|
||||
基线:feat/admin-component-preview / 541304a。
|
||||
状态源:本目录 SUBTASKS.csv;旧 visual-editor 任务保留为历史。
|
||||
当前仅完成规划,实现未开始。各子任务开始前建立 tasks 对应目录的 SPEC.md、TODO.csv、PROGRESS.md,补充具体验证命令和证据。
|
||||
完成条件:全部子任务通过,业务内容有明确编辑入口,真实保存、发布隔离及生产部署验证完成。
|
||||
@@ -0,0 +1,13 @@
|
||||
# 进度记录
|
||||
|
||||
2026-10-09:与现有 ADR 0020、后续计划和交付清单对齐,制定四阶段实施计划。
|
||||
2026-10-09:完成任务 1。盘点两套模板页面与 manifest / renderer 目标,修复餐饮首页身份区点选、咨询页字段过滤和首页业务目标 key;`pnpm validate:templates` 19 项通过,浏览器测试 2 项通过。
|
||||
2026-10-09:完成任务 2、3、4。区域来源改为按 binding 推导;编辑面板改单列自适应;咨询表单字段可独立点选和编辑。Admin/Taro 类型检查与浏览器测试通过。
|
||||
|
||||
- 任务:可视化内容编辑闭环。
|
||||
- 形态:epic。
|
||||
- 进度:5/5 子任务完成。
|
||||
- 当前:本轮计划已完成;后续可继续做真实数据库持久化和发布隔离验收。
|
||||
- 验证:`pnpm validate:templates`、Admin/Taro typecheck、Admin build、`ADMIN_URL=http://localhost:3005 pnpm --filter @personal-brand/taro test:browser -- admin-editor.spec.ts` 均通过;计划 CSV 未纳入 Prettier 检查。
|
||||
- 文件:.codex-tasks/visual-editor-closure/SUBTASKS.csv。
|
||||
- 下一步:使用隔离品牌执行真实 API 保存、发布隔离和重载验证。
|
||||
@@ -0,0 +1,6 @@
|
||||
id,task,task_type,status,depends_on,task_dir,acceptance_criteria,validation_command,completed_at,retry_count,notes
|
||||
1,逐页建立覆盖清单,single-full,DONE,,tasks/coverage,所有页面内容与字段对应且缺陷可复现,pnpm validate:templates; pnpm --filter @personal-brand/taro test:browser -- admin-editor.spec.ts,2026-10-09,0,已盘点两套模板页面;首批缺口已复现并修复:首页身份区目标、咨询品牌字段过滤、餐饮首页目标 key;契约 19 项和浏览器 2 项通过
|
||||
2,修复通用选区绑定与模板发现,single-full,DONE,1,tasks/contract,混合来源及重复记录映射正确且契约测试通过,pnpm validate:templates; pnpm --filter @personal-brand/admin typecheck; 浏览器测试,2026-10-09,0,区域来源按 binding 推导;餐饮首页身份目标和业务卡片目标对齐;切页及记录失效选择已有清理逻辑
|
||||
3,整理选区面板与保存交互,single-full,DONE,2,tasks/inspector,布局及失败和未保存切换验证通过,pnpm --filter @personal-brand/admin typecheck; 浏览器测试,2026-10-09,0,选区字段改单列自适应并移除固定最小高度;保持保存失败输入不重置
|
||||
4,接通咨询字段编辑,single-full,DONE,2;3,tasks/inquiry,配置保存重载一致且历史提交不受损,pnpm --filter @personal-brand/admin typecheck; 浏览器测试,2026-10-09,0,咨询字段可独立点选并编辑标题、类型、必填、选项;预览草稿不提交真实咨询
|
||||
5,全页面回归与部署验收,single-full,DONE,1;2;3;4,tasks/delivery,覆盖清单及工程门槛和部署验收通过,pnpm validate:templates; pnpm --filter @personal-brand/admin build; pnpm --filter @personal-brand/admin typecheck; pnpm --filter @personal-brand/taro typecheck; 浏览器测试,2026-10-09,0,模板契约 19 项、浏览器 2 项、Admin build、Admin/Taro typecheck 通过;CSV 不交给 Prettier
|
||||
|
@@ -0,0 +1,13 @@
|
||||
template,page,visible_content,renderer_target,manifest_editor,source,status,evidence
|
||||
acheng-campus-food,home,主理人身份、地点、出摊图片、餐品标题、首页操作按钮、承诺、业务卡片,food.home.identity; food.home.location; food.home.hero; food.home.offerings-heading; food.home.actions; food.home.promise-heading; acheng-campus-food.home.offering,对应 sections 已声明并补齐身份与操作目标,brand; offering; trust,已覆盖,契约测试 + 浏览器点选
|
||||
acheng-campus-food,offerings,菜单说明、业务卡片,acheng-campus-food.offerings.menu; acheng-campus-food.offerings.item,对应 sections 已声明,brand; offering,已覆盖,契约测试 + 浏览器点选
|
||||
acheng-campus-food,service,出摊说明、日程、配送、流程,acheng-campus-food.service.service; trust:schedule; trust:coverage; trust:process,对应 sections / trust declarations 已声明,brand; trust,待第二阶段复核,已存在浏览器点选路径
|
||||
acheng-campus-food,profile,主理人与信任内容,acheng-campus-food.profile.identity; trust:credential; trust:case; trust:promise,对应 sections / trust declarations 已声明,brand; trust,待第二阶段复核,已存在 renderer target
|
||||
acheng-campus-food,detail,餐品详情、详情说明,acheng-campus-food.detail.dishDetail; acheng-campus-food.detail.detailCopy,对应 sections 已声明,offering; brand,已覆盖,浏览器已验证底栏与编辑入口
|
||||
acheng-campus-food,inquiry,页面文案、访客表单,acheng-campus-food.inquiry.booking,对应 section 已声明;Admin 已允许 inquiry section 编辑,brand; inquiry,首批已修复,浏览器已验证表单展示
|
||||
acheng-campus-food,success,提交结果文案,acheng-campus-food.success.successCopy,对应 section 已声明,brand,待第二阶段复核,已验证页面可切换
|
||||
acheng-campus-food,records,记录页文案,acheng-campus-food.records.recordsCopy,对应 section 已声明,brand; records,待第二阶段复核,已验证页面可切换
|
||||
linjing-editorial,home,身份、主视觉、证明、主张、案例,editorial.home.identity; editorial.home.hero; editorial.home.proof; editorial.home.manifesto; editorial.home.works; linjing-editorial.home.home,对应 sections 已声明,brand; trust; offering,已覆盖,契约测试 + 浏览器点选
|
||||
linjing-editorial,offerings,案例说明、业务卡片,linjing-editorial.offerings.cases; linjing-editorial.offerings.item,对应 sections 已声明,brand; offering,待第二阶段复核,已有 renderer target
|
||||
linjing-editorial,profile,身份、履约、联系方式、信任内容,linjing-editorial.profile.identity; linjing-editorial.profile.profileDetails; trust:*,对应 sections / trust declarations 已声明,brand; trust,已覆盖,契约测试 + 浏览器点选
|
||||
linjing-editorial,detail,案例详情、详情说明,linjing-editorial.detail.projectDetail; linjing-editorial.detail.detailCopy,对应 sections 已声明,offering; brand,待第二阶段复核,已有 renderer target
|
||||
|
@@ -0,0 +1,25 @@
|
||||
.agents
|
||||
.aws
|
||||
.claude
|
||||
.codex
|
||||
.codex-tasks
|
||||
.git
|
||||
.github
|
||||
.turbo
|
||||
.worktrees
|
||||
coverage
|
||||
dist
|
||||
pnpm-lock.yaml.bak
|
||||
docker-compose.override.yml
|
||||
docker-compose.prod.yml
|
||||
docs
|
||||
media
|
||||
node_modules
|
||||
prototype
|
||||
scripts/deploy/*.test.mjs
|
||||
.env
|
||||
.env.*
|
||||
!.env.production.example
|
||||
**/node_modules
|
||||
**/dist
|
||||
!apps/api/prisma/assets/**
|
||||
@@ -6,13 +6,31 @@ POSTGRES_DB=personal_brand
|
||||
POSTGRES_PORT=5432
|
||||
API_PORT=3001
|
||||
API_PREFIX=
|
||||
CORS_ORIGINS=http://localhost:3000
|
||||
ADMIN_PORT=3000
|
||||
SESSION_SECRET=replace-with-a-long-random-value
|
||||
# 单实例使用 memory;多实例部署改用 postgres 并先执行数据库迁移
|
||||
CLIENT_ERROR_THROTTLE_STORE=memory
|
||||
DEFAULT_BRAND_ID=00000000-0000-0000-0000-000000000001
|
||||
TEMPLATE_ARTIFACT_ROOT=/var/lib/personal-brand/template-artifacts
|
||||
SEED_ADMIN_PASSWORD=change-me-now-123
|
||||
OBJECT_STORAGE_ENDPOINT=
|
||||
OBJECT_STORAGE_BUCKET=
|
||||
OBJECT_STORAGE_ACCESS_KEY=
|
||||
OBJECT_STORAGE_SECRET_KEY=
|
||||
WECHAT_APP_ID=
|
||||
WECHAT_APP_SECRET=
|
||||
OBJECT_STORAGE_ENDPOINT=http://localhost:9000
|
||||
OBJECT_STORAGE_PUBLIC_URL=http://localhost:9000/personal-brand-media
|
||||
OBJECT_STORAGE_BUCKET=personal-brand-media
|
||||
OBJECT_STORAGE_ACCESS_KEY=minioadmin
|
||||
OBJECT_STORAGE_SECRET_KEY=minioadmin
|
||||
# 微信 AppID 与 AppSecret 按品牌在后台「小程序配置」维护,不使用全局环境变量
|
||||
WECHAT_UPLOAD_PRIVATE_KEY=
|
||||
MINIAPP_CREDENTIAL_ENCRYPTION_KEY=replace-with-32-byte-random-secret
|
||||
# 小程序代码构建产物根目录,相对路径按仓库根目录解析;默认 apps/taro/dist
|
||||
# MINIAPP_ARTIFACT_ROOT=apps/taro/dist
|
||||
# 构建超过该毫秒数没有进度更新即视为中断,允许重新上传;默认 15 分钟
|
||||
# MINIAPP_BUILD_STALE_MS=900000
|
||||
# 小程序请求地址在后台「小程序配置」维护,这里仅为回落值;
|
||||
# 未设置时由 PUBLIC_BASE_URL + MINIAPP_API_PATH 推导
|
||||
# MINIAPP_API_BASE_URL=https://wechat.app.que01.top/api
|
||||
# MINIAPP_API_PATH=/api
|
||||
# 单个品牌的 AppID 在后台“小程序配置”维护,这里只作为回落值
|
||||
# WEAPP_APP_ID=
|
||||
# 上传子进程工作目录;miniprogram-ci 的编译缓存放这里,默认系统临时目录
|
||||
# MINIAPP_UPLOAD_WORKSPACE=/tmp/personal-brand-miniapp-upload
|
||||
@@ -0,0 +1,42 @@
|
||||
NODE_ENV=production
|
||||
POSTGRES_USER=personal_brand
|
||||
POSTGRES_PASSWORD=replace-with-a-long-database-password
|
||||
POSTGRES_DB=personal_brand
|
||||
POSTGRES_PORT=5432
|
||||
|
||||
DATABASE_URL=postgresql://personal_brand:replace-with-a-long-database-password@127.0.0.1:5432/personal_brand?schema=public
|
||||
SESSION_SECRET=replace-with-at-least-32-random-characters
|
||||
# 建议单独配置并长期保持不变;未设置时回退 SESSION_SECRET。
|
||||
# 轮换该密钥后,已保存的上传私钥和 AppSecret 都需要在后台重新填写。
|
||||
# MINIAPP_CREDENTIAL_ENCRYPTION_KEY=replace-with-32-byte-random-secret
|
||||
# 单实例使用 memory;多实例部署改用 postgres 并先执行数据库迁移
|
||||
CLIENT_ERROR_THROTTLE_STORE=memory
|
||||
DEFAULT_BRAND_ID=00000000-0000-0000-0000-000000000001
|
||||
SEED_ADMIN_PASSWORD=replace-with-a-one-time-initial-password
|
||||
SEED_MODE=skip
|
||||
|
||||
API_PORT=3001
|
||||
API_PREFIX=
|
||||
CORS_ORIGINS=
|
||||
|
||||
# 发布备份保留 7 份;定时备份默认保留 14 天
|
||||
BACKUP_RETENTION_DAYS=14
|
||||
# 可选:配置 rsync 目标后,每次定时备份会额外复制一份到异地
|
||||
# 需要预先为 ubuntu 用户配置 SSH key;未配置时备份只保留在本机
|
||||
# BACKUP_OFFSITE_TARGET=backup@example-host:/srv/personal-brand-backups/
|
||||
|
||||
LOCAL_MEDIA_ROOT=/home/ubuntu/persional-brand/media
|
||||
LOCAL_MEDIA_BASE_URL=/media
|
||||
OBJECT_STORAGE_ENDPOINT=
|
||||
OBJECT_STORAGE_PUBLIC_URL=
|
||||
OBJECT_STORAGE_BUCKET=
|
||||
OBJECT_STORAGE_ACCESS_KEY=
|
||||
OBJECT_STORAGE_SECRET_KEY=
|
||||
OBJECT_STORAGE_REGION=us-east-1
|
||||
|
||||
# 微信 AppID 与 AppSecret 按品牌在后台「小程序配置」维护,不使用全局环境变量
|
||||
|
||||
# 小程序请求地址正常情况下在后台「小程序配置」维护;
|
||||
# 这里仅作为后台未配置时的回落值(否则由 PUBLIC_BASE_URL + /api 推导)
|
||||
# MINIAPP_API_BASE_URL=https://wechat.app.que01.top/api
|
||||
# MINIAPP_BUILD_STALE_MS=900000
|
||||
@@ -0,0 +1,178 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
# 纯文档提交不占用 runner;需要状态时用 workflow_dispatch 手动触发。
|
||||
paths-ignore:
|
||||
- "**.md"
|
||||
# PR 不设置 paths-ignore:branch protection 的 required checks 必须始终上报,
|
||||
# 否则纯文档 PR 会永远等不到状态检查而无法合并。
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
NODE_VERSION: "24"
|
||||
PNPM_VERSION: "9.15.0"
|
||||
# runner 任务容器把该路径 bind mount 到宿主机共享 store,避免每个 job 重复下载依赖。
|
||||
npm_config_store_dir: /workspace/.pnpm-store
|
||||
|
||||
jobs:
|
||||
static:
|
||||
name: Static checks
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 40
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Verify preinstalled toolchain
|
||||
# 任务镜像已内置 Node 与 pnpm;不在这里下载 Node,避免 nodejs.org 慢连接拖死整个 job。
|
||||
run: |
|
||||
actual_node="$(node -p 'process.versions.node')"
|
||||
actual_pnpm="$(pnpm --version)"
|
||||
test "${actual_node%%.*}" = "$NODE_VERSION" || { echo "expected Node $NODE_VERSION.x, got $actual_node" >&2; exit 1; }
|
||||
test "$actual_pnpm" = "$PNPM_VERSION" || { echo "expected pnpm $PNPM_VERSION, got $actual_pnpm" >&2; exit 1; }
|
||||
- name: Restore Prisma engine cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/prisma
|
||||
key: prisma-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
prisma-${{ runner.os }}-${{ runner.arch }}-
|
||||
- name: Restore Turbo cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .turbo/cache
|
||||
key: turbo-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
turbo-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }}-
|
||||
turbo-${{ runner.os }}-${{ runner.arch }}-
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- run: pnpm check
|
||||
- run: pnpm test:api-routes
|
||||
- run: pnpm test:deploy
|
||||
- run: pnpm validate:templates
|
||||
- run: pnpm template:compatibility
|
||||
- run: pnpm --filter @personal-brand/api exec tsx --test test/template-preview-matrix.test.ts
|
||||
- run: pnpm template:conformance
|
||||
- run: pnpm template:doctor
|
||||
|
||||
build:
|
||||
name: Production build
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
needs: [static]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Verify preinstalled toolchain
|
||||
# 任务镜像已内置 Node 与 pnpm;不在这里下载 Node,避免 nodejs.org 慢连接拖死整个 job。
|
||||
run: |
|
||||
actual_node="$(node -p 'process.versions.node')"
|
||||
actual_pnpm="$(pnpm --version)"
|
||||
test "${actual_node%%.*}" = "$NODE_VERSION" || { echo "expected Node $NODE_VERSION.x, got $actual_node" >&2; exit 1; }
|
||||
test "$actual_pnpm" = "$PNPM_VERSION" || { echo "expected pnpm $PNPM_VERSION, got $actual_pnpm" >&2; exit 1; }
|
||||
- name: Restore Prisma engine cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/prisma
|
||||
key: prisma-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
prisma-${{ runner.os }}-${{ runner.arch }}-
|
||||
- name: Restore Turbo cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .turbo/cache
|
||||
key: turbo-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
turbo-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }}-
|
||||
turbo-${{ runner.os }}-${{ runner.arch }}-
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- run: pnpm build
|
||||
- run: pnpm build:admin:preview
|
||||
- run: pnpm validate:template-release
|
||||
|
||||
browser-smoke:
|
||||
name: Browser smoke
|
||||
# 只在 PR 和手动触发时运行,避免 main 合并后重复消耗共享生产 runner。
|
||||
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Verify preinstalled toolchain
|
||||
# 任务镜像已内置 Node 与 pnpm;不在这里下载 Node,避免 nodejs.org 慢连接拖死整个 job。
|
||||
run: |
|
||||
actual_node="$(node -p 'process.versions.node')"
|
||||
actual_pnpm="$(pnpm --version)"
|
||||
test "${actual_node%%.*}" = "$NODE_VERSION" || { echo "expected Node $NODE_VERSION.x, got $actual_node" >&2; exit 1; }
|
||||
test "$actual_pnpm" = "$PNPM_VERSION" || { echo "expected pnpm $PNPM_VERSION, got $actual_pnpm" >&2; exit 1; }
|
||||
- name: Restore Prisma engine cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/prisma
|
||||
key: prisma-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
prisma-${{ runner.os }}-${{ runner.arch }}-
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- name: Cache Playwright browsers
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/ms-playwright
|
||||
key: playwright-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
- name: Install Chromium
|
||||
# 系统依赖与同版本 Chromium 已预装在 personal-brand-ci:node24 中;这里只做版本兜底。
|
||||
run: pnpm --filter @personal-brand/taro exec playwright install chromium
|
||||
- name: Run PR browser smoke
|
||||
run: pnpm test:browser:smoke
|
||||
|
||||
api:
|
||||
name: API integration
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
env:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: personal_brand
|
||||
options: >-
|
||||
--health-cmd "pg_isready -U postgres -d personal_brand"
|
||||
--health-interval 5s
|
||||
--health-timeout 5s
|
||||
--health-retries 12
|
||||
env:
|
||||
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/personal_brand
|
||||
DEFAULT_BRAND_ID: 00000000-0000-0000-0000-000000000001
|
||||
SESSION_SECRET: ci-integration-session-secret-0123456789abcdef
|
||||
SEED_ADMIN_PASSWORD: ci-integration-admin-password
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Verify preinstalled toolchain
|
||||
# 任务镜像已内置 Node 与 pnpm;不在这里下载 Node,避免 nodejs.org 慢连接拖死整个 job。
|
||||
run: |
|
||||
actual_node="$(node -p 'process.versions.node')"
|
||||
actual_pnpm="$(pnpm --version)"
|
||||
test "${actual_node%%.*}" = "$NODE_VERSION" || { echo "expected Node $NODE_VERSION.x, got $actual_node" >&2; exit 1; }
|
||||
test "$actual_pnpm" = "$PNPM_VERSION" || { echo "expected pnpm $PNPM_VERSION, got $actual_pnpm" >&2; exit 1; }
|
||||
- name: Restore Prisma engine cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/prisma
|
||||
key: prisma-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
prisma-${{ runner.os }}-${{ runner.arch }}-
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- name: Prepare API test env
|
||||
working-directory: apps/api
|
||||
run: |
|
||||
cat > .env <<EOF
|
||||
DATABASE_URL=$DATABASE_URL
|
||||
DEFAULT_BRAND_ID=$DEFAULT_BRAND_ID
|
||||
SESSION_SECRET=$SESSION_SECRET
|
||||
SEED_ADMIN_PASSWORD=$SEED_ADMIN_PASSWORD
|
||||
EOF
|
||||
- run: pnpm --filter @personal-brand/api test:integration
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# 提交前让模板完成证据的源码哈希跟随当前工作树,避免额外的 chore 提交。
|
||||
set -e
|
||||
[ -f scripts/template-evidence-refresh.mjs ] || exit 0
|
||||
command -v node >/dev/null 2>&1 || exit 0
|
||||
node scripts/template-evidence-refresh.mjs --stage
|
||||
@@ -2,11 +2,13 @@ node_modules/
|
||||
.pnpm-store/
|
||||
.turbo/
|
||||
dist/
|
||||
packages/config/dist/
|
||||
.next/
|
||||
coverage/
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
.env.production
|
||||
!.env.production.example
|
||||
*.log
|
||||
.DS_Store
|
||||
apps/miniapp/miniprogram_npm/
|
||||
@@ -14,8 +16,18 @@ apps/miniapp/project.private.config.json
|
||||
|
||||
.worktrees/
|
||||
apps/taro/src/assets/
|
||||
apps/admin/public/template-preview/
|
||||
|
||||
apps/taro/test-results/
|
||||
apps/taro/playwright-report/
|
||||
media/
|
||||
|
||||
**/.swc/
|
||||
.codex-tasks/
|
||||
!.codex-tasks/template-audit-execution/
|
||||
!.codex-tasks/template-audit-execution/raw/
|
||||
!.codex-tasks/template-audit-execution/raw/completion-evidence.json
|
||||
docker-compose.override.yml
|
||||
.env.production
|
||||
|
||||
apps/api/storage/
|
||||
@@ -1,6 +1,7 @@
|
||||
node_modules
|
||||
.turbo
|
||||
dist
|
||||
apps/admin/public/template-preview
|
||||
.next
|
||||
prototype
|
||||
pnpm-lock.yaml
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
# Product Direction
|
||||
|
||||
- 模板新增、绑定修改及宣称完成前,执行 pnpm template:doctor 并遵循 docs/template-completion-rules.md。静态校验、输入框出现、mock 成功不能单独证明完成;回归使用真实 manifest,按区域全部可见变量验收。
|
||||
|
||||
- The core product is a personal-brand platform whose primary goal is to build trust and convert that trust into qualified inquiries or collaborations.
|
||||
- Personal-brand identity, positioning, proof of work, communication expectations, and contact paths are higher priority than any single industry workflow.
|
||||
- Industry behavior is implemented as replaceable templates. Food, consulting, design, photography, and future industries must not hard-code their terminology or fields into the shared brand model or shared UI.
|
||||
- The food template is supported, but it is an example template rather than the product definition.
|
||||
- Backend configuration is the source of truth for brand content, services, template selection, trust-building content, and industry-specific fields. The mini program only renders configuration and submits user input.
|
||||
- Template packages are the source of truth for template manifests, visual structure, default/sample content, field declarations, assets, and capabilities. Do not copy every template's sample data into Prisma seed or global database tables. A template's sample content may be copied into the database only when an administrator explicitly imports it for one specific brand; the resulting rows are brand content, not template registration.
|
||||
- Templates have exactly one active package manifest/runtime contract. Do not add legacy readers, dual-write paths, inferred defaults, aliases, or silent fallbacks. Convert existing persisted data with a one-time, auditable migration that fails on ambiguity, then remove the old representation.
|
||||
- `apps/api/prisma/seed.ts` may contain a small, explicit development fixture for the seeded demo brands, but it must never become the catalog of all templates or require one seed block per production template. New templates must be discoverable and validated from their package manifest without editing global seed data.
|
||||
- Any delivered backend endpoint must have an automated test covering its authorization and successful behavior before it is considered complete.
|
||||
- Keep personal-brand trust details explicit: biography, positioning, credentials, portfolio/proof, process, expectations, availability, contact methods, and clear follow-up status.
|
||||
|
||||
@@ -1,104 +1,170 @@
|
||||
# Project Status
|
||||
|
||||
最后更新:2026-09-19
|
||||
|
||||
## 当前目标
|
||||
|
||||
先为餐饮摊主朋友交付一个真正能带来订单的个人品牌小程序,再根据真实使用把通用能力产品化。产品方的收益、运营和平台化目标不能牺牲朋友的实际使用效果。
|
||||
最后更新:2026-10-21
|
||||
|
||||
## 当前阶段
|
||||
|
||||
后端基础、数据库环境和订单 API 已完成首轮验证,管理后台和小程序静态页面已接入首版结构,下一步进行真实资源与微信登录/预约联调。
|
||||
系统已从“餐饮试点小程序”演进为多模板个人品牌平台。当前已完成统一模板契约收口、模板完成证据门禁、品牌与页面方案拆分、管理员登录态撤销和 release 版本一致性修复。
|
||||
|
||||
## 已完成
|
||||
ADR 0033 已落地:
|
||||
|
||||
- 产品 PRD、原型规格、架构决策、数据/API 设计和实施计划。
|
||||
- 餐饮试点画像与首轮需求访谈决策。
|
||||
- 可点击低保真原型:`prototype/index.html`。
|
||||
- Git 仓库、`main` 分支和远程仓库。
|
||||
- pnpm workspace + Turborepo Monorepo。
|
||||
- TypeScript 严格配置、ESLint、Prettier、EditorConfig、环境变量模板。
|
||||
- NestJS + Fastify API 骨架。
|
||||
- Prisma PostgreSQL schema:品牌、服务、客户身份、订单、订单明细、标签、管理员。
|
||||
- 微信官方 `jscode2session` 登录交换边界。
|
||||
- 客户登录 token、客户订单提交/查询/取消。
|
||||
- 普通套餐价格快照和私厨需求人工报价模型。
|
||||
- 管理员账号密码登录和角色 token。
|
||||
- 管理员订单列表、状态、未读、标签和内部备忘能力。
|
||||
- DTO 校验、全局异常响应、请求 ID和订单状态流转规则。
|
||||
- Docker PostgreSQL Compose、seed 和 Prisma 脚本说明。
|
||||
- 初始 Prisma migration,已在本地 PostgreSQL 应用并验证数据库 schema up to date。
|
||||
- seed 已写入品牌、服务、标签和管理员数据,并完成数量核验。
|
||||
- 管理员订单详情、状态/未读/标签筛选和未读数量接口。
|
||||
- API 自动化业务规则测试:订单创建、客户取消、状态流转和标签品牌隔离,共 6 项通过。
|
||||
- 修复 ESM 下 `bcryptjs` 导入和 Fastify 请求 ID middleware 的运行时问题。
|
||||
- API 已通过真实 HTTP 验证:健康检查、公开品牌/服务读取和管理员登录。
|
||||
- HTTP 集成测试:公开接口、管理员登录、错误密码、管理员权限边界、客户会话、预约 DTO 校验、创建/取消和状态流转,共 8 项通过。
|
||||
- OpenAPI 3.1 契约:`docs/openapi.yaml`,覆盖当前公开、客户和管理员接口。
|
||||
- 类型化 `@personal-brand/api-client`:支持公开内容、客户预约、管理员订单和统一错误处理,并有 2 项客户端测试。
|
||||
- 已根据 `/home/que01/桌面/个人品牌设计图/` 确认 C 端页面视觉规范:暖白、米黄、砖红、深炭黑,16px 卡片圆角和大字号优先。
|
||||
- 小程序已完成首页、服务列表、预约套餐和我的订单静态页面,页面标题使用微信原生导航栏。
|
||||
- 已配置小程序 AppID:`wxd75d946d6978d183`。
|
||||
- 服务分类、预约数量步进器、订单状态卡和底部导航已按设计图完成首版还原。
|
||||
- 已执行多轮 Codex 代码审查并修复关键认证和权限问题。
|
||||
- “表达方式”已从 Admin 源码移除。
|
||||
- “业务类型”和“页面方案”是两个独立概念。
|
||||
- 新增“创建品牌”和“页面方案”页面。
|
||||
- 创建品牌不会自动导入示例内容。
|
||||
- `linjing-editorial` 只兼容 `doors`,不再兼容 `personal`。
|
||||
|
||||
## 最近提交
|
||||
## 当前能力
|
||||
|
||||
- NestJS + Fastify API、Prisma PostgreSQL、全局 DTO 校验、统一错误响应和 `requestId`。
|
||||
- 多品牌 Admin、品牌 membership、角色边界、品牌切换和品牌隔离。
|
||||
- 创建品牌时按业务类型筛选兼容的页面方案;不兼容组合无法提交。
|
||||
- 模板包发现、确定性打包、导入、校验、发布、预览、安装、升级和回滚。
|
||||
- 三套已交付模板及其业务类型:
|
||||
- `acheng-campus-food@1.0.3`:`food`
|
||||
- `atelier-solopreneur@1.3.2`:`personal`
|
||||
- `linjing-editorial@1.0.7`:`doors`
|
||||
- Taro Runtime、Admin 组件预览、真实 manifest 驱动编辑、草稿/发布隔离。
|
||||
- 发布备注为可选字段;空备注不会写入数据库,也不影响发布、回滚和公开内容。
|
||||
- 依赖 override 的运行时兼容性通过 `miniprogram-ci` / Jimp / image-size / uuid smoke test 守卫。
|
||||
- Gitea Actions CI 已在 `oracle_arm` 自托管 runner 上落地,`static` / `build` / `api` 三个 job 已完整通过(run 21);详见 `docs/ci.md`。
|
||||
- 小程序构建、上传任务状态机、attempt lease 和失败记录。
|
||||
- Admin/Customer token version:修改 admin 密码或调用 logout 后旧 token 立即失效;无 membership 的账号不会自动获得 owner 权限。
|
||||
- `visualPresentation` 已进入唯一 `template.json` 契约,旧手写 visual manifest 优先路径已删除。
|
||||
|
||||
## 生产状态
|
||||
|
||||
当前生产 release:
|
||||
|
||||
```text
|
||||
fee3c77 fix: 按设计图优化预约套餐数量和商品卡
|
||||
13ead2d fix: 对齐服务分类和订单视觉结构
|
||||
255756c feat: 增加小程序品牌首页
|
||||
本次工作:数据库初始化、订单管理接口、业务规则测试和运行时修复
|
||||
f2687c5 chore: prepare portable postgres development environment
|
||||
0e8b8e1 feat: add api http conventions and booking state rules
|
||||
0d4caab feat: add admin order tags and read state
|
||||
bb5ccb1 feat: add admin authentication
|
||||
b89853b fix: harden api authentication and validation
|
||||
20261023100112-a2fa6c3c3140
|
||||
```
|
||||
|
||||
远程:`https://git.app.que01.top/que01/persionalBrand.git`
|
||||
该 release 由提交 `a2fa6c3` 构建,新增生产数据库每日定时备份、备份可读性校验、发布/定时备份保留策略、`backup-timer` 与 `backup-age-hours` 部署状态门禁。部署后已手动触发一次 `personal-brand-backup.service`,生成 `scheduled-20261023T100426Z-1029929.dump`,并通过 `pg_restore -l` 校验可读。
|
||||
|
||||
## 下一步优先级
|
||||
生产健康检查:
|
||||
|
||||
1. 接入真实品牌图片、电话和微信配置,并替换当前图片占位区域。
|
||||
2. 在微信开发者工具/真机完成 `wx.login`、预约提交、订单查询和取消联调。
|
||||
3. 完善管理后台订单详情、筛选和状态处理视觉页面。
|
||||
4. 继续补充页面截图回归和真实素材下的移动端溢出检查。
|
||||
|
||||
## 未决问题
|
||||
|
||||
- 普通套餐采用固定菜单、每日菜单,还是固定套餐加每日可用状态。
|
||||
- 朋友最终品牌名称、图片、联系方式、营业时间和配送范围。
|
||||
- 微信小程序主体、AppID、服务类目和订阅消息模板是否可用。
|
||||
- 生产部署使用哪家 PostgreSQL、对象存储和 API 托管服务。
|
||||
- 当前 token 是开发阶段的签名 Bearer token;生产前应替换为带撤销能力的正式 session/Cookie 方案。
|
||||
|
||||
## 当前明确不做
|
||||
|
||||
- 支付、退款、发票、财务对账。
|
||||
- 复杂库存、自动配送判断和每日菜单编排。
|
||||
- 多商户注册、套餐计费、会员和营销系统。
|
||||
- 自动发布微信小程序。
|
||||
|
||||
## 跨电脑恢复
|
||||
|
||||
```bash
|
||||
git clone https://git.app.que01.top/que01/persionalBrand.git
|
||||
cd persionalBrand
|
||||
cat PROJECT_STATUS.md
|
||||
cat agent.md
|
||||
cp .env.example .env
|
||||
```text
|
||||
api=online
|
||||
pm2-autostart=enabled
|
||||
admin=active
|
||||
database=running
|
||||
backups=8
|
||||
latest-backup=2026-10-23 10:04:27 +0000 scheduled-20261023T100426Z-1029929.dump
|
||||
backup-timer=active
|
||||
backup-age-hours=0
|
||||
backup-temp-files=0
|
||||
/admin/ 200
|
||||
/template-preview/ 200
|
||||
/api/health 200
|
||||
/media/seed/food-package-02.jpg 200
|
||||
/admin/client-errors(无登录态) 401
|
||||
```
|
||||
|
||||
有 Docker 的机器再执行:
|
||||
生产数据库已应用全部 48 个 Prisma migration,schema 为 up to date。
|
||||
|
||||
```bash
|
||||
docker compose up -d postgres
|
||||
pnpm install
|
||||
pnpm db:migrate
|
||||
pnpm db:seed
|
||||
三个生产品牌的当前发布快照:
|
||||
|
||||
| 品牌 | 业务类型 | 页面方案 | 发布版本 |
|
||||
| ---------------- | ---------- | --------------------------- | ------------ |
|
||||
| `atelier-studio` | `personal` | `atelier-solopreneur@1.3.2` | `v2 current` |
|
||||
| `default-brand` | `food` | `acheng-campus-food@1.0.3` | `v2 current` |
|
||||
| `linjing-doors` | `doors` | `linjing-editorial@1.0.7` | `v3 current` |
|
||||
|
||||
## 完成证据
|
||||
|
||||
`.codex-tasks/template-audit-execution/raw/completion-evidence.json` 登记四类证据:
|
||||
|
||||
- `real-manifest-interaction`
|
||||
- `save-reload-publish-isolation`
|
||||
- `visual-reference`
|
||||
- `empty-error-branches`
|
||||
|
||||
每条证据保留执行命令、日志和产物 SHA-256。`pnpm template:doctor` 会校验证据覆盖和哈希;当前三套模板均为:
|
||||
|
||||
```text
|
||||
staticStatus=pass
|
||||
completionStatus=complete
|
||||
unresolvedIssues=0
|
||||
```
|
||||
|
||||
## 更新规则
|
||||
Admin 浏览器回归新增 `apps/taro/test/browser/brand-creation-and-page-scheme.spec.ts`,覆盖:
|
||||
|
||||
每完成一个可验证的开发任务,更新“当前阶段”“已完成”“最近提交”和“下一步优先级”。只记录已经发生或已经确认的事实;未确认内容放入“未决问题”。
|
||||
- 创建品牌时按业务类型筛选页面方案。
|
||||
- `personal` 不出现林境页面方案。
|
||||
- 切换业务类型后清除不兼容的页面方案选择,提交按钮禁用。
|
||||
- 创建失败时保留用户输入并显示错误。
|
||||
- 页面方案切换和升级提交正确版本、校验和与冲突保留参数。
|
||||
- 操作成功后刷新工作区、页面方案选项和升级预览查询。
|
||||
|
||||
`apps/taro/test/browser/publication-release.spec.ts` 覆盖内容与发布流程:
|
||||
|
||||
- 发布按钮按 readiness 启用;空备注发布提交空 body,不写入 `note`。
|
||||
- 备注提交前去除首尾空格。
|
||||
- 发布失败时保留备注与确认弹窗,并显示服务端错误。
|
||||
- 撤回当前版本、恢复历史版本分别提交正确路径与版本号。
|
||||
- 小程序配置页从服务端回填设置,只提交用户新输入的私钥。
|
||||
|
||||
该回归同时发现并修复了 `MiniAppSettingsTab` 的 `Form` 实例归属问题:表单实例原本在父组件创建、子组件懒挂载,触发 antd `useForm` 未连接警告;现已下沉到配置页自身。
|
||||
|
||||
## Admin 渲染错误边界
|
||||
|
||||
后台此前没有任何 React error boundary:任一页面在渲染阶段抛错(例如接口返回了形状不符的数据)都会导致整页白屏,用户只能从控制台看到堆栈。现在按两级兜底:
|
||||
|
||||
- `Root` 上的整页边界:后台外壳自身渲染失败时显示错误页,提供「重新加载页面」和「返回概览」。
|
||||
- `Dashboard` 内容区的页面边界:单个业务页面失败时保留侧边栏与顶部导航,提供「重试」和「重新加载页面」,切换路由后自动复位。
|
||||
- 错误页展示可复制的错误编号,日志侧输出同一编号、堆栈与组件栈,便于把用户反馈和服务器日志对应起来。
|
||||
- 开发环境额外显示原始错误信息;生产环境不暴露堆栈。
|
||||
|
||||
外壳数据不再直接信任接口形状:`apps/admin/src/lib/brand-switcher.ts` 只接受完整成员记录,跳过异常条目并对重复品牌、缺失名称和非字符串品牌名做稳定收敛,避免单条脏数据让整个后台外壳崩溃。错误边界只作为最后一道防线。
|
||||
|
||||
`apps/taro/test/browser/admin-error-boundary.spec.ts` 覆盖:
|
||||
|
||||
- 品牌成员与品牌名称返回异常结构时,后台外壳仍正常渲染。
|
||||
- 业务页面数据异常时保留导航,重试仍失败保持错误页,重新加载后恢复。
|
||||
|
||||
`apps/admin/test/brand-switcher.test.mjs` 覆盖选项转换的异常条目、非数组、重复品牌、缺失名称与非字符串名称。
|
||||
|
||||
## Ant Design 6 弃用项
|
||||
|
||||
- `Alert` 统一使用 `title`,`Space` 统一使用 `orientation`。
|
||||
- 提示与确认框改为 `App.useApp()` 实例,删除静态 `message` 转出口 `components/AdminMessage.ts`。
|
||||
- `apps/admin/test/antd-deprecations.test.mjs` 作为静态门禁,阻止静态 `message`、`Modal.confirm`、`Alert.message`、`Space.direction` 回流。
|
||||
- `List` 仍保留:`Listy` 是虚拟滚动组件,API 不兼容,当前仅用于小数据量场景;已记录在 `docs/adr/0034-antd6-static-api-and-list.md`,升级 Ant Design 7 前重新评估。
|
||||
|
||||
## 已验证门禁
|
||||
|
||||
- `pnpm check`
|
||||
- `pnpm validate:template-release`
|
||||
- `pnpm --filter @personal-brand/api test`
|
||||
- `pnpm --filter @personal-brand/api test:integration`
|
||||
- `miniprogram-ci` override 兼容 smoke test
|
||||
- `pnpm test:api-client`
|
||||
- `pnpm test:deploy`
|
||||
- `pnpm --filter @personal-brand/admin typecheck`
|
||||
- `pnpm --filter @personal-brand/admin lint`
|
||||
- `pnpm --filter @personal-brand/admin test`
|
||||
- `pnpm --filter @personal-brand/admin build`
|
||||
- `pnpm build`
|
||||
- `pnpm template:doctor`
|
||||
- Playwright:
|
||||
- `brand-creation-and-page-scheme.spec.ts`
|
||||
- `publication-release.spec.ts`
|
||||
- `admin-error-boundary.spec.ts`
|
||||
- `template-preview-media.spec.ts`
|
||||
- `admin-editor.spec.ts`
|
||||
|
||||
发布脚本的 Node 版本门禁已提前到所有构建之前。Node 22 下执行 `pnpm deploy:release` 会立即失败,并给出 Node.js 24 要求提示,不再先执行一轮无用构建。
|
||||
|
||||
## 安全审计
|
||||
|
||||
- `pnpm audit --prod --registry=https://registry.npmjs.org` 已完成。
|
||||
- 可修复 advisory 已通过 `pnpm.overrides` 收敛;`request` 替换为 `@cypress/request@4.0.1`。
|
||||
- 剩余 8 条为 `miniprogram-ci@2.1.31` 无修复版本的上游 advisory,已在 `pnpm.auditConfig.ignoreGhsas` 和 `docs/security-audit.md` 中显式登记风险、控制措施与跟进条件。
|
||||
- Taro 官方 peer 仍声明 Vite 4;当前使用 Vite 6.4.3,H5 与 Weapp 实际构建均通过,peer warning 记录在安全审计文档。
|
||||
|
||||
## 未决事项
|
||||
|
||||
- `miniprogram-ci` 上游发布修复版本后,需要移除对应的 audit ignore、风险登记和本地 patch。
|
||||
- Gitea SSH 直连仍受 OCI 安全列表限制;当前本机通过 `oracle_arm` ProxyCommand 转发访问,不阻塞业务。
|
||||
- CI 已加入 audit 和三套模板矩阵构建;后续可继续拆分更细粒度的 smoke/visual matrix。
|
||||
@@ -2,3 +2,5 @@ VITE_APP_BASE_PATH=/admin/
|
||||
VITE_API_BASE_URL=/api
|
||||
VITE_DEV_API_TARGET=http://localhost:3001
|
||||
ADMIN_PORT=3000
|
||||
VITE_TEMPLATE_PREVIEW_URL=http://localhost:3002
|
||||
VITE_MEDIA_PROXY_TARGET=http://localhost:9000
|
||||
@@ -0,0 +1,420 @@
|
||||
# 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` |
|
||||
|
||||
强调色只用于:主按钮、选中态、链接、关键数字、聚焦描边。不得用于大面积背景。
|
||||
|
||||
例外:小程序预览区(iframe / 模拟器内)显示的是模板自身的品牌色(例如餐饮模板的砖红 `#B54A2C`),与后台无关,不视为违规,也不要「修正」成后台强调色。
|
||||
|
||||
### 状态色
|
||||
|
||||
状态一律用「浅底 + 深字」,不使用 antd 的实心鲜艳 Tag。
|
||||
|
||||
| 语义 | 底色 | 边框 | 文字色 |
|
||||
| ------------- | --------- | --------- | --------- |
|
||||
| 成功 / 已发布 | `#ECFDF3` | `#ABEFC6` | `#067647` |
|
||||
| 警告 / 进行中 | `#FFFAEB` | `#FEDF89` | `#B54708` |
|
||||
| 错误 / 失败 | `#FEF3F2` | `#FBD5D1` | `#B42318` |
|
||||
| 中性 / 草稿 | `#F2F4F7` | `#E7E9EC` | `#475467` |
|
||||
| 信息 / 系统态 | `#EFF4FF` | `#B2CCFF` | `#2563EB` |
|
||||
|
||||
- 底色 + 边框 + 深色文字三件套同时用于 `StatusTag`、`Alert`、错误条与空状态,不得混用其他色阶。
|
||||
- 需要中间调的场合(图标、进度条完成态)使用中间色:成功 `#12B76A`、警告 `#F79009`、错误 `#F04438`、信息 `#2563EB`。
|
||||
|
||||
---
|
||||
|
||||
## 2. 排版
|
||||
|
||||
系统无衬线字体栈:`Inter`、`PingFang SC`、`Noto Sans SC`、`sans-serif`。
|
||||
|
||||
| 角色 | 字号 | 字重 | 行高 |
|
||||
| ------------------ | ---- | ---- | ---- |
|
||||
| 页面标题 | 20px | 600 | 1.4 |
|
||||
| 区块/卡片标题 | 16px | 600 | 1.45 |
|
||||
| 卡片内对象主标题 | 18px | 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,居中 |
|
||||
| 页面头部到主体 | 32px |
|
||||
| 卡片内边距 | 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` 渲染:页面标题 20px/600 + 可选副标题 13px 次要色 + 右侧操作区。标题与副标题间距 6px,页头到主体 32px(明显大于卡片之间的 16px)。页面内不得再手写标题层级。
|
||||
|
||||
- 页面标题必须与侧栏导航用词一致,不额外添加「小程序内容:」这类前缀;页面职责写进副标题。
|
||||
- 副标题一句话讲清这一页做什么,最长不超过 2 行;能由页面内文案表达的细节不要重复写在这里。
|
||||
|
||||
### 卡片
|
||||
|
||||
- 标题 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,不使用表格线。
|
||||
|
||||
落地:`<Descriptions className="admin-descriptions" column={1} size="small">`,字号与间距由 `admin.css` 与 `Descriptions` 令牌统一,不逐处传 `bordered`。
|
||||
|
||||
### Tabs
|
||||
|
||||
- 顶部 1px 分隔线,选中项底部 2px 强调色下划线 + 深色文字,未选中 14px `#6B7280`。
|
||||
- 不超过 5 个 Tab,超出改用左侧分段导航。
|
||||
|
||||
### 切换控件选型
|
||||
|
||||
同一层级切换控件只允许两种,按范围选择,不得混用:
|
||||
|
||||
| 场景 | 控件 | 现状 |
|
||||
| ---------------------------------------- | ----------- | ------------------------------ |
|
||||
| 页面级分区(内容结构不同、各自独立成段) | `Tabs` | 配置与发布 |
|
||||
| 区块内视图切换(同一份数据换视角) | `Segmented` | 小程序页面、业务提供项编辑弹窗 |
|
||||
|
||||
`Segmented` 用作「取值选择」(如能力状态降级/启用/停用)时按表单控件处理,不受本表约束。
|
||||
|
||||
### 标题层级
|
||||
|
||||
页面内标题只用三档,禁止再用 `Typography.Title level` 直接指定字号:
|
||||
|
||||
| 用途 | 类名 | 字号 |
|
||||
| ---------------------- | --------------------- | ---------- |
|
||||
| 区块标题 | `admin-section-title` | 16px / 600 |
|
||||
| 面板内小标题、表单分组 | `admin-subhead` | 15px / 600 |
|
||||
| 列表行、条目名称 | `admin-row-title` | 14px / 600 |
|
||||
|
||||
页面级标题只由 `AdminPageHeader` 输出(20px / 600),一个页面只出现一次。
|
||||
|
||||
### 进度
|
||||
|
||||
- 高 6px,圆角 3px,轨道 `#F0F1F3`,进度条强调色;完成态用成功色。
|
||||
- 进度条上方 14px 文案说明当前含义,不允许只有一根进度条。
|
||||
|
||||
---
|
||||
|
||||
## 6. 状态设计
|
||||
|
||||
每个远程数据页面必须显式实现四种状态,不得出现无反馈的白屏。
|
||||
|
||||
| 状态 | 规范 |
|
||||
| -------- | ----------------------------------------------------------------------------------- |
|
||||
| 加载中 | 骨架屏,形状与最终内容一致;不用居中转圈 |
|
||||
| 空数据 | 居中:极简线性图形 + 15px/600 标题 + 13px 灰色说明 + 主操作按钮 |
|
||||
| 请求失败 | 卡片内错误条:`#FEF3F2` 底 + 1px 浅红边框 + 圆角 8px + 文案 14px + 「重试」文字按钮 |
|
||||
| 成功反馈 | 右上角轻量 toast,白底圆角 8px,280–320px 宽 |
|
||||
|
||||
- 行内操作使用按钮 `loading` 表达进行中,不用全局遮罩。
|
||||
- 提交成功后:关闭弹窗、重置表单、刷新受影响列表;提交失败保持原状。
|
||||
- 幂等写操作要防止重复点击(提交中禁用)。
|
||||
|
||||
落地约定:
|
||||
|
||||
- 空状态统一用 `EmptyState`(`components/EmptyState.tsx`);表格内用 `compact` 变体,整块区域用默认变体。禁止再使用 antd 默认 `Empty` 插画。
|
||||
- 列表 / 表格加载统一用 `TableSkeleton`、`ListSkeleton`(`components/TableSkeleton.tsx`)替换内容区,不使用 antd `Table` 的转圈遮罩;卡片级加载用 `LoadingStack`。
|
||||
- 卡片内的写操作只在「有未保存修改」时使用主按钮,其余状态用次要按钮并禁用,同时用 `StatusTag` 标明修改状态。
|
||||
- 发布准备度、内容检查这类清单,条目文案只描述「检查什么」(中性名词),是否达标由「已完成 / 待完善」标签表达;帮助文案只在待完善时展示。禁止出现「已完成 · 请先完善…」这类自相矛盾的措辞。
|
||||
|
||||
---
|
||||
|
||||
## 7. 页面结构
|
||||
|
||||
以下为各页面的视觉结构约定,业务逻辑不变。
|
||||
|
||||
| 页面 | 结构要点 |
|
||||
| -------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
||||
| 登录 | 居中 400px 卡片,标识 + 说明 + 表单 + 通栏主按钮;错误态展示在字段下方 |
|
||||
| 首次改密 | 同登录卡片形态,说明文案 + 三个密码字段 + 「保存新密码」 |
|
||||
| 品牌概览 | 品牌卡 + 三张指标卡(等宽一行)+ 两栏(发布准备度 / 品牌内容检查) |
|
||||
| 内容与发布 | 内容发布 / 小程序发布 / 小程序配置三个分区;内容发布含发布状态卡、草稿卡和历史版本表,不承载业务类型或页面方案选择 |
|
||||
| 页面方案 | 当前业务类型与页面方案 + 升级预览 + 版本选择 + 配置恢复 + 高级示例内容导入 |
|
||||
| 品牌管理 | 品牌列表与创建入口;创建品牌先选不可变的业务类型,再选兼容页面方案,创建时不导入示例内容 |
|
||||
| 小程序页面 | 左右两栏:左 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",
|
||||
colorTextQuaternary: "#C3C7CF",
|
||||
colorBgLayout: "#F7F8FA",
|
||||
colorBgContainer: "#FFFFFF",
|
||||
colorBorder: "#D8DBE0",
|
||||
colorBorderSecondary: "#E7E9EC",
|
||||
colorSplit: "#F0F1F3",
|
||||
colorFillTertiary: "#F7F8FA",
|
||||
colorFillQuaternary: "#FAFAFB",
|
||||
colorSuccess: "#12B76A",
|
||||
colorSuccessBg: "#ECFDF3",
|
||||
colorSuccessBorder: "#ABEFC6",
|
||||
colorSuccessText: "#067647",
|
||||
colorWarning: "#F79009",
|
||||
colorWarningBg: "#FFFAEB",
|
||||
colorWarningBorder: "#FEDF89",
|
||||
colorWarningText: "#B54708",
|
||||
colorError: "#F04438",
|
||||
colorErrorBg: "#FEF3F2",
|
||||
colorErrorBorder: "#FBD5D1",
|
||||
colorErrorText: "#B42318",
|
||||
colorInfo: "#2563EB",
|
||||
colorInfoBg: "#EFF4FF",
|
||||
colorInfoBorder: "#B2CCFF",
|
||||
colorInfoText: "#2563EB",
|
||||
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 },
|
||||
Alert: { borderRadius: 8 },
|
||||
Descriptions: {
|
||||
labelBg: "#FAFAFB",
|
||||
labelColor: "#6B7280",
|
||||
contentColor: "#1C1F23",
|
||||
itemPaddingBottom: 12,
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
可执行来源是 `apps/admin/src/lib/theme.ts`,本块为同值快照;改令牌时两处一起改。
|
||||
|
||||
- 新增页面优先使用令牌与共享组件;禁止在 JSX 内写内联色值、字号、圆角(唯一的例外是通过 CSS 变量透传的数据色,例如视觉模板色板的 `--swatch-color`)。
|
||||
- 共享视觉组件清单:`AdminPageHeader`、`AdminSection`、`StatusTag`、`EmptyState`、`TableSkeleton` / `ListSkeleton`、`MetricCard`、`QueryState`。
|
||||
@@ -3,6 +3,10 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'self'; img-src 'self' data: blob:; media-src 'self' data: blob:; style-src 'self' 'unsafe-inline'; font-src 'self' data:; connect-src 'self' ws: wss:; script-src 'self'; object-src 'none'; base-uri 'none'; form-action 'self'"
|
||||
/>
|
||||
<title>个人品牌后台</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^6.3.4",
|
||||
"@personal-brand/api-client": "workspace:*",
|
||||
"@tanstack/react-query": "^5.103.1",
|
||||
"antd": "^6.6.4",
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { createElement, type ReactNode } from "react";
|
||||
import { Navigate, Route, Routes } from "react-router-dom";
|
||||
|
||||
export function AdminOverviewRedirect() {
|
||||
return createElement(Navigate, { to: "/admin/overview", replace: true });
|
||||
}
|
||||
|
||||
export function AdminRouter({ children }: { children: ReactNode }) {
|
||||
return createElement(
|
||||
Routes,
|
||||
null,
|
||||
createElement(Route, { path: "/admin/*", element: children }),
|
||||
createElement(Route, { path: "*", element: createElement(AdminOverviewRedirect) }),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import {
|
||||
AppstoreOutlined,
|
||||
BarsOutlined,
|
||||
CloudUploadOutlined,
|
||||
FormOutlined,
|
||||
LayoutOutlined,
|
||||
MessageOutlined,
|
||||
MobileOutlined,
|
||||
SafetyCertificateOutlined,
|
||||
ShopOutlined,
|
||||
TeamOutlined,
|
||||
ThunderboltOutlined,
|
||||
} from "@ant-design/icons";
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
import { createApiClient } from "../lib/api.js";
|
||||
import { BrandMark } from "../components/BrandMark.js";
|
||||
import { StatusTag } from "../components/StatusTag.js";
|
||||
import {
|
||||
FeatureBrandPage,
|
||||
FeatureBrandsPage,
|
||||
FeatureCapabilitiesPage,
|
||||
FeatureCreateBrandPage,
|
||||
FeatureInquiriesPage,
|
||||
FeatureMembersPage,
|
||||
FeatureOverviewPage,
|
||||
FeaturePageSchemePage,
|
||||
FeaturePublicationPage,
|
||||
FeatureTemplateManagementPage,
|
||||
FeatureServicesPage,
|
||||
FeatureTrustContentPage,
|
||||
FeatureWorkspacePage,
|
||||
} from "./routes.js";
|
||||
import { LoadingStack } from "../components/LoadingStack.js";
|
||||
import { AdminMenu } from "../components/AdminMenu.js";
|
||||
import { App } from "antd";
|
||||
import { AdminButton } from "../components/AdminButton.js";
|
||||
import { AdminSelect } from "../components/AdminSelect.js";
|
||||
import { AdminLayout } from "../components/AdminLayout.js";
|
||||
import { Route, Routes } from "react-router-dom";
|
||||
import { AdminOverviewRedirect } from "./AdminRouter.js";
|
||||
import { createBrandRouteElement } from "./route-access.js";
|
||||
import { Suspense } from "react";
|
||||
import { AdminErrorBoundary } from "../components/AdminErrorBoundary.js";
|
||||
import { toBrandDisplayName, toBrandSwitcherOptions } from "../lib/brand-switcher.js";
|
||||
|
||||
export function Dashboard({
|
||||
onLogout,
|
||||
role,
|
||||
platformTemplateRole,
|
||||
}: {
|
||||
onLogout: () => void;
|
||||
role: string;
|
||||
platformTemplateRole: "none" | "template_admin";
|
||||
}) {
|
||||
const { message } = App.useApp();
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const brand = useQuery({
|
||||
queryKey: ["admin-shell-brand"],
|
||||
queryFn: () => createApiClient().getAdminBrand(),
|
||||
});
|
||||
const memberships = useQuery({
|
||||
queryKey: ["admin-brand-memberships"],
|
||||
queryFn: () => createApiClient().listAdminBrands(),
|
||||
});
|
||||
const switchBrand = async (brandId: string) => {
|
||||
try {
|
||||
await createApiClient().switchAdminBrand(brandId);
|
||||
window.location.reload();
|
||||
} catch (error) {
|
||||
message.error(error instanceof Error ? error.message : "品牌切换失败");
|
||||
}
|
||||
};
|
||||
const page = location.pathname.split("/")[2] || "overview";
|
||||
const brandName = toBrandDisplayName(brand.data?.name, "当前品牌");
|
||||
const brandOptions = toBrandSwitcherOptions(memberships.data);
|
||||
const items = [
|
||||
{
|
||||
type: "group" as const,
|
||||
label: "日常经营",
|
||||
children: [
|
||||
{ key: "overview", label: "当前品牌概览", icon: <AppstoreOutlined /> },
|
||||
{ key: "publication", label: "内容与发布", icon: <CloudUploadOutlined /> },
|
||||
{ key: "brand", label: "小程序页面", icon: <MobileOutlined /> },
|
||||
{ key: "trust", label: "信任内容", icon: <SafetyCertificateOutlined /> },
|
||||
{ key: "services", label: "业务提供项", icon: <BarsOutlined /> },
|
||||
{ key: "inquiries", label: "咨询记录", icon: <MessageOutlined /> },
|
||||
{ key: "workspace", label: "咨询表单与字段", icon: <FormOutlined /> },
|
||||
],
|
||||
},
|
||||
...(role === "editor"
|
||||
? []
|
||||
: [
|
||||
{
|
||||
type: "group" as const,
|
||||
label: "品牌设置",
|
||||
children: [
|
||||
{ key: "brands", label: "品牌管理", icon: <ShopOutlined /> },
|
||||
{ key: "page-scheme", label: "页面方案", icon: <LayoutOutlined /> },
|
||||
{ key: "capabilities", label: "能力插件", icon: <ThunderboltOutlined /> },
|
||||
{ key: "members", label: "团队成员", icon: <TeamOutlined /> },
|
||||
...(platformTemplateRole === "template_admin"
|
||||
? [{ key: "templates", label: "模板管理", icon: <AppstoreOutlined /> }]
|
||||
: []),
|
||||
],
|
||||
},
|
||||
]),
|
||||
];
|
||||
return (
|
||||
<AdminLayout className="admin-shell">
|
||||
<AdminLayout.Sider className="admin-sider" breakpoint="lg" collapsedWidth={0} width={232}>
|
||||
<div className="admin-sider-brand">
|
||||
<BrandMark name={toBrandDisplayName(brand.data?.name, "")} />
|
||||
<span className="admin-sider-brand-name">品牌工作区</span>
|
||||
</div>
|
||||
<AdminMenu
|
||||
selectedKeys={[page]}
|
||||
onClick={({ key }) => navigate(`/admin/${key}`)}
|
||||
items={items}
|
||||
/>
|
||||
</AdminLayout.Sider>
|
||||
<AdminLayout className="admin-main">
|
||||
<AdminLayout.Header className="admin-header">
|
||||
<div className="admin-header-left">
|
||||
<span className="admin-header-brand">{brandName}</span>
|
||||
<span className="admin-header-context">品牌工作区</span>
|
||||
<StatusTag
|
||||
tone={role === "owner" ? "info" : "neutral"}
|
||||
label={role === "owner" ? "负责人" : "内容编辑"}
|
||||
/>
|
||||
<AdminSelect
|
||||
size="small"
|
||||
variant="outlined"
|
||||
className="admin-brand-switcher"
|
||||
value={brand.data?.id}
|
||||
loading={memberships.isLoading}
|
||||
onChange={(value: string | undefined) => {
|
||||
if (value) void switchBrand(value);
|
||||
}}
|
||||
options={brandOptions}
|
||||
/>
|
||||
</div>
|
||||
<AdminButton type="text" onClick={onLogout}>
|
||||
退出登录
|
||||
</AdminButton>
|
||||
</AdminLayout.Header>
|
||||
<AdminLayout.Content className="admin-content">
|
||||
<div className="admin-content-inner">
|
||||
<AdminErrorBoundary key={location.pathname}>
|
||||
<Suspense fallback={<LoadingStack />}>
|
||||
<Routes>
|
||||
<Route index element={<AdminOverviewRedirect />} />
|
||||
<Route path="overview" element={<FeatureOverviewPage />} />
|
||||
<Route path="publication" element={<FeaturePublicationPage />} />
|
||||
<Route path="brand" element={<FeatureBrandPage />} />
|
||||
<Route path="trust" element={<FeatureTrustContentPage />} />
|
||||
<Route path="services" element={<FeatureServicesPage />} />
|
||||
<Route path="inquiries" element={<FeatureInquiriesPage />} />
|
||||
<Route path="workspace" element={<FeatureWorkspacePage />} />
|
||||
{role === "editor" ? null : (
|
||||
<>
|
||||
<Route
|
||||
path="brands"
|
||||
element={<FeatureBrandsPage canCreate={role === "owner"} />}
|
||||
/>
|
||||
<Route
|
||||
path="brands/new"
|
||||
element={createBrandRouteElement(role, <FeatureCreateBrandPage />)}
|
||||
/>
|
||||
<Route path="page-scheme" element={<FeaturePageSchemePage />} />
|
||||
<Route path="capabilities" element={<FeatureCapabilitiesPage />} />
|
||||
<Route path="members" element={<FeatureMembersPage />} />
|
||||
{platformTemplateRole === "template_admin" ? (
|
||||
<Route path="templates" element={<FeatureTemplateManagementPage />} />
|
||||
) : null}
|
||||
</>
|
||||
)}
|
||||
<Route path="*" element={<AdminOverviewRedirect />} />
|
||||
</Routes>
|
||||
</Suspense>
|
||||
</AdminErrorBoundary>
|
||||
</div>
|
||||
</AdminLayout.Content>
|
||||
</AdminLayout>
|
||||
</AdminLayout>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
import React, { useState } from "react";
|
||||
import type { AdminSession } from "@personal-brand/api-client";
|
||||
import { ChangePassword, Login } from "../features/auth/AuthPages.js";
|
||||
import { Dashboard } from "./Dashboard.js";
|
||||
import { AdminRouter } from "./AdminRouter.js";
|
||||
import { App } from "antd";
|
||||
import { createApiClient } from "../lib/api.js";
|
||||
import { LoadingStack } from "../components/LoadingStack.js";
|
||||
import { AdminErrorBoundary } from "../components/AdminErrorBoundary.js";
|
||||
|
||||
type SessionState = Omit<AdminSession, "authenticated">;
|
||||
|
||||
export function Root() {
|
||||
const { message } = App.useApp();
|
||||
const [session, setSession] = useState<SessionState | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
React.useEffect(() => {
|
||||
let active = true;
|
||||
createApiClient()
|
||||
.getAdminSession()
|
||||
.then((current) => {
|
||||
if (active) setSession(current);
|
||||
})
|
||||
.catch(() => {
|
||||
if (active) setSession(null);
|
||||
})
|
||||
.finally(() => {
|
||||
if (active) setLoading(false);
|
||||
});
|
||||
return () => {
|
||||
active = false;
|
||||
};
|
||||
}, []);
|
||||
|
||||
React.useEffect(() => {
|
||||
const expire = () => {
|
||||
message.warning("登录状态已失效,请重新登录");
|
||||
setSession(null);
|
||||
};
|
||||
window.addEventListener("admin-auth-expired", expire);
|
||||
return () => window.removeEventListener("admin-auth-expired", expire);
|
||||
}, []);
|
||||
|
||||
const logout = async () => {
|
||||
try {
|
||||
await createApiClient().logoutAdmin();
|
||||
} catch {
|
||||
message.warning("已退出本地会话;服务端撤销请求未完成");
|
||||
} finally {
|
||||
setSession(null);
|
||||
}
|
||||
};
|
||||
|
||||
if (loading) return <LoadingStack />;
|
||||
if (!session)
|
||||
return (
|
||||
<Login
|
||||
onLogin={(current) => {
|
||||
setSession(current);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
if (session.mustChangePassword)
|
||||
return (
|
||||
<ChangePassword
|
||||
onComplete={async () => {
|
||||
try {
|
||||
setSession(await createApiClient().getAdminSession());
|
||||
} catch {
|
||||
setSession(null);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
);
|
||||
return (
|
||||
<AdminErrorBoundary variant="page">
|
||||
<AdminRouter>
|
||||
<Dashboard
|
||||
onLogout={logout}
|
||||
role={session.role}
|
||||
platformTemplateRole={session.platformTemplateRole}
|
||||
/>
|
||||
</AdminRouter>
|
||||
</AdminErrorBoundary>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { createElement, type ReactNode } from "react";
|
||||
import { Navigate } from "react-router-dom";
|
||||
|
||||
export const createBrandFallbackPath = "/admin/brands";
|
||||
|
||||
export function canCreateBrand(role: string) {
|
||||
return role === "owner";
|
||||
}
|
||||
|
||||
export function createBrandRouteElement(role: string, content: ReactNode) {
|
||||
return canCreateBrand(role)
|
||||
? content
|
||||
: createElement(Navigate, { to: createBrandFallbackPath, replace: true });
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
import React from "react";
|
||||
|
||||
export const FeatureInquiriesPage = React.lazy(() =>
|
||||
import("../features/inquiries/InquiriesPage.js").then((module) => ({
|
||||
default: module.InquiriesPage,
|
||||
})),
|
||||
);
|
||||
export const FeatureTrustContentPage = React.lazy(() =>
|
||||
import("../features/trust-content/TrustContentPage.js").then((module) => ({
|
||||
default: module.TrustContentPage,
|
||||
})),
|
||||
);
|
||||
export const FeatureServicesPage = React.lazy(() =>
|
||||
import("../features/services/ServicesPage.js").then((module) => ({
|
||||
default: module.ServicesPage,
|
||||
})),
|
||||
);
|
||||
export const FeatureBrandPage = React.lazy(() =>
|
||||
import("../features/brand/BrandPage.js").then((module) => ({ default: module.BrandPage })),
|
||||
);
|
||||
export const FeatureWorkspacePage = React.lazy(() =>
|
||||
import("../features/workspace/WorkspacePage.js").then((module) => ({
|
||||
default: module.WorkspacePage,
|
||||
})),
|
||||
);
|
||||
export const FeatureOverviewPage = React.lazy(() =>
|
||||
import("../features/overview/OverviewPage.js").then((module) => ({
|
||||
default: module.OverviewPage,
|
||||
})),
|
||||
);
|
||||
export const FeatureCapabilitiesPage = React.lazy(() =>
|
||||
import("../features/capabilities/CapabilitiesPage.js").then((module) => ({
|
||||
default: module.CapabilitiesPage,
|
||||
})),
|
||||
);
|
||||
export const FeatureMembersPage = React.lazy(() =>
|
||||
import("../features/team/MembersPage.js").then((module) => ({
|
||||
default: module.MembersPage,
|
||||
})),
|
||||
);
|
||||
export const FeaturePublicationPage = React.lazy(() =>
|
||||
import("../features/publication/PublicationPage.js").then((module) => ({
|
||||
default: module.PublicationPage,
|
||||
})),
|
||||
);
|
||||
export const FeatureTemplateManagementPage = React.lazy(() =>
|
||||
import("../features/template-management/TemplateManagementPage.js").then((module) => ({
|
||||
default: module.TemplateManagementPage,
|
||||
})),
|
||||
);
|
||||
export const FeatureBrandsPage = React.lazy(() =>
|
||||
import("../features/brands/BrandsPage.js").then((module) => ({
|
||||
default: module.BrandsPage,
|
||||
})),
|
||||
);
|
||||
export const FeatureCreateBrandPage = React.lazy(() =>
|
||||
import("../features/brands/CreateBrandPage.js").then((module) => ({
|
||||
default: module.CreateBrandPage,
|
||||
})),
|
||||
);
|
||||
export const FeaturePageSchemePage = React.lazy(() =>
|
||||
import("../features/page-scheme/PageSchemePage.js").then((module) => ({
|
||||
default: module.PageSchemePage,
|
||||
})),
|
||||
);
|
||||
@@ -0,0 +1,6 @@
|
||||
import { Button } from "antd";
|
||||
import type { ButtonProps } from "antd";
|
||||
|
||||
export function AdminButton(props: ButtonProps) {
|
||||
return <Button {...props} />;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { Card } from "antd";
|
||||
import type { CardProps } from "antd";
|
||||
|
||||
export function AdminCard(props: CardProps) {
|
||||
return <Card {...props} />;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { App, ConfigProvider } from "antd";
|
||||
import type { ConfigProviderProps } from "antd";
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
export function AdminConfigProvider({
|
||||
children,
|
||||
...props
|
||||
}: ConfigProviderProps & { children?: ReactNode }) {
|
||||
return (
|
||||
<ConfigProvider {...props}>
|
||||
<App>{children}</App>
|
||||
</ConfigProvider>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
import { Component, type ErrorInfo, type ReactNode } from "react";
|
||||
import { Button, Result, Space, Typography } from "antd";
|
||||
import { createApiClient } from "../lib/api.js";
|
||||
|
||||
interface AdminErrorBoundaryProps {
|
||||
children: ReactNode;
|
||||
variant?: "page" | "content";
|
||||
}
|
||||
|
||||
interface AdminErrorBoundaryState {
|
||||
error: Error | null;
|
||||
errorId: string | null;
|
||||
}
|
||||
|
||||
function createErrorId(): string {
|
||||
return `admin-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 后台渲染错误边界:页面级兜底整页,内容级兜底单个业务页面且保留导航。
|
||||
* React 只支持 class 组件捕获渲染异常,因此这里保留 class 实现。
|
||||
*/
|
||||
export class AdminErrorBoundary extends Component<
|
||||
AdminErrorBoundaryProps,
|
||||
AdminErrorBoundaryState
|
||||
> {
|
||||
override state: AdminErrorBoundaryState = { error: null, errorId: null };
|
||||
private reportedErrorId: string | null = null;
|
||||
|
||||
static getDerivedStateFromError(error: Error): AdminErrorBoundaryState {
|
||||
return { error, errorId: createErrorId() };
|
||||
}
|
||||
|
||||
override componentDidCatch(error: Error, info: ErrorInfo) {
|
||||
const errorId = this.state.errorId ?? createErrorId();
|
||||
console.error("[admin] 页面渲染异常", errorId, error, info.componentStack);
|
||||
if (this.reportedErrorId === errorId) return;
|
||||
this.reportedErrorId = errorId;
|
||||
// 上报失败不能影响错误页本身:只记录到控制台,不抛出、不改状态。
|
||||
void createApiClient()
|
||||
.reportAdminClientError({
|
||||
errorId,
|
||||
message: error.message.slice(0, 2000) || error.name,
|
||||
route: `${window.location.pathname}${window.location.search}`.slice(0, 500),
|
||||
...(info.componentStack ? { componentStack: info.componentStack.slice(0, 20000) } : {}),
|
||||
})
|
||||
.catch((reportError: unknown) => {
|
||||
console.warn("[admin] 渲染异常上报失败", errorId, reportError);
|
||||
});
|
||||
}
|
||||
|
||||
private reset = () => {
|
||||
this.setState({ error: null, errorId: null });
|
||||
};
|
||||
|
||||
private reload = () => {
|
||||
window.location.reload();
|
||||
};
|
||||
|
||||
override render() {
|
||||
const { error, errorId } = this.state;
|
||||
if (!error) return this.props.children;
|
||||
const isPage = this.props.variant === "page";
|
||||
return (
|
||||
<Result
|
||||
status="error"
|
||||
title="页面渲染出错"
|
||||
subTitle={
|
||||
isPage
|
||||
? "后台页面无法显示。可以重新加载;如果问题持续,请把错误编号提供给管理员。"
|
||||
: "这个页面无法显示,其他页面仍可正常使用。可以重试或重新加载页面。"
|
||||
}
|
||||
extra={
|
||||
<Space wrap>
|
||||
{isPage ? null : (
|
||||
<Button type="primary" onClick={this.reset}>
|
||||
重试
|
||||
</Button>
|
||||
)}
|
||||
<Button type={isPage ? "primary" : "default"} onClick={this.reload}>
|
||||
重新加载页面
|
||||
</Button>
|
||||
{isPage ? <Button href="/admin/overview">返回概览</Button> : null}
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<Typography.Paragraph type="secondary" copyable={{ text: errorId ?? "" }}>
|
||||
错误编号:{errorId}
|
||||
</Typography.Paragraph>
|
||||
{import.meta.env.DEV ? (
|
||||
<Typography.Paragraph type="secondary">
|
||||
开发环境错误信息:{error.message}
|
||||
</Typography.Paragraph>
|
||||
) : null}
|
||||
</Result>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { Form as AdminForm, Input as AdminInput } from "antd";
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Layout } from "antd";
|
||||
import type { BasicProps } from "antd/es/layout/layout";
|
||||
|
||||
function AdminLayoutBase(props: BasicProps) {
|
||||
return <Layout {...props} />;
|
||||
}
|
||||
|
||||
export const AdminLayout = Object.assign(AdminLayoutBase, {
|
||||
Sider: Layout.Sider,
|
||||
Header: Layout.Header,
|
||||
Content: Layout.Content,
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import { Menu } from "antd";
|
||||
import type { MenuProps } from "antd";
|
||||
|
||||
export function AdminMenu(props: MenuProps) {
|
||||
return <Menu {...props} />;
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Space, Typography } from "antd";
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
export function AdminPageHeader({
|
||||
@@ -11,21 +10,12 @@ export function AdminPageHeader({
|
||||
extra?: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<Space
|
||||
align="start"
|
||||
style={{ width: "100%", justifyContent: "space-between", marginBottom: 24 }}
|
||||
>
|
||||
<div>
|
||||
<Typography.Title level={2} style={{ margin: 0 }}>
|
||||
{title}
|
||||
</Typography.Title>
|
||||
{description && (
|
||||
<Typography.Paragraph type="secondary" style={{ margin: "8px 0 0" }}>
|
||||
{description}
|
||||
</Typography.Paragraph>
|
||||
)}
|
||||
<header className="admin-page-header">
|
||||
<div className="admin-page-header-text">
|
||||
<h1 className="admin-page-header-title">{title}</h1>
|
||||
{description ? <p className="admin-page-header-description">{description}</p> : null}
|
||||
</div>
|
||||
{extra}
|
||||
</Space>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
export function AdminSection({
|
||||
title,
|
||||
description,
|
||||
extra,
|
||||
children,
|
||||
}: {
|
||||
title?: ReactNode;
|
||||
description?: ReactNode;
|
||||
extra?: ReactNode;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<section className="admin-section">
|
||||
{title ? (
|
||||
<div className="admin-section-head">
|
||||
<div>
|
||||
<h2 className="admin-section-title">{title}</h2>
|
||||
{description ? <p className="admin-section-description">{description}</p> : null}
|
||||
</div>
|
||||
{extra}
|
||||
</div>
|
||||
) : null}
|
||||
{children}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { Select } from "antd";
|
||||
import type { SelectProps } from "antd";
|
||||
|
||||
export function AdminSelect(props: SelectProps) {
|
||||
return <Select {...props} />;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { Skeleton } from "antd";
|
||||
import type { SkeletonProps } from "antd";
|
||||
|
||||
export function AdminSkeleton(props: SkeletonProps) {
|
||||
return <Skeleton {...props} />;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* 品牌标识:取品牌名首字渲染单字标记,未取到品牌时回落到中性字。
|
||||
* 视觉规则见 apps/admin/design.md 的「侧栏导航」。
|
||||
*/
|
||||
export function BrandMark({
|
||||
name,
|
||||
fallback = "品",
|
||||
className = "admin-sider-brand-mark",
|
||||
}: {
|
||||
name?: string | null | undefined;
|
||||
fallback?: string;
|
||||
className?: string;
|
||||
}) {
|
||||
const trimmed = name?.trim() ?? "";
|
||||
const mark = Array.from(trimmed)[0] ?? fallback;
|
||||
return <span className={className}>{mark}</span>;
|
||||
}
|
||||