Compare commits

...
Author SHA1 Message Date
que01 1e1d4d0326 chore: 重新触发 CI(Gitea 状态上报失败)
CI / API integration (pull_request) Successful in 3m41s
CI / Browser smoke (pull_request) Failing after 13m2s
CI / Static checks (pull_request) Failing after 13m4s
CI / Production build (pull_request) Has been cancelled
2026-10-23 21:34:31 +08:00
que01 92227e1311 fix: 增加微信登录配置部署检查
CI / API integration (pull_request) Successful in 1m44s
CI / Browser smoke (pull_request) Failing after 12m12s
CI / Static checks (pull_request) Failing after 12m13s
CI / Production build (pull_request) Has been cancelled
2026-10-23 19:27:44 +08:00
que01 e75c524343 Merge pull request 'docs: 更新生产发布与备份状态' (#9) from docs/production-status-backup into main 2026-10-23 10:09:26 +00:00
que01 1a4f71996a docs: 更新生产发布与备份状态
CI / Browser smoke (pull_request) Successful in 51s
CI / Static checks (pull_request) Successful in 58s
CI / API integration (pull_request) Successful in 1m34s
CI / Production build (pull_request) Successful in 1m47s
2026-10-23 18:05:25 +08:00
que01 a2fa6c3c31 Merge pull request 'feat: 增加生产数据库每日备份与状态门禁' (#8) from feat/scheduled-db-backup into main
CI / Browser smoke (push) Has been skipped
CI / Static checks (push) Successful in 50s
CI / API integration (push) Successful in 1m22s
CI / Production build (push) Successful in 1m49s
2026-10-23 09:58:56 +00:00
que01 015947f8fb feat: 增加生产数据库每日备份与状态门禁
CI / Browser smoke (pull_request) Successful in 50s
CI / Static checks (pull_request) Successful in 52s
CI / API integration (pull_request) Successful in 1m23s
CI / Production build (pull_request) Successful in 1m48s
2026-10-23 17:54:27 +08:00
que01 072a1037ac Merge pull request 'ci: 预热 Prisma 并移除运行时 Node 下载' (#7) from ci/avoid-runtime-downloads into main
CI / Browser smoke (push) Has been skipped
CI / Static checks (push) Successful in 53s
CI / Production build (push) Successful in 1m49s
CI / API integration (push) Successful in 1m23s
2026-10-23 09:41:33 +00:00
que01 447c224fce ci: 预热 Prisma 并移除运行时 Node 下载
CI / Static checks (pull_request) Successful in 1m1s
CI / API integration (pull_request) Successful in 1m26s
CI / Production build (pull_request) Successful in 1m45s
CI / Browser smoke (pull_request) Successful in 50s
2026-10-23 17:37:48 +08:00
que01 f2fc1e0810 Merge pull request 'fix: 修复 runner 迁移后的部署状态检查' (#6) from fix/deploy-status-after-runner-migration into main
CI / Browser smoke (push) Has been skipped
CI / API integration (push) Failing after 5m0s
CI / Static checks (push) Failing after 8m4s
CI / Production build (push) Has been skipped
2026-10-23 09:16:08 +00:00
que01 12a3bf2f3b fix: 修复 runner 迁移后的部署状态检查
CI / Static checks (pull_request) Successful in 1m34s
CI / Browser smoke (pull_request) Successful in 1m43s
CI / API integration (pull_request) Successful in 2m21s
CI / Production build (pull_request) Successful in 4m1s
2026-10-23 16:59:26 +08:00
que01 ca6d1712bd Merge pull request 'ci: 迁移本地 runner 并优化并行检查' (#5) from ci/local-runner-parallel into main
CI / Browser smoke (push) Has been skipped
CI / Static checks (push) Successful in 1m26s
CI / API integration (push) Successful in 2m1s
CI / Production build (push) Successful in 2m21s
2026-10-23 08:34:58 +00:00
que01 e7ef0b3ce5 ci: 允许 runner 挂载共享 pnpm store
CI / Static checks (pull_request) Successful in 2m31s
CI / Browser smoke (pull_request) Successful in 1m46s
CI / Production build (pull_request) Successful in 2m25s
CI / API integration (pull_request) Successful in 10m56s
2026-10-23 16:10:49 +08:00
que01 b82aa12875 ci: 共享 pnpm store 加速本地 runner 2026-10-23 16:09:25 +08:00
que01 b43b6f2785 ci: 预构建 runner 镜像并预装 Playwright 依赖
CI / Static checks (pull_request) Successful in 1m49s
CI / Browser smoke (pull_request) Has been cancelled
CI / API integration (pull_request) Has been cancelled
CI / Production build (pull_request) Successful in 2m38s
2026-10-23 15:52:24 +08:00
que01 965dd10219 ci: 迁移本地 runner 并优化并行检查 2026-10-23 15:40:50 +08:00
que01 371689484e Merge pull request 'fix/react-dev-warnings' (#3) from fix/react-dev-warnings into main
CI / Static checks (push) Successful in 6m15s
CI / Production build (push) Successful in 6m1s
CI / Browser smoke (push) Has been skipped
CI / API integration (push) Successful in 3m47s
Reviewed-on: #3
2026-10-23 06:37:36 +00:00
que01 d923b8cea9 fix: 修复内存限流存储异步签名
CI / Static checks (pull_request) Successful in 6m32s
CI / Production build (pull_request) Successful in 5m53s
CI / API integration (pull_request) Has been cancelled
CI / Browser smoke (pull_request) Has been cancelled
2026-10-23 14:35:55 +08:00
que01 a1b29cedee fix: 忽略空图片并收紧预览警告断言 2026-10-23 14:32:01 +08:00
que01 34504c0b44 fix: 清理后台开发态 React 警告 2026-10-23 14:25:56 +08:00
que01 3af5611da5 fix: 收紧发布环境与任务文件边界 2026-10-23 12:57:15 +08:00
que01 2fe108d66a feat: 支持多实例客户端异常限流 2026-10-23 12:57:06 +08:00
que01 4cd3749806 refactor: 缓存后台请求级权限校验 2026-10-23 12:56:57 +08:00
que01 00aeaa3cb1 refactor: 拆分后台可视化编辑器 2026-10-23 12:56:48 +08:00
que01 b190f2758a docs: 记录后台客户端异常上报限流边界 2026-10-23 12:26:53 +08:00
que01 4d9c84defc fix: 生产环境拒绝占位 SESSION_SECRET 2026-10-23 12:26:45 +08:00
que01 b4e3e86dcd refactor: 拆分模板工作区服务并统一后台访问控制 2026-10-23 12:26:37 +08:00
que01 5051839986 Merge pull request 'test: 修复浏览器回归 fixture 契约漂移' (#2) from fix/browser-contract-fixtures into main
CI / Static checks (push) Successful in 5m45s
CI / API integration (push) Successful in 3m35s
CI / Production build (push) Successful in 5m41s
CI / Browser smoke (push) Has been skipped
Reviewed-on: #2
2026-10-21 08:42:41 +00:00
que01 84522a8908 test: 修复浏览器回归 fixture 契约漂移
CI / Static checks (pull_request) Successful in 5m52s
CI / Production build (pull_request) Successful in 5m35s
CI / Browser smoke (pull_request) Successful in 3m0s
CI / API integration (pull_request) Successful in 3m41s
- 补齐 trust content 与模板版本 fixture 的必填字段\n- mock template-operations/failures 的完整响应结构\n- 补全完整浏览器回归的启动步骤与 CORS 要求\n\n完整回归 32 个用例全部通过。
2026-10-21 16:37:31 +08:00
que01 18bcdbeb00 ci: 增加 PR 浏览器 smoke (#1)
CI / Static checks (push) Successful in 5m49s
CI / Production build (push) Successful in 5m44s
CI / Browser smoke (push) Has been skipped
CI / API integration (push) Successful in 3m36s
2026-10-21 07:49:43 +00:00
que01 040504774d fix: 补齐证据哈希与 runner 安装脚本边界
CI / Static checks (push) Successful in 5m44s
CI / Production build (push) Successful in 5m34s
CI / API integration (push) Successful in 3m44s
2026-10-21 14:43:16 +08:00
que01 1001c43af6 chore: 提供可复现的 CI runner 安装脚本
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Static checks (push) Has been cancelled
2026-10-21 14:41:47 +08:00
que01 121148f6cf fix: 修正 deploy:status 远程脚本执行并检查 runner 2026-10-21 14:41:39 +08:00
que01 a08a2f0f98 ci: 让 main 的必需检查始终上报 2026-10-21 14:41:31 +08:00
que01 669d4a7de6 chore: 收敛模板证据哈希并接入提交钩子 2026-10-21 14:41:23 +08:00
que01 ec0cf78d69 chore: 更新模板完成证据源码哈希
CI / Static checks (push) Successful in 5m41s
CI / Production build (push) Successful in 5m36s
CI / API integration (push) Successful in 3m40s
2026-10-21 14:14:04 +08:00
que01 658c94a4e9 docs: 修正 CI 缓存放行网段与日志级别说明 2026-10-21 14:14:04 +08:00
que01 261a33a5ca chore: 更新模板完成证据源码哈希
CI / Static checks (push) Successful in 11m39s
CI / API integration (push) Successful in 3m46s
CI / Production build (push) Successful in 7m38s
2026-10-21 13:40:47 +08:00
que01 f28332f49a docs: 记录 Gitea Actions 首次完整通过 2026-10-21 13:40:46 +08:00
que01 c33c9cbd63 chore: 更新模板完成证据源码哈希
CI / API integration (push) Successful in 9m44s
CI / Static checks (push) Successful in 11m48s
CI / Production build (push) Successful in 11m40s
2026-10-21 13:03:46 +08:00
que01 b742fc70b5 fix: API 集成测试先构建工作区依赖 2026-10-21 13:03:46 +08:00
que01 6bd91d5ee8 chore: 更新模板完成证据源码哈希
CI / Static checks (push) Successful in 12m18s
CI / Production build (push) Successful in 11m41s
CI / API integration (push) Failing after 4m38s
2026-10-21 12:30:46 +08:00
que01 cdc7b407bc fix: 补充 arm64 Prisma 查询引擎目标 2026-10-21 12:30:46 +08:00
que01 9bfa4bb736 chore: 更新模板完成证据源码哈希 2026-10-21 12:29:45 +08:00
que01 c04ab1ef60 fix: API lint 先构建本包以保证脚本类型可解析 2026-10-21 12:29:44 +08:00
que01 4a6bc42635 chore: 更新模板完成证据源码哈希
CI / Static checks (push) Failing after 6m29s
CI / Production build (push) Has been skipped
CI / API integration (push) Has been skipped
2026-10-21 12:17:12 +08:00
que01 b86c661af5 fix: 视觉夹具校验容忍缺失 npm 构建产物 2026-10-21 12:17:11 +08:00
que01 71c068966e chore: 更新模板完成证据源码哈希 2026-10-21 12:16:00 +08:00
que01 784b9cbac8 fix: 缺少 npm 构建产物时模板产物校验只告警 2026-10-21 12:16:00 +08:00
que01 2325214078 chore: 更新模板完成证据源码哈希 2026-10-21 12:11:19 +08:00
que01 e194e605f9 fix: 修复干净环境 lint 与类型检查依赖构建 2026-10-21 12:10:42 +08:00
que01 82381a5e93 chore: 落地 Gitea Actions CI 门禁
CI / Static checks (push) Failing after 5m7s
CI / Production build (push) Has been skipped
CI / API integration (push) Has been skipped
2026-10-21 12:01:40 +08:00
que01 ec6b0dee3e chore: 增加 Gitea Actions runner 冒烟工作流
CI / Runner smoke (push) Successful in 12s
2026-10-21 12:01:04 +08:00
que01 060bad2df0 docs: 更新生产发布状态
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been skipped
CI / API integration (push) Has been skipped
CI / Taro builds (acheng-campus-food) (push) Has been skipped
CI / Taro builds (atelier-solopreneur) (push) Has been skipped
CI / Taro builds (linjing-editorial) (push) Has been skipped
CI / Browser regression (push) Has been skipped
2026-10-21 11:49:40 +08:00
que01 adcaa12970 feat: 接通后台渲染异常上报与响应契约校验 2026-10-21 11:43:41 +08:00
que01 330d67adc1 docs: 更新生产发布状态
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
2026-10-21 11:06:23 +08:00
que01 737010ea03 fix: 后台外壳容忍异常品牌成员数据
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
2026-10-21 11:03:55 +08:00
que01 ec84988e57 docs: 更新生产发布状态
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
2026-10-21 11:00:37 +08:00
que01 f266bda3a9 test: 覆盖后台渲染异常页面
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
2026-10-21 10:56:51 +08:00
que01 88ab2561bd fix: 增加后台渲染错误边界 2026-10-21 10:56:51 +08:00
que01 98c7701ccd docs: 更新生产发布状态
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
2026-10-21 10:50:14 +08:00
que01 e752a3b7ed docs: 记录发布流程回归覆盖
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
2026-10-21 10:47:38 +08:00
que01 9389235a6c test: 补充发布流程浏览器回归 2026-10-21 10:47:30 +08:00
que01 a293591dba fix: 修正小程序配置表单实例归属 2026-10-21 10:47:30 +08:00
que01 8c5860699f docs: 更新生产发布状态
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
2026-10-21 10:37:36 +08:00
que01 06619a191f refactor: 提示与确认框改用 App 上下文实例
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
2026-10-21 10:34:34 +08:00
que01 3a0099e674 refactor: 迁移 Ant Design 6 弃用的 Alert 与 Space 属性 2026-10-21 10:30:03 +08:00
que01 ca1b873a50 docs: 更新生产发布状态
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
2026-10-21 10:28:25 +08:00
que01 c2bd956b07 docs: 更新项目状态与交付证据
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
2026-10-21 10:22:44 +08:00
que01 b101d169c9 fix: 前置发布构建的 Node 版本门禁 2026-10-21 10:22:44 +08:00
que01 ab17f80607 fix: 修正品牌创建与页面方案交互 2026-10-21 10:22:44 +08:00
que01 6df4e1d72b docs: 补充模板契约发布快照刷新流程
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
2026-10-21 09:02:16 +08:00
que01 cb046a4c27 fix: 支持显式放行遗留字段删除的重发分类 2026-10-21 09:00:05 +08:00
que01 3738be884b chore: 更新模板完成证据源码哈希 2026-10-20 22:25:16 +08:00
que01 193858c727 fix: 增加模板契约发布快照重发工具 2026-10-20 22:14:55 +08:00
que01 ea81c754ed test: 增加发布包运行时预检 2026-10-20 21:24:21 +08:00
que01 16fd827634 fix: 收口发布包完整性与模板契约迁移 2026-10-20 17:59:11 +08:00
que01 38e9d59864 chore: 更新模板完成证据源码哈希 2026-10-20 17:37:34 +08:00
que01 fb072d844b fix: 补齐发布包补丁文件 2026-10-20 17:35:04 +08:00
que01 0d9f4a7d6f refactor: 拆分品牌业务类型与页面方案
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
2026-10-20 17:04:30 +08:00
que01 f02e2cafbb test: 增加 API 路由覆盖门禁 2026-10-19 20:13:47 +08:00
que01 5d88cb2040 test: 补齐 Admin 会话边界回归 2026-10-19 11:35:41 +08:00
que01 8e29932bc6 fix: 修复首次登录会话恢复 2026-10-19 10:58:26 +08:00
que01 4ef4be2071 refactor: 收口 Admin 会话与授权边界 2026-10-19 10:13:13 +08:00
que01 0788480ce3 fix: 收口审查发现的 CI 与授权边界
将 admin identity helper 移到共享边界,清理跨 feature 导入;修复 CI 集成环境、浏览器数据库/Playwright 配置;增强 doctor source hash 对重命名文件的处理,并补充 logout API 文档。
2026-10-19 00:28:37 +08:00
que01 bd129a3069 fix: 收口会话边界与 CI 环境
统一 Admin 会话解析、避免登出未处理异常,补充 admin/customer logout 与品牌切换契约文档;修正 CI integration 缺少数据库/会话环境的问题,并刷新 doctor source hash。
2026-10-19 00:09:39 +08:00
que01 3017e3eb49 fix: 收口依赖兼容与会话撤销
为 miniprogram-ci 和 Jimp 依赖增加兼容 patch 与 smoke test;修复平台模板管理员路由漏配;收紧模板契约校验;为 admin/customer 增加 token 撤销和集中会话存储;同步品牌切换角色、doctor source hash、多屏宽截图证据和 CI 构建门禁。
2026-10-18 23:43:25 +08:00
que01 4f0b50c7f1 fix: 收口模板契约与安全门禁
统一模板包 visual 契约并补齐完成证据;修复 release 版本一致性、管理员 token 撤销、CORS 与默认品牌配置;收敛依赖安全风险并完成全量回归验证。
2026-10-18 22:05:31 +08:00
que01 456171aa85 fix: 收口模板契约迁移预检 2026-10-18 17:45:15 +08:00
que01 50b87e48de refactor: 统一模板契约并修复预览版本 2026-10-18 17:09:09 +08:00
que01 cd2992c00a fix: 修复模板画布点选与保存切页回归 2026-10-18 13:40:01 +08:00
que01 e6d843b4a7 fix: 将模板失败概览操作类别改为中文 2026-10-18 13:40:01 +08:00
que01 5a93d38437 docs: 归档阶段八隔离验收与迁移审查 2026-10-17 22:39:43 +08:00
que01 bba20c5b28 docs: 记录阶段八本地验收证据 2026-10-17 21:37:03 +08:00
que01 b47cf5badc docs: 启动模板真实验收阶段 2026-10-17 21:34:52 +08:00
que01 71c528de34 feat: 收口模板升级与阶段七持续回归 2026-10-17 21:33:57 +08:00
que01 ec16fff70e feat: 收口小程序构建上传阶段 2026-10-17 18:01:38 +08:00
que01 6420b85019 fix: 修复林境模板包预览资源版本 2026-10-17 16:03:47 +08:00
que01 c1633fb6f3 fix: 禁止已撤回模板进入预览 2026-10-17 14:49:05 +08:00
que01 d1958a7d7f feat: 完成模板管理阶段4闭环 2026-10-17 13:56:19 +08:00
que01 b1e8012ded fix: 收口模板预览状态与媒体矩阵 2026-10-16 22:53:05 +08:00
que01 5bf54096be feat: 完成模板预览隔离与矩阵验收 2026-10-16 20:36:57 +08:00
que01 d38dbe02aa feat: 增加模板预览短期隔离上下文 2026-10-16 19:46:38 +08:00
que01 b60174885e feat: 分离模板演示数据并校验预览资源 2026-10-16 17:55:52 +08:00
que01 6edde5a8d6 feat: 增加模板版本独立预览入口 2026-10-16 17:28:07 +08:00
que01 413413efda feat: 完成模板目录导入与生命周期管理 2026-10-16 16:34:24 +08:00
que01 553a07c4ec feat: 增加模板自动一致性校验 2026-10-16 14:12:46 +08:00
que01 cddf836f4f feat: 增加模板确定性打包命令 2026-10-16 14:01:45 +08:00
que01 58370224b5 docs: 固化模板管理现状盘点 2026-10-16 13:43:33 +08:00
que01 b6713ea34c fix: 统一模板包版本与校验 2026-10-16 13:35:18 +08:00
que01 1918dae36b docs: 固化模板管理与分发交付计划 2026-10-16 13:13:12 +08:00
que01 3989fbd39e test: 同步工坊模板审查记录 2026-10-16 11:53:27 +08:00
que01 cfd42e17f8 refactor: 收敛工坊模板页面职责与视觉 2026-10-16 11:40:37 +08:00
que01 f12003004b style: 按设计稿收敛工坊首页视觉 2026-10-16 10:07:46 +08:00
que01 6de7dd8d9e fix: 恢复工坊首页主理人身份卡 2026-10-16 09:26:00 +08:00
que01 0862a4c01d fix: 调整工坊模板第三个Tab为我的 2026-10-16 00:19:23 +08:00
que01 18eb8bb9b0 fix: 安装发布依赖闭包 2026-10-15 23:47:36 +08:00
que01 a933e1feb6 fix: 修复小程序构建进度死锁 2026-10-15 23:42:08 +08:00
que01 f7be18a35e fix: 合并发布依赖安装避免链接丢失 2026-10-15 23:32:26 +08:00
que01 714cbd55f2 fix: 补齐发布包中的 Taro 构建工程 2026-10-15 23:26:04 +08:00
que01 50753db79d fix: 完善工坊模板安装预览与详情样例 2026-10-15 20:58:45 +08:00
que01 5313fd9d32 chore: 合并主分支后台路由修复 2026-10-15 17:50:47 +08:00
que01 34bd8142de fix: 修复后台菜单路由匹配和概览重定向循环 2026-10-15 17:50:30 +08:00
que01 04e42b3a80 feat: 新增独立工坊宣传模板及配置导入验证 2026-10-15 17:44:52 +08:00
que01 bf4bbf81c7 refactor: 拆分管理端入口并优化构建分包 2026-10-15 15:10:21 +08:00
que01 0f6ad8b993 docs: 记录API模块边界决策 2026-10-15 14:59:21 +08:00
que01 2ad009f5c0 refactor: 拆分媒体上传职责并锁定API路由 2026-10-15 14:52:59 +08:00
que01 6f18c67315 refactor: 拆分品牌展示编辑器职责 2026-10-15 14:42:20 +08:00
que01 b23120477f refactor: 拆分后台工作区与API模块 2026-10-15 14:35:16 +08:00
que01 12bc263d3b test: 补充小程序发布服务边界测试 2026-10-15 14:35:16 +08:00
que01 7c0f22ad7a refactor: 拆分小程序发布与后台发布页面职责 2026-10-15 14:20:17 +08:00
que01 8973338c64 fix: 完善记录错误状态与缓存失效策略 2026-10-15 13:58:39 +08:00
que01 476e3d93dd fix: 修复 API 前缀下的管理端鉴权绕过 2026-10-15 13:42:29 +08:00
que01 3ae7b462f5 refactor: 将数据库访问从控制器下沉到服务层 2026-10-14 17:53:49 +08:00
que01 f158f906d5 fix: 修复系统一致性与安全问题 2026-10-14 17:36:46 +08:00
que01 aaeec14733 fix: 保证品牌模板身份不被台账漂移 2026-10-14 16:27:23 +08:00
que01 6073e72940 feat: 收敛行业模板身份为品牌单一真相
- BrandProfile.templateKey 为唯一真相,安装记录降级为同模板的版本台账
- 安装只允许补建当前模板台账,跨行业模板请求返回 400,杜绝身份漂移
- preview 不再强制要求台账存在,台账缺失时以模板目录版本为准
- seed 按品牌身份补齐模板台账,消除「身份有、台账无」
- 记录 ADR 0026
2026-10-14 13:55:54 +08:00
que01 896f3240f9 refactor: 拆分模板治理与咨询表单页面
- /admin/workspace 收敛为「咨询表单与字段」,只做咨询入口表单与高级自定义字段
- 行业模板版本升级/回滚迁入「配置与发布 → 内容发布 → 选择表达方式」
- 移除行业模板安装入口、视觉模板历史与模板组合预览等不可达 UI
- 表单下拉的业务选项改用本品牌后台数据,避免公开接口回退默认品牌导致跨品牌串数据
- 侧栏导航与设计文档同步
2026-10-14 13:55:35 +08:00
que01 7b1e9eee47 fix: 校验咨询表单关联业务并修正发布清单文案
- 关联的业务提供项必须存在且属于当前品牌,非法 id 返回 400 而不是数据库外键错误
- targetType 由 offeringId 推导,允许传 null 改回品牌通用入口
- 业务被停用时在发布准备度里点名说明,避免静默卡住发布
- 发布清单条目改为中性描述,是否达标交给状态标签表达
2026-10-14 13:55:00 +08:00
que01 47d6309cba style: 重做后台页头层级与页面命名
- 页头标题 24px 降到 20px,说明 14px 降到 13px,标题与说明间距 8px 收到 6px
- 页头到主体间距从 24px 提到 32px,与卡片间 16px 拉开层级
- 说明文字增加 880px 最大宽度,长句不再横跨整行
- 页面标题与侧栏导航用词对齐:信任内容、业务提供项、小程序页面、能力插件
- 信任内容页说明文案精简到一行内
- 概览页对象主标题降到 18px,避免与页面标题同级
- design.md 同步字号表、页头规范与导航命名约定
2026-10-14 12:07:33 +08:00
que01 ebab77057a fix: 修复信任内容列表展示问题
- 列表按模板声明的类型顺序排列,与必填清单顺序一致
- 类型标签并入说明行,去掉与类型重复的标签;展示位置改为可读页面名
- 类型未识别时页面名补充中文映射(service/inquiry)
- 无配图时按类型显示线性图标,替换统一的文件图标
- 摘要长文本按前 3 个字段截断,避免单行超长
- 记录行改为顶部对齐,操作按钮垂直居中,行内段落间距交给 gap
- Modal destroyOnClose 迁移到 destroyOnHidden,消除 antd 弃用告警
- 发布必填清单显示同类已配置条数,已配置区块显示总数
2026-10-14 11:47:56 +08:00
que01 3ef46b0aa8 feat: 完善后台设计语言细节
- 统一说明文案层级:Typography.Paragraph 次要文案迁移到 admin-section-description
- 状态色补齐边框与中间调令牌,Alert/错误条/Descriptions 与 StatusTag 同源
- 咨询详情描述列表去表格线,改为键值展示并统一令牌
- 新增 BrandMark,侧栏与登录页标识改用品牌首字
- 信任内容改用列表行,空状态、表格骨架屏、主按钮脏检查落地
- design.md 同步令牌映射、切换控件选型与组件清单
2026-10-14 11:21:31 +08:00
que01 2f26828f09 feat: 统一 Admin 后台设计语言
用中性灰底 + 单一强调色重做后台视觉,并集中到一套令牌:

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

设计规范见 apps/admin/design.md。
2026-10-14 10:54:05 +08:00
que01 bb94d80e13 fix: 修正 H5 按钮高度令牌不生效
共享按钮令牌声明在 app.css 的 page 选择器里,而 H5 渲染树没有 page 元素,导致
var(--brand-button-height) 解析失败、min-height 退化成 auto:H5 预览按钮实际高 38px
(内容撑开),与小程序 88rpx(375px 视口等于 44px)不一致,也违反模板完成度规则的
双端 reset 一致要求。

- 令牌改为同时声明在 page 与 body 上,值仍只写一次;微信端取 page,H5 取 body;
- 新增浏览器守卫,断言首页按钮 min-height 解析为 44px 且实际高度一致;
- 在模板完成度规则中记录该根因,避免声明被挪回单一 page 选择器。

验证:weapp 产物输出 page,body{--brand-button-height:88rpx},H5 输出 page,body{2.2rem};
浏览器实测 375px 视口下 min-height/height 均为 44px,430px 视口为 50.45px,与小程序
rpx 缩放一致;把声明改回 page-only 后守卫按预期失败(Received: "auto"),恢复后 12 项
浏览器回归全部通过;六类产物指纹残留为 0;format、lint、typecheck 通过。
2026-10-13 23:44:12 +08:00
que01 29e5666d74 refactor: 共享按钮尺寸令牌改用中性命名
--taro-button-height / --taro-button-compact-height 是本仓库自有的共享令牌,却借用了
框架名。源码级中性命名比产物替换更彻底,也不会出现源码与产物两套名字,因此改为
--brand-button-height / --brand-button-compact-height,与既有的 brand-button 组件命名一致;
产物遮蔽仍按同一张表处理 Taro 自身的标识符。

验证:weapp 的 app-origin.wxss 输出 page{--brand-button-height:88rpx} 与
button{min-height:var(--brand-button-height)};H5 与后台产物的声明与引用同步改名;
六类产物残留指纹均为 0;H5 预览 11 项浏览器回归通过;遮蔽前后后台产物用生产静态
服务器跑同一套测试,失败内容逐字节一致;format、lint、typecheck 通过。
2026-10-13 23:30:07 +08:00
que01 d34cb182e3 test: 修正首页行动按钮的失效断言
首页行动按钮在 inquiry 能力停用时退化为 Text,H5 端 Button 又渲染为 taro-button-core
自定义元素,两种情况都没有原生 button,因此按标签断言恒为 0。改为按稳定的
.home-action 类名断言,H5 预览的 11 项浏览器回归由 10 通过恢复为全部通过。
2026-10-13 23:18:56 +08:00
que01 4d1cd8f365 feat: 遮蔽后台静态产物中的 Taro 指纹
Traefik 把 wechat.app.que01.top 上除 /api、/media 以外的路径直接转发到 Admin 静态
服务器且没有鉴权,因此 /admin/assets/*.js 可以被任意下载。后台产物里的模板 renderer
glob 路径(packages/template-*/taro/index.tsx)与按钮尺寸令牌(--taro-button-height)
同样暴露技术栈,此前只遮蔽了 Taro 双端产物。

- mask-taro.cjs 增加 admin 目标,覆盖 apps/admin/dist,接入根脚本 build:admin:preview;
- deploy:package 在后台构建后校验 apps/admin/dist,命中指纹即中止打包;
- 补充遮蔽目标测试与文档(ADR 0025、README、部署说明、交付清单)。

验证:后台产物遮蔽后 glob key 与运行时查找同步改名;未遮蔽/已遮蔽产物用生产静态
服务器跑同一套后台浏览器测试,失败内容逐字节一致(既有失败与本改动无关);H5 预览
11 项浏览器回归全部通过;admin 构建、lint、typecheck、deploy 与 API 测试通过。
2026-10-13 23:18:43 +08:00
que01 9ad2776515 feat: 遮蔽产物中的 Taro 指纹
H5 预览与小程序产物会带出 taro_tmpl、taro-*-core、taro.js、--taro-button-height、
project.config.json 的 projectname 等指纹,而 Taro 4.3 没有隐藏这些名称的配置。
改为在 build:h5、build:weapp、build:preview 之后按 apps/taro/config/mask.config.json
做构建后处理:

- 同一张替换表同时作用于文件名与文本内容,重命名后引用保持同步,长度 ≥ 40 的 base64/哈希片段原样保留;
- 遮蔽后仍命中 forbidden 词表时构建失败,并把 project.config.json 的 projectname/description 中性化;
- dev:h5、dev:preview 保持原始命名,便于本地调试;改架构名只改 mask.config.json;
- 产物契约测试先用 unmask() 还原再断言,浏览器测试选择器写成 :is(<源码名>, <遮蔽名>)。

取舍与迁移见 docs/adr/0025-build-output-stack-masking.md。
2026-10-13 23:03:32 +08:00
que01 53713e5935 fix: 上传缓存目录不再污染仓库
miniprogram-ci 的 SummerCompiler 用 path.join("", md5(projectPath + "|summer"))
建编译缓存,得到的是相对路径,会创建在进程工作目录下。上传子进程此前继承
API 进程的工作目录,于是每次上传都在 apps/api 下留下一个 32 位十六进制空目录。

把上传子进程的工作目录固定到 MINIAPP_UPLOAD_WORKSPACE(默认系统临时目录),
缓存随之落在临时目录,仓库保持干净;projectPath 一直是绝对路径,行为不受影响。

用真实 ensureCacheDir 验证目录落在临时工作目录,并断言仓库内不再新增缓存目录。
2026-10-13 22:11:33 +08:00
que01 ac3f433ee6 feat: 重做小程序发布任务卡片并支持配置请求地址
- 发布任务卡片拆为 MiniAppReleaseCard,状态用中文映射并附下一步说明,构建日志收进折叠面板,构建中自动滚动到底部
- 小程序配置增加“小程序请求地址”字段,展示当前生效域名,未配置时直接提示原因与修复位置
- 顶部上传按钮在无任务时自动创建发布任务,不再报“还没有可发布的内容版本”
- 构建轮询在任务被判定为中断后停止,避免页面空转请求
2026-10-13 21:59:00 +08:00
que01 44fe7a0142 fix: 打通小程序代码上传链路
小程序上传此前连续失败,根因分散在状态机、产物路径、模块导入、私钥解析和进程隔离上,逐项修复:

- 构建进度改用 updateBuild 只写 buildStatus/buildLogs,不再用 updateStatus 记录进度,避免状态机拒绝自我迁移而返回 409
- 产物目录锚定仓库根目录,不再随 API 进程工作目录变成 apps/api/apps/taro/dist
- miniprogram-ci 为 CommonJS 包,动态导入后从 default 归一化取 Project/upload,替换原有的类型断言
- 上传私钥统一还原成合法 PEM;输入框曾把换行吞成单行,导致 OpenSSL 解码失败,现保存时校验、上传时自动修复存量数据
- 上传改在独立子进程执行,miniprogram-ci 崩溃或超时不再终止 API 进程,失败返回 502 并保留微信原始错误
- 构建超过 MINIAPP_BUILD_STALE_MS 无进度即视为中断,允许重新上传,避免任务永久卡在 building
- 构建前校验请求地址与 AppID,请求地址支持在品牌配置中维护,环境变量仅作回落,避免再打出指向 localhost 的包
- 小程序 /media/ 按请求地址的 origin 解析,不再依赖网关剥离 /api 前缀

新增对应单测与集成断言,并更新部署说明。
2026-10-13 21:58:48 +08:00
que01 f52577ff9e fix: 兼容线上小程序构建状态迁移 2026-10-13 20:34:40 +08:00
que01 8e90b8ca09 fix: 分离小程序构建状态与发布状态 2026-10-13 20:31:49 +08:00
que01 998e32e49c feat: 展示小程序构建过程和日志 2026-10-13 20:20:13 +08:00
que01 8b4d27b0ee fix: 按模板包定位小程序构建产物 2026-10-13 20:06:52 +08:00
que01 26f1157083 fix: 恢复小程序上传配置并固定产物目录 2026-10-13 19:56:45 +08:00
que01 ad949ab370 feat: 简化小程序上传入口 2026-10-13 17:58:57 +08:00
que01 d5a84b51a7 fix: 恢复 API 编译运行并支持 watch 2026-10-13 17:53:57 +08:00
que01 760f41a584 chore: API 开发模式支持热重载 2026-10-13 17:51:45 +08:00
que01 20f880a761 fix: 修正发布中心标签页内容归属 2026-10-13 17:47:38 +08:00
que01 ab1531d9b0 feat: 拆分发布中心内容和小程序标签页 2026-10-13 17:41:52 +08:00
que01 3d0252d187 feat: 支持小程序上传配置加密存储 2026-10-13 17:28:40 +08:00
que01 526a9db789 feat: 实现小程序代码发布任务闭环 2026-10-13 17:13:24 +08:00
que01 9b35b8e7a7 docs: 确认小程序发布中心架构 2026-10-13 17:12:47 +08:00
que01 14b6541bee fix: 避免编辑覆盖层触发画布选中 2026-10-13 16:28:15 +08:00
que01 00edcedbcf fix: 优化预览区域选择提示布局 2026-10-13 16:04:19 +08:00
que01 dcf1d76944 fix: 修复本地图片上传与发布进程切换 2026-10-13 16:00:42 +08:00
que01 7f67f4d685 chore: 增加部署状态与备份保留 2026-10-13 15:14:27 +08:00
que01 d2ca528543 fix: 完善部署回滚健康检查
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
2026-10-13 15:05:02 +08:00
que01 47a24e0d53 chore: 固化一键生产部署流程
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
2026-10-13 14:56:16 +08:00
que01 c78deafee3 fix: 清理模板编译失败产物并登记审查 2026-10-13 11:37:43 +08:00
que01 3330b536dc fix: 统一小程序按钮契约并补齐模板图标 2026-10-13 11:12:53 +08:00
que01 07629a4596 fix: 补全小程序媒体地址并支持构建注入 AppID 2026-10-13 09:51:38 +08:00
que01 5c6ad02f46 chore: 完善生产发布与部署校验 2026-10-13 09:19:57 +08:00
que01 048c42207c chore: 添加生产级 Docker 部署配置与 ARM64 支持
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
2026-10-12 18:19:29 +08:00
que01 67735afd45 chore: 忽略本地调试产物 2026-10-12 15:33:03 +08:00
que01 0574a85632 fix: 修复预览 loading 与媒体代理 2026-10-12 15:31:25 +08:00
que01 18ddf125be fix: 修复品牌预览渲染循环与区域点选 2026-10-12 12:00:46 +08:00
que01 bb0709b8cc feat: 能力插件元数据与运行时消费闭环 2026-10-12 11:20:43 +08:00
que01 076c6124c8 refactor: Taro 模板发现与校验收敛为目录驱动 2026-10-12 10:06:20 +08:00
que01 89fdfd7d83 refactor: 模板注册与默认模板收敛到目录驱动 2026-10-12 10:00:46 +08:00
que01 f87b26b201 merge: 合并代码结构标准重构 2026-10-12 05:11:26 +08:00
que01 466dc66907 refactor: 拆分业务、信任内容与公共工作台模块 2026-10-12 05:11:26 +08:00
que01 357f271639 refactor: 拆分 API Client 资源模块 2026-10-12 03:37:05 +08:00
que01 f3adf7bc15 style: 格式化工作台控制器 2026-10-12 03:36:57 +08:00
que01 4512d2601d refactor: 拆分工作台业务服务边界 2026-10-12 03:29:30 +08:00
que01 d0902d6568 refactor: 拆分模板配置契约与注册逻辑 2026-10-12 03:26:43 +08:00
que01 7e1dd543fb refactor: 拆分工作台查询与模板变更逻辑 2026-10-12 03:17:28 +08:00
que01 3003e7801d refactor: 建立代码标准并拆分品牌编辑状态 2026-10-12 03:08:24 +08:00
que01 567921e726 feat: 还原示例图片并优化媒体选择交互 2026-10-12 02:48:14 +08:00
que01 03f947e9b8 feat: 迁移示例媒体到本地存储 2026-10-12 02:09:08 +08:00
que01 6ac2d9421b feat: 支持本地媒体存储与上传回退 2026-10-12 01:39:56 +08:00
que01 aa42e7b866 fix: 修复 Admin 浏览器运行缺少 process 2026-10-12 01:05:18 +08:00
que01 e09b56e0f3 feat: 完善媒体存储状态与上传失败提示 2026-10-12 01:00:02 +08:00
que01 84956b8fe2 feat: 接入对象存储图片直传 2026-10-12 00:55:30 +08:00
que01 f57c0ca0ea ci: 增加发布产物打包脚本 2026-10-12 00:46:07 +08:00
que01 9c15a822e9 ci: 增加部署后发布验收脚本 2026-10-12 00:44:21 +08:00
que01 85f37d2eae ci: 建立完整发布门禁流水线 2026-10-12 00:41:14 +08:00
que01 222055595c docs: 明确模板预览产物结构 2026-10-12 00:26:18 +08:00
que01 b1d5c2b4b0 docs: 补充生产发布基线 2026-10-12 00:23:36 +08:00
que01 787a50369f fix: 收敛分类键运行时契约 2026-10-12 00:03:03 +08:00
que01 422162e580 chore: 移除林然演示品牌数据 2026-10-11 23:26:54 +08:00
que01 26bcb2b66e feat: 完善模板字段编辑与分类治理 2026-10-11 23:07:53 +08:00
que01 91322fa9a0 feat: 统一业务内容双入口编辑预览 2026-10-11 12:55:13 +08:00
572 changed files with 67001 additions and 13081 deletions

No files matched your search

@@ -0,0 +1,260 @@
{
"schemaVersion": 1,
"scope": "模板完成证据登记,保留命令、日志与产物哈希",
"generatedAt": "2026-10-23T11:27:49.824Z",
"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": "1dbd5f3a24cc1f86925b4bcd05c99b45cc00d6a39dabe2302ad07ba7f763c79c"
}
@@ -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)
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -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)
File diff suppressed because it is too large. Load diff
@@ -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)
File diff suppressed because it is too large. Load diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

+25
View File
@@ -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/**
+23 -4
View File
@@ -6,13 +6,32 @@ 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=
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
WECHAT_APP_ID=
WECHAT_APP_SECRET=
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
+42
View File
@@ -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
# 单实例使用 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 只放在服务器环境变量中
WECHAT_APP_ID=
WECHAT_APP_SECRET=
# 小程序请求地址正常情况下在后台「小程序上传配置」维护;
# 这里仅作为后台未配置时的回落值(否则由 PUBLIC_BASE_URL + /api 推导)
# MINIAPP_API_BASE_URL=https://wechat.app.que01.top/api
# MINIAPP_BUILD_STALE_MS=900000
+178
View File
@@ -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
+6
View File
@@ -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
+12 -1
View File
@@ -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/
@@ -18,5 +20,14 @@ 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
View File
@@ -8,6 +8,7 @@
- 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.
+150 -84
View File
@@ -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。
+1
View File
@@ -3,3 +3,4 @@ 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
+420
View File
@@ -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`。
+4
View File
@@ -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>
+1
View File
@@ -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",
+15
View File
@@ -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) }),
);
}
+188
View File
@@ -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>
);
}
+87
View File
@@ -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>
);
}
+14
View File
@@ -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 });
}
+65
View File
@@ -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} />;
}
+6
View File
@@ -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>
);
}
}
+1
View File
@@ -0,0 +1 @@
export { Form as AdminForm, Input as AdminInput } from "antd";
+12
View File
@@ -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,
});
+6
View File
@@ -0,0 +1,6 @@
import { Menu } from "antd";
import type { MenuProps } from "antd";
export function AdminMenu(props: MenuProps) {
return <Menu {...props} />;
}
+5 -15
View File
@@ -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} />;
}
+17
View File
@@ -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>;
}
+25
View File
@@ -0,0 +1,25 @@
import type { ReactNode } from "react";
export function EmptyState({
icon,
title,
description,
action,
compact = false,
}: {
icon?: ReactNode;
title: string;
description?: string;
action?: ReactNode;
compact?: boolean;
}) {
const className = compact ? "admin-empty admin-empty--compact" : "admin-empty";
return (
<div className={className}>
{icon ? <span className="admin-empty__icon">{icon}</span> : null}
<p className="admin-empty__title">{title}</p>
{description ? <p className="admin-empty__description">{description}</p> : null}
{action ? <div className="admin-empty__action">{action}</div> : null}
</div>
);
}
+120 -15
View File
@@ -1,33 +1,138 @@
import { Image, Input, Space, Typography } from "antd";
import { CloudUploadOutlined, DeleteOutlined, PictureOutlined } from "@ant-design/icons";
import { Alert, App, Button, Image, Popconfirm, Spin, Upload } from "antd";
import { useEffect, useMemo, useState } from "react";
import { apiBaseUrl, authenticatedFetch, createApiClient } from "../lib/api.js";
interface ImageUrlFieldProps {
id?: string;
value?: string;
onChange?: (value: string) => void;
placeholder?: string;
scope?: "brand" | "offering" | "trust";
}
export function ImageUrlField({ value, onChange, placeholder }: ImageUrlFieldProps) {
export function ImageUrlField({ id, value, onChange, placeholder, scope }: ImageUrlFieldProps) {
const { message } = App.useApp();
const imageUrl = typeof value === "string" ? value.trim() : "";
const [uploading, setUploading] = useState(false);
const [storageStatus, setStorageStatus] = useState<
"loading" | "ok" | "unavailable" | "unconfigured"
>("loading");
const client = useMemo(() => createApiClient(), []);
useEffect(() => {
let active = true;
client
.getUploadConfig()
.then((config) => {
if (active) setStorageStatus(config.configured ? config.status : "unconfigured");
})
.catch(() => {
if (active) setStorageStatus("unavailable");
});
return () => {
active = false;
};
}, [client]);
async function upload(file: File) {
if (!file.type.startsWith("image/")) {
message.error("仅支持图片文件");
return;
}
if (file.size > 10 * 1024 * 1024) {
message.error("图片不能超过 10MB");
return;
}
setUploading(true);
try {
const presign = await client.createPresignedUpload({
fileName: file.name,
contentType: file.type,
...(scope ? { scope } : {}),
});
const isLocalUpload = presign.mode === "local";
const uploadUrl = isLocalUpload
? `${apiBaseUrl.replace(/\/$/, "")}${presign.uploadUrl}`
: presign.uploadUrl;
const response = await authenticatedFetch(uploadUrl, {
method: "PUT",
headers: { "content-type": file.type },
body: file,
});
if (!response.ok) throw new Error(`upload failed: ${response.status}`);
onChange?.(presign.publicUrl);
} catch (error) {
message.error(error instanceof Error ? error.message : "图片上传失败,请重试");
} finally {
setUploading(false);
}
}
return (
<Space direction="vertical" size={8} style={{ width: "100%" }}>
<Input
value={value}
onChange={(event) => onChange?.(event.target.value)}
placeholder={placeholder ?? "粘贴图片地址"}
/>
<div className="admin-field-stack-xs admin-block">
{storageStatus !== "ok" ? (
<Alert
type={storageStatus === "loading" ? "info" : "warning"}
showIcon
title={
storageStatus === "loading"
? "正在检查媒体存储..."
: storageStatus === "unconfigured"
? "媒体存储未配置,请先设置对象存储"
: "媒体存储不可用,请检查对象存储配置"
}
/>
) : null}
{imageUrl ? (
<Space align="start">
<div className="admin-media-preview">
<Image
src={imageUrl}
width={96}
height={64}
alt={placeholder ?? "图片预览"}
width="100%"
height={180}
preview
fallback="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="
style={{ objectFit: "cover", borderRadius: 8, background: "#f5f5f5" }}
/>
<Typography.Text type="secondary">预览图</Typography.Text>
</Space>
<Popconfirm title="移除这张图片?" onConfirm={() => onChange?.("")}>
<Button danger size="small" icon={<DeleteOutlined />} className="admin-thumb-remove">
移除
</Button>
</Popconfirm>
</div>
) : (
<Upload.Dragger
accept="image/*"
multiple={false}
showUploadList={false}
disabled={uploading || storageStatus !== "ok"}
beforeUpload={(file) => {
if (storageStatus === "ok") void upload(file);
return false;
}}
>
<p className="ant-upload-drag-icon">{uploading ? <Spin /> : <PictureOutlined />}</p>
<p className="ant-upload-text">{uploading ? "上传中..." : "点击或拖拽上传图片"}</p>
<p className="ant-upload-hint">JPG、PNG、WebP 或 AVIF,最大 10MB</p>
</Upload.Dragger>
)}
{storageStatus === "unavailable" ? (
<Button
icon={<CloudUploadOutlined />}
onClick={() => {
setStorageStatus("loading");
client
.getUploadConfig()
.then((config) =>
setStorageStatus(config.configured ? config.status : "unconfigured"),
)
.catch(() => setStorageStatus("unavailable"));
}}
>
重新检查存储
</Button>
) : null}
</Space>
<input {...(id ? { id } : {})} type="hidden" value={imageUrl} />
</div>
);
}
@@ -0,0 +1,17 @@
import { AdminCard } from "./AdminCard.js";
import { AdminSkeleton } from "./AdminSkeleton.js";
export function LoadingStack({ rows = 3 }: { rows?: number }) {
return (
<div className="admin-loading-stack">
<AdminCard>
<AdminSkeleton active paragraph={{ rows: 2 }} title={false} />
</AdminCard>
{Array.from({ length: rows }).map((_, index) => (
<AdminCard key={index}>
<AdminSkeleton active paragraph={{ rows: 1 }} title={false} />
</AdminCard>
))}
</div>
);
}
+25
View File
@@ -0,0 +1,25 @@
import { Card } from "antd";
import type { ReactNode } from "react";
export function MetricCard({
label,
value,
suffix,
extra,
}: {
label: ReactNode;
value: ReactNode;
suffix?: ReactNode;
extra?: ReactNode;
}) {
return (
<Card>
<div className="admin-metric-label">{label}</div>
<div className="admin-metric-value">
{value}
{suffix ? <span className="admin-metric-suffix">{suffix}</span> : null}
</div>
{extra}
</Card>
);
}
+27 -27
View File
@@ -1,5 +1,10 @@
import { Alert, Button, Card, Empty, Result, Spin } from "antd";
import { Button } from "antd";
import type { ReactNode } from "react";
import { LoadingStack } from "./LoadingStack.js";
function errorMessage(error: unknown, fallback: string) {
return error instanceof Error ? error.message : fallback;
}
export function QueryState({
loading,
@@ -12,36 +17,31 @@ export function QueryState({
onRetry?: () => void;
children?: ReactNode;
}) {
if (loading)
return (
<Card>
<Spin />
</Card>
);
if (error) {
return (
<Result
status="error"
title="内容加载失败"
subTitle={error instanceof Error ? error.message : "请检查 API 服务后重试"}
extra={onRetry ? <Button onClick={onRetry}>重新加载</Button> : undefined}
/>
);
}
if (loading) return <LoadingStack />;
if (error) return <ErrorNote error={error} onRetry={onRetry} />;
return <>{children}</>;
}
export function EmptyState({ description }: { description: string }) {
return <Empty description={description} image={Empty.PRESENTED_IMAGE_SIMPLE} />;
export function ErrorNote({
error,
onRetry,
}: {
error?: unknown;
onRetry?: (() => void) | undefined;
}) {
if (!error) return null;
return (
<div className="admin-error-note" role="alert">
<span>{errorMessage(error, "操作失败,请重试")}</span>
{onRetry ? (
<Button type="link" size="small" onClick={onRetry}>
重试
</Button>
) : null}
</div>
);
}
export function MutationError({ error }: { error?: unknown }) {
if (!error) return null;
return (
<Alert
type="error"
showIcon
message={error instanceof Error ? error.message : "操作失败,请重试"}
/>
);
return <ErrorNote error={error} />;
}
+36 -129
View File
@@ -1,95 +1,42 @@
import {
Alert,
Button,
Col,
Form,
Input,
InputNumber,
Row,
Select,
Space,
Switch,
Typography,
message,
} from "antd";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { useEffect, useMemo } from "react";
import { Alert, Button, Col, Form, Row, Space, Typography } from "antd";
import { useNavigate } from "react-router-dom";
import type {
Offering,
TemplateAdminField,
TemplateAdminSection,
TrustContent,
} from "@personal-brand/api-client";
import { createApiClient } from "../lib/api.js";
import { ImageUrlField } from "./ImageUrlField.js";
import type { TemplateAdminSection } from "@personal-brand/api-client";
import { TemplateListField } from "./TemplateListField.js";
import { TemplateFieldRenderer } from "./TemplateFieldRenderer.js";
import { MutationError } from "./QueryState.js";
import {
applyPresentationValues,
applyStandardEntityValues,
presentationFieldName,
readPresentationValue,
type PresentationValues,
} from "../features/brand/presentation-bindings.js";
import { presentationFieldName } from "../lib/presentation/presentation-bindings.js";
import { useRecordContentEditorState } from "./record-content/useRecordContentEditorState.js";
import type { RecordContentEditorProps, RecordContentSource } from "./record-content/types.js";
export type RecordContentSource = "offering" | "trust";
export type { RecordContentEditorProps, RecordContentSource };
export interface RecordContentEditorProps {
source: RecordContentSource;
record: Offering | TrustContent;
export function RecordContentFields({
section,
sectionKey = section.key,
}: {
section: TemplateAdminSection;
context: "visual" | "services";
onDraft?: (values: PresentationValues) => void;
onSaved?: () => void;
visualSelection?: { targetKey: string; page: string };
}
function renderField(field: TemplateAdminField) {
if (field.input === "textarea")
return (
<Input.TextArea
rows={3}
maxLength={field.maxLength}
showCount={!!field.maxLength}
placeholder={field.placeholder}
/>
);
if (field.input === "image")
return <ImageUrlField {...(field.placeholder ? { placeholder: field.placeholder } : {})} />;
if (field.input === "phone") return <Input type="tel" placeholder={field.placeholder} />;
if (field.input === "number") return <InputNumber min={0} placeholder={field.placeholder} />;
if (field.input === "boolean") return <Switch />;
if (field.input === "select")
return <Select options={(field.options ?? []).map((item) => ({ ...item }))} />;
if (field.input === "multi-select")
return (
<Select
mode="multiple"
options={(field.options ?? []).map((item) => ({ ...item }))}
placeholder={field.placeholder}
/>
);
return <Input placeholder={field.placeholder} />;
}
export function RecordContentFields({ section }: { section: TemplateAdminSection }) {
sectionKey?: string;
}) {
return (
<Row gutter={16}>
{section.fields.map((field) => (
<Col key={field.key} xs={24} md={24}>
{field.input === "list" ? (
<TemplateListField field={field} name={presentationFieldName(section.key, field.key)} />
<TemplateListField field={field} name={presentationFieldName(sectionKey, field.key)} />
) : (
<Form.Item
name={presentationFieldName(section.key, field.key)}
name={presentationFieldName(sectionKey, field.key)}
label={field.label}
htmlFor={presentationFieldName(sectionKey, field.key)}
{...(field.help ? { help: field.help } : {})}
{...(field.required
? { rules: [{ required: true, message: `请填写${field.label}` }] }
: {})}
>
{renderField(field)}
<TemplateFieldRenderer
field={field}
id={presentationFieldName(sectionKey, field.key)}
/>
</Form.Item>
)}
</Col>
@@ -108,68 +55,28 @@ export function RecordContentEditor({
visualSelection,
}: RecordContentEditorProps) {
const navigate = useNavigate();
const [form] = Form.useForm<PresentationValues>();
const queryClient = useQueryClient();
const recordName = "name" in record ? record.name : record.title;
const initialValues = useMemo(
() =>
Object.fromEntries(
section.fields.map((field) => [
presentationFieldName(section.key, field.key),
readPresentationValue(
record.config,
field.binding,
field,
record as unknown as Record<string, unknown>,
),
]),
),
[record, section],
);
useEffect(() => form.setFieldsValue(initialValues), [form, initialValues]);
const save = useMutation({
mutationFn: async (values: PresentationValues): Promise<void> => {
const config = applyPresentationValues(record.config, [section], values);
const standard = applyStandardEntityValues(
record as unknown as Record<string, unknown>,
source,
[section],
values,
);
const changed = Object.fromEntries(
Object.entries(standard).filter(
([key, value]) =>
key !== "config" && value !== (record as unknown as Record<string, unknown>)[key],
),
);
const client = createApiClient();
if (source === "offering")
await client.updateAdminOffering(record.id, { ...changed, config });
else await client.updateAdminTrustContent(record.id, { ...changed, config });
},
onSuccess: () => {
message.success("已保存内容草稿,发布后访客才会看到更新");
onSaved?.();
void queryClient.invalidateQueries({
queryKey: [source === "offering" ? "admin-offerings" : "trust-content"],
});
void queryClient.invalidateQueries({ queryKey: ["admin-workspace"] });
void queryClient.invalidateQueries({ queryKey: ["admin-preview-workspace"] });
},
const { form, handleValuesChange, initialValues, save, submit } = useRecordContentEditorState({
source,
record,
section,
...(onDraft ? { onDraft } : {}),
...(onSaved ? { onSaved } : {}),
});
return (
<Form
form={form}
layout="vertical"
initialValues={initialValues}
onValuesChange={(_, values) => onDraft?.(values)}
onFinish={(values) => save.mutate(values)}
style={{ minHeight: 0, display: "flex", flexDirection: "column" }}
onValuesChange={handleValuesChange}
onFinish={submit}
className="admin-form-column"
>
<Alert
type="info"
showIcon
message={
title={
source === "offering"
? `正在编辑业务提供项:${recordName}`
: `正在编辑信任内容:${recordName}`
@@ -181,11 +88,11 @@ export function RecordContentEditor({
}
/>
{save.isPending ? <Typography.Text type="secondary">正在保存内容…</Typography.Text> : null}
<Typography.Paragraph type="secondary">{section.description}</Typography.Paragraph>
<div style={{ flex: 1 }}>
<p className="admin-section-description">{section.description}</p>
<div className="admin-flex-1">
<RecordContentFields section={section} />
</div>
<Space direction="vertical" style={{ width: "100%", marginTop: 24 }}>
<div className="admin-actions admin-offset-top-lg">
<MutationError error={save.error} />
<Space wrap>
<Button type="primary" htmlType="submit" loading={save.isPending}>
@@ -197,7 +104,7 @@ export function RecordContentEditor({
onClick={() =>
navigate("/admin/brand", {
state: {
targetKey: visualSelection?.targetKey ?? "linjing-editorial.offerings.item",
targetKey: visualSelection?.targetKey ?? "offering.list.item",
recordId: record.id,
},
})
@@ -207,7 +114,7 @@ export function RecordContentEditor({
</Button>
) : null}
</Space>
</Space>
</div>
</Form>
);
}
+67
View File
@@ -0,0 +1,67 @@
export type StatusTone = "success" | "warning" | "error" | "info" | "neutral";
const TONE_BY_STATUS: Record<string, StatusTone> = {
published: "success",
approved: "success",
completed: "success",
active: "success",
enabled: "success",
building: "info",
built: "neutral",
uploaded: "info",
pending: "neutral",
draft: "neutral",
superseded: "neutral",
disabled: "neutral",
review: "warning",
reviewing: "warning",
under_review: "warning",
processing: "warning",
rejected: "error",
failed: "error",
error: "error",
};
const LABELS: Record<string, string> = {
published: "已发布",
approved: "已通过",
completed: "已完成",
active: "已启用",
enabled: "已公开",
building: "构建中",
built: "待上传",
uploaded: "已上传微信",
pending: "待处理",
draft: "草稿",
superseded: "已过期",
disabled: "已停用",
review: "审核中",
reviewing: "审核中",
under_review: "审核中",
processing: "处理中",
rejected: "已拒绝",
failed: "失败",
error: "异常",
};
export function statusLabel(status: string | null | undefined, fallback = "未知"): string {
if (!status) return fallback;
return LABELS[status] ?? status;
}
export function StatusTag({
status,
label,
tone,
}: {
status?: string | null;
label?: string;
tone?: StatusTone;
}) {
const resolvedTone = tone ?? (status ? TONE_BY_STATUS[status] : undefined) ?? "neutral";
return (
<span className="admin-status-tag" data-tone={resolvedTone}>
{label ?? statusLabel(status)}
</span>
);
}
@@ -0,0 +1,29 @@
import { Skeleton } from "antd";
export function TableSkeleton({ rows = 4 }: { rows?: number }) {
return (
<div className="admin-table-skeleton" role="status" aria-live="polite">
{Array.from({ length: rows }).map((_, index) => (
<div key={index} className="admin-table-skeleton__row">
<Skeleton.Input active size="small" block />
</div>
))}
</div>
);
}
export function ListSkeleton({ rows = 3 }: { rows?: number }) {
return (
<div className="admin-list-skeleton" role="status" aria-live="polite">
{Array.from({ length: rows }).map((_, index) => (
<div key={index} className="admin-list-skeleton__row">
<Skeleton.Input active size="small" className="admin-list-skeleton__thumb" />
<div className="admin-list-skeleton__body">
<Skeleton.Input active size="small" block />
<Skeleton.Input active size="small" block />
</div>
</div>
))}
</div>
);
}
@@ -0,0 +1,96 @@
import { Input, InputNumber, Select, Switch } from "antd";
import type { TemplateAdminField } from "@personal-brand/api-client";
import { ImageUrlField } from "./ImageUrlField.js";
export function TemplateFieldRenderer({
field,
id,
value,
onChange,
}: {
field: TemplateAdminField;
id?: string;
value?: unknown;
onChange?: (value: unknown) => void;
}) {
if (field.input === "textarea")
return (
<Input.TextArea
{...(id ? { id } : {})}
value={typeof value === "string" ? value : ""}
onChange={(event) => onChange?.(event.target.value)}
rows={3}
maxLength={field.maxLength}
showCount={!!field.maxLength}
placeholder={field.placeholder}
/>
);
if (field.input === "image")
return (
<ImageUrlField
{...(id ? { id } : {})}
{...(field.placeholder ? { placeholder: field.placeholder } : {})}
{...(typeof value === "string" ? { value } : {})}
{...(onChange ? { onChange: (next: string) => onChange(next) } : {})}
/>
);
if (field.input === "phone")
return (
<Input
{...(id ? { id } : {})}
type="tel"
placeholder={field.placeholder}
value={typeof value === "string" ? value : ""}
onChange={(event) => onChange?.(event.target.value)}
/>
);
if (field.input === "number")
return (
<InputNumber
{...(id ? { id } : {})}
value={typeof value === "number" ? value : null}
onChange={(input) => onChange?.(input ?? undefined)}
min={0}
className="admin-block"
placeholder={field.placeholder}
/>
);
if (field.input === "boolean")
return (
<Switch
{...(id ? { id } : {})}
checked={Boolean(value)}
onChange={(checked) => onChange?.(checked)}
/>
);
if (field.input === "select")
return (
<Select
{...(id ? { id } : {})}
options={(field.options ?? []).map((item) => ({ ...item }))}
value={typeof value === "string" || typeof value === "number" ? value : undefined}
onChange={(selected) => onChange?.(selected)}
{...(field.placeholder ? { placeholder: field.placeholder } : {})}
/>
);
if (field.input === "multi-select")
return (
<Select
{...(id ? { id } : {})}
mode="multiple"
options={(field.options ?? []).map((item) => ({ ...item }))}
value={Array.isArray(value) ? value.map(String) : []}
onChange={(selected) => onChange?.(selected)}
placeholder={field.placeholder}
/>
);
return (
<Input
{...(id ? { id } : {})}
value={typeof value === "string" ? value : ""}
onChange={(event) => onChange?.(event.target.value)}
maxLength={field.maxLength}
placeholder={field.placeholder}
/>
);
}
+108 -35
View File
@@ -1,5 +1,12 @@
import { Button, Form, Input, Space } from "antd";
import { Button, Card, Collapse, Form, Input, Space, Typography } from "antd";
import {
CaretDownOutlined,
CaretUpOutlined,
DeleteOutlined,
PlusOutlined,
} from "@ant-design/icons";
import type { TemplateAdminField } from "@personal-brand/api-client";
import { EmptyState } from "./EmptyState.js";
export function TemplateListField({
field,
@@ -22,43 +29,109 @@ export function TemplateListField({
]}
>
{(rows, { add, remove, move }, { errors }) => (
<Space direction="vertical" style={{ width: "100%" }}>
{rows.map((row, index) => (
<Space key={row.key} align="start" wrap>
{field.itemFields?.map((itemField) => (
<Form.Item
key={itemField.key}
name={[row.name, itemField.key]}
label={`${index + 1}. ${itemField.label}`}
rules={
itemField.required === false
? []
: [{ required: true, message: `请填写${itemField.label}` }]
}
>
{itemField.input === "textarea" ? <Input.TextArea rows={2} /> : <Input />}
</Form.Item>
))}
<Button onClick={() => remove(row.name)}>删除</Button>
<Button
aria-label={`上移第 ${index + 1} 项`}
disabled={index === 0}
onClick={() => move(index, index - 1)}
<div className="admin-stack admin-stack-tight">
{rows.length === 0 ? <EmptyState compact title={`还没有${field.label}内容`} /> : null}
{rows.map((row, index) => {
const titleField = field.itemFields?.[0];
const primaryTitle = titleField ? (
<Form.Item
noStyle
shouldUpdate={(prev: unknown, next: unknown) => {
const previous = Array.isArray(prev)
? (prev[row.name] as Record<string, unknown> | undefined)
: undefined;
const nextRow = Array.isArray(next)
? (next[row.name] as Record<string, unknown> | undefined)
: undefined;
return previous?.[titleField.key] !== nextRow?.[titleField.key];
}}
>
上移
</Button>
<Button
aria-label={`下移第 ${index + 1} 项`}
disabled={index === rows.length - 1}
onClick={() => move(index, index + 1)}
{({ getFieldValue }) => {
const value = String(
getFieldValue([...name, row.name, titleField.key] as const) ?? "",
);
return (
<Typography.Text
strong
>{`${index + 1}. ${value || titleField.label}`}</Typography.Text>
);
}}
</Form.Item>
) : (
<Typography.Text strong>{`${index + 1}. ${field.label}`}</Typography.Text>
);
return (
<Card
key={row.key}
size="small"
title={primaryTitle}
extra={
<Space size={0}>
<Button
type="text"
size="small"
aria-label={`上移第 ${index + 1} 项`}
icon={<CaretUpOutlined />}
disabled={index === 0}
onClick={() => move(index, index - 1)}
/>
<Button
type="text"
size="small"
aria-label={`下移第 ${index + 1} 项`}
icon={<CaretDownOutlined />}
disabled={index === rows.length - 1}
onClick={() => move(index, index + 1)}
/>
<Button
type="text"
danger
size="small"
aria-label={`删除第 ${index + 1} 项`}
icon={<DeleteOutlined />}
onClick={() => remove(row.name)}
/>
</Space>
}
>
下移
</Button>
</Space>
))}
{field.itemFields?.map((itemField) => (
<Form.Item
key={itemField.key}
name={[row.name, itemField.key]}
label={itemField.label}
rules={
itemField.required === false
? []
: [{ required: true, message: `请填写${itemField.label}` }]
}
>
{itemField.input === "textarea" ? <Input.TextArea rows={2} /> : <Input />}
</Form.Item>
))}
</Card>
);
})}
{rows.length > 1 ? (
<Collapse
ghost
items={[
{
key: "sort-help",
label: "排序说明",
children: (
<Typography.Text type="secondary">
使用每张卡片右上角的箭头调整顺序,保存后预览也会按当前顺序展示。
</Typography.Text>
),
},
]}
/>
) : null}
<Form.ErrorList errors={errors} />
<Button onClick={() => add()}>新增{field.label}</Button>
</Space>
<Button block icon={<PlusOutlined />} onClick={() => add()}>
新增{field.label}
</Button>
</div>
)}
</Form.List>
</Form.Item>
@@ -0,0 +1,14 @@
import type { Offering, TemplateAdminSection, TrustContent } from "@personal-brand/api-client";
import type { PresentationValues } from "../../lib/presentation/presentation-bindings.js";
export type RecordContentSource = "offering" | "trust";
export interface RecordContentEditorProps {
source: RecordContentSource;
record: Offering | TrustContent;
section: TemplateAdminSection;
context: "visual" | "services";
onDraft?: (values: PresentationValues) => void;
onSaved?: () => void;
visualSelection?: { targetKey: string; page: string };
}
@@ -0,0 +1,118 @@
import { App, Form } from "antd";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { useEffect, useMemo, useState } from "react";
import type { TemplateAdminSection } from "@personal-brand/api-client";
import type { Offering, TrustContent } from "@personal-brand/api-client";
import { createApiClient } from "../../lib/api.js";
import {
applyPresentationValues,
applyStandardEntityValues,
presentationFieldName,
readPresentationValue,
type PresentationValues,
} from "../../lib/presentation/presentation-bindings.js";
import type { RecordContentSource } from "./types.js";
function createInitialValues(
record: Offering | TrustContent,
section: TemplateAdminSection,
): PresentationValues {
return Object.fromEntries(
section.fields.map((field) => [
presentationFieldName(section.key, field.key),
readPresentationValue(
record.config,
field.binding,
field,
record as unknown as Record<string, unknown>,
),
]),
);
}
function createChangedStandardValues(
record: Offering | TrustContent,
source: RecordContentSource,
section: TemplateAdminSection,
values: PresentationValues,
) {
const entity = record as unknown as Record<string, unknown>;
const standard = applyStandardEntityValues(entity, source, [section], values);
return Object.fromEntries(
Object.entries(standard).filter(
([key, value]) => key !== "config" && (key in entity || value !== entity[key]),
),
);
}
export function useRecordContentEditorState({
source,
record,
section,
onDraft,
onSaved,
}: {
source: RecordContentSource;
record: Offering | TrustContent;
section: TemplateAdminSection;
onDraft?: ((values: PresentationValues) => void) | undefined;
onSaved?: (() => void) | undefined;
}) {
const { message } = App.useApp();
const [form] = Form.useForm<PresentationValues>();
const queryClient = useQueryClient();
const [draftValues, setDraftValues] = useState<PresentationValues>(() =>
createInitialValues(record, section),
);
const initialValues = useMemo(() => createInitialValues(record, section), [record, section]);
useEffect(() => form.setFieldsValue(initialValues), [form, initialValues]);
const save = useMutation({
mutationFn: async (values: PresentationValues): Promise<void> => {
const config = applyPresentationValues(record.config, [section], values);
const changed = createChangedStandardValues(record, source, section, values);
const client = createApiClient();
if (source === "offering") {
await client.updateAdminOffering(record.id, { ...changed, config });
} else {
await client.updateAdminTrustContent(record.id, { ...changed, config });
}
},
onSuccess: () => {
message.success("已保存内容草稿,发布后访客才会看到更新");
onSaved?.();
void queryClient.invalidateQueries({
queryKey: [source === "offering" ? "admin-offerings" : "trust-content"],
});
void queryClient.invalidateQueries({ queryKey: ["admin-workspace"] });
void queryClient.invalidateQueries({ queryKey: ["admin-preview-workspace"] });
if (source === "offering") {
void queryClient.invalidateQueries({ queryKey: ["admin-workspace-offering-fields"] });
}
},
});
const submit = (values: PresentationValues) => {
const currentValues = form.getFieldsValue(true) as PresentationValues;
save.mutate({ ...draftValues, ...values, ...currentValues });
};
const handleValuesChange = (_values: PresentationValues) => {
const currentValues = form.getFieldsValue(true) as PresentationValues;
const next = { ...draftValues, ..._values, ...currentValues };
setDraftValues(next);
onDraft?.(next);
};
return {
draftValues,
form,
handleValuesChange,
initialValues,
save,
submit,
};
}
+112
View File
@@ -0,0 +1,112 @@
import { useState } from "react";
import { App } from "antd";
import { createApiClient } from "../../lib/api.js";
import { BrandMark } from "../../components/BrandMark.js";
import { AdminButton } from "../../components/AdminButton.js";
import { AdminCard } from "../../components/AdminCard.js";
import { AdminForm, AdminInput } from "../../components/AdminForm.js";
import type { AdminLoginSession } from "@personal-brand/api-client";
export function Login({ onLogin }: { onLogin: (session: AdminLoginSession) => void }) {
const { message } = App.useApp();
const [form] = AdminForm.useForm();
const [loading, setLoading] = useState(false);
async function submit(values: { username: string; password: string }) {
setLoading(true);
try {
const result = await createApiClient().loginAdmin(values.username, values.password);
onLogin(result);
} catch (error) {
message.error(error instanceof Error ? error.message : "登录失败");
} finally {
setLoading(false);
}
}
return (
<div className="admin-auth">
<AdminCard className="admin-auth-card">
<div className="admin-auth-brand">
<BrandMark />
<span className="admin-header-brand">个人品牌后台</span>
</div>
<p className="admin-auth-hint">管理你的品牌表达、内容发布与客户咨询。</p>
<AdminForm form={form} layout="vertical" onFinish={submit}>
<AdminForm.Item
name="username"
label="账号"
initialValue="admin"
rules={[{ required: true }]}
>
<AdminInput />
</AdminForm.Item>
<AdminForm.Item name="password" label="密码" rules={[{ required: true }]}>
<AdminInput.Password />
</AdminForm.Item>
<AdminButton type="primary" size="large" htmlType="submit" loading={loading} block>
登录
</AdminButton>
</AdminForm>
<p className="admin-auth-footnote">仅限授权成员访问。</p>
</AdminCard>
</div>
);
}
export function ChangePassword({ onComplete }: { onComplete: () => void }) {
const { message } = App.useApp();
const [form] = AdminForm.useForm<{
currentPassword: string;
newPassword: string;
confirmPassword: string;
}>();
const [loading, setLoading] = useState(false);
async function submit(values: {
currentPassword: string;
newPassword: string;
confirmPassword: string;
}) {
if (values.newPassword !== values.confirmPassword) {
message.error("两次输入的新密码不一致");
return;
}
setLoading(true);
try {
await createApiClient().changeAdminPassword(values.currentPassword, values.newPassword);
message.success("密码已更新");
onComplete();
} catch (error) {
message.error(error instanceof Error ? error.message : "密码更新失败");
} finally {
setLoading(false);
}
}
return (
<div className="admin-auth">
<AdminCard className="admin-auth-card">
<div className="admin-auth-brand">
<BrandMark />
<span className="admin-header-brand">首次登录需要修改密码</span>
</div>
<p className="admin-auth-hint">请先设置只有你本人知道的新密码。</p>
<AdminForm form={form} layout="vertical" onFinish={submit}>
<AdminForm.Item name="currentPassword" label="初始密码" rules={[{ required: true }]}>
<AdminInput.Password />
</AdminForm.Item>
<AdminForm.Item
name="newPassword"
label="新密码"
rules={[{ required: true, min: 8, message: "请输入至少 8 位新密码" }]}
>
<AdminInput.Password />
</AdminForm.Item>
<AdminForm.Item name="confirmPassword" label="确认密码" rules={[{ required: true }]}>
<AdminInput.Password />
</AdminForm.Item>
<AdminButton type="primary" size="large" htmlType="submit" loading={loading} block>
保存新密码
</AdminButton>
</AdminForm>
</AdminCard>
</div>
);
}
+24 -46
View File
@@ -1,19 +1,29 @@
.brand-page__content {
max-width: 960px;
}
.brand-page__content[hidden] {
display: none;
}
.brand-page__toolbar {
display: flex;
justify-content: space-between;
align-items: center;
gap: 16px;
padding: 16px 0;
border-bottom: 1px solid #e5e7eb;
margin-bottom: 20px;
padding: 8px 12px;
border: 1px solid var(--admin-border);
border-radius: 10px;
background: var(--admin-fill-quiet);
margin-bottom: 16px;
}
.brand-page__toolbar .ant-segmented {
background: var(--admin-surface);
}
.brand-page__toolbar-actions {
display: flex;
align-items: center;
gap: 12px;
}
@media (max-width: 575px) {
.brand-page__toolbar {
flex-wrap: wrap;
@@ -25,54 +35,22 @@
}
.brand-settings-section {
padding: 24px 0;
border-top: 1px solid #f0f0f0;
padding: 20px;
border: 1px solid var(--admin-border);
border-radius: 10px;
background: var(--admin-surface);
}
.brand-settings-section:first-child {
padding-top: 8px;
border-top: 0;
}
.brand-settings-section__header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16px;
margin-bottom: 20px;
}
.brand-settings-section__header .ant-typography {
margin: 0;
}
.brand-settings-section__header .ant-typography + .ant-typography {
display: block;
margin-top: 4px;
.brand-settings-section + .brand-settings-section {
margin-top: 16px;
}
.brand-page__template-note {
margin-top: 24px;
margin-top: 16px;
}
@media (max-width: 1199px) {
.brand-page__content {
display: block;
}
.brand-page__template-note {
position: static;
margin-top: 24px;
}
}
@media (max-width: 575px) {
.brand-settings-section__header {
display: block;
}
.brand-settings-section__header .ant-tag {
display: inline-block;
margin-top: 10px;
}
}
Loaded 100 of 572 files, more files were not shown because too many files have changed in this diff. Show more