feat: 收口多品牌与模板构建基础
This commit is contained in:
1 parent
0425a1c672
commit
77224ea51f
317 files changed
+11290
-1158
No files matched your search
@@ -0,0 +1,16 @@
|
||||
# 进度
|
||||
|
||||
- 任务:阿成校园餐导航与咨询还原
|
||||
- 形态:single-full
|
||||
- 进度:3/3
|
||||
- 当前:已完成阿成五入口导航、出摊服务页和餐饮咨询入口。
|
||||
- 真相文件:`TODO.csv`
|
||||
|
||||
## 完成记录
|
||||
|
||||
- 固定微信 `tabBar` 已移除,改为 Runtime Workspace 驱动的 `runtime-tab-bar`。
|
||||
- 阿成模板入口:首页/摊位、套餐餐品、出摊服务、主理人、定制/咨询。
|
||||
- 林境模板入口:首页、案例与体系、主理人与我。
|
||||
- `定制/咨询` 使用既有动态咨询表单和提交 API;未复制原型 mock 数据。
|
||||
- 新增 `pages/stall-service/index`,展示出摊地址、取餐配送和定制流程。
|
||||
- `typecheck`、Mini Program fixture、visual fixture 已通过。
|
||||
@@ -0,0 +1,17 @@
|
||||
# 阿成校园餐导航与咨询还原
|
||||
|
||||
## 目标
|
||||
|
||||
将阿成校园餐从林境的三 Tab 外壳中拆出,恢复原型的五个入口,并让定制咨询使用餐饮视觉而不是通用下单页。
|
||||
|
||||
## 边界
|
||||
|
||||
- 使用 Runtime Workspace 的视觉模板、品牌和咨询表单数据。
|
||||
- 微信原生 Tab 配置静态,使用 custom tab bar 完成模板运行时导航差异。
|
||||
- 不引入原型 mock 菜品、预约记录或文案作为生产数据。
|
||||
|
||||
## 验收
|
||||
|
||||
- 阿成模板显示首页/摊位、套餐餐品、出摊服务、主理人、定制/咨询五个入口。
|
||||
- 林境模板保留三个对应入口,不显示餐饮专用入口。
|
||||
- 阿成定制咨询页使用独立 renderer 并提交既有动态咨询 API。
|
||||
@@ -0,0 +1,4 @@
|
||||
id,task,status,acceptance_criteria,validation_command,completed_at,retry_count,notes
|
||||
1,建立模板驱动的自定义导航,DONE,阿成五入口和林境三入口根据 Runtime Workspace 切换,pnpm --filter @personal-brand/miniapp test:fixture,已移除固定 tabBar,新增 runtime-tab-bar,0,
|
||||
2,实现出摊服务与餐饮咨询 renderer,DONE,出摊服务和定制咨询不再回退到通用林境页面,pnpm --filter @personal-brand/miniapp test:visual-fixture,新增出摊服务页,定制/咨询接入动态表单,0,
|
||||
3,补充回归样例并完成验证,DONE,导航和咨询 renderer 具备自动回归检查,pnpm typecheck,JSON、typecheck、fixture、visual fixture 全部通过,0,
|
||||
|
@@ -0,0 +1,13 @@
|
||||
# 管理员账号使用闭环
|
||||
|
||||
## 目标
|
||||
|
||||
让手动添加的品牌成员可以安全完成首次登录和密码更新,并让 `editor` 在后台只看到自己有权限使用的功能。
|
||||
|
||||
## 规则
|
||||
|
||||
- 手动创建成员时标记 `mustChangePassword`。
|
||||
- 登录响应返回当前成员角色和是否需要改密。
|
||||
- 首次改密必须校验初始密码,成功后清除标记。
|
||||
- `editor` 隐藏系统管理菜单,直接访问系统管理路由回到概览页。
|
||||
- 密码只保存 hash,不返回或记录明文。
|
||||
@@ -0,0 +1,23 @@
|
||||
# 进度
|
||||
|
||||
- 任务:管理员账号使用闭环
|
||||
- 形态:epic
|
||||
- 进度:3/3
|
||||
- 当前:账号使用闭环已完成,下一步进行多品牌真实初始化验收。
|
||||
|
||||
## 已完成
|
||||
|
||||
- `AdminUser.mustChangePassword` 字段和 Prisma migration 已添加。
|
||||
- 新增 `POST /admin/session/change-password`。
|
||||
- 登录响应包含 `role` 和 `mustChangePassword`。
|
||||
- 手动添加成员自动标记首次改密。
|
||||
- 后台首次登录改密页面已接入。
|
||||
- `editor` 隐藏系统管理菜单,直接访问系统管理路由会回到概览。
|
||||
|
||||
## 验证
|
||||
|
||||
- `pnpm typecheck`:通过。
|
||||
- `pnpm --filter @personal-brand/admin build`:通过。
|
||||
- `pnpm format:check`:通过。
|
||||
- `pnpm --filter @personal-brand/api exec prisma migrate deploy`:已成功应用,`mustChangePassword` 字段已确认落库。
|
||||
- `pnpm --filter @personal-brand/api test:integration`:34/34 通过。
|
||||
@@ -0,0 +1,4 @@
|
||||
id,title,task_type,depends_on,status,task_dir,acceptance_criteria,validation_command,notes
|
||||
1,增加首次改密状态和 API,single-full,,DONE,tasks/password-api,手动成员必须改密且密码 hash 存储,pnpm typecheck,新增 schema 字段、迁移和 change-password API
|
||||
2,接入后台首次改密与角色菜单,single-full,1,DONE,tasks/password-ui,editor 隐藏系统管理并显示改密页面,pnpm --filter @personal-brand/admin build,登录响应持久化角色和改密状态
|
||||
3,补齐回归测试与交付记录,single-full,1;2,DONE,tasks/regression,登录、改密、编辑者路由和迁移均有验证,pnpm --filter @personal-brand/api test:integration,Prisma migration 已落库,API integration 34/34 通过
|
||||
|
@@ -0,0 +1,13 @@
|
||||
# 后台信息架构分层
|
||||
|
||||
## 目标
|
||||
|
||||
让普通品牌使用者优先看到日常经营配置,将模板、能力和字段等系统级设置收纳到独立的系统管理分组。
|
||||
|
||||
## 当前边界
|
||||
|
||||
当前登录身份统一为 `admin`,还没有品牌运营者与平台管理员的真实权限模型。因此本轮只调整导航信息架构,不宣称完成 API 权限隔离。
|
||||
|
||||
## 后续
|
||||
|
||||
建立明确的 membership role 权限矩阵后,再在路由和 API 层执行真正的访问控制。
|
||||
@@ -0,0 +1,18 @@
|
||||
# 进度
|
||||
|
||||
- 任务:后台信息架构分层
|
||||
- 形态:epic
|
||||
- 进度:3/3
|
||||
- 当前:导航分组已完成;真实角色权限作为后续独立任务。
|
||||
|
||||
## 已完成
|
||||
|
||||
- “日常经营”:品牌表达、信任内容、业务提供项、咨询记录。
|
||||
- “系统管理”:模板与设置、能力插件。
|
||||
- 保留现有路由和 API,不引入假权限。
|
||||
|
||||
## 验证
|
||||
|
||||
- `pnpm --filter @personal-brand/admin build`:通过。
|
||||
- `pnpm typecheck`:通过。
|
||||
- `pnpm format:check`:通过。
|
||||
@@ -0,0 +1,4 @@
|
||||
id,title,task_type,depends_on,status,task_dir,acceptance_criteria,validation_command,notes
|
||||
1,分组后台导航,single-full,,DONE,tasks/navigation,日常经营与系统管理分组清晰,pnpm --filter @personal-brand/admin build,已完成导航分组
|
||||
2,验证前端构建与类型,single-full,1,DONE,tasks/validation,构建和类型检查通过,pnpm format:check && pnpm typecheck,已通过
|
||||
3,记录权限边界,single-full,1;2,DONE,tasks/delivery,明确导航分组不等于 API 权限隔离,pnpm --filter @personal-brand/admin build,已记录
|
||||
|
@@ -0,0 +1,50 @@
|
||||
# 品牌友好内容工作台与模板契约增强
|
||||
|
||||
## 目标
|
||||
|
||||
- 让品牌管理员以通俗业务语言配置自己的品牌介绍、图片、业务提供项、案例、咨询问题和发布内容。
|
||||
- 让视觉模板保持页面结构、交互和视觉表达的自由,不依赖公共视觉组件兜底。
|
||||
- 建立稳定的模板数据、资产、字段语义和发布校验契约,支持未来大量独立模板 package。
|
||||
|
||||
## 非目标
|
||||
|
||||
- 不实现小程序运行时下载或执行模板代码。
|
||||
- 不在本 Epic 新增第三个行业模板。
|
||||
- 不让品牌用户直接编辑 JSON、schemaKey、renderer、capability 或模板版本。
|
||||
|
||||
## 约束
|
||||
|
||||
- 继续使用 NestJS、Prisma、React Admin、微信小程序和 pnpm workspace。
|
||||
- 后端只提供稳定业务事实、状态和能力;模板负责视觉和交互表达。
|
||||
- 所有受保护 API 必须覆盖未授权、错误角色和成功路径的自动化测试。
|
||||
- 品牌隔离必须由服务端当前会话/品牌上下文决定,不能信任客户端 brandId。
|
||||
- 新增或修改发布数据必须进入 immutable release snapshot。
|
||||
|
||||
## 风险
|
||||
|
||||
- RuntimeWorkspace 契约变更可能影响 Admin、小程序和已有模板,必须用双模板 fixture 回归。
|
||||
- 数据库与快照结构变更需要 migration、seed、发布流程和 API 测试同步更新。
|
||||
- “通俗易懂”的配置文案是模板定义的一部分,不能通过通用技术字段勉强复用。
|
||||
|
||||
## 子任务
|
||||
|
||||
1. 增强 Template Contract:数据槽位、资产槽位、字段语义、导航和 Admin 编辑声明。
|
||||
2. 完整 RuntimeWorkspace Projection:稳定输出导航、展示属性、资产和模板适配状态。
|
||||
3. 发布前模板适配校验与快照:阻止缺少关键内容、图片或表单的发布。
|
||||
4. 品牌友好 Admin 内容工作台:按模板 Admin manifest 渲染业务化编辑界面。
|
||||
5. 双模板端到端回归:阿成与林境的品牌隔离、发布、数据槽位和小程序构建验收。
|
||||
|
||||
## 依赖
|
||||
|
||||
- 任务 2 依赖任务 1。
|
||||
- 任务 3 依赖任务 1 和 2。
|
||||
- 任务 4 依赖任务 1、2 和 3。
|
||||
- 任务 5 依赖任务 1 至 4。
|
||||
|
||||
## 完成条件
|
||||
|
||||
- [ ] 所有 `SUBTASKS.csv` 行为 `DONE`。
|
||||
- [ ] 两个模板均可由品牌管理员通过通俗编辑界面完成配置并发布。
|
||||
- [ ] 发布时能以可行动提示阻止模板必需内容缺失。
|
||||
- [ ] RuntimeWorkspace 不丢失模板已声明的展示字段。
|
||||
- [ ] API、Admin build、模板编译和双模板 fixture 回归通过。
|
||||
@@ -0,0 +1,16 @@
|
||||
# 进度
|
||||
|
||||
- 任务:品牌友好内容工作台与模板契约增强
|
||||
- 形态:epic
|
||||
- 进度:0/5
|
||||
- 当前:任务已建立,等待从模板与 Admin 内容契约开始实施。
|
||||
- 真相文件:`SUBTASKS.csv`
|
||||
|
||||
## Context Recovery Block
|
||||
|
||||
- 当前子任务:#1 模板与 Admin 内容契约
|
||||
- 当前状态:TODO
|
||||
- 已完成:无
|
||||
- 关键背景:阿成和林境静态视觉验收通过,但 RuntimeWorkspace、发布校验和 Admin 编辑仍不足以支撑大量差异化模板。
|
||||
- 已知问题:后端导航存在固定结构痕迹;offering projection 可能丢失展示属性;公共视觉页面不应再作为模板兜底。
|
||||
- 下一步:审计现有模板 manifest、Admin 配置页面和发布服务,定义最小的 Template Admin Contract。
|
||||
@@ -0,0 +1,6 @@
|
||||
id,task,task_type,status,depends_on,task_dir,acceptance_criteria,validation_command,completed_at,retry_count,notes
|
||||
1,模板与 Admin 内容契约,single-full,TODO,,tasks/template-admin-contract,manifest 声明数据槽位资产槽位字段语义和通俗编辑文案,pnpm --filter @personal-brand/template-contract typecheck,,0,不引入模板专属后端 if else
|
||||
2,RuntimeWorkspace 完整投影,single-full,TODO,1,tasks/runtime-workspace-projection,导航和 offering presentation/assets 完整且品牌隔离,pnpm --filter @personal-brand/api test:integration,,0,不得丢弃模板声明字段
|
||||
3,发布模板适配校验,single-full,TODO,1;2,tasks/publication-compatibility,发布前给出可行动缺失提示并写入快照,pnpm --filter @personal-brand/api test:integration,,0,覆盖缺图缺字段缺表单场景
|
||||
4,品牌友好内容工作台,single-full,TODO,1;2;3,tasks/brand-content-workbench,普通品牌管理员可按业务语言配置并发布,pnpm --filter @personal-brand/admin build,,0,不暴露 JSON schema renderer capability
|
||||
5,双模板回归与验收,single-full,TODO,1;2;3;4,tasks/template-e2e-regression,阿成和林境品牌数据与模板产物均正确,pnpm test:template-compiler,,0,包含发布快照和品牌隔离回归
|
||||
|
@@ -0,0 +1,29 @@
|
||||
# 品牌发布生命周期 Epic
|
||||
|
||||
## 目标
|
||||
|
||||
建立多品牌、模板驱动的草稿与发布边界,使普通用户可以完成首次配置、预览、发布和回滚,并让小程序只展示已发布内容。
|
||||
|
||||
## 范围
|
||||
|
||||
- 品牌发布版本模型、快照生成和可逆迁移;
|
||||
- 发布、撤回、回滚 API 及授权、校验、审计;
|
||||
- 公开 workspace 读取发布快照;
|
||||
- 后台首次配置引导和发布检查;
|
||||
- API client、集成测试、管理后台构建和小程序未发布状态。
|
||||
|
||||
## 不在本 Epic
|
||||
|
||||
- 新增行业模板或视觉风格;
|
||||
- 邀请制团队协作;
|
||||
- 订单领域状态扩展;
|
||||
- 生产环境部署和 Nginx 配置。
|
||||
|
||||
## 验收原则
|
||||
|
||||
- 每个受保护端点覆盖缺少凭证、无效凭证/错误角色和成功路径;
|
||||
- 不同品牌不能读取或回滚其他品牌的发布版本;
|
||||
- 发布失败不改变草稿和当前发布版本;
|
||||
- 回滚生成新发布版本,不覆盖草稿;
|
||||
- 公开接口永远不读取未发布草稿;
|
||||
- 运行 `prisma migrate deploy`、format、typecheck、API integration 和 Admin build。
|
||||
@@ -0,0 +1,34 @@
|
||||
# 进度
|
||||
|
||||
- 任务:品牌发布生命周期
|
||||
- 形态:epic
|
||||
- 进度:5/5
|
||||
- 当前:品牌发布生命周期 Epic 已完成;所有子任务和交付验证均已通过。
|
||||
- 决策依据:`docs/adr/0012-brand-publication-lifecycle.md`
|
||||
|
||||
## 阶段执行记录
|
||||
|
||||
已完成 `1 发布模型与快照生成`:新增 `BrandRelease`、可部署 migration 和 `BrandReleaseService.buildSnapshot`。公开接口仍读取现有工作区,待发布 API 完成后再切换。
|
||||
|
||||
已完成 `2 发布与回滚 API`:新增 `/admin/releases` 列表、`publish`、`revoke` 和版本 `rollback`;发布前校验品牌、模板、业务项、表单和信任内容;回滚生成新版本;覆盖认证、客户越权、成功版本化流程,API integration `37/37` 通过。
|
||||
|
||||
已完成 `3 公开 workspace 发布边界`:公开品牌、信任内容、业务项、表单及 workspace 只读取当前发布快照;未发布响应不含草稿品牌资料。客户咨询使用已发布表单字段和版本,预约业务项需存在于发布版本且实时启用;小程序不回退旧缓存。验证:API integration `37/37`、miniapp fixture、API typecheck、Admin build、format、diff 检查通过;测试后已恢复 seed。
|
||||
|
||||
阶段 `4 首次配置与发布引导`:后台提供非技术用户可理解的准备清单、模板选择与示例导入、发布前预览、发布/撤回/回滚操作。发布校验由服务端作为唯一真相。
|
||||
|
||||
已完成 `4 首次配置与发布引导`:新增 `/admin/publication`,提供行业/视觉选择、示例导入、草稿内容核对、服务端 readiness 检查、发布、撤回和历史版本恢复;编辑成员只可编辑内容,模板管理操作按角色限制。发布检查复用共享 validation 包,发布快照保存模板和视觉声明,客户提交使用发布版本字段和业务快照。验证:API 隔离 schema integration `37/37`、API client `3/3`、API/Admin typecheck、lint、Admin build、format、miniapp fixture 和 visual fixture 均通过。
|
||||
|
||||
已完成 `5 全量回归与交付`:
|
||||
|
||||
- `pnpm format:check`:通过。
|
||||
- `pnpm lint`:通过;保留既有 `booking.service.test.ts` 的 6 个 `no-explicit-any` warning。
|
||||
- `pnpm typecheck`:通过。
|
||||
- `pnpm --filter @personal-brand/api test`:`6/6` 通过。
|
||||
- `pnpm --filter @personal-brand/api test:integration`:隔离 schema 部署 25 个 migration,API 集成 `37/37` 通过;临时 schema 已清理。
|
||||
- `pnpm test:api-client`:`3/3` 通过。
|
||||
- `pnpm --filter @personal-brand/admin build`:通过。
|
||||
- `pnpm --filter @personal-brand/miniapp test:fixture`:通过。
|
||||
- `pnpm --filter @personal-brand/miniapp test:visual-fixture`:通过。
|
||||
- `git diff --check`:通过。
|
||||
|
||||
交付结论:公开内容只读取已发布快照;发布、撤回、回滚具备事务、版本和审计约束;后台发布引导和服务端 readiness 已覆盖;客户提交与预约均按发布快照校验;本 Epic 无未验证的 API 路径或用户操作。
|
||||
@@ -0,0 +1,6 @@
|
||||
id,title,task_type,depends_on,status,task_dir,acceptance_criteria,validation_command,notes
|
||||
1,发布模型与快照生成,single-full,,DONE,tasks/release-model,BrandRelease 模型和运行时快照生成器完成且 migration 可部署,pnpm --filter @personal-brand/api exec prisma migrate deploy && pnpm --filter @personal-brand/api typecheck,已完成;公开读取路径尚未切换
|
||||
2,发布与回滚 API,single-full,1,DONE,tasks/release-api,发布撤回回滚接口具备校验授权审计和隔离测试,pnpm --filter @personal-brand/api test:integration,已完成;集成测试 37/37
|
||||
3,公开 workspace 发布边界,single-full,1;2,DONE,tasks/public-release-boundary,公开接口只读取已发布快照并覆盖未发布空状态,pnpm --filter @personal-brand/api test:integration,API 37/37;miniapp fixture 通过;seed 已恢复
|
||||
4,首次配置与发布引导,single-full,2;3,DONE,tasks/onboarding-publish,普通用户可选择模板导入示例完善身份预览并发布,pnpm --filter @personal-brand/admin build,新增配置与发布页;服务端 readiness;发布撤回回滚;模板/示例/草稿核对;Admin build/typecheck 通过
|
||||
5,全量回归与交付,single-full,1;2;3;4,DONE,tasks/regression,pnpm format/typecheck/build/integration 和 diff 检查通过,pnpm format:check && pnpm typecheck && pnpm --filter @personal-brand/api test:integration && pnpm --filter @personal-brand/admin build,已完成;全量验证通过,临时测试 schema 已清理
|
||||
|
@@ -0,0 +1,7 @@
|
||||
# 进度
|
||||
|
||||
- 任务:首次配置与发布引导
|
||||
- 形态:single-full
|
||||
- 进度:4/4
|
||||
- 当前:首次配置、内容核对、发布操作和回归验证已完成。
|
||||
- 文件:本目录 `TODO.csv` 为真相。
|
||||
@@ -0,0 +1,3 @@
|
||||
# 首次配置与发布引导
|
||||
|
||||
普通品牌用户无需理解内部模板结构,也能按“选择行业与视觉模板、导入示例、完善身份与业务内容、预览、发布”的顺序完成首次发布。后台明确区分草稿和已发布版本,发布失败保留输入并提示缺项。
|
||||
@@ -0,0 +1,5 @@
|
||||
id,task,status,acceptance_criteria,validation_command,completed_at,retry_count,notes
|
||||
1,服务端发布检查接口,DONE,返回与 publish 相同规则的缺项列表,pnpm --filter @personal-brand/api test:integration,2026-09-24,0,复用 validation 包并测试未就绪状态
|
||||
2,后台模板与示例引导,DONE,可选择模板并预览或导入示例,pnpm --filter @personal-brand/admin build,2026-09-24,0,新增配置与发布页
|
||||
3,后台发布预览与版本操作,DONE,发布撤回回滚及失败状态完整,pnpm --filter @personal-brand/admin build,2026-09-24,0,含权限控制和失败提示
|
||||
4,回归验证,DONE,API 与 UI 构建和格式检查通过,pnpm format:check,2026-09-24,0,隔离 schema integration 37/37
|
||||
|
+7
@@ -0,0 +1,7 @@
|
||||
# 进度
|
||||
|
||||
- 任务:公开 workspace 发布边界
|
||||
- 形态:single-full
|
||||
- 进度:3/3
|
||||
- 验证:API integration 37/37;miniapp fixture、API typecheck、Admin build、format 和 diff 检查通过。
|
||||
- 文件:本目录 `TODO.csv` 为真相。
|
||||
@@ -0,0 +1,3 @@
|
||||
# 公开发布边界
|
||||
|
||||
公开接口、小程序运行时和客户提交都必须以当前品牌发布快照为边界。未发布时不显示草稿,也不受理新的咨询或预约;实时禁用仍应即时拦截。
|
||||
@@ -0,0 +1,4 @@
|
||||
id,task,status,acceptance_criteria,validation_command,completed_at,retry_count,notes
|
||||
1,公开查询切换发布快照,DONE,无发布版本不暴露草稿,pnpm --filter @personal-brand/api test:integration,2026-09-24,0,37/37
|
||||
2,客户提交与小程序缓存边界,DONE,未发布时不受理且不回退旧缓存,pnpm --filter @personal-brand/miniapp test:fixture,2026-09-24,0,通过
|
||||
3,全量验证与恢复种子,DONE,集成测试和构建通过且 seed 恢复,pnpm format:check,2026-09-24,0,API 37/37;Admin build 通过
|
||||
|
@@ -0,0 +1,7 @@
|
||||
# 进度
|
||||
|
||||
- 状态:DONE
|
||||
- 新增 `BrandReleaseApiService` 和 `AdminReleaseController`。
|
||||
- 发布前校验品牌名称、行业模板、视觉模板兼容性、启用业务项、启用咨询表单和已发布信任内容。
|
||||
- 新增 API Client 的 release 方法和 认证/成功/回滚/撤回集成测试。
|
||||
- `prisma migrate deploy`、API build、API typecheck、format 和 API integration `37/37` 已通过。
|
||||
@@ -0,0 +1,3 @@
|
||||
# 发布与回滚 API
|
||||
|
||||
提供品牌发布版本的查询、发布、撤回和回滚接口。所有数据按管理员会话中的 `brandId` 隔离,发布失败不得修改已有版本,回滚通过创建新版本保留历史。
|
||||
@@ -0,0 +1,4 @@
|
||||
id,task,status,completed_at,notes
|
||||
1,实现发布校验和版本创建,DONE,2026-09-24,事务中标记旧版本 superseded 并创建新版本
|
||||
2,实现回滚与撤回,DONE,2026-09-24,回滚创建新版本,撤回标记当前版本 revoked
|
||||
3,补齐授权、隔离和成功测试,DONE,2026-09-24,API integration 37/37
|
||||
|
@@ -0,0 +1,6 @@
|
||||
# 进度
|
||||
|
||||
- 状态:DONE
|
||||
- 已新增 `BrandRelease` Prisma 模型及 migration `20260924100000_add_brand_releases`。
|
||||
- 已新增 `BrandReleaseService.buildSnapshot`,按品牌收集品牌资料、模板安装、模块、字段、业务项、表单、信任内容和能力安装。
|
||||
- 已执行 `prisma migrate deploy`、API typecheck。
|
||||
@@ -0,0 +1,3 @@
|
||||
# 发布模型与快照生成
|
||||
|
||||
为每个品牌增加不可变发布版本,保存完整工作区快照,为后续发布、回滚和公开读取提供数据边界。本阶段不切换公开接口。
|
||||
@@ -0,0 +1,4 @@
|
||||
id,task,status,completed_at,notes
|
||||
1,新增 BrandRelease Prisma 模型,DONE,2026-09-24,保存品牌版本快照和状态
|
||||
2,实现品牌工作区快照生成器,DONE,2026-09-24,BrandReleaseService 按 brandId 收集完整配置
|
||||
3,执行数据库迁移与 API 类型检查,DONE,2026-09-24,prisma migrate deploy 和 typecheck 通过
|
||||
|
@@ -0,0 +1,12 @@
|
||||
# 阿成校园餐第二视觉模板 Epic
|
||||
|
||||
## 目标
|
||||
|
||||
将 `阿成校园餐` React 原型转化为第二个真实可切换的小程序视觉模板,验证模板包不是只保存声明,而是可以替换页面表达,同时继续消费统一 Runtime Workspace 和发布快照。
|
||||
|
||||
## 约束
|
||||
|
||||
- 原型中的 mock dishes、records 和静态品牌资料不得进入生产运行时;
|
||||
- 页面内容来自当前品牌发布 workspace;
|
||||
- 模板代码可以与林境完全不同,但 API、能力和品牌隔离必须复用平台契约;
|
||||
- 新模板必须有独立 renderer、包声明、fixture 和切换测试。
|
||||
@@ -0,0 +1,27 @@
|
||||
# 进度
|
||||
|
||||
- 任务:阿成校园餐第二视觉模板
|
||||
- 形态:epic
|
||||
- 进度:3/3
|
||||
- 当前:第二模板制作、renderer 接入、切换链路和全量回归已完成,等待用户在微信开发者工具验收。
|
||||
- 真相文件:`SUBTASKS.csv`
|
||||
|
||||
## 固化流程
|
||||
|
||||
新模板必须经过:原型提取 → `template.json` → 独立 renderer → Runtime Workspace 适配 → fixture → API/构建门禁 → 发布切换验收。原型 mock 数据只用于设计参考,不进入生产。
|
||||
|
||||
## 本轮完成
|
||||
|
||||
- 修正 seed:personal 使用 `linjing-editorial`,food 使用 `acheng-campus-food`,doors 使用 `linjing-editorial`。
|
||||
- 收紧视觉模板行业兼容性:林境仅支持 personal、doors;阿成仅支持 food。
|
||||
- 接入阿成首页、菜单和主理人页 renderer,并保留 Runtime Workspace 数据来源。
|
||||
- 增加 `acheng-campus-food-visual.json`,覆盖 7 个页面状态。
|
||||
- `validate:templates`、`typecheck`、miniapp fixture、visual fixture、admin build、format check 已通过。
|
||||
- API 集成测试已通过:37/37;测试使用隔离 schema,并验证模板兼容性、发布与 brandSlug 隔离。
|
||||
|
||||
## 验收切换
|
||||
|
||||
- `brandSlug=default-brand`:food 行业,使用 `acheng-campus-food`,首页、菜单、主理人页分别使用 `acheng-home`、`acheng-offerings`、`acheng-profile`。
|
||||
- `brandSlug=linran-brand`:personal 行业,使用 `linjing-editorial`。
|
||||
- `brandSlug=linjing-doors`:doors 行业,使用 `linjing-editorial`。
|
||||
- 新模板流程已固化在本文件和 `templates/acheng-campus-food/`:原型提取、声明、独立 renderer、Runtime Workspace、fixture、构建与 API 门禁、切换验收。
|
||||
@@ -0,0 +1,4 @@
|
||||
id,title,task_type,depends_on,status,task_dir,acceptance_criteria,validation_command,notes
|
||||
1,原型提取与模板包声明,single-full,,DONE,tasks/package,阿成校园餐包声明页面入口能力和行业兼容性已落盘,pnpm validate:templates,来源为用户提供的 React 原型
|
||||
2,小程序独立 renderer,single-full,1,DONE,tasks/renderer,首页主理人页和餐品列表呈现阿成校园餐独立视觉且消费 Runtime Workspace,pnpm --filter @personal-brand/miniapp test:fixture,已接入首页、菜单、主理人页 renderer,并增加视觉 fixture,
|
||||
3,切换链路与全量回归,single-full,2,DONE,tasks/regression,后台/API 可选择并发布第二模板,brandSlug 切换后视觉 renderer 正确,pnpm --filter @personal-brand/api test:integration,37/37 API 集成测试通过;模板兼容性和 brandSlug 隔离已验证,
|
||||
|
@@ -0,0 +1,13 @@
|
||||
# 手动添加品牌成员
|
||||
|
||||
## 目标
|
||||
|
||||
在暂不建设邀请流程的前提下,由品牌负责人直接创建成员账号并绑定当前品牌。
|
||||
|
||||
## 规则
|
||||
|
||||
- 只有 `owner / admin / platform-admin` 可以添加成员。
|
||||
- 创建时填写登录账号、成员姓名、初始密码和角色。
|
||||
- 初始密码使用 `bcrypt` hash 保存,接口不返回密码,也不记录明文。
|
||||
- 账号名全局唯一,已存在账号不会被覆盖。
|
||||
- 邀请、找回密码和首次登录改密暂不纳入本轮。
|
||||
@@ -0,0 +1,25 @@
|
||||
# 进度
|
||||
|
||||
- 任务:手动添加品牌成员
|
||||
- 形态:epic
|
||||
- 进度:3/3
|
||||
- 当前:手动添加账号和品牌成员绑定已完成。
|
||||
|
||||
## 已完成
|
||||
|
||||
- 新增 `POST /admin/brands/members`。
|
||||
- 新增后台“手动添加成员”表单。
|
||||
- 初始密码按 `bcrypt` hash 存储,不返回明文。
|
||||
- 重复账号由 API 拒绝,不覆盖已有账号。
|
||||
- 成员角色和品牌隔离复用现有权限规则。
|
||||
|
||||
## 验证
|
||||
|
||||
- `pnpm --filter @personal-brand/api test:integration`:33/33 通过。
|
||||
- `pnpm --filter @personal-brand/admin build`:通过。
|
||||
- `pnpm typecheck`:通过。
|
||||
- `pnpm format:check`:通过。
|
||||
|
||||
## 暂不实现
|
||||
|
||||
邀请链接、邮件 / 微信通知、密码找回和首次登录改密后续再做。
|
||||
@@ -0,0 +1,4 @@
|
||||
id,title,task_type,depends_on,status,task_dir,acceptance_criteria,validation_command,notes
|
||||
1,实现手动添加成员 API,single-full,,DONE,tasks/member-create-api,owner 可创建当前品牌成员且密码不出现在响应,pnpm --filter @personal-brand/api test:integration,新增 POST /admin/brands/members
|
||||
2,接入后台手动添加表单,single-full,1,DONE,tasks/member-create-ui,可填写账号、姓名、初始密码和角色,pnpm --filter @personal-brand/admin build,新增“手动添加成员”弹窗
|
||||
3,完成安全回归与记录,single-full,1;2,DONE,tasks/regression,授权、重复账号和密码存储行为验证,pnpm --filter @personal-brand/api test:integration,API 33/33 通过
|
||||
|
@@ -0,0 +1,30 @@
|
||||
# 多品牌初始化与真实验收
|
||||
|
||||
## 目标
|
||||
|
||||
把个人品牌、餐饮与门窗三个 demo 品牌固化为可重复初始化的运行时基线,验证公开 Workspace 的品牌隔离、行业表达和咨询转化链路。
|
||||
|
||||
## 非目标
|
||||
|
||||
- 不新增行业模板或订单能力。
|
||||
- 不改变普通用户的配置流程。
|
||||
- 不引入历史数据兼容层;当前为开发期 fixture,直接修正旧样例。
|
||||
|
||||
## 约束
|
||||
|
||||
- `Offering.kind` 只使用共享 allow-list:`service`、`product`、`package`、`subscription`。
|
||||
- 行业分类通过 `config.categoryKey` 与 `config.categoryLabel` 表达。
|
||||
- 三个品牌均须具备已启用的品牌级咨询表单。
|
||||
- 公开接口必须按 `brandSlug` 隔离验证。
|
||||
|
||||
## 风险
|
||||
|
||||
- seed 会更新本地 demo 数据,因此必须在执行后检查三个公开 Workspace。
|
||||
- 运行中的 API 需在 seed 后重启,才能清除其进程内 Workspace 缓存。
|
||||
|
||||
## 完成标准
|
||||
|
||||
- [ ] `SUBTASKS.csv` 所有任务为 `DONE`。
|
||||
- [ ] seed 可重复执行并生成 3 个独立品牌。
|
||||
- [ ] API integration 覆盖三品牌公开 Workspace 基线。
|
||||
- [ ] migration、seed、format、typecheck、integration、Admin build 通过。
|
||||
@@ -0,0 +1,21 @@
|
||||
# 进度
|
||||
|
||||
- 任务:多品牌初始化与真实验收
|
||||
- 形态:epic
|
||||
- 进度:3/3
|
||||
- 当前:多品牌初始化与真实验收完成
|
||||
- 真相文件:`SUBTASKS.csv`
|
||||
|
||||
## 恢复信息
|
||||
|
||||
- 已完成:新增 `linran-brand` 个人品牌 fixture,并向管理员授予 owner membership。
|
||||
- 已完成:`Offering.kind` 收敛到共享 allow-list,餐饮和门窗行业分类改由 `config.categoryKey`、`config.categoryLabel` 表达;小程序从 `categoryLabel` 渲染行业名称。
|
||||
- 已完成:餐饮的预订表达与品牌级咨询表单被 seed 反复校正为启用状态。
|
||||
- 已完成:公开 Workspace integration 覆盖 3 个品牌的身份、模板、主理人、表单、业务归属和分类语义,API `35/35` 通过。
|
||||
- 已完成:`prisma migrate deploy` 无待执行项;测试结束后已重跑 seed 恢复 demo 数据;`format:check`、`typecheck`、Admin build 均通过。
|
||||
|
||||
## 最终结果
|
||||
|
||||
- 风险收口:不再用行业文案污染共享 `Offering.kind`。
|
||||
- 验收基线:`linran-brand`(个人品牌)、`default-brand`(餐饮)、`linjing-doors`(门窗)三套独立公开 Workspace。
|
||||
- 已知非阻塞项:Admin production build 提示主 chunk 约 669 kB,后续按路由进一步拆包,不影响本次功能与数据正确性。
|
||||
@@ -0,0 +1,4 @@
|
||||
id,task,task_type,status,depends_on,task_dir,acceptance_criteria,validation_command,completed_at,retry_count,notes
|
||||
1,统一运行时样例语义与三品牌 fixture,single-full,DONE,,tasks/seed-baseline,seed 使用共享 kind 并提供个人、餐饮、门窗的可用内容,pnpm --filter @personal-brand/api typecheck,2026-09-24,0,新增 personal fixture;行业分类迁移至 config.categoryKey/categoryLabel
|
||||
2,公开 Workspace 三品牌验收测试,single-full,DONE,1,tasks/runtime-contract,按 brandSlug 验证身份、模板、表单、业务项和隔离,pnpm --filter @personal-brand/api test:integration,2026-09-24,0,API integration 35/35 通过
|
||||
3,执行初始化与全量门禁,single-full,DONE,1;2,tasks/regression,迁移、seed 与质量门禁均通过,pnpm format:check && pnpm typecheck && pnpm --filter @personal-brand/api test:integration,2026-09-24,0,migrate deploy 无待执行项;seed 已在测试后重跑恢复 demo 基线
|
||||
|
@@ -0,0 +1,5 @@
|
||||
# 子任务记录
|
||||
|
||||
- 状态:DONE
|
||||
- 变更:执行 migration、seed 并恢复 integration 后的 demo 基线。
|
||||
- 验证:`pnpm format:check`、`pnpm typecheck`、Admin production build 均通过。
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
# 子任务记录
|
||||
|
||||
- 状态:DONE
|
||||
- 变更:新增按 `brandSlug` 读取三品牌 Workspace 的公开 API integration 测试。
|
||||
- 验证:`pnpm --filter @personal-brand/api test:integration`,`35/35` 通过。
|
||||
@@ -0,0 +1,5 @@
|
||||
# 子任务记录
|
||||
|
||||
- 状态:DONE
|
||||
- 变更:三品牌可重复 seed、共享 kind 收敛、餐饮文案和咨询表单修复。
|
||||
- 验证:`pnpm --filter @personal-brand/api typecheck` 通过。
|
||||
@@ -0,0 +1,26 @@
|
||||
# 三品牌真实业务验收 Epic
|
||||
|
||||
## 目标
|
||||
|
||||
验证个人品牌、餐饮和门窗三种已发布品牌能够在同一套模板、视觉、发布快照与多品牌隔离体系中稳定运行。验收以用户可配置、已发布内容可展示、草稿不污染线上、禁用即时拦截为边界。
|
||||
|
||||
## 范围
|
||||
|
||||
- 三个品牌公开 workspace 的身份、行业模板、视觉模板、业务项、表单和信任内容;
|
||||
- 草稿修改、发布生效、撤回和回滚的公开边界;
|
||||
- 已发布业务项和表单的实时禁用拦截;
|
||||
- 后台切换品牌后的隔离;
|
||||
- API、Admin 和 Miniapp 回归门禁。
|
||||
|
||||
## 不在本 Epic
|
||||
|
||||
- 新增行业模板或视觉模板;
|
||||
- 媒体库和文件上传;
|
||||
- 邀请、通知和生产部署。
|
||||
|
||||
## 验收原则
|
||||
|
||||
- 不以 seed 静态数据存在作为验收通过,而验证公开发布版本和草稿的边界;
|
||||
- 行业差异只能来自模板声明、内容和 capability,不能写入共享业务分支;
|
||||
- 所有客户操作按当前品牌已发布快照验证,并保留实时禁用拦截;
|
||||
- 每项 API 行为必须可由隔离 schema 集成测试复现。
|
||||
@@ -0,0 +1,19 @@
|
||||
# 进度
|
||||
|
||||
- 任务:三品牌真实业务验收与模板覆盖验证
|
||||
- 形态:epic
|
||||
- 进度:4/4
|
||||
- 当前:三品牌真实业务自动化验收已完成,等待按清单进行微信开发者工具和后台的人工视觉验收。
|
||||
- 真相文件:`SUBTASKS.csv`
|
||||
|
||||
## 阶段执行记录
|
||||
|
||||
已完成阶段 `1 三品牌发布基线验收`:个人、餐饮、门窗 3 个 `brandSlug` 均验证了品牌身份、行业模板、视觉模板 manifest、信任内容、业务项和咨询表单,API integration `37/37` 通过。
|
||||
|
||||
已完成阶段 `2 草稿与发布边界组合验收`:验证草稿修改不污染已发布 workspace,发布后才生效,回滚生成新版本,撤回后公开 workspace 进入未发布状态,并保持品牌隔离。
|
||||
|
||||
已完成阶段 `3 提交与实时禁用验收`:验证发布快照表单和业务项可以提交;草稿新增、表单禁用、业务项禁用、能力禁用和撤回状态均被提交端拦截。
|
||||
|
||||
已完成阶段 `4 全量回归与手工验收清单`:`format:check`、全仓 `typecheck`、隔离 schema API integration `37/37`、Admin build、Miniapp fixture、visual fixture 和 `git diff --check` 均通过。
|
||||
|
||||
人工验收步骤已记录于 [MANUAL-ACCEPTANCE.md](tasks/regression/MANUAL-ACCEPTANCE.md)。自动化已完成,人工验收重点是微信开发者工具中的视觉还原、图片资源和品牌切换操作。
|
||||
@@ -0,0 +1,5 @@
|
||||
id,title,task_type,depends_on,status,task_dir,acceptance_criteria,validation_command,notes
|
||||
1,三品牌发布基线验收,single-full,,DONE,tasks/three-brand-baseline,个人、餐饮、门窗各自公开 workspace 具备匹配的身份模板视觉业务表单和信任内容,pnpm --filter @personal-brand/api test:integration,API integration 37/37;三品牌断言通过
|
||||
2,草稿与发布边界组合验收,single-full,1,DONE,tasks/draft-publication-boundary,草稿修改不影响线上且发布回滚撤回均保持品牌隔离,pnpm --filter @personal-brand/api test:integration,发布生命周期、草稿隔离、回滚和撤回测试通过
|
||||
3,提交与实时禁用验收,single-full,1;2,DONE,tasks/submission-boundary,已发布表单和业务项可提交且草稿或实时禁用状态被正确拦截,pnpm --filter @personal-brand/api test:integration,表单/业务项禁用和发布快照提交测试通过
|
||||
4,全量回归与手工验收清单,single-full,1;2;3,DONE,tasks/regression,自动化门禁通过并形成后台和小程序手工验收步骤,pnpm format:check && pnpm typecheck && pnpm --filter @personal-brand/api test:integration && pnpm --filter @personal-brand/admin build,全量门禁通过;已形成 MANUAL-ACCEPTANCE.md
|
||||
|
@@ -0,0 +1,13 @@
|
||||
# 后台与小程序手工验收
|
||||
|
||||
对每个 `linran-brand`、`default-brand`、`linjing-doors` 依次执行:
|
||||
|
||||
1. 在后台切换到目标品牌,确认 Header 品牌名称、品牌表达、业务提供项和咨询表单均属于当前品牌。
|
||||
2. 在“配置与发布”查看 readiness,确认模板、视觉、业务项、表单和信任内容均通过。
|
||||
3. 修改一项草稿文案或图片但不发布;在小程序重新进入对应 `brandSlug`,确认线上仍是发布版本。
|
||||
4. 发布草稿;重新进入小程序,确认修改后的品牌身份、业务展示、咨询表单和信任内容生效。
|
||||
5. 禁用一个已发布业务项或表单;确认其不再展示,且历史入口提交被 API 拦截。
|
||||
6. 选择历史版本恢复并确认小程序回到该版本;撤回后确认小程序显示“品牌尚未发布”。
|
||||
7. 切换到另一个品牌重复第 1 至 4 步,确认不出现前一品牌的名称、图片、业务项或咨询记录。
|
||||
|
||||
通过标准:每个品牌独立通过,且发布、撤回、回滚和禁用均只影响当前品牌。
|
||||
@@ -0,0 +1,16 @@
|
||||
# 后台角色权限分层
|
||||
|
||||
## 目标
|
||||
|
||||
把日常品牌经营权限与模板、能力、字段等系统设置权限分开,避免普通品牌编辑误操作系统配置。
|
||||
|
||||
## 角色矩阵
|
||||
|
||||
- `owner`、`admin`、`platform-admin`:可以管理品牌内容和系统设置。
|
||||
- `editor`:可以管理品牌表达、信任内容、业务提供项、咨询表单和咨询记录;不能安装或升级模板、调整能力、模块、字段或视觉模板。
|
||||
|
||||
## 完成条件
|
||||
|
||||
- 全局 membership guard 在系统设置路由执行角色校验。
|
||||
- visual template 通过独立接口或品牌配置写入时同样受保护。
|
||||
- 自动化测试覆盖编辑者允许日常经营、拒绝系统设置。
|
||||
@@ -0,0 +1,22 @@
|
||||
# 进度
|
||||
|
||||
- 任务:后台角色权限分层
|
||||
- 形态:epic
|
||||
- 进度:3/3
|
||||
- 当前:`owner / admin / platform-admin` 与 `editor` 的最小权限边界已生效。
|
||||
|
||||
## 已完成
|
||||
|
||||
- 系统设置路径:模板安装、能力、视觉模板、模块和字段,仅允许 owner 级角色。
|
||||
- 日常经营路径继续允许已启用品牌成员访问。
|
||||
- `editor` 通过业务提供项读取测试,但访问能力设置和视觉模板被拒绝。
|
||||
|
||||
## 验证
|
||||
|
||||
- `pnpm --filter @personal-brand/api test:integration`:32/32 通过。
|
||||
- `pnpm typecheck`:通过。
|
||||
- `pnpm format:check`:通过。
|
||||
|
||||
## 注意
|
||||
|
||||
当前登录接口仍返回通用 `admin` token,真实用户管理、成员邀请和角色变更需要后续独立任务建设;本轮不把前端导航分组误称为完整权限系统。
|
||||
@@ -0,0 +1,4 @@
|
||||
id,title,task_type,depends_on,status,task_dir,acceptance_criteria,validation_command,notes
|
||||
1,在 membership guard 增加系统设置角色校验,single-full,,DONE,tasks/guard,系统设置路径只允许 owner 级角色,pnpm --filter @personal-brand/api test:integration,已覆盖 workspace 系统路由和 visual-template 路由
|
||||
2,保护视觉模板配置写入,single-full,1,DONE,tasks/visual-template,editor 不能通过品牌配置修改 visualTemplateKey,pnpm --filter @personal-brand/api test:integration,已在 AdminConfigController 增加角色校验
|
||||
3,完成授权回归与记录,single-full,1;2,DONE,tasks/regression,编辑者允许内容管理且拒绝系统设置,pnpm typecheck && pnpm format:check,API 32/32 通过,typecheck 和 format 通过
|
||||
|
@@ -0,0 +1,14 @@
|
||||
# 进度
|
||||
|
||||
- 任务:Runtime Workspace 契约收敛
|
||||
- 形态:single-full
|
||||
- 进度:3/3
|
||||
- 当前:Runtime Workspace 契约收敛完成
|
||||
- 真相文件:`TODO.csv`
|
||||
|
||||
## 恢复信息
|
||||
|
||||
- 已完成:`RuntimeOffering` 明确声明共享类别、封面、价格和 `presentation`(行业标签、关键词、详情、媒体)。
|
||||
- 已完成:公开 Workspace 仅下发 Runtime Offering;不再以原始 Prisma `offerings` 或 `modules` 覆盖同名 Runtime 字段。
|
||||
- 已完成:小程序从 `presentation` 读取行业标签与详情首图;模块类型在 API 层归一为渲染组件类型。
|
||||
- 验证:全仓 typecheck、API integration `35/35`、Miniapp fixture、Miniapp visual fixture 通过;测试后已重跑 seed 恢复三品牌 demo 数据。
|
||||
@@ -0,0 +1,23 @@
|
||||
# Runtime Workspace 契约收敛
|
||||
|
||||
## 目标
|
||||
|
||||
让 `public/workspace` 只返回一套符合共享类型的业务提供项展示数据,消除原始 Prisma `offerings` 覆盖 `RuntimeWorkspace.offerings` 的重复响应。
|
||||
|
||||
## 范围
|
||||
|
||||
- 扩展 `RuntimeOffering`,承载小程序所需的共享展示数据与模板配置。
|
||||
- API 只下发投影后的 Runtime Workspace,不泄漏重复原始字段。
|
||||
- Miniapp 改为消费明确的 Runtime Offering 合约。
|
||||
- 补 API integration 和 Miniapp fixture 验证。
|
||||
|
||||
## 非目标
|
||||
|
||||
- 不新增行业字段、模板或插件。
|
||||
- 不保留旧的重复 `offerings` 响应兼容层。
|
||||
|
||||
## 验收
|
||||
|
||||
- `RuntimeWorkspace.offerings` 与实际 API 响应一致。
|
||||
- 三品牌展示数据、封面、行业标签与详情配置可被小程序读取。
|
||||
- API integration、Miniapp fixture、format、typecheck 通过。
|
||||
@@ -0,0 +1,4 @@
|
||||
id,task,status,acceptance_criteria,validation_command,completed_at,retry_count,notes
|
||||
1,审计并定义统一 RuntimeOffering 投影,DONE,共享类型覆盖小程序实际展示字段,pnpm --filter @personal-brand/types typecheck,2026-09-24,0,定义共享展示字段与 presentation 投影
|
||||
2,切换 API 与小程序至唯一契约,DONE,公开响应不再覆盖 runtime offerings,pnpm --filter @personal-brand/api test:integration,2026-09-24,0,移除 Prisma offerings/modules 覆盖并迁移消费者
|
||||
3,补齐回归与任务收口,DONE,三品牌和小程序 fixture 均验证,pnpm format:check && pnpm typecheck,2026-09-24,0,API 35/35 与 Miniapp fixture 均通过;测试后重跑 seed
|
||||
|
@@ -0,0 +1,17 @@
|
||||
# 品牌团队成员管理
|
||||
|
||||
## 目标
|
||||
|
||||
让品牌负责人可以查看当前品牌成员、调整内容编辑权限和启停用成员,同时保护品牌不被误配置到失去负责人。
|
||||
|
||||
## 规则
|
||||
|
||||
- 只有 `owner / admin / platform-admin` 可以管理成员。
|
||||
- 成员角色支持 `owner` 和 `editor`。
|
||||
- 不能修改自己的角色或停用自己。
|
||||
- 不能移除最后一位启用的负责人。
|
||||
- 成员数据始终按当前品牌隔离。
|
||||
|
||||
## 未覆盖
|
||||
|
||||
成员邀请、邮件 / 微信通知、首次登录和跨品牌平台管理员界面作为后续任务。
|
||||
@@ -0,0 +1,25 @@
|
||||
# 进度
|
||||
|
||||
- 任务:品牌团队成员管理
|
||||
- 形态:epic
|
||||
- 进度:3/3
|
||||
- 当前:成员列表、角色调整和启停用已完成。
|
||||
|
||||
## 已完成
|
||||
|
||||
- 新增 `GET /admin/brands/members`。
|
||||
- 新增 `PATCH /admin/brands/members/:id`。
|
||||
- 新增后台“团队成员”页面。
|
||||
- 成员角色使用“负责人 / 内容编辑”业务语言展示。
|
||||
- 保护自禁用和最后负责人约束。
|
||||
|
||||
## 验证
|
||||
|
||||
- `pnpm --filter @personal-brand/api test:integration`:33/33 通过。
|
||||
- `pnpm --filter @personal-brand/admin build`:通过。
|
||||
- `pnpm typecheck`:通过。
|
||||
- `pnpm format:check`:通过。
|
||||
|
||||
## 后续边界
|
||||
|
||||
当前页面只管理已经存在的成员,不提供邀请和首次登录流程;这部分需要单独设计账号生命周期和通知策略。
|
||||
@@ -0,0 +1,4 @@
|
||||
id,title,task_type,depends_on,status,task_dir,acceptance_criteria,validation_command,notes
|
||||
1,实现成员列表和角色更新 API,single-full,,DONE,tasks/member-api,owner 可按当前品牌读取和更新成员,pnpm --filter @personal-brand/api test:integration,新增 GET/PATCH /admin/brands/members
|
||||
2,实现后台团队成员页面,single-full,1,DONE,tasks/member-ui,后台可查看成员并修改角色和状态,pnpm --filter @personal-brand/admin build,新增团队成员页面和系统管理导航
|
||||
3,完成成员安全回归,single-full,1;2,DONE,tasks/regression,自禁用、最后负责人保护和品牌隔离有测试,pnpm --filter @personal-brand/api test:integration,API 33/33 通过
|
||||
|
@@ -0,0 +1,27 @@
|
||||
# 林境模板包基础 Epic
|
||||
|
||||
## 目标
|
||||
|
||||
将林境作为当前唯一正式视觉模板包,保留个人、餐饮、门窗行业模板作为数据与能力声明。移除当前没有独立 renderer、仅复用林境页面的伪视觉模板,建立可扩展的模板包契约和版本快照基础。
|
||||
|
||||
## 范围
|
||||
|
||||
- `template.json` 风格的模板包契约类型与校验;
|
||||
- 林境模板包元数据、页面入口、能力依赖和 fixture;
|
||||
- 视觉模板目录只暴露林境模板;
|
||||
- 所有品牌视觉默认值和发布快照统一使用林境;
|
||||
- Admin、API、Miniapp fixture 和文档同步。
|
||||
|
||||
## 不在本 Epic
|
||||
|
||||
- 新增餐饮专属视觉模板;
|
||||
- 运行时下载 WXML/WXSS/JS;
|
||||
- 媒体上传服务;
|
||||
- 多模板构建服务。
|
||||
|
||||
## 设计边界
|
||||
|
||||
- 行业模板决定业务数据、字段和 capability,不决定视觉代码;
|
||||
- 林境模板包只消费统一 Runtime Workspace,不读取数据库;
|
||||
- 后台不能展示没有独立 renderer 的视觉模板;
|
||||
- 模板包和品牌发布版本都必须保留精确版本。
|
||||
@@ -0,0 +1,17 @@
|
||||
# 进度
|
||||
|
||||
- 任务:林境模板包基础
|
||||
- 形态:epic
|
||||
- 进度:3/3
|
||||
- 当前:模板包可执行边界已完成;林境是唯一正式视觉模板包,个人、餐饮、门窗继续作为行业数据模板。
|
||||
- 真相文件:`SUBTASKS.csv`
|
||||
|
||||
## 阶段执行记录
|
||||
|
||||
已完成阶段 `1 模板包契约与林境声明`:共享 config 新增 `TemplatePackageManifest`、模板包 registry、入口声明和校验函数,林境包固定为 `linjing-editorial@1.0.0`。
|
||||
|
||||
已完成阶段 `2 统一唯一视觉模板`:移除 `minimal-neutral` 视觉目录和默认回退;API、Admin、seed、发布快照和模板目录只暴露林境视觉模板。个人、餐饮、门窗仍由行业模板、业务数据和 capability 区分。
|
||||
|
||||
已完成阶段 `3 全量回归与扩展文档`:`pnpm validate:templates` 校验模板包 `1/1`,`format:check`、全仓 `typecheck`、API integration `37/37`、Admin build、Miniapp fixture、visual fixture 和 `git diff --check` 通过。新增模板流程记录在 `tasks/contract/README.md` 和 `tasks/regression/README.md`。
|
||||
|
||||
约束:未来新增视觉模板必须提供独立编译期 renderer、manifest、fixture、API 兼容性和构建验证;不得只复制林境 manifest 后注册为新模板。
|
||||
@@ -0,0 +1,4 @@
|
||||
id,title,task_type,depends_on,status,task_dir,acceptance_criteria,validation_command,notes
|
||||
1,模板包契约与林境声明,single-full,,DONE,tasks/contract,共享类型提供模板包元数据和运行时入口声明,林境包可校验,pnpm typecheck && pnpm validate:templates,新增 TemplatePackageManifest、registry 和文件级校验器
|
||||
2,统一唯一视觉模板,single-full,1,DONE,tasks/linjing-package,API、Admin、seed 和发布默认值只使用林境视觉模板,pnpm --filter @personal-brand/api test:integration,移除 minimal-neutral 目录和默认回退;个人/餐饮/门窗保留为行业模板
|
||||
3,全量回归与扩展文档,single-full,1;2,DONE,tasks/regression,fixture、构建、格式、类型和集成测试通过并记录新增模板流程,pnpm format:check && pnpm typecheck && pnpm --filter @personal-brand/api test:integration && pnpm --filter @personal-brand/admin build,模板校验 1/1;API 37/37;Admin、Miniapp fixture、visual fixture 和格式检查通过
|
||||
|
@@ -0,0 +1,3 @@
|
||||
# 模板包契约
|
||||
|
||||
当前正式视觉模板包为 `linjing-editorial@1.0.0`,元数据位于 `templates/linjing-editorial/template.json`。未来新增视觉模板必须提供独立的编译期页面 renderer,不得只复制林境 manifest 或复用林境 renderer 后伪装成新模板。
|
||||
@@ -0,0 +1,3 @@
|
||||
# 扩展门禁
|
||||
|
||||
新增视觉模板前必须同时提交:模板包声明、页面入口、Runtime Workspace 适配说明、品牌/行业兼容性、运行时 fixture、视觉 fixture、Admin 目录展示、API 集成测试和生产构建结果。
|
||||
@@ -0,0 +1,18 @@
|
||||
# 模板包运行时与构建体系
|
||||
|
||||
## 目标
|
||||
|
||||
将视觉模板从 `apps/miniapp` 主工程中隔离为独立 pnpm workspace package,通过构建期 compiler 生成微信小程序目录,支持大量模板扩展而不引入运行时下载。
|
||||
|
||||
## 阶段
|
||||
|
||||
1. 模板包协议与校验。
|
||||
2. 本地 template compiler 和开发命令。
|
||||
3. 林境、阿成模板迁移到独立 package。
|
||||
4. 发布配置、快照版本和模板回归门禁。
|
||||
|
||||
## 非目标
|
||||
|
||||
- 不实现小程序运行时下载或执行模板代码。
|
||||
- 不把 300 个模板打入同一个小程序包。
|
||||
- 不复制登录、API、预约状态机等业务逻辑到模板包。
|
||||
@@ -0,0 +1,62 @@
|
||||
# 进度
|
||||
|
||||
- 任务:模板包运行时与构建体系
|
||||
- 形态:epic
|
||||
- 进度:4/4
|
||||
- 当前:模板包运行时与构建体系已完成,阿成与林境静态视觉原型均已通过人工验收;后续新增模板继续按独立 package + compiler 产物流程接入。动态数据、接口联调和品牌切换另行验收。
|
||||
- 真相文件:`SUBTASKS.csv`
|
||||
|
||||
## 决策
|
||||
|
||||
- 模板包是构建输入,不是小程序运行时下载内容。
|
||||
- 单次构建只包含一个模板包。
|
||||
- 模板包只负责视觉页面、导航和交互表达;公共 runtime 负责数据、鉴权、提交和状态。
|
||||
|
||||
## 已完成
|
||||
|
||||
- 新增 `packages/template-contract`,定义 runtime contract `1.0`、页面入口和导航声明。
|
||||
- 新增 `packages/template-compiler`,支持 `pnpm template:dev <template-key> --out <dir>`。
|
||||
- 新增 `packages/template-acheng-campus-food` 模板包骨架,已通过 workspace 模板校验。
|
||||
- 编译器已验证可生成带 `template.manifest.json` 的 Mini Program 目录。
|
||||
- 新增 `template-linjing-editorial` 包声明。
|
||||
- 阿成首页、菜单、主理人和出摊服务 renderer 已复制到独立模板包,compiler 会以 `apps/miniapp` shell 为基底合并模板文件。
|
||||
- compiler 现在会根据模板声明生成 `app.json` 标题和 `template.runtime.json`,并在生成前校验页面入口、导航和 runtime contract。
|
||||
- 当前仍处于迁移过渡期:shell 的旧 renderer 暂不删除,避免页面配置尚未覆盖完整时生成不可编译目录;只有模板包完成页面级覆盖后才执行所有权清理。
|
||||
- 新增 compiler 自动测试,验证阿成 5 导航、林境 3 导航、模板标题和 renderer 文件隔离。
|
||||
- 模板包现在声明 `renderers`,阿成和林境 renderer 源码已复制进各自 package;compiler 会校验 renderer 文件存在。
|
||||
- compiler 根据模板声明生成 `app.json.tabBar`,并从生成目录移除自定义 runtime tab bar 组件和引用;阿成 5 项、林境 3 项均有回归测试。
|
||||
- 导航协议支持模板扩展 entrypoint;阿成的“出摊服务”现在独立指向 `pages/stall-service/index`,不再与餐品页复用同一入口。
|
||||
- compiler 为模板 renderer 生成稳定的 `components/template-pages/<page>` alias,公共页面不再需要引用 `acheng-*` 或 `linjing-*` 组件名;生成页面只依赖 `template-home`、`template-offerings`、`template-profile` 等稳定别名。
|
||||
- 对没有专属 renderer 的模板页面,compiler 使用公共 runtime 模块生成 alias,不会从其他行业模板借用组件;单次生成结果中的 renderer 条件会被构建期固化,避免运行时保留模板分支。
|
||||
- 咨询页已移除 `templateKey` 行业分支,改为使用 workspace 下发的 presentation;compiler 会校验 manifest 中所有 entrypoint 的 `.js/.json/.wxml/.wxss` 文件均存在。
|
||||
- 生成完成后会删除 `components/templates` 旧 renderer 目录,生成产物不再携带其他模板组件;林境产物已验证不会混入阿成 renderer。
|
||||
- manifest 现在显式声明 `runtimeOwnedPages`,当前详情、咨询、成功、记录由公共 runtime 所有;compiler 会扫描生成页面,拒绝旧模板路径、runtime tab bar 和 `templateKey` 行业分支残留。
|
||||
- `pnpm test:template-compiler` 已通过,生成链路现在有自动回归而不是只依赖手工检查。
|
||||
|
||||
## 本轮验证
|
||||
|
||||
- `pnpm validate:templates`
|
||||
- `pnpm test:template-compiler`
|
||||
- `pnpm typecheck`
|
||||
- `pnpm format:check`
|
||||
- `git diff --check`
|
||||
|
||||
## 未完成
|
||||
|
||||
- 详情、成功、记录页面暂时继续使用公共 runtime 模块,后续如需行业专属视觉可通过 manifest renderer 声明扩展。
|
||||
- `ownedPaths` 仍用于声明模板源码所有权,但生成目录清理已由 compiler 的产物隔离逻辑负责。
|
||||
- 当前构建门禁已通过:`pnpm test:template-compiler`、`pnpm validate:templates`、`pnpm typecheck`、`pnpm format:check`、`git diff --check`。
|
||||
- 发布门禁已通过:`pnpm validate:template-release`、Mini Program fixture、visual fixture。
|
||||
- 阿成模板已补齐 5 个真实页面入口:首页、套餐餐品、出摊服务、主理人、定制咨询;生成目录的 5 个 tab 全部由微信原生 `tabBar` 驱动。
|
||||
- 阿成模板 package 进一步补齐餐品详情、预订成功、预订记录 3 个二级页面,并统一餐饮橙色视觉;生成产物的 8 个页面均来自 package 或公共 runtime 的明确入口。
|
||||
- 阿成 tab 图标资源已归属模板 package;图标完整性校验放在模板包校验脚本,compiler 只按 manifest 复制并写入原生 `tabBar`,不包含行业资源特判。
|
||||
- 本轮按 `/home/que01/下载/阿成校园餐---微信小程序原型/` 的 `ServiceView`、`BookingView` 先完成静态页面迁移:出摊服务包含固定日程、配送范围、4 步定制流程和咨询 CTA;定制咨询包含表单 / 历史记录切换、类型网格、人数/日期/预算/配送选择、错误态、提交承诺和记录卡,并继续接入现有提交接口。
|
||||
- 林境模板补齐独立案例 renderer、案例分类筛选、第三个 tab 外层间距和原生 tabBar 图标;模板声明默认品牌 `linjing-doors`,生成产物不再请求 `default-brand`。
|
||||
- 静态验收结论:阿成与林境模板的页面结构、主要视觉表现、原生 tabBar 和模板间隔离达到当前验收标准。
|
||||
- `apps/miniapp` 仍是开发过渡 shell,最终人工验收目录必须使用 `pnpm template:dev <template-key> --out <dir>` 生成的构建产物;生成产物已确认不包含自定义 tab bar。
|
||||
|
||||
## 阶段结论
|
||||
|
||||
- 阶段 3 模板包迁移:已完成,静态原型迁移和生成产物已人工验收。
|
||||
- 阶段 4 发布配置与回归:已完成,发布、fixture、类型和格式门禁通过。
|
||||
- 后续新增模板只需新增独立 `packages/template-*`、更新 `config/template-build.json`,并通过 compiler、fixture 和人工验收门禁。
|
||||
@@ -0,0 +1,5 @@
|
||||
id,title,task_type,depends_on,status,task_dir,acceptance_criteria,validation_command,notes
|
||||
1,模板包协议与校验,single-full,,DONE,tasks/contract,协议定义并能校验模板包声明,pnpm validate:templates,已增加 template-contract 和 workspace 包校验
|
||||
2,本地 template compiler,single-full,1,DONE,tasks/compiler,可从 workspace 模板包生成 Mini Program 目录,pnpm template:dev acheng-campus-food,已验证生成 manifest 和 Mini Program 目录
|
||||
3,模板包迁移,single-full,2,DONE,tasks/migration,林境和阿成源码由独立包提供,pnpm test:template-compiler,已完成人工验收;阿成 5 个 tab 页面及详情/成功/记录二级页面和 tab 图标资源均归属 template package
|
||||
4,发布配置与回归,single-full,3,DONE,tasks/release,模板包版本进入构建配置并完成 fixture/API 回归,pnpm validate:template-release,发布配置、模板 fixture、compiler、类型和格式门禁均已通过
|
||||
|
@@ -0,0 +1,10 @@
|
||||
# 进度
|
||||
|
||||
- 任务:按当前行业选择模板示例内容
|
||||
- 形态:single-full
|
||||
- 状态:DONE
|
||||
- 当前:已完成
|
||||
- 关联任务:`template-sample-content-registry`
|
||||
- 已补齐个人品牌、餐饮、门窗三套示例内容注册。
|
||||
- API 按当前品牌 `templateKey` 选择示例包,不再固定门窗 key。
|
||||
- 验证:`format:check`、全仓 `typecheck`、API integration(链路成功完成)、测试后 seed 恢复。
|
||||
@@ -0,0 +1,13 @@
|
||||
# 进度
|
||||
|
||||
- 任务:模板示例内容注册表
|
||||
- 形态:single-full
|
||||
- 进度:3/3
|
||||
- 当前:已完成
|
||||
- 真相文件:`TODO.csv`
|
||||
|
||||
## 结果
|
||||
|
||||
- `@personal-brand/config` 新增 `TemplateSampleContent` 与门窗模板示例注册表。
|
||||
- Admin Workspace Controller 只消费注册表,不再写死业务项、信任内容和字段。
|
||||
- `pnpm typecheck` 已通过;API integration 和全量格式门禁待最终执行。
|
||||
@@ -0,0 +1,17 @@
|
||||
# 模板示例内容注册表
|
||||
|
||||
## 目标
|
||||
|
||||
将模板示例内容从 API Controller 移入 `@personal-brand/config` 注册表,保证模板安装与导入由声明驱动。
|
||||
|
||||
## 决策
|
||||
|
||||
- 示例业务项、信任内容、字段和能力归属属于模板包定义。
|
||||
- Controller 只负责权限、幂等检查、事务和审计。
|
||||
- 本轮先迁移现有门窗示例内容,后续行业模板按同一注册表扩展。
|
||||
|
||||
## 验收
|
||||
|
||||
- 示例内容接口不再包含行业文案、字段数组或数量常量。
|
||||
- 现有预览、导入、重复导入行为保持一致。
|
||||
- API、config、format、typecheck 通过。
|
||||
@@ -0,0 +1,4 @@
|
||||
id,task,status,acceptance_criteria,validation_command,completed_at,retry_count,notes
|
||||
1,建立模板示例内容注册表,DONE,门窗示例内容迁移至 config,pnpm typecheck,2026-09-24,0,
|
||||
2,改造示例内容 API 使用注册表,DONE,Controller 无行业内容硬编码,pnpm --filter @personal-brand/api test:integration,2026-09-24,0,保留现有导入幂等与审计
|
||||
3,完成格式与回归验证,DONE,全量门禁通过,pnpm format:check && pnpm typecheck,2026-09-24,0,
|
||||
|
@@ -0,0 +1,17 @@
|
||||
# 面向普通用户的品牌配置闭环
|
||||
|
||||
## 目标
|
||||
|
||||
在不暴露模板 key、能力状态、版本快照等管理员概念的前提下,让普通品牌使用者可以通过易懂的表单维护品牌表达、页面文案和图片,并让小程序通过 Runtime Workspace 实时消费这些配置。
|
||||
|
||||
## 边界
|
||||
|
||||
- 普通用户配置:我是谁、信任表达、业务展示、咨询文案、联系方式和图片。
|
||||
- 管理员配置:行业模板、视觉模板、能力插件、版本升级、回滚和数据结构。
|
||||
- 所有配置按当前品牌隔离,不能由客户端提交 brandId。
|
||||
|
||||
## 验收
|
||||
|
||||
- 普通用户无需理解 JSON、manifest、slot 或 template key。
|
||||
- 保存失败保留输入并显示可操作错误,成功后刷新预览和 Runtime Workspace。
|
||||
- API 有授权、成功、品牌隔离自动化测试。
|
||||
@@ -0,0 +1,18 @@
|
||||
# 进度
|
||||
|
||||
- 任务:面向普通用户的品牌配置闭环
|
||||
- 形态:epic
|
||||
- 进度:4/4
|
||||
- 当前:本 Epic 已完成,下一步补齐普通用户的图片、作品和服务内容配置
|
||||
- 真相文件:`SUBTASKS.csv`
|
||||
|
||||
## 决策
|
||||
|
||||
- 普通用户不接触模板 key、manifest、slot、插件和快照。
|
||||
- 管理员工作区继续承载模板安装、视觉模板切换、能力和版本管理。
|
||||
- presentation 以页面语义分组保存,后端合并到当前品牌 config,由公开 workspace 下发。
|
||||
- 2026-09-23:presentation API 和普通用户表单已完成。API 集成测试 `31/31` 通过,后台 `build`、`lint`、`typecheck`、`format:check` 通过;下一步验证保存后预览刷新和小程序运行时读取。
|
||||
- 2026-09-23:后台新增“当前已生效内容”运行时预览,保存成功会刷新公开 workspace,读取失败有明确提示;admin build、lint、typecheck、format:check 均通过。
|
||||
- 2026-09-23:配置闭环回归完成:API 集成测试 `31/31`、admin build、全仓 lint/typecheck/format、miniapp fixture 和 visual-fixture 均通过。
|
||||
- 2026-09-23:补充主理人身份配置,普通用户可维护姓名、身份、主张、电话、微信和服务范围;身份字段写入品牌 runtime identity,不混入视觉模板 section。API 集成测试继续保持 `31/31`。
|
||||
- 2026-09-23:在运行时预览中明确显示“主理人 / 老板姓名”和身份,避免字段虽已保存但普通用户无法确认小程序是否生效。
|
||||
@@ -0,0 +1,5 @@
|
||||
id,title,task_type,depends_on,status,task_dir,acceptance_criteria,validation_command,notes
|
||||
1,定义用户配置契约与品牌 presentation API,single-full,,DONE,tasks/presentation-api,普通用户可提交受控的 presentation 配置且按当前品牌保存,pnpm --filter @personal-brand/api test:integration,独立 presentation API 只接受允许的页面 section,集成测试 31/31 通过
|
||||
2,实现普通用户友好的品牌表达表单,single-full,1,DONE,tasks/brand-editor,表单使用中文业务概念并覆盖核心页面文案和资源,pnpm --filter @personal-brand/admin build,已实现首页、咨询页、主理人与我页面表达表单;不暴露 JSON、manifest、slot 和版本概念
|
||||
3,接入保存后的运行时预览与错误状态,single-full,1;2,DONE,tasks/runtime-preview,保存成功刷新后台预览和小程序运行时数据,pnpm --filter @personal-brand/admin build,已显示小程序当前已生效内容;运行时读取失败显示明确提示,保存失败保留输入
|
||||
4,完成配置闭环测试与文档,single-full,1;2;3,DONE,tasks/regression,授权、品牌隔离、保存、刷新和构建全部验证,pnpm format:check && pnpm lint && pnpm typecheck && pnpm --filter @personal-brand/api test:integration,API 31/31、admin build、全仓 lint/typecheck/format、miniapp fixture 均通过
|
||||
|
@@ -0,0 +1,18 @@
|
||||
# 普通用户咨询表单配置
|
||||
|
||||
## 目标
|
||||
|
||||
让普通品牌使用者可以用业务语言配置咨询表单,而不需要理解字段 key、JSON 或内部提交协议。
|
||||
|
||||
## 边界
|
||||
|
||||
- 表单名称、用途和关联业务保留为业务概念。
|
||||
- 字段只展示“要询问客户什么、回答方式、是否必填、可选内容”。
|
||||
- 字段 key 自动生成并稳定保存在快照中。
|
||||
- 后端继续负责字段校验、版本递增和提交快照,不在前端绕过校验。
|
||||
|
||||
## 完成条件
|
||||
|
||||
- 后台不显示英文 type、Key 或选项 JSON。
|
||||
- 新增和编辑字段能生成符合 API 校验的快照。
|
||||
- API integration、admin build、typecheck 和格式检查通过。
|
||||
@@ -0,0 +1,20 @@
|
||||
# 进度
|
||||
|
||||
- 任务:普通用户咨询表单配置
|
||||
- 形态:epic
|
||||
- 进度:3/3
|
||||
- 当前:本轮已完成,后台表单编辑器面向普通用户收敛。
|
||||
|
||||
## 已完成
|
||||
|
||||
- 字段编辑改为中文业务表达:字段名称、回答方式、必填状态和可选内容。
|
||||
- 内部字段 key 自动生成并隐藏,编辑已有表单时保持原 key。
|
||||
- 选择类字段使用逐行或顿号分隔的普通文本,不再要求输入 JSON。
|
||||
- 后端字段校验、版本递增和运行时提交链路保持不变。
|
||||
|
||||
## 验证
|
||||
|
||||
- `pnpm --filter @personal-brand/admin build`:通过。
|
||||
- `pnpm --filter @personal-brand/api test:integration`:31/31 通过。
|
||||
- `pnpm typecheck`:通过。
|
||||
- `pnpm format:check`:通过。
|
||||
@@ -0,0 +1,4 @@
|
||||
id,title,task_type,depends_on,status,task_dir,acceptance_criteria,validation_command,notes
|
||||
1,改造普通用户表单字段编辑器,single-full,,DONE,tasks/form-editor,字段使用中文业务表达且自动处理内部 key 和 options,pnpm --filter @personal-brand/admin build,已移除 Key、英文类型和选项 JSON 输入
|
||||
2,验证表单运行时链路,single-full,1,DONE,tasks/runtime-regression,版本、校验和客户提交链路无回归,pnpm --filter @personal-brand/api test:integration,API 31/31 通过
|
||||
3,落盘交付记录,single-full,1;2,DONE,tasks/delivery,进度和验证命令已记录,pnpm format:check && pnpm typecheck,format、typecheck 通过
|
||||
|
@@ -0,0 +1,17 @@
|
||||
# 普通用户图片资源配置
|
||||
|
||||
## 目标
|
||||
|
||||
统一品牌头像、封面、服务封面和信任内容配图的配置体验,让普通用户可以在保存前确认图片效果。
|
||||
|
||||
## 当前边界
|
||||
|
||||
- 当前阶段没有文件存储或上传服务,因此只接受可公开访问的图片地址。
|
||||
- 所有图片地址输入统一使用预览控件,避免用户保存后才发现地址不可用。
|
||||
- 后续接入媒体库时替换控件内部实现,不改变业务字段契约。
|
||||
|
||||
## 完成条件
|
||||
|
||||
- 品牌、业务提供项和信任内容统一使用图片预览控件。
|
||||
- 不再使用 `URL` 技术术语作为普通用户字段标签。
|
||||
- build、typecheck 和 format check 通过。
|
||||
@@ -0,0 +1,23 @@
|
||||
# 进度
|
||||
|
||||
- 任务:普通用户图片资源配置
|
||||
- 形态:epic
|
||||
- 进度:3/3
|
||||
- 当前:图片地址配置和预览已完成;后续可独立建设媒体库与上传服务。
|
||||
|
||||
## 已完成
|
||||
|
||||
- 品牌头像和品牌封面使用统一图片预览控件。
|
||||
- 业务提供项封面使用统一图片预览控件。
|
||||
- 信任内容配图使用统一图片预览控件。
|
||||
- 普通用户标签改为“图片地址 / 配图地址”,不再显示 `URL`。
|
||||
|
||||
## 验证
|
||||
|
||||
- `pnpm --filter @personal-brand/admin build`:通过。
|
||||
- `pnpm typecheck`:通过。
|
||||
- `pnpm format:check`:通过。
|
||||
|
||||
## 后续边界
|
||||
|
||||
文件上传需要对象存储、访问权限、大小和格式限制、删除策略以及品牌隔离,不能在当前仅有 URL 字段的基础上伪装实现;应作为独立媒体库任务推进。
|
||||
@@ -0,0 +1,4 @@
|
||||
id,title,task_type,depends_on,status,task_dir,acceptance_criteria,validation_command,notes
|
||||
1,统一图片地址和预览控件,single-full,,DONE,tasks/image-preview,四类普通用户图片配置复用同一控件,pnpm --filter @personal-brand/admin build,新增 ImageUrlField 并接入品牌、业务和信任内容
|
||||
2,验证图片配置不影响业务契约,single-full,1,DONE,tasks/contract-regression,全仓类型和格式检查通过,pnpm typecheck && pnpm format:check,已通过
|
||||
3,记录上传能力边界,single-full,1;2,DONE,tasks/delivery,明确当前未实现文件上传且保留后续替换边界,pnpm --filter @personal-brand/admin build,已记录在 EPIC 和 PROGRESS
|
||||
|
@@ -0,0 +1,18 @@
|
||||
# 普通用户业务提供项配置
|
||||
|
||||
## 目标
|
||||
|
||||
让不懂技术的品牌使用者可以用业务语言维护服务、产品或套餐,并安全地影响小程序公开展示。
|
||||
|
||||
## 边界
|
||||
|
||||
- 普通用户只接触名称、介绍、价格、封面、顺序和公开状态。
|
||||
- `sections`、`media`、`cta` 等模板结构继续由系统和管理员维护,不出现在普通用户表单中。
|
||||
- 禁用后不进入公开 workspace;存在关联咨询表单时禁止删除。
|
||||
|
||||
## 完成条件
|
||||
|
||||
- 后台编辑器不暴露内部配置字段。
|
||||
- 编辑普通字段不会覆盖已有模板详情配置。
|
||||
- API 授权、品牌隔离、启用状态和删除保护测试通过。
|
||||
- admin build、格式化和类型检查通过。
|
||||
@@ -0,0 +1,18 @@
|
||||
# 进度
|
||||
|
||||
- 任务:普通用户业务提供项配置
|
||||
- 形态:epic
|
||||
- 进度:3/3
|
||||
- 当前:本轮普通用户业务提供项配置已完成,下一步进入图片资源和咨询表单的易用化。
|
||||
|
||||
## 已完成
|
||||
|
||||
- 移除普通用户表单中的 `sections`、`media`、`cta` 内部结构。
|
||||
- 编辑时仅回填和提交用户可理解的业务字段,避免覆盖模板详情配置。
|
||||
- 删除增加二次确认,并保留关联咨询表单时由 API 阻止删除。
|
||||
|
||||
## 验证
|
||||
|
||||
- `pnpm --filter @personal-brand/api test:integration`:31/31 通过。
|
||||
- `pnpm --filter @personal-brand/admin build`:通过。
|
||||
- `pnpm exec prettier --check apps/admin/src/features/services/ServicesPage.tsx`:通过。
|
||||
@@ -0,0 +1,4 @@
|
||||
id,title,task_type,depends_on,status,task_dir,acceptance_criteria,validation_command,notes
|
||||
1,收敛普通用户业务提供项编辑器,single-full,,DONE,tasks/user-facing-editor,表单仅展示业务字段且编辑不回传内部配置,pnpm --filter @personal-brand/admin build,已移除 sections、media、cta 编辑控件,并限制编辑回填字段
|
||||
2,验证业务提供项生命周期,single-full,1,DONE,tasks/lifecycle-regression,启用、禁用、删除保护和公开 workspace 行为有自动化验证,pnpm --filter @personal-brand/api test:integration,现有 offering 生命周期测试 31/31 通过,覆盖禁用隐藏和关联表单删除保护
|
||||
3,更新交付记录,single-full,1;2,DONE,tasks/delivery,任务进度和验证结果落盘,pnpm format:check && pnpm typecheck,admin build、API integration、format 均通过
|
||||
|
@@ -0,0 +1,14 @@
|
||||
# 进度
|
||||
|
||||
- 任务:视觉模板兼容性约束
|
||||
- 形态:single-full
|
||||
- 进度:3/3
|
||||
- 当前:视觉模板兼容性约束完成
|
||||
- 真相文件:`TODO.csv`
|
||||
|
||||
## 恢复信息
|
||||
|
||||
- 已完成:视觉模板 definition 与 manifest 增加 `supportedIndustryTemplates`,兼容关系由配置声明。
|
||||
- 已完成:目录、组合预览、管理员实际切换统一执行兼容性校验;餐饮不能选择林境建筑画册。
|
||||
- 已完成:后台视觉模板选择器和组合预览仅展示当前行业可用模板。
|
||||
- 验证:API integration `36/36`、全仓 typecheck、Prettier format check 通过;Admin production build 已在前序回归通过。
|
||||
@@ -0,0 +1,19 @@
|
||||
# 视觉模板兼容性约束
|
||||
|
||||
## 目标
|
||||
|
||||
让视觉模板对行业模板的适配关系成为显式声明,并在目录、组合预览和实际切换时统一校验。
|
||||
|
||||
## 决策
|
||||
|
||||
- `linjing-editorial` 适配 `personal`、`doors`,不作为餐饮视觉模板。
|
||||
- `minimal-neutral` 适配 `personal`、`food`、`doors`。
|
||||
- 兼容性由视觉模板 manifest 声明,不能在 Controller 中写行业分支。
|
||||
- API 拒绝不兼容组合;后台只展示当前行业可用视觉模板。
|
||||
|
||||
## 验收
|
||||
|
||||
- 视觉目录返回兼容行业列表。
|
||||
- 不兼容的组合预览和切换返回明确 `400`。
|
||||
- 兼容模板切换行为保持不变。
|
||||
- API integration、Admin build、format、typecheck 通过。
|
||||
@@ -0,0 +1,4 @@
|
||||
id,task,status,acceptance_criteria,validation_command,completed_at,retry_count,notes
|
||||
1,增加视觉模板兼容声明与校验函数,DONE,config manifest 明确支持的行业模板,pnpm --filter @personal-brand/config typecheck,2026-09-24,0,兼容关系由 manifest 声明
|
||||
2,接入 API 目录预览与切换校验,DONE,不兼容组合无法预览或保存,pnpm --filter @personal-brand/api test:integration,2026-09-24,0,不兼容组合返回 400;兼容组合保持成功
|
||||
3,更新后台选择器与全量回归,DONE,后台只显示当前行业可用模板,pnpm format:check && pnpm typecheck && pnpm --filter @personal-brand/admin build,2026-09-24,0,API integration 36/36 通过;类型与格式通过
|
||||
|
@@ -3,7 +3,7 @@
|
||||
- 任务:小程序视觉模板包体系
|
||||
- 形态:epic
|
||||
- 进度:5/5
|
||||
- 当前:视觉模板包体系本轮完成
|
||||
- 当前:本 Epic 已完成,下一阶段应进入模板选择与内容配置的真实业务验收
|
||||
- 真相文件:`SUBTASKS.csv`
|
||||
|
||||
## 恢复信息
|
||||
@@ -12,8 +12,11 @@
|
||||
- 已新增 `VisualTemplateManifest`、`TemplatePackage`、页面/模块/资源/数据槽位和设计 token 类型。
|
||||
- 已将林境模板登记为 7 个核心页面的正式 manifest,并保留个人品牌主线、行业解耦和能力依赖。
|
||||
- `pnpm format:check`、`pnpm --filter @personal-brand/config typecheck`、`git diff --check` 已通过。
|
||||
- 小程序 workspace 现在消费 `visualTemplateManifest`,将 manifest 页面模块解析为运行时模块和首页布局,并兼容旧版 `layout`。
|
||||
- API workspace 返回完整视觉 manifest,API integration 28/28、Miniapp fixture 和 visual fixture 已通过。
|
||||
- 模板安装快照现在包含行业模板、视觉 manifest 和能力依赖;现有示例内容导入流程保持幂等并纳入安装验收。
|
||||
- 全量门禁通过:`format:check`、`lint`、`typecheck`、`build`、API integration 28/28、Miniapp fixture 和 visual fixture。
|
||||
- lint 仅保留既有测试文件中的 6 个 `any` warning,无 error。
|
||||
- 已发现:先前仅验证 manifest 形状,没有验证静态设计中的顶部主理人信息和信任区数据投影,也没有达到林境静态页的视觉还原要求。
|
||||
- 当前修复:API 正式投影品牌身份与信任呈现数据;seed 由模板声明注册表驱动,消除按行业 key 的共享逻辑分支;首页开始渲染工艺支柱与履约流程。
|
||||
- 本轮新增:林境的完整作品规格、履约资料和咨询字段由模板初始数据声明导入;小程序移除了静默回退到过期静态数据的路径,改为同品牌 workspace 缓存与明确错误状态。已确认 `172.16.6.123:3001` 的 `linjing-doors` workspace 返回 4 个完整作品、品牌资料、信任内容和表单字段。
|
||||
- 内容审计:林境首页、作品、详情、咨询、提交成功、记录与“主理人与我”的业务文案均已改为读取 `brand.visualPresentation`、`trustPresentation`、`offerings` 或 `inquiryForms`。布局、图标和通用交互仍保留在视觉组件中。API 集成测试覆盖了关键 presentation 文案下发。
|
||||
- 视觉验收限制:本机微信开发者工具 CLI 不提供可脚本化截图能力;文本 fixture 只能验证页面绑定和结构。用户已确认首页、作品、详情、咨询、成功、记录、我的页面均能正常显示。
|
||||
- 2026-09-23:数据真实性复核完成。小程序业务内容来自 `public/workspace`,图片来自 workspace brand/offering 数据,表单来自 `inquiryForms`,咨询记录来自客户 API;已删除未使用的 `linjingInquiryRecords` 本地假数据读取。客户微信会话改为携带 `brandSlug`,服务端按请求品牌签发 token,并在集成测试中验证林境品牌隔离。
|
||||
- 2026-09-23:通用组件的林境业务硬编码已清理,联系人标签、信任标题、流程标题和作品区文案改由 presentation slot 输入;fixture 增加品牌会话隔离与静态业务词泄漏检查。
|
||||
- 2026-09-23:全量回归完成:`format:check`、`lint`、`typecheck`、`build`、API 集成测试 `30/30`、miniapp fixture、visual-fixture 和 `git diff --check` 全部通过。lint 仅有既存测试文件的 6 个 `any` warning,无新增 error。
|
||||
@@ -1,6 +1,6 @@
|
||||
id,title,task_type,depends_on,status,task_dir,acceptance_criteria,validation_command,notes
|
||||
1,定义视觉模板包契约,single-full,,DONE,tasks/contract,VisualTemplateManifest 和 TemplatePackage 类型及契约说明完成,pnpm format:check && pnpm --filter @personal-brand/config typecheck,共享契约和 ADR 已完成
|
||||
2,将林境静态设计映射为正式视觉模板,single-full,1,DONE,tasks/linjing-mapping,林境核心页面和资源数据映射到 manifest,pnpm --filter @personal-brand/config typecheck,7 个页面、模块变体、资源槽位、数据槽位和能力依赖已登记
|
||||
3,改造小程序按 manifest 和 variant 渲染,single-full,1;2,DONE,tasks/miniapp-renderer,小程序不再依赖行业硬编码页面结构,pnpm --filter @personal-brand/miniapp test:fixture && pnpm --filter @personal-brand/miniapp test:visual-fixture,运行时解析 visualTemplateManifest,保留旧 workspace 兼容
|
||||
3,改造小程序按 manifest 和 variant 渲染,single-full,1;2,DONE,tasks/miniapp-renderer,小程序按 manifest 和 variant 渲染且林境视觉与数据完整,pnpm --filter @personal-brand/miniapp test:fixture && pnpm --filter @personal-brand/miniapp test:visual-fixture,用户已在微信开发者工具确认核心页面正常显示;数据链路与多品牌客户会话已验证
|
||||
4,初始数据导入与模板安装快照,single-full,1;2,DONE,tasks/installation,新品牌可安装模板并导入初始内容且生成快照,pnpm --filter @personal-brand/api test:integration,安装快照包含行业模板、视觉 manifest 和能力依赖;示例内容导入保持幂等
|
||||
5,视觉与全量回归,single-full,1;2;3;4,DONE,tasks/regression,接口、构建、fixture 和视觉回归全部通过,pnpm format:check && pnpm lint && pnpm typecheck && pnpm --filter @personal-brand/api test:integration,全部门禁通过;lint 保留 6 个既有 any warning
|
||||
5,视觉与全量回归,single-full,1;2;3;4,DONE,tasks/regression,接口、构建、fixture 和视觉回归全部通过,pnpm format:check && pnpm lint && pnpm typecheck && pnpm --filter @personal-brand/api test:integration,用户页面验收通过;全量工程门禁与 API 30/30 集成测试通过
|
||||
|
@@ -2,5 +2,9 @@
|
||||
|
||||
- 状态:DONE
|
||||
- 依赖:视觉模板包契约、林境模板映射和用户验收
|
||||
- 结果:公共 workspace 返回视觉 manifest;Miniapp runtime 按 manifest 页面和模块 variant 解析,并保留旧 workspace fallback。
|
||||
- 验证:`pnpm --filter @personal-brand/api test:integration`、`pnpm --filter @personal-brand/miniapp test:fixture`、`pnpm --filter @personal-brand/miniapp test:visual-fixture`
|
||||
- 已发现静态设计还原缺口,不能以 manifest 返回和 fixture 通过作为完成标准。
|
||||
- 当前方向:删除不必要的旧契约兼容思路,使用模板声明数据和视觉模块完成林境首页还原。
|
||||
- 2026-09-23:运行时 seed 已补齐林境 4 个作品、详情规格、联系资料和动态表单;作品、详情与“主理人与我”页面已接入对应数据。API 请求失败不再静默返回不完整的静态 fallback,而是使用同品牌缓存或显示错误状态。待微信开发者工具截图对照静态基准。
|
||||
- 2026-09-23:完成业务静态文案审计。林境专属页面的行业标题、履约说明、转化文案和空状态均通过 `brand.visualPresentation` 下发;不再由 WXML 写死。运行时 API 测试与小程序 fixture 已通过,待 7 页截图对照。
|
||||
- 2026-09-23:复核数据来源并修复多品牌客户会话。`customer/session/wechat` 现在使用请求中的 `brandSlug`,小程序 token 按品牌缓存;“主理人与我”记录数改为读取客户咨询 API,不再读取不存在的行业专属本地 key。集成测试 30/30、fixture 和 visual-fixture 均通过。
|
||||
- 2026-09-23:用户在微信开发者工具确认核心页面显示正常,子任务收口,后续进入全量工程回归。
|
||||
@@ -0,0 +1,33 @@
|
||||
import { Image, Input, Space, Typography } from "antd";
|
||||
|
||||
interface ImageUrlFieldProps {
|
||||
value?: string;
|
||||
onChange?: (value: string) => void;
|
||||
placeholder?: string;
|
||||
}
|
||||
|
||||
export function ImageUrlField({ value, onChange, placeholder }: ImageUrlFieldProps) {
|
||||
const imageUrl = typeof value === "string" ? value.trim() : "";
|
||||
return (
|
||||
<Space direction="vertical" size={8} style={{ width: "100%" }}>
|
||||
<Input
|
||||
value={value}
|
||||
onChange={(event) => onChange?.(event.target.value)}
|
||||
placeholder={placeholder ?? "粘贴图片地址"}
|
||||
/>
|
||||
{imageUrl ? (
|
||||
<Space align="start">
|
||||
<Image
|
||||
src={imageUrl}
|
||||
width={96}
|
||||
height={64}
|
||||
preview
|
||||
fallback="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="
|
||||
style={{ objectFit: "cover", borderRadius: 8, background: "#f5f5f5" }}
|
||||
/>
|
||||
<Typography.Text type="secondary">预览图</Typography.Text>
|
||||
</Space>
|
||||
) : null}
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
@@ -3,7 +3,13 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import type { BrandProfile } from "@personal-brand/api-client";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { ImageUrlField } from "../../components/ImageUrlField.js";
|
||||
import { MutationError, QueryState } from "../../components/QueryState.js";
|
||||
import { PresentationEditor } from "./PresentationEditor.js";
|
||||
|
||||
function textValue(value: unknown): string {
|
||||
return typeof value === "string" ? value : "";
|
||||
}
|
||||
|
||||
export function BrandPage() {
|
||||
const client = createApiClient();
|
||||
@@ -15,6 +21,10 @@ export function BrandPage() {
|
||||
queryFn: () => client.getPublicTemplate(brand.data!.templateKey),
|
||||
enabled: Boolean(brand.data?.templateKey),
|
||||
});
|
||||
const runtime = useQuery({
|
||||
queryKey: ["public-runtime-workspace"],
|
||||
queryFn: () => client.getPublicWorkspace(),
|
||||
});
|
||||
const save = useMutation({
|
||||
mutationFn: (values: Partial<BrandProfile>) => client.updateAdminBrand(values),
|
||||
onSuccess: () => {
|
||||
@@ -115,13 +125,17 @@ export function BrandPage() {
|
||||
</Form.Item>
|
||||
<Row gutter={16}>
|
||||
<Col xs={24} md={12}>
|
||||
<Form.Item name="avatarUrl" label="头像 URL">
|
||||
<Input />
|
||||
<Form.Item
|
||||
name="avatarUrl"
|
||||
label="头像图片地址"
|
||||
help="粘贴一张可公开访问的图片地址。"
|
||||
>
|
||||
<ImageUrlField />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col xs={24} md={12}>
|
||||
<Form.Item name="coverUrl" label="品牌封面 URL">
|
||||
<Input />
|
||||
<Form.Item name="coverUrl" label="品牌封面图片地址" help="建议使用横向图片。">
|
||||
<ImageUrlField />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
</Row>
|
||||
@@ -133,6 +147,45 @@ export function BrandPage() {
|
||||
</Button>
|
||||
</Space>
|
||||
</Form>
|
||||
<PresentationEditor
|
||||
initialValue={{
|
||||
identity: {
|
||||
founder: textValue(brand.data.config?.founder),
|
||||
title: textValue(brand.data.config?.title),
|
||||
slogan: textValue(brand.data.config?.slogan),
|
||||
phone: textValue(brand.data.config?.phone),
|
||||
wechat: textValue(brand.data.config?.wechat),
|
||||
studioAddress: textValue(brand.data.config?.studioAddress),
|
||||
},
|
||||
...((brand.data.config?.visualPresentation as {
|
||||
home?: Record<string, string>;
|
||||
offerings?: Record<string, string>;
|
||||
detail?: Record<string, string>;
|
||||
profile?: Record<string, string>;
|
||||
inquiry?: Record<string, string>;
|
||||
success?: Record<string, string>;
|
||||
records?: Record<string, string>;
|
||||
}) ?? {}),
|
||||
}}
|
||||
runtimeValue={
|
||||
runtime.data?.brand
|
||||
? {
|
||||
identity: {
|
||||
founder: textValue(runtime.data.brand.config?.founder),
|
||||
title: textValue(runtime.data.brand.config?.title),
|
||||
slogan: textValue(runtime.data.brand.config?.slogan),
|
||||
},
|
||||
...((runtime.data.brand.config?.visualPresentation as {
|
||||
home?: Record<string, string>;
|
||||
inquiry?: Record<string, string>;
|
||||
profile?: Record<string, string>;
|
||||
}) ?? {}),
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
runtimeLoading={runtime.isLoading}
|
||||
runtimeError={runtime.error}
|
||||
/>
|
||||
</Col>
|
||||
<Col xs={24} xl={9}>
|
||||
<Card title="公开表达预览" style={{ position: "sticky", top: 24 }}>
|
||||
|
||||
@@ -0,0 +1,189 @@
|
||||
import { Alert, Button, Card, Col, Form, Input, Row, Space, Typography, message } from "antd";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { useEffect } from "react";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
import { MutationError } from "../../components/QueryState.js";
|
||||
|
||||
interface PresentationEditorProps {
|
||||
initialValue: PresentationFormValues;
|
||||
runtimeValue?: PresentationFormValues | undefined;
|
||||
runtimeLoading?: boolean | undefined;
|
||||
runtimeError?: unknown;
|
||||
}
|
||||
|
||||
type PresentationFormValues = {
|
||||
identity?: Record<string, string>;
|
||||
home?: Record<string, string>;
|
||||
offerings?: Record<string, string>;
|
||||
detail?: Record<string, string>;
|
||||
profile?: Record<string, string>;
|
||||
inquiry?: Record<string, string>;
|
||||
success?: Record<string, string>;
|
||||
records?: Record<string, string>;
|
||||
};
|
||||
|
||||
export function PresentationEditor({
|
||||
initialValue,
|
||||
runtimeValue,
|
||||
runtimeLoading,
|
||||
runtimeError,
|
||||
}: PresentationEditorProps) {
|
||||
const [form] = Form.useForm<PresentationFormValues>();
|
||||
const queryClient = useQueryClient();
|
||||
const save = useMutation({
|
||||
mutationFn: (values: PresentationFormValues) =>
|
||||
createApiClient().updateAdminBrandPresentation(values),
|
||||
onSuccess: () => {
|
||||
message.success("页面表达已保存,小程序将使用最新内容");
|
||||
void queryClient.invalidateQueries({ queryKey: ["admin-brand"] });
|
||||
void queryClient.invalidateQueries({ queryKey: ["public-runtime-workspace"] });
|
||||
},
|
||||
});
|
||||
useEffect(() => {
|
||||
form.setFieldsValue(initialValue);
|
||||
}, [form, initialValue]);
|
||||
|
||||
return (
|
||||
<Card
|
||||
title="小程序页面表达"
|
||||
style={{ marginTop: 24 }}
|
||||
extra={<Typography.Text type="secondary">普通用户配置</Typography.Text>}
|
||||
>
|
||||
<Typography.Paragraph type="secondary">
|
||||
这里的内容会显示在小程序中。只填写你希望访客看到的话,不需要理解模板或技术配置。
|
||||
</Typography.Paragraph>
|
||||
{runtimeLoading ? <Alert type="info" showIcon message="正在读取小程序当前内容" /> : null}
|
||||
{runtimeError ? (
|
||||
<Alert type="warning" showIcon message="小程序当前内容暂时无法读取,保存后可重新加载。" />
|
||||
) : runtimeValue ? (
|
||||
<Card size="small" title="小程序当前已生效内容" style={{ marginBottom: 16 }}>
|
||||
<Typography.Text strong>
|
||||
{runtimeValue.identity?.founder || "尚未设置主理人 / 老板姓名"}
|
||||
</Typography.Text>
|
||||
{runtimeValue.identity?.title ? (
|
||||
<Typography.Text type="secondary"> · {runtimeValue.identity.title}</Typography.Text>
|
||||
) : null}
|
||||
<Typography.Paragraph strong>
|
||||
{runtimeValue.home?.proofTitle || "尚未设置信任介绍标题"}
|
||||
</Typography.Paragraph>
|
||||
<Typography.Paragraph type="secondary">
|
||||
{runtimeValue.inquiry?.subtitle || "尚未设置咨询说明"}
|
||||
</Typography.Paragraph>
|
||||
<Typography.Text type="secondary">
|
||||
咨询按钮:{runtimeValue.inquiry?.submitLabel || "未设置"} · 记录入口:
|
||||
{runtimeValue.profile?.recordsTitle || "未设置"}
|
||||
</Typography.Text>
|
||||
</Card>
|
||||
) : null}
|
||||
<Form
|
||||
form={form}
|
||||
layout="vertical"
|
||||
initialValues={initialValue}
|
||||
onFinish={(values) => save.mutate(values)}
|
||||
>
|
||||
<Card size="small" title="主理人信息" style={{ marginBottom: 16 }}>
|
||||
<Typography.Paragraph type="secondary">
|
||||
访客需要先知道是谁在提供服务。这里填写主理人或老板的公开信息。
|
||||
</Typography.Paragraph>
|
||||
<Row gutter={16}>
|
||||
<Col xs={24} md={12}>
|
||||
<Form.Item name={["identity", "founder"]} label="主理人 / 老板姓名">
|
||||
<Input placeholder="例如:林然" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col xs={24} md={12}>
|
||||
<Form.Item name={["identity", "title"]} label="身份或职位">
|
||||
<Input placeholder="例如:品牌顾问 / 工作室主理人" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col xs={24}>
|
||||
<Form.Item name={["identity", "slogan"]} label="主理人希望传达的一句话">
|
||||
<Input placeholder="例如:认真做好每一次定制" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col xs={24} md={12}>
|
||||
<Form.Item name={["identity", "phone"]} label="公开联系电话">
|
||||
<Input placeholder="选填" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col xs={24} md={12}>
|
||||
<Form.Item name={["identity", "wechat"]} label="公开微信号">
|
||||
<Input placeholder="选填" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col xs={24}>
|
||||
<Form.Item name={["identity", "studioAddress"]} label="工作地点或服务范围">
|
||||
<Input placeholder="例如:杭州及周边地区 / 某某工作室" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
</Row>
|
||||
</Card>
|
||||
<Card size="small" title="首页" style={{ marginBottom: 16 }}>
|
||||
<Row gutter={16}>
|
||||
<Col xs={24} md={12}>
|
||||
<Form.Item name={["home", "founderBadge"]} label="主理人标签">
|
||||
<Input placeholder="例如:亲自主理 / 10 年经验" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col xs={24} md={12}>
|
||||
<Form.Item name={["home", "proofTitle"]} label="信任介绍标题">
|
||||
<Input placeholder="例如:用经历和作品建立信任" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col xs={24} md={12}>
|
||||
<Form.Item name={["home", "worksTitle"]} label="作品区域标题">
|
||||
<Input placeholder="例如:精选作品" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col xs={24} md={12}>
|
||||
<Form.Item name={["home", "flowTitle"]} label="合作流程标题">
|
||||
<Input placeholder="例如:从沟通到交付" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
</Row>
|
||||
</Card>
|
||||
<Card size="small" title="咨询页面" style={{ marginBottom: 16 }}>
|
||||
<Form.Item name={["inquiry", "title"]} label="页面标题">
|
||||
<Input placeholder="例如:告诉我你的需求" />
|
||||
</Form.Item>
|
||||
<Form.Item name={["inquiry", "subtitle"]} label="说明文字">
|
||||
<Input.TextArea
|
||||
rows={2}
|
||||
showCount
|
||||
maxLength={120}
|
||||
placeholder="告诉访客提交后会发生什么。"
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item name={["inquiry", "submitLabel"]} label="提交按钮文字">
|
||||
<Input placeholder="例如:提交咨询" />
|
||||
</Form.Item>
|
||||
</Card>
|
||||
<Card size="small" title="主理人与我" style={{ marginBottom: 16 }}>
|
||||
<Row gutter={16}>
|
||||
<Col xs={24} md={12}>
|
||||
<Form.Item name={["profile", "recordsTitle"]} label="咨询记录入口标题">
|
||||
<Input placeholder="例如:我的咨询记录" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col xs={24} md={12}>
|
||||
<Form.Item name={["profile", "coverageTitle"]} label="服务范围标题">
|
||||
<Input placeholder="例如:服务范围与合作方式" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col xs={24} md={12}>
|
||||
<Form.Item name={["profile", "warrantyTitle"]} label="承诺标题">
|
||||
<Input placeholder="例如:我的服务承诺" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
</Row>
|
||||
</Card>
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<MutationError error={save.error} />
|
||||
<Button type="primary" htmlType="submit" loading={save.isPending}>
|
||||
保存页面表达
|
||||
</Button>
|
||||
</Space>
|
||||
</Form>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,382 @@
|
||||
import { useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import {
|
||||
Alert,
|
||||
Button,
|
||||
Divider,
|
||||
Empty,
|
||||
Input,
|
||||
Modal,
|
||||
Select,
|
||||
Space,
|
||||
Spin,
|
||||
Tag,
|
||||
Typography,
|
||||
message,
|
||||
} from "antd";
|
||||
import type { BrandTemplateKey } from "@personal-brand/api-client";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { MutationError, QueryState } from "../../components/QueryState.js";
|
||||
|
||||
const client = createApiClient();
|
||||
|
||||
const destinations: Record<string, string> = {
|
||||
brand: "/admin/brand",
|
||||
positioning: "/admin/brand",
|
||||
template: "/admin/publication",
|
||||
visual: "/admin/publication",
|
||||
offerings: "/admin/services",
|
||||
forms: "/admin/workspace",
|
||||
trust: "/admin/trust",
|
||||
};
|
||||
|
||||
export function PublicationPage({ canManageTemplate }: { canManageTemplate: boolean }) {
|
||||
const navigate = useNavigate();
|
||||
const queryClient = useQueryClient();
|
||||
const [industryTarget, setIndustryTarget] = useState<BrandTemplateKey | null>(null);
|
||||
const [confirmAction, setConfirmAction] = useState<"publish" | "revoke" | null>(null);
|
||||
const [rollbackVersion, setRollbackVersion] = useState<number | null>(null);
|
||||
const [note, setNote] = useState("");
|
||||
const brand = useQuery({
|
||||
queryKey: ["publication-brand"],
|
||||
queryFn: () => client.getAdminBrand(),
|
||||
});
|
||||
const workspace = useQuery({
|
||||
queryKey: ["publication-workspace"],
|
||||
queryFn: () => client.getAdminWorkspace(),
|
||||
});
|
||||
const catalog = useQuery({
|
||||
queryKey: ["publication-catalog"],
|
||||
queryFn: () => client.listPublicTemplates(),
|
||||
});
|
||||
const sample = useQuery({
|
||||
queryKey: ["publication-sample"],
|
||||
queryFn: () => client.previewAdminSampleContent(),
|
||||
enabled: Boolean(workspace.data),
|
||||
});
|
||||
const readiness = useQuery({
|
||||
queryKey: ["publication-readiness"],
|
||||
queryFn: () => client.getAdminReleaseReadiness(),
|
||||
});
|
||||
const releases = useQuery({
|
||||
queryKey: ["publication-releases"],
|
||||
queryFn: () => client.listAdminReleases(),
|
||||
});
|
||||
const refresh = () => {
|
||||
for (const key of [
|
||||
"publication-brand",
|
||||
"publication-workspace",
|
||||
"publication-sample",
|
||||
"publication-readiness",
|
||||
"publication-releases",
|
||||
"admin-shell-brand",
|
||||
"admin-workspace",
|
||||
"public-runtime-workspace",
|
||||
]) {
|
||||
void queryClient.invalidateQueries({ queryKey: [key] });
|
||||
}
|
||||
};
|
||||
const install = useMutation({
|
||||
mutationFn: (key: BrandTemplateKey) => client.installAdminTemplate(key),
|
||||
onSuccess: () => {
|
||||
setIndustryTarget(null);
|
||||
message.success("行业模板已安装");
|
||||
refresh();
|
||||
},
|
||||
});
|
||||
const selectVisual = useMutation({
|
||||
mutationFn: (key: string) =>
|
||||
client.updateAdminBrand({
|
||||
config: { ...(brand.data?.config ?? {}), visualTemplateKey: key },
|
||||
}),
|
||||
onSuccess: () => {
|
||||
message.success("视觉模板已保存到草稿");
|
||||
refresh();
|
||||
},
|
||||
});
|
||||
const importSample = useMutation({
|
||||
mutationFn: () => client.importAdminSampleContent(),
|
||||
onSuccess: () => {
|
||||
message.success("示例内容已导入草稿");
|
||||
refresh();
|
||||
},
|
||||
});
|
||||
const publish = useMutation({
|
||||
mutationFn: () => client.publishAdminRelease(note.trim() || undefined),
|
||||
onSuccess: () => {
|
||||
setConfirmAction(null);
|
||||
setNote("");
|
||||
message.success("品牌已发布");
|
||||
refresh();
|
||||
},
|
||||
});
|
||||
const revoke = useMutation({
|
||||
mutationFn: () => client.revokeAdminRelease(),
|
||||
onSuccess: () => {
|
||||
setConfirmAction(null);
|
||||
message.success("品牌已撤回,小程序将显示未发布状态");
|
||||
refresh();
|
||||
},
|
||||
});
|
||||
const rollback = useMutation({
|
||||
mutationFn: (version: number) => client.rollbackAdminRelease(version),
|
||||
onSuccess: () => {
|
||||
setRollbackVersion(null);
|
||||
message.success("历史版本已重新发布");
|
||||
refresh();
|
||||
},
|
||||
});
|
||||
const loading = [brand, workspace, catalog, readiness, releases].some((query) => query.isLoading);
|
||||
const error = [brand, workspace, catalog, readiness, releases].find(
|
||||
(query) => query.isError,
|
||||
)?.error;
|
||||
const retry = () => {
|
||||
void brand.refetch();
|
||||
void workspace.refetch();
|
||||
void catalog.refetch();
|
||||
void readiness.refetch();
|
||||
void releases.refetch();
|
||||
};
|
||||
const industryKey =
|
||||
workspace.data?.installations[0]?.templateKey ??
|
||||
workspace.data?.brand?.templateKey ??
|
||||
brand.data?.templateKey ??
|
||||
"personal";
|
||||
const visuals = (catalog.data?.visuals ?? []).filter((item) =>
|
||||
item.supportedIndustryTemplates.includes(industryKey),
|
||||
);
|
||||
const visualKey =
|
||||
typeof brand.data?.config?.visualTemplateKey === "string"
|
||||
? brand.data.config.visualTemplateKey
|
||||
: "linjing-editorial";
|
||||
const currentRelease = releases.data?.find((item) => item.status === "published");
|
||||
const publishedHistory = (releases.data ?? []).filter(
|
||||
(item) => item.status === "published" || item.status === "superseded",
|
||||
);
|
||||
const draftOfferings = workspace.data?.offerings.filter((item) => item.isEnabled) ?? [];
|
||||
const draftForms = (workspace.data?.forms ?? []) as Array<{
|
||||
id: string;
|
||||
name: string;
|
||||
isEnabled: boolean;
|
||||
}>;
|
||||
|
||||
return (
|
||||
<QueryState loading={loading} error={error} onRetry={retry}>
|
||||
<AdminPageHeader
|
||||
title="配置与发布"
|
||||
description="编辑内容不会立即影响小程序;确认后统一发布当前品牌。"
|
||||
/>
|
||||
<Space direction="vertical" size={24} style={{ width: "100%" }}>
|
||||
<section>
|
||||
<Typography.Title level={4}>1. 选择表达方式</Typography.Title>
|
||||
<Space wrap>
|
||||
<Select
|
||||
aria-label="行业模板"
|
||||
style={{ width: 220 }}
|
||||
value={industryKey}
|
||||
disabled={!canManageTemplate || Boolean(workspace.data?.installations.length)}
|
||||
options={(catalog.data?.industries ?? []).map((item) => ({
|
||||
value: item.key,
|
||||
label: item.name,
|
||||
}))}
|
||||
onChange={(key: BrandTemplateKey) => setIndustryTarget(key)}
|
||||
/>
|
||||
<Select
|
||||
aria-label="视觉模板"
|
||||
style={{ width: 220 }}
|
||||
value={visualKey}
|
||||
disabled={!canManageTemplate}
|
||||
loading={selectVisual.isPending}
|
||||
options={visuals.map((item) => ({ value: item.key, label: item.name }))}
|
||||
onChange={(key) => selectVisual.mutate(key)}
|
||||
/>
|
||||
{canManageTemplate && (
|
||||
<Button onClick={() => navigate("/admin/workspace")}>高级模板设置</Button>
|
||||
)}
|
||||
</Space>
|
||||
{workspace.data?.installations.length ? (
|
||||
<Typography.Paragraph type="secondary" style={{ marginTop: 8 }}>
|
||||
当前品牌已安装主模板。模板版本与升级在高级设置中管理。
|
||||
</Typography.Paragraph>
|
||||
) : null}
|
||||
<MutationError error={install.error || selectVisual.error} />
|
||||
<Divider />
|
||||
<Space wrap>
|
||||
<Typography.Text>示例内容</Typography.Text>
|
||||
{sample.isLoading && <Spin size="small" />}
|
||||
{sample.data && (
|
||||
<Tag color={sample.data.alreadyImported ? "green" : "blue"}>
|
||||
{sample.data.alreadyImported ? "已导入" : "可导入"}
|
||||
</Tag>
|
||||
)}
|
||||
<Button
|
||||
disabled={!canManageTemplate || !sample.data || sample.data.alreadyImported}
|
||||
loading={importSample.isPending}
|
||||
onClick={() => importSample.mutate()}
|
||||
>
|
||||
导入示例内容
|
||||
</Button>
|
||||
{sample.isError && <Button onClick={() => void sample.refetch()}>重试</Button>}
|
||||
</Space>
|
||||
{sample.isError && (
|
||||
<Alert
|
||||
type="error"
|
||||
message={sample.error instanceof Error ? sample.error.message : "示例内容加载失败"}
|
||||
showIcon
|
||||
style={{ marginTop: 8 }}
|
||||
/>
|
||||
)}
|
||||
{sample.data && !sample.data.alreadyImported && (
|
||||
<Typography.Paragraph type="secondary" style={{ marginTop: 8 }}>
|
||||
将向草稿添加{" "}
|
||||
{Object.entries(sample.data.counts)
|
||||
.map(([key, count]) => `${key} ${count} 项`)
|
||||
.join("、")}
|
||||
;发布前请替换示例文案和图片。
|
||||
</Typography.Paragraph>
|
||||
)}
|
||||
<MutationError error={importSample.error} />
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<Typography.Title level={4}>2. 核对草稿内容</Typography.Title>
|
||||
<Typography.Paragraph type="secondary">
|
||||
此处核对的是待发布内容,不是小程序视觉预览。
|
||||
</Typography.Paragraph>
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<Typography.Text strong>{brand.data?.name || "未命名品牌"}</Typography.Text>
|
||||
<Typography.Text>{brand.data?.tagline || "尚未填写品牌定位"}</Typography.Text>
|
||||
<Typography.Text>
|
||||
已启用业务项:{draftOfferings.map((item) => item.name).join("、") || "无"}
|
||||
</Typography.Text>
|
||||
<Typography.Text>
|
||||
已启用咨询表单:
|
||||
{draftForms
|
||||
.filter((item) => item.isEnabled)
|
||||
.map((item) => item.name)
|
||||
.join("、") || "无"}
|
||||
</Typography.Text>
|
||||
<Space wrap>
|
||||
<Button onClick={() => navigate("/admin/brand")}>编辑品牌</Button>
|
||||
<Button onClick={() => navigate("/admin/services")}>编辑业务项</Button>
|
||||
<Button onClick={() => navigate("/admin/trust")}>编辑信任内容</Button>
|
||||
</Space>
|
||||
</Space>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<Typography.Title level={4}>3. 检查并发布</Typography.Title>
|
||||
<Space wrap style={{ marginBottom: 12 }}>
|
||||
<Tag color={currentRelease ? "green" : "default"}>
|
||||
{currentRelease ? `已发布 v${currentRelease.version}` : "尚未发布"}
|
||||
</Tag>
|
||||
<Button onClick={() => void readiness.refetch()}>重新检查</Button>
|
||||
</Space>
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
{(readiness.data?.checks ?? []).map((check) => (
|
||||
<Space key={check.key}>
|
||||
<Tag color={check.passed ? "success" : "warning"}>
|
||||
{check.passed ? "已完成" : "待完善"}
|
||||
</Tag>
|
||||
<Typography.Text>{check.label}</Typography.Text>
|
||||
{!check.passed && (
|
||||
<Button
|
||||
type="link"
|
||||
onClick={() => navigate(destinations[check.key] ?? "/admin/overview")}
|
||||
>
|
||||
去处理
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
))}
|
||||
</Space>
|
||||
<Space wrap style={{ marginTop: 16 }}>
|
||||
<Button
|
||||
type="primary"
|
||||
disabled={!readiness.data?.ready}
|
||||
onClick={() => setConfirmAction("publish")}
|
||||
>
|
||||
发布当前草稿
|
||||
</Button>
|
||||
{currentRelease && (
|
||||
<Button danger onClick={() => setConfirmAction("revoke")}>
|
||||
撤回当前版本
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
<MutationError error={publish.error || revoke.error} />
|
||||
<Divider />
|
||||
<Typography.Title level={5}>发布记录</Typography.Title>
|
||||
{releases.data?.length ? (
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
{releases.data.map((item) => (
|
||||
<Space key={item.id} wrap>
|
||||
<Typography.Text>v{item.version}</Typography.Text>
|
||||
<Tag color={item.status === "published" ? "green" : "default"}>{item.status}</Tag>
|
||||
<Typography.Text type="secondary">
|
||||
{new Date(item.createdAt).toLocaleString("zh-CN")}
|
||||
</Typography.Text>
|
||||
{item.note && <Typography.Text>{item.note}</Typography.Text>}
|
||||
{item.status === "superseded" && publishedHistory.length > 1 && (
|
||||
<Button size="small" onClick={() => setRollbackVersion(item.version)}>
|
||||
恢复此版本
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
))}
|
||||
</Space>
|
||||
) : (
|
||||
<Empty description="暂无发布记录" />
|
||||
)}
|
||||
<MutationError error={rollback.error} />
|
||||
</section>
|
||||
</Space>
|
||||
<Modal
|
||||
title={confirmAction === "revoke" ? "确认撤回品牌" : "确认发布品牌"}
|
||||
open={confirmAction !== null}
|
||||
onCancel={() => setConfirmAction(null)}
|
||||
onOk={() => (confirmAction === "revoke" ? revoke.mutate() : publish.mutate())}
|
||||
confirmLoading={publish.isPending || revoke.isPending}
|
||||
okText={confirmAction === "revoke" ? "确认撤回" : "确认发布"}
|
||||
okButtonProps={{ danger: confirmAction === "revoke" }}
|
||||
>
|
||||
{confirmAction === "revoke" ? (
|
||||
<Alert
|
||||
type="warning"
|
||||
message="撤回后,小程序将显示品牌尚未发布,新的咨询和预约会停止受理。"
|
||||
/>
|
||||
) : (
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<Typography.Text>当前草稿将成为品牌新的公开版本。</Typography.Text>
|
||||
<Input
|
||||
value={note}
|
||||
onChange={(event) => setNote(event.target.value)}
|
||||
placeholder="发布备注(可选)"
|
||||
maxLength={200}
|
||||
/>
|
||||
</Space>
|
||||
)}
|
||||
</Modal>
|
||||
<Modal
|
||||
title="确认恢复历史版本"
|
||||
open={rollbackVersion !== null}
|
||||
onCancel={() => setRollbackVersion(null)}
|
||||
onOk={() => rollbackVersion !== null && rollback.mutate(rollbackVersion)}
|
||||
confirmLoading={rollback.isPending}
|
||||
>
|
||||
将 v{rollbackVersion} 重新发布为新版本;当前草稿不会被覆盖。
|
||||
</Modal>
|
||||
<Modal
|
||||
title="确认安装行业模板"
|
||||
open={industryTarget !== null}
|
||||
onCancel={() => setIndustryTarget(null)}
|
||||
onOk={() => industryTarget && install.mutate(industryTarget)}
|
||||
confirmLoading={install.isPending}
|
||||
>
|
||||
模板会更新当前品牌的草稿结构,不会立即改变已发布的小程序。请安装后核对业务内容与视觉模板。
|
||||
</Modal>
|
||||
</QueryState>
|
||||
);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
Form,
|
||||
Input,
|
||||
Modal,
|
||||
Popconfirm,
|
||||
Select,
|
||||
Space,
|
||||
Table,
|
||||
@@ -16,6 +17,7 @@ import type { Offering } from "@personal-brand/api-client";
|
||||
import { useState } from "react";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { ImageUrlField } from "../../components/ImageUrlField.js";
|
||||
import { MutationError, QueryState } from "../../components/QueryState.js";
|
||||
|
||||
export function ServicesPage() {
|
||||
@@ -56,16 +58,19 @@ export function ServicesPage() {
|
||||
const beginOffering = (item?: Offering) => {
|
||||
setEditingOffering(item ?? null);
|
||||
setOfferingOpen(true);
|
||||
const config = item?.config ?? {};
|
||||
offeringForm.setFieldsValue(
|
||||
item
|
||||
? {
|
||||
...item,
|
||||
sections: config.sections ?? [],
|
||||
media: config.media ?? [],
|
||||
cta: config.cta ?? {},
|
||||
kind: item.kind,
|
||||
name: item.name,
|
||||
summary: item.summary ?? "",
|
||||
description: item.description ?? "",
|
||||
priceText: item.priceText ?? "",
|
||||
coverUrl: item.coverUrl ?? "",
|
||||
sortOrder: item.sortOrder,
|
||||
isEnabled: item.isEnabled,
|
||||
}
|
||||
: { kind: "service", isEnabled: true, sortOrder: 0, sections: [], media: [], cta: {} },
|
||||
: { kind: "service", isEnabled: true, sortOrder: 0 },
|
||||
);
|
||||
};
|
||||
return (
|
||||
@@ -129,9 +134,17 @@ export function ServicesPage() {
|
||||
>
|
||||
{item.isEnabled ? "禁用" : "启用"}
|
||||
</Button>
|
||||
<Button danger size="small" onClick={() => deleteOffering.mutate(item.id)}>
|
||||
删除
|
||||
</Button>
|
||||
<Popconfirm
|
||||
title="确认删除这项业务提供项?"
|
||||
description="如果它已经关联咨询表单,系统会阻止删除。"
|
||||
onConfirm={() => deleteOffering.mutate(item.id)}
|
||||
okText="删除"
|
||||
cancelText="取消"
|
||||
>
|
||||
<Button danger size="small" loading={deleteOffering.isPending}>
|
||||
删除
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
@@ -180,85 +193,22 @@ export function ServicesPage() {
|
||||
<Input.TextArea rows={5} />
|
||||
</Form.Item>
|
||||
<Form.Item name="priceText" label="价格展示">
|
||||
<Input />
|
||||
<Input placeholder="例如:按现场评估报价 / ¥ 2,800 起" />
|
||||
</Form.Item>
|
||||
<Form.Item name="coverUrl" label="封面图片 URL">
|
||||
<Input />
|
||||
<Form.Item
|
||||
name="coverUrl"
|
||||
label="封面图片地址"
|
||||
help="填写图片地址;图片上传能力将在后续媒体管理中提供。"
|
||||
>
|
||||
<ImageUrlField placeholder="粘贴服务或产品封面图片地址" />
|
||||
</Form.Item>
|
||||
<Form.List name="sections">
|
||||
{(fields, { add, remove }) => (
|
||||
<>
|
||||
<Form.Item label="内容分区">
|
||||
<Button onClick={() => add({ type: "text" })}>新增分区</Button>
|
||||
</Form.Item>
|
||||
{fields.map(({ key, name, ...restField }) => (
|
||||
<Space key={key} align="start" style={{ display: "flex", marginBottom: 8 }}>
|
||||
<Form.Item {...restField} name={[name, "type"]}>
|
||||
<Select
|
||||
style={{ width: 120 }}
|
||||
options={[
|
||||
{ value: "text", label: "文本" },
|
||||
{ value: "image-list", label: "图片列表" },
|
||||
{ value: "timeline", label: "时间线" },
|
||||
{ value: "faq", label: "常见问题" },
|
||||
]}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item {...restField} name={[name, "title"]}>
|
||||
<Input placeholder="分区标题" />
|
||||
</Form.Item>
|
||||
<Form.Item {...restField} name={[name, "content"]}>
|
||||
<Input placeholder="分区内容" />
|
||||
</Form.Item>
|
||||
<Button danger onClick={() => remove(name)}>
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
</Form.List>
|
||||
<Form.List name="media">
|
||||
{(fields, { add, remove }) => (
|
||||
<>
|
||||
<Form.Item label="媒体列表">
|
||||
<Button onClick={() => add({ type: "image" })}>新增媒体</Button>
|
||||
</Form.Item>
|
||||
{fields.map(({ key, name, ...restField }) => (
|
||||
<Space key={key} align="start" style={{ display: "flex", marginBottom: 8 }}>
|
||||
<Form.Item {...restField} name={[name, "url"]}>
|
||||
<Input placeholder="图片 URL" />
|
||||
</Form.Item>
|
||||
<Form.Item {...restField} name={[name, "alt"]}>
|
||||
<Input placeholder="替代文本" />
|
||||
</Form.Item>
|
||||
<Button danger onClick={() => remove(name)}>
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
</Form.List>
|
||||
<Form.Item label="行动按钮">
|
||||
<Space>
|
||||
<Form.Item name={["cta", "type"]} noStyle>
|
||||
<Select
|
||||
style={{ width: 150 }}
|
||||
allowClear
|
||||
placeholder="按钮行为"
|
||||
options={[
|
||||
{ value: "inquiry", label: "提交咨询" },
|
||||
{ value: "booking", label: "预约服务" },
|
||||
{ value: "contact", label: "联系品牌" },
|
||||
{ value: "external-link", label: "外部链接" },
|
||||
]}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item name={["cta", "label"]} noStyle>
|
||||
<Input placeholder="按钮文案" />
|
||||
</Form.Item>
|
||||
</Space>
|
||||
<Form.Item
|
||||
name="sortOrder"
|
||||
label="展示顺序"
|
||||
help="数字越小越靠前,不确定时填写 0。"
|
||||
rules={[{ type: "number", min: 0, max: 9999 }]}
|
||||
>
|
||||
<Input type="number" min={0} max={9999} />
|
||||
</Form.Item>
|
||||
<Form.Item name="isEnabled" label="公开状态">
|
||||
<Select
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
import {
|
||||
Alert,
|
||||
Button,
|
||||
Card,
|
||||
Form,
|
||||
Input,
|
||||
Modal,
|
||||
Select,
|
||||
Space,
|
||||
Table,
|
||||
Tag,
|
||||
Typography,
|
||||
message,
|
||||
} from "antd";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import type { AdminBrandMember } from "@personal-brand/api-client";
|
||||
import { useState } from "react";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { MutationError, QueryState } from "../../components/QueryState.js";
|
||||
|
||||
const roleLabels: Record<string, string> = {
|
||||
owner: "负责人",
|
||||
editor: "内容编辑",
|
||||
admin: "管理员",
|
||||
"platform-admin": "平台管理员",
|
||||
};
|
||||
|
||||
export function MembersPage() {
|
||||
const client = createApiClient();
|
||||
const queryClient = useQueryClient();
|
||||
const [addOpen, setAddOpen] = useState(false);
|
||||
const [addForm] = Form.useForm();
|
||||
const members = useQuery({
|
||||
queryKey: ["admin-members"],
|
||||
queryFn: () => client.listAdminMembers(),
|
||||
});
|
||||
const update = useMutation({
|
||||
mutationFn: ({
|
||||
id,
|
||||
body,
|
||||
}: {
|
||||
id: string;
|
||||
body: Partial<Pick<AdminBrandMember, "role" | "isEnabled">>;
|
||||
}) => client.updateAdminMember(id, body),
|
||||
onSuccess: () => {
|
||||
message.success("成员权限已更新");
|
||||
void queryClient.invalidateQueries({ queryKey: ["admin-members"] });
|
||||
},
|
||||
});
|
||||
const create = useMutation({
|
||||
mutationFn: (values: {
|
||||
username: string;
|
||||
displayName: string;
|
||||
password: string;
|
||||
role: "owner" | "editor";
|
||||
}) => client.createAdminMember(values),
|
||||
onSuccess: () => {
|
||||
message.success("成员已添加");
|
||||
setAddOpen(false);
|
||||
addForm.resetFields();
|
||||
void queryClient.invalidateQueries({ queryKey: ["admin-members"] });
|
||||
},
|
||||
});
|
||||
return (
|
||||
<QueryState
|
||||
loading={members.isLoading}
|
||||
error={members.error}
|
||||
onRetry={() => void members.refetch()}
|
||||
>
|
||||
<AdminPageHeader
|
||||
title="团队成员"
|
||||
description="管理谁可以维护当前品牌。负责人可以调整系统设置,内容编辑只能维护日常经营内容。"
|
||||
extra={
|
||||
<Button type="primary" onClick={() => setAddOpen(true)}>
|
||||
手动添加成员
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
<Card>
|
||||
<Alert
|
||||
type="info"
|
||||
showIcon
|
||||
message="请将初始账号和密码安全地交给成员"
|
||||
description="当前采用负责人手动添加方式;系统不会再次显示成员初始密码。"
|
||||
style={{ marginBottom: 16 }}
|
||||
/>
|
||||
<Table
|
||||
rowKey="id"
|
||||
loading={members.isLoading}
|
||||
dataSource={members.data ?? []}
|
||||
columns={[
|
||||
{
|
||||
title: "成员",
|
||||
render: (_: unknown, item: AdminBrandMember) => item.adminUser.displayName,
|
||||
},
|
||||
{ title: "账号", dataIndex: ["adminUser", "username"] },
|
||||
{
|
||||
title: "角色",
|
||||
dataIndex: "role",
|
||||
render: (value: string, item: AdminBrandMember) => (
|
||||
<Select
|
||||
value={value}
|
||||
options={["owner", "editor"].map((role) => ({
|
||||
value: role,
|
||||
label: roleLabels[role],
|
||||
}))}
|
||||
onChange={(role) => update.mutate({ id: item.id, body: { role } })}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
dataIndex: "isEnabled",
|
||||
render: (value: boolean, item: AdminBrandMember) => (
|
||||
<Select
|
||||
value={value}
|
||||
options={[
|
||||
{ value: true, label: "已启用" },
|
||||
{ value: false, label: "已停用" },
|
||||
]}
|
||||
onChange={(isEnabled) => update.mutate({ id: item.id, body: { isEnabled } })}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "说明",
|
||||
render: (_: unknown, item: AdminBrandMember) => (
|
||||
<Space>
|
||||
<Tag>{roleLabels[item.role] ?? item.role}</Tag>
|
||||
{!item.adminUser.isEnabled ? (
|
||||
<Typography.Text type="danger">账号已停用</Typography.Text>
|
||||
) : null}
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<MutationError error={update.error} />
|
||||
<MutationError error={create.error} />
|
||||
</Card>
|
||||
<Modal
|
||||
open={addOpen}
|
||||
title="手动添加成员"
|
||||
onCancel={() => {
|
||||
setAddOpen(false);
|
||||
addForm.resetFields();
|
||||
}}
|
||||
onOk={() => addForm.submit()}
|
||||
confirmLoading={create.isPending}
|
||||
destroyOnClose
|
||||
>
|
||||
<Form
|
||||
form={addForm}
|
||||
layout="vertical"
|
||||
onFinish={(values) =>
|
||||
create.mutate(
|
||||
values as {
|
||||
username: string;
|
||||
displayName: string;
|
||||
password: string;
|
||||
role: "owner" | "editor";
|
||||
},
|
||||
)
|
||||
}
|
||||
>
|
||||
<Form.Item
|
||||
name="username"
|
||||
label="登录账号"
|
||||
rules={[{ required: true, message: "请输入登录账号" }]}
|
||||
>
|
||||
<Input placeholder="例如:linran" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="displayName"
|
||||
label="成员姓名"
|
||||
rules={[{ required: true, message: "请输入成员姓名" }]}
|
||||
>
|
||||
<Input placeholder="例如:林然" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="password"
|
||||
label="初始密码"
|
||||
rules={[{ required: true, min: 8, message: "请输入至少 8 位初始密码" }]}
|
||||
extra="添加成功后不会再次显示,请提前告知成员。"
|
||||
>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Form.Item name="role" label="角色" initialValue="editor" rules={[{ required: true }]}>
|
||||
<Select
|
||||
options={[
|
||||
{ value: "editor", label: "内容编辑:维护日常经营内容" },
|
||||
{ value: "owner", label: "负责人:可调整系统设置" },
|
||||
]}
|
||||
/>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
</QueryState>
|
||||
);
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import type { TrustContent, TrustContentInput } from "@personal-brand/api-client
|
||||
import { useState } from "react";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { ImageUrlField } from "../../components/ImageUrlField.js";
|
||||
import { MutationError, QueryState } from "../../components/QueryState.js";
|
||||
|
||||
const types = [
|
||||
@@ -157,8 +158,12 @@ export function TrustContentPage() {
|
||||
<Form.Item name="content" label="详细内容" rules={[{ required: true }]}>
|
||||
<Input.TextArea rows={8} showCount maxLength={2000} />
|
||||
</Form.Item>
|
||||
<Form.Item name="coverUrl" label="封面图片 URL">
|
||||
<Input />
|
||||
<Form.Item
|
||||
name="coverUrl"
|
||||
label="配图地址"
|
||||
help="粘贴一张可公开访问的图片地址,保存前会显示预览。"
|
||||
>
|
||||
<ImageUrlField placeholder="粘贴案例或经历配图地址" />
|
||||
</Form.Item>
|
||||
<Form.Item name="isPublished" label="公开状态">
|
||||
<Select
|
||||
|
||||
@@ -14,11 +14,59 @@ import {
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
import { ApiClientError } from "@personal-brand/api-client";
|
||||
import type { BrandFieldDefinition, BrandModule, InquiryForm } from "@personal-brand/api-client";
|
||||
import type {
|
||||
BrandFieldDefinition,
|
||||
BrandModule,
|
||||
BrandTemplateKey,
|
||||
InquiryForm,
|
||||
} from "@personal-brand/api-client";
|
||||
import { useState } from "react";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { MutationError } from "../../components/QueryState.js";
|
||||
|
||||
const inquiryFieldTypes = [
|
||||
{ value: "text", label: "简短文字" },
|
||||
{ value: "textarea", label: "详细说明" },
|
||||
{ value: "phone", label: "联系电话" },
|
||||
{ value: "number", label: "数字" },
|
||||
{ value: "date", label: "日期" },
|
||||
{ value: "image", label: "图片" },
|
||||
{ value: "url", label: "链接" },
|
||||
{ value: "select", label: "单项选择" },
|
||||
{ value: "multi-select", label: "多项选择" },
|
||||
];
|
||||
|
||||
function optionsToText(options: unknown): string {
|
||||
if (!Array.isArray(options)) return "";
|
||||
return options
|
||||
.map((option) => {
|
||||
if (!option || typeof option !== "object") return "";
|
||||
const label = (option as { label?: unknown }).label;
|
||||
return typeof label === "string" ? label : "";
|
||||
})
|
||||
.filter(Boolean)
|
||||
.join("\n");
|
||||
}
|
||||
|
||||
function optionsFromText(value: unknown): Array<{ label: string; value: string }> {
|
||||
if (typeof value !== "string") return [];
|
||||
return value
|
||||
.split(/\r?\n|、|,/)
|
||||
.map((item) => item.trim())
|
||||
.filter(Boolean)
|
||||
.map((item) => ({ label: item, value: item }));
|
||||
}
|
||||
|
||||
function supportsIndustry(
|
||||
visual: { supportedIndustryTemplates?: unknown },
|
||||
industry: string,
|
||||
): boolean {
|
||||
return (
|
||||
Array.isArray(visual.supportedIndustryTemplates) &&
|
||||
visual.supportedIndustryTemplates.includes(industry)
|
||||
);
|
||||
}
|
||||
|
||||
export function WorkspacePage() {
|
||||
const client = createApiClient();
|
||||
const queryClient = useQueryClient();
|
||||
@@ -32,7 +80,7 @@ export function WorkspacePage() {
|
||||
description: string;
|
||||
capabilities: string[];
|
||||
} | null>(null);
|
||||
const [previewIndustry, setPreviewIndustry] = useState("personal");
|
||||
const [previewIndustry, setPreviewIndustry] = useState<BrandTemplateKey>("personal");
|
||||
const [previewVisual, setPreviewVisual] = useState("linjing-editorial");
|
||||
const [form] = Form.useForm<Record<string, unknown>>();
|
||||
const [inquiryForm] = Form.useForm<Record<string, unknown>>();
|
||||
@@ -53,6 +101,9 @@ export function WorkspacePage() {
|
||||
queryFn: () => client.previewPublicTemplateCombination(previewIndustry, previewVisual),
|
||||
enabled: Boolean(templateCatalog.data),
|
||||
});
|
||||
const compatibleVisuals = (templateCatalog.data?.visuals ?? []).filter((visual) =>
|
||||
supportsIndustry(visual, query.data?.brand?.templateKey ?? "personal"),
|
||||
);
|
||||
const visualTemplate = useMutation({
|
||||
mutationFn: (key: string) =>
|
||||
client.updateAdminBrand({
|
||||
@@ -247,8 +298,7 @@ export function WorkspacePage() {
|
||||
loading={visualTemplate.isPending}
|
||||
onChange={(key) => setVisualTarget(key)}
|
||||
options={[
|
||||
{ value: "linjing-editorial", label: "林境建筑画册" },
|
||||
{ value: "minimal-neutral", label: "极简留白" },
|
||||
...compatibleVisuals.map((visual) => ({ value: visual.key, label: visual.name })),
|
||||
]}
|
||||
/>
|
||||
{runtimeQuery.data?.visualTemplate && (
|
||||
@@ -285,7 +335,7 @@ export function WorkspacePage() {
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<Typography.Text strong>可用视觉模板</Typography.Text>
|
||||
<Space wrap>
|
||||
{(templateCatalog.data?.visuals ?? []).map((visual) => (
|
||||
{compatibleVisuals.map((visual) => (
|
||||
<Card key={visual.key} size="small" style={{ width: 260 }}>
|
||||
<Typography.Text strong>{visual.name}</Typography.Text>
|
||||
<Typography.Paragraph type="secondary" ellipsis={{ rows: 2 }}>
|
||||
@@ -321,9 +371,7 @@ export function WorkspacePage() {
|
||||
<Typography.Paragraph>
|
||||
当前模板:{runtimeQuery.data?.visualTemplate?.name ?? "林境建筑画册"}
|
||||
</Typography.Paragraph>
|
||||
<Typography.Paragraph>
|
||||
目标模板:{visualTarget === "minimal-neutral" ? "极简留白" : "林境建筑画册"}
|
||||
</Typography.Paragraph>
|
||||
<Typography.Paragraph>目标模板:林境建筑画册</Typography.Paragraph>
|
||||
<Typography.Paragraph type="secondary">
|
||||
只会替换视觉主题和模块变体,不会覆盖品牌内容、业务提供项或咨询记录。
|
||||
</Typography.Paragraph>
|
||||
@@ -418,10 +466,9 @@ export function WorkspacePage() {
|
||||
<Select
|
||||
value={previewVisual}
|
||||
onChange={setPreviewVisual}
|
||||
options={(templateCatalog.data?.visuals ?? []).map((item) => ({
|
||||
value: item.key,
|
||||
label: item.name,
|
||||
}))}
|
||||
options={(templateCatalog.data?.visuals ?? [])
|
||||
.filter((item) => supportsIndustry(item, previewIndustry))
|
||||
.map((item) => ({ value: item.key, label: item.name }))}
|
||||
/>
|
||||
</Space>
|
||||
{combinationPreview.isLoading ? (
|
||||
@@ -490,9 +537,7 @@ export function WorkspacePage() {
|
||||
const value = field as Record<string, unknown>;
|
||||
return {
|
||||
...value,
|
||||
...(Array.isArray(value.options)
|
||||
? { optionsText: JSON.stringify(value.options) }
|
||||
: {}),
|
||||
optionsText: optionsToText(value.options),
|
||||
};
|
||||
}),
|
||||
});
|
||||
@@ -692,15 +737,11 @@ export function WorkspacePage() {
|
||||
: []
|
||||
).map((field) => {
|
||||
const item = field as Record<string, unknown>;
|
||||
if (typeof item.optionsText !== "string") return item;
|
||||
try {
|
||||
const options = JSON.parse(item.optionsText) as unknown;
|
||||
const { optionsText, ...rest } = item;
|
||||
void optionsText;
|
||||
return { ...rest, options };
|
||||
} catch {
|
||||
return item;
|
||||
}
|
||||
const { optionsText, ...rest } = item;
|
||||
const type = typeof rest.type === "string" ? rest.type : "text";
|
||||
return ["select", "radio", "multi-select"].includes(type)
|
||||
? { ...rest, options: optionsFromText(optionsText) }
|
||||
: rest;
|
||||
}),
|
||||
};
|
||||
if (editingForm) updateForm.mutate({ id: editingForm.id, body });
|
||||
@@ -738,47 +779,70 @@ export function WorkspacePage() {
|
||||
{(fields, { add, remove }) => (
|
||||
<>
|
||||
<Form.Item label="表单字段">
|
||||
<Button onClick={() => add({ type: "text", required: false })}>新增字段</Button>
|
||||
<Button
|
||||
onClick={() =>
|
||||
add({
|
||||
key: `field_${Date.now()}`,
|
||||
type: "text",
|
||||
required: false,
|
||||
})
|
||||
}
|
||||
>
|
||||
新增字段
|
||||
</Button>
|
||||
</Form.Item>
|
||||
{fields.map(({ key, name, ...restField }) => (
|
||||
<Space key={key} align="start" style={{ display: "flex", marginBottom: 8 }}>
|
||||
<Form.Item {...restField} name={[name, "key"]} rules={[{ required: true }]}>
|
||||
<Input placeholder="Key" />
|
||||
</Form.Item>
|
||||
<Form.Item {...restField} name={[name, "label"]} rules={[{ required: true }]}>
|
||||
<Input placeholder="字段名称" />
|
||||
</Form.Item>
|
||||
<Form.Item {...restField} name={[name, "type"]}>
|
||||
<Select
|
||||
style={{ width: 120 }}
|
||||
options={[
|
||||
"text",
|
||||
"textarea",
|
||||
"number",
|
||||
"date",
|
||||
"select",
|
||||
"multi-select",
|
||||
"image",
|
||||
"url",
|
||||
"phone",
|
||||
].map((value) => ({ value, label: value }))}
|
||||
/>
|
||||
<Card key={key} size="small" style={{ marginBottom: 12 }}>
|
||||
<Form.Item {...restField} name={[name, "key"]} hidden>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Space align="start" style={{ display: "flex" }}>
|
||||
<Form.Item
|
||||
{...restField}
|
||||
name={[name, "label"]}
|
||||
label="要询问客户什么"
|
||||
rules={[{ required: true, message: "请填写字段名称" }]}
|
||||
style={{ flex: 1 }}
|
||||
>
|
||||
<Input placeholder="例如:联系电话、预计预算、项目地址" />
|
||||
</Form.Item>
|
||||
<Form.Item {...restField} name={[name, "type"]} label="回答方式">
|
||||
<Select style={{ width: 130 }} options={inquiryFieldTypes} />
|
||||
</Form.Item>
|
||||
<Form.Item {...restField} name={[name, "required"]} label="必填">
|
||||
<Select
|
||||
style={{ width: 90 }}
|
||||
options={[
|
||||
{ value: true, label: "必填" },
|
||||
{ value: false, label: "选填" },
|
||||
]}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Button danger onClick={() => remove(name)} style={{ marginTop: 30 }}>
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
<Form.Item noStyle shouldUpdate>
|
||||
{({ getFieldValue }) =>
|
||||
["select", "radio"].includes(
|
||||
["select", "radio", "multi-select"].includes(
|
||||
String(getFieldValue(["fieldsSnapshot", name, "type"])),
|
||||
) ? (
|
||||
<Form.Item {...restField} name={[name, "optionsText"]}>
|
||||
<Input placeholder="选项 JSON" />
|
||||
<Form.Item
|
||||
{...restField}
|
||||
name={[name, "optionsText"]}
|
||||
label="可选内容"
|
||||
help="每行填写一个选项,也可以用顿号分隔。"
|
||||
rules={[{ required: true, message: "请至少填写一个选项" }]}
|
||||
>
|
||||
<Input.TextArea
|
||||
rows={2}
|
||||
placeholder="例如:预算内、需要沟通、暂不确定"
|
||||
/>
|
||||
</Form.Item>
|
||||
) : null
|
||||
}
|
||||
</Form.Item>
|
||||
<Button danger onClick={() => remove(name)}>
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
</Card>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
|
||||
+128
-13
@@ -49,13 +49,27 @@ const FeatureCapabilitiesPage = React.lazy(() =>
|
||||
default: module.CapabilitiesPage,
|
||||
})),
|
||||
);
|
||||
const FeatureMembersPage = React.lazy(() =>
|
||||
import("./features/team/MembersPage.js").then((module) => ({
|
||||
default: module.MembersPage,
|
||||
})),
|
||||
);
|
||||
const FeaturePublicationPage = React.lazy(() =>
|
||||
import("./features/publication/PublicationPage.js").then((module) => ({
|
||||
default: module.PublicationPage,
|
||||
})),
|
||||
);
|
||||
import { BrowserRouter, Navigate, Route, Routes, useLocation, useNavigate } from "react-router-dom";
|
||||
import "antd/dist/reset.css";
|
||||
|
||||
const queryClient = new QueryClient();
|
||||
const api = createApiClient;
|
||||
|
||||
function Login({ onLogin }: { onLogin: () => void }) {
|
||||
function Login({
|
||||
onLogin,
|
||||
}: {
|
||||
onLogin: (session: { role: string; mustChangePassword: boolean }) => void;
|
||||
}) {
|
||||
const [form] = Form.useForm();
|
||||
const [loading, setLoading] = useState(false);
|
||||
async function submit(values: { username: string; password: string }) {
|
||||
@@ -63,7 +77,9 @@ function Login({ onLogin }: { onLogin: () => void }) {
|
||||
try {
|
||||
const result = await api().loginAdmin(values.username, values.password);
|
||||
localStorage.setItem("adminToken", result.token);
|
||||
onLogin();
|
||||
localStorage.setItem("adminRole", result.role);
|
||||
localStorage.setItem("adminMustChangePassword", String(result.mustChangePassword));
|
||||
onLogin(result);
|
||||
} catch (error) {
|
||||
message.error(error instanceof Error ? error.message : "登录失败");
|
||||
} finally {
|
||||
@@ -87,7 +103,60 @@ function Login({ onLogin }: { onLogin: () => void }) {
|
||||
);
|
||||
}
|
||||
|
||||
function Dashboard({ onLogout }: { onLogout: () => void }) {
|
||||
function ChangePassword({ onComplete }: { onComplete: () => void }) {
|
||||
const [form] = Form.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 api().changeAdminPassword(values.currentPassword, values.newPassword);
|
||||
localStorage.setItem("adminMustChangePassword", "false");
|
||||
message.success("密码已更新");
|
||||
onComplete();
|
||||
} catch (error) {
|
||||
message.error(error instanceof Error ? error.message : "密码更新失败");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
return (
|
||||
<Card title="首次登录需要修改密码" style={{ maxWidth: 420, margin: "120px auto" }}>
|
||||
<Typography.Paragraph type="secondary">请先设置只有你本人知道的新密码。</Typography.Paragraph>
|
||||
<Form form={form} layout="vertical" onFinish={submit}>
|
||||
<Form.Item name="currentPassword" label="初始密码" rules={[{ required: true }]}>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="newPassword"
|
||||
label="新密码"
|
||||
rules={[{ required: true, min: 8, message: "请输入至少 8 位新密码" }]}
|
||||
>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Form.Item name="confirmPassword" label="确认新密码" rules={[{ required: true }]}>
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Button type="primary" htmlType="submit" loading={loading} block>
|
||||
保存新密码
|
||||
</Button>
|
||||
</Form>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
function Dashboard({ onLogout, role }: { onLogout: () => void; role: string }) {
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const brand = useQuery({
|
||||
@@ -109,13 +178,31 @@ function Dashboard({ onLogout }: { onLogout: () => void }) {
|
||||
};
|
||||
const page = location.pathname.split("/")[2] || "overview";
|
||||
const items = [
|
||||
{ key: "overview", label: "当前品牌概览" },
|
||||
{ key: "brand", label: "当前品牌表达" },
|
||||
{ key: "trust", label: "信任内容" },
|
||||
{ key: "services", label: "业务提供项" },
|
||||
{ key: "workspace", label: "模板与设置" },
|
||||
{ key: "capabilities", label: "能力插件" },
|
||||
{ key: "inquiries", label: "咨询记录" },
|
||||
{
|
||||
type: "group" as const,
|
||||
label: "日常经营",
|
||||
children: [
|
||||
{ key: "overview", label: "当前品牌概览" },
|
||||
{ key: "publication", label: "配置与发布" },
|
||||
{ key: "brand", label: "品牌表达" },
|
||||
{ key: "trust", label: "信任内容" },
|
||||
{ key: "services", label: "业务提供项" },
|
||||
{ key: "inquiries", label: "咨询记录" },
|
||||
],
|
||||
},
|
||||
...(role === "editor"
|
||||
? []
|
||||
: [
|
||||
{
|
||||
type: "group" as const,
|
||||
label: "系统管理",
|
||||
children: [
|
||||
{ key: "workspace", label: "模板与设置" },
|
||||
{ key: "capabilities", label: "能力插件" },
|
||||
{ key: "members", label: "团队成员" },
|
||||
],
|
||||
},
|
||||
]),
|
||||
];
|
||||
return (
|
||||
<Layout style={{ minHeight: "100vh" }}>
|
||||
@@ -163,9 +250,20 @@ function Dashboard({ onLogout }: { onLogout: () => void }) {
|
||||
<Suspense fallback={<Card loading />}>
|
||||
<Routes>
|
||||
<Route path="/admin/overview" element={<FeatureOverviewPage />} />
|
||||
<Route
|
||||
path="/admin/publication"
|
||||
element={<FeaturePublicationPage canManageTemplate={role !== "editor"} />}
|
||||
/>
|
||||
<Route path="/admin/brand" element={<FeatureBrandPage />} />
|
||||
<Route path="/admin/workspace" element={<FeatureWorkspacePage />} />
|
||||
<Route path="/admin/capabilities" element={<FeatureCapabilitiesPage />} />
|
||||
{role === "editor" ? null : (
|
||||
<Route path="/admin/workspace" element={<FeatureWorkspacePage />} />
|
||||
)}
|
||||
{role === "editor" ? null : (
|
||||
<Route path="/admin/capabilities" element={<FeatureCapabilitiesPage />} />
|
||||
)}
|
||||
{role === "editor" ? null : (
|
||||
<Route path="/admin/members" element={<FeatureMembersPage />} />
|
||||
)}
|
||||
<Route path="/admin/trust" element={<FeatureTrustContentPage />} />
|
||||
<Route path="/admin/services" element={<FeatureServicesPage />} />
|
||||
<Route path="/admin/inquiries" element={<FeatureInquiriesPage />} />
|
||||
@@ -180,6 +278,10 @@ function Dashboard({ onLogout }: { onLogout: () => void }) {
|
||||
|
||||
function Root() {
|
||||
const [loggedIn, setLoggedIn] = useState(Boolean(localStorage.getItem("adminToken")));
|
||||
const [role, setRole] = useState(localStorage.getItem("adminRole") || "owner");
|
||||
const [mustChangePassword, setMustChangePassword] = useState(
|
||||
localStorage.getItem("adminMustChangePassword") === "true",
|
||||
);
|
||||
React.useEffect(() => {
|
||||
const expire = () => {
|
||||
message.warning("登录状态已失效,请重新登录");
|
||||
@@ -190,9 +292,22 @@ function Root() {
|
||||
}, []);
|
||||
const logout = () => {
|
||||
localStorage.removeItem("adminToken");
|
||||
localStorage.removeItem("adminRole");
|
||||
localStorage.removeItem("adminMustChangePassword");
|
||||
setLoggedIn(false);
|
||||
};
|
||||
return loggedIn ? <Dashboard onLogout={logout} /> : <Login onLogin={() => setLoggedIn(true)} />;
|
||||
if (!loggedIn)
|
||||
return (
|
||||
<Login
|
||||
onLogin={(session) => {
|
||||
setRole(session.role);
|
||||
setMustChangePassword(session.mustChangePassword);
|
||||
setLoggedIn(true);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
if (mustChangePassword) return <ChangePassword onComplete={() => setMustChangePassword(false)} />;
|
||||
return <Dashboard onLogout={logout} role={role} />;
|
||||
}
|
||||
createRoot(document.getElementById("app")!).render(
|
||||
<React.StrictMode>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"lint": "eslint .",
|
||||
"typecheck": "tsc -p tsconfig.json --noEmit",
|
||||
"test": "tsx --test test/**/*.test.ts",
|
||||
"test:integration": "pnpm build && NODE_ENV=test node --env-file=.env --test test/http.integration.test.js",
|
||||
"test:integration": "pnpm build && node --env-file=.env test/run-integration.cjs",
|
||||
"clean": "rimraf dist",
|
||||
"start": "node dist/main.js",
|
||||
"db:generate": "prisma generate",
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE "AdminUser" ADD COLUMN "mustChangePassword" BOOLEAN NOT NULL DEFAULT false;
|
||||
@@ -0,0 +1,16 @@
|
||||
CREATE TABLE "BrandRelease" (
|
||||
"id" TEXT NOT NULL,
|
||||
"brandId" TEXT NOT NULL,
|
||||
"version" INTEGER NOT NULL,
|
||||
"status" TEXT NOT NULL DEFAULT 'published',
|
||||
"snapshot" JSONB NOT NULL,
|
||||
"actorId" TEXT NOT NULL,
|
||||
"note" TEXT,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"revokedAt" TIMESTAMP(3),
|
||||
CONSTRAINT "BrandRelease_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX "BrandRelease_brandId_version_key" ON "BrandRelease"("brandId", "version");
|
||||
CREATE INDEX "BrandRelease_brandId_status_createdAt_idx" ON "BrandRelease"("brandId", "status", "createdAt");
|
||||
ALTER TABLE "BrandRelease" ADD CONSTRAINT "BrandRelease_brandId_fkey" FOREIGN KEY ("brandId") REFERENCES "BrandProfile"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE "BrandRelease" ADD COLUMN "revokedBy" TEXT;
|
||||
@@ -62,6 +62,23 @@ model BrandProfile {
|
||||
capabilityInstallations CapabilityInstallation[]
|
||||
capabilityAuditLogs CapabilityAuditLog[]
|
||||
adminMemberships BrandMembership[]
|
||||
releases BrandRelease[]
|
||||
}
|
||||
|
||||
model BrandRelease {
|
||||
id String @id @default(uuid())
|
||||
brandId String
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
||||
version Int
|
||||
status String @default("published")
|
||||
snapshot Json
|
||||
actorId String
|
||||
note String?
|
||||
createdAt DateTime @default(now())
|
||||
revokedAt DateTime?
|
||||
revokedBy String?
|
||||
@@unique([brandId, version])
|
||||
@@index([brandId, status, createdAt])
|
||||
}
|
||||
|
||||
model CapabilityInstallation {
|
||||
@@ -328,6 +345,7 @@ model AdminUser {
|
||||
displayName String
|
||||
role String @default("admin")
|
||||
isEnabled Boolean @default(true)
|
||||
mustChangePassword Boolean @default(false)
|
||||
lastLoginAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
+742
-171
@@ -1,5 +1,6 @@
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import bcrypt from "bcryptjs";
|
||||
import { buildBrandReleaseSnapshot } from "../src/brand-release.service.js";
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
@@ -14,47 +15,660 @@ const runtimeImages = {
|
||||
"https://images.unsplash.com/photo-1603133872878-684f208fb84b?auto=format&fit=crop&w=1000&q=85",
|
||||
"https://images.unsplash.com/photo-1559847844-5315695dadae?auto=format&fit=crop&w=1000&q=85",
|
||||
],
|
||||
personal: [
|
||||
"https://images.unsplash.com/photo-1556761175-b413da4baf72?auto=format&fit=crop&w=1000&q=85",
|
||||
"https://images.unsplash.com/photo-1521737711867-e3b97375f902?auto=format&fit=crop&w=1000&q=85",
|
||||
],
|
||||
};
|
||||
|
||||
async function ensureRuntimeContent(
|
||||
brandId: string,
|
||||
templateKey: "food" | "doors",
|
||||
offerings: Array<{ name: string; summary: string; image: string; categoryKey: string }>,
|
||||
): Promise<void> {
|
||||
type OfferingKind = "service" | "product" | "package" | "subscription";
|
||||
|
||||
interface RuntimeSeedTemplate {
|
||||
brandConfig: Record<string, unknown>;
|
||||
retiredOfferingNames?: string[];
|
||||
offerings: Array<{
|
||||
name: string;
|
||||
summary: string;
|
||||
image: string;
|
||||
kind: OfferingKind;
|
||||
priceText?: string;
|
||||
priceAmount?: number;
|
||||
config: Record<string, unknown>;
|
||||
}>;
|
||||
trustContent: Array<{
|
||||
type: string;
|
||||
title: string;
|
||||
content: string;
|
||||
config?: Record<string, unknown>;
|
||||
}>;
|
||||
inquiryForm: { name: string; fieldsSnapshot: Array<Record<string, unknown>> };
|
||||
}
|
||||
|
||||
const runtimeSeedTemplates: Record<"personal" | "food" | "doors", RuntimeSeedTemplate> = {
|
||||
personal: {
|
||||
brandConfig: {
|
||||
visualTemplateKey: "linjing-editorial",
|
||||
founder: "林然",
|
||||
title: "品牌策略顾问",
|
||||
slogan: "用清晰的定位与可执行的表达,让专业被看见。",
|
||||
phone: "13900000003",
|
||||
wechat: "linran-brand",
|
||||
studioAddress: "上海市徐汇区创意园区",
|
||||
heroImage: runtimeImages.personal[0],
|
||||
visualPresentation: {
|
||||
home: {
|
||||
proofEyebrow: "专业经验与合作成果",
|
||||
manifestoEyebrow: "工作原则",
|
||||
manifestoTitle: "先厘清问题,再设计表达",
|
||||
worksEyebrow: "合作方式",
|
||||
worksTitle: "品牌策略与顾问服务",
|
||||
worksAction: "查看全部 →",
|
||||
flowEyebrow: "合作流程",
|
||||
flowTitle: "从诊断到持续落地",
|
||||
},
|
||||
offerings: {
|
||||
title: "合作方式",
|
||||
subtitle: "围绕品牌定位、表达与业务转化,选择适合当前阶段的支持。",
|
||||
materialLabel: "服务内容:",
|
||||
hardwareLabel: "合作重点:",
|
||||
detailAction: "查看服务详情 →",
|
||||
inquiryAction: "发起合作咨询",
|
||||
},
|
||||
detail: {
|
||||
priceLabel: "服务参考",
|
||||
spaceLabel: "适合阶段",
|
||||
backgroundTitle: "服务背景",
|
||||
conceptTitle: "工作方法",
|
||||
craftsTitle: "交付内容",
|
||||
materialsTitle: "合作说明",
|
||||
inquiryAction: "发起合作咨询",
|
||||
inquiryHint: "提交信息后由主理人与您沟通。",
|
||||
},
|
||||
profile: {
|
||||
phoneLabel: "联系电话",
|
||||
wechatLabel: "微信",
|
||||
addressLabel: "工作地点",
|
||||
callAction: "呼叫",
|
||||
copyAction: "复制",
|
||||
recordsTitle: "我的咨询记录",
|
||||
recordsCountUnit: "条记录",
|
||||
},
|
||||
inquiry: {
|
||||
eyebrow: "COLLABORATION",
|
||||
title: "合作咨询",
|
||||
subtitle: "留下你的品牌现状与目标,主理人会尽快联系。",
|
||||
submitLabel: "提交合作需求",
|
||||
},
|
||||
success: {
|
||||
eyebrow: "COLLABORATION",
|
||||
title: "已收到你的咨询",
|
||||
intro: "主理人会尽快与你联系。",
|
||||
recordsAction: "查看咨询记录",
|
||||
homeAction: "返回首页",
|
||||
},
|
||||
records: {
|
||||
title: "我的咨询记录",
|
||||
createAction: "新增咨询",
|
||||
emptyTitle: "还没有咨询记录",
|
||||
emptyDescription: "提交一次咨询,开始与你的主理人沟通。",
|
||||
emptyAction: "开始咨询",
|
||||
},
|
||||
},
|
||||
},
|
||||
offerings: [
|
||||
{
|
||||
name: "品牌定位诊断",
|
||||
summary: "梳理现有表达、目标客户与业务优先级,形成清晰的下一步行动建议。",
|
||||
image: runtimeImages.personal[0],
|
||||
kind: "service",
|
||||
config: {
|
||||
categoryKey: "consulting",
|
||||
categoryLabel: "策略咨询",
|
||||
keywords: ["定位", "诊断", "表达"],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "个人品牌年度顾问",
|
||||
summary: "持续支持内容策略、产品表达与关键节点决策,建立长期信任资产。",
|
||||
image: runtimeImages.personal[1],
|
||||
kind: "subscription",
|
||||
config: {
|
||||
categoryKey: "advisory",
|
||||
categoryLabel: "长期顾问",
|
||||
keywords: ["陪跑", "内容", "转化"],
|
||||
},
|
||||
},
|
||||
],
|
||||
trustContent: [
|
||||
{
|
||||
type: "profile",
|
||||
title: "关于林然",
|
||||
content: "专注帮助专业服务者建立可信、清晰且能带来合作的个人品牌表达。",
|
||||
},
|
||||
{
|
||||
type: "process",
|
||||
title: "合作方法",
|
||||
content: "诊断现状、明确定位、搭建表达、持续复盘,让每一步都服务于真实业务。",
|
||||
},
|
||||
],
|
||||
inquiryForm: {
|
||||
name: "品牌合作咨询",
|
||||
fieldsSnapshot: [
|
||||
{ key: "name", label: "您的称呼", type: "text", required: true },
|
||||
{ key: "phone", label: "联系电话", type: "phone", required: true },
|
||||
{ key: "remark", label: "目前的品牌或业务问题", type: "textarea", required: true },
|
||||
],
|
||||
},
|
||||
},
|
||||
food: {
|
||||
brandConfig: {
|
||||
visualTemplateKey: "acheng-campus-food",
|
||||
founder: "阿成",
|
||||
title: "私房菜主理人",
|
||||
slogan: "认真做好每一顿家常饭。",
|
||||
phone: "",
|
||||
wechat: "",
|
||||
studioAddress: "大学城生活区东门附近",
|
||||
heroImage: runtimeImages.food[0],
|
||||
visualPresentation: {
|
||||
home: {
|
||||
proofEyebrow: "主理人信任凭证",
|
||||
manifestoEyebrow: "品牌坚持",
|
||||
manifestoTitle: "认真对待每一次托付",
|
||||
worksEyebrow: "今日餐品与预订",
|
||||
worksTitle: "套餐、聚餐与定制餐",
|
||||
worksAction: "查看全部 →",
|
||||
flowEyebrow: "预订流程",
|
||||
flowTitle: "从预订到取餐",
|
||||
},
|
||||
offerings: {
|
||||
title: "今日套餐与定制餐",
|
||||
subtitle: "现做套餐、聚餐预订和定制餐品。",
|
||||
materialLabel: "餐品说明:",
|
||||
hardwareLabel: "预订要点:",
|
||||
detailAction: "查看餐品 →",
|
||||
inquiryAction: "咨询 / 提前预订",
|
||||
},
|
||||
detail: {
|
||||
priceLabel: "参考价格",
|
||||
spaceLabel: "适合场景",
|
||||
backgroundTitle: "餐品说明",
|
||||
conceptTitle: "口味与分量",
|
||||
craftsTitle: "制作方式",
|
||||
materialsTitle: "食材与搭配",
|
||||
inquiryAction: "咨询 / 提前预订",
|
||||
inquiryHint: "提交后由主理人与您确认餐品和时间。",
|
||||
},
|
||||
profile: {
|
||||
phoneLabel: "联系电话",
|
||||
wechatLabel: "微信",
|
||||
addressLabel: "服务地址",
|
||||
callAction: "呼叫",
|
||||
copyAction: "复制",
|
||||
recordsTitle: "我的咨询记录",
|
||||
recordsCountUnit: "条记录",
|
||||
},
|
||||
inquiry: {
|
||||
eyebrow: "CONSULTATION",
|
||||
title: "餐品预订与定制",
|
||||
subtitle: "提交信息后由主理人与您确认时间和需求。",
|
||||
submitLabel: "提交预订需求",
|
||||
},
|
||||
success: {
|
||||
eyebrow: "CONSULTATION",
|
||||
title: "已收到你的预订需求",
|
||||
intro: "主理人会尽快与你确认。",
|
||||
recordsAction: "查看咨询记录",
|
||||
homeAction: "返回首页",
|
||||
},
|
||||
records: {
|
||||
title: "我的预订记录",
|
||||
createAction: "新增预订",
|
||||
emptyTitle: "还没有预订记录",
|
||||
emptyDescription: "提交一次预订需求,开始确认餐品与时间。",
|
||||
emptyAction: "开始预订",
|
||||
},
|
||||
},
|
||||
},
|
||||
offerings: [
|
||||
{
|
||||
name: "红烧肉双拼套餐",
|
||||
summary: "红烧肉、时蔬、米饭",
|
||||
image: runtimeImages.food[0],
|
||||
kind: "package",
|
||||
priceAmount: 2800,
|
||||
config: {
|
||||
categoryKey: "set-meal",
|
||||
categoryLabel: "套餐",
|
||||
keywords: ["现做", "家常", "定制"],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "小炒鸡套餐",
|
||||
summary: "现炒鸡块、时蔬、米饭",
|
||||
image: runtimeImages.food[1],
|
||||
kind: "package",
|
||||
priceAmount: 3200,
|
||||
config: {
|
||||
categoryKey: "set-meal",
|
||||
categoryLabel: "套餐",
|
||||
keywords: ["现做", "家常", "定制"],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "家庭聚餐私厨",
|
||||
summary: "根据人数、地点和口味人工沟通报价",
|
||||
image: runtimeImages.food[2],
|
||||
kind: "service",
|
||||
config: {
|
||||
categoryKey: "private-chef",
|
||||
categoryLabel: "私厨",
|
||||
keywords: ["现做", "家常", "定制"],
|
||||
},
|
||||
},
|
||||
],
|
||||
trustContent: [
|
||||
{ type: "profile", title: "关于阿成", content: "每天认真做好一顿家常饭。" },
|
||||
{
|
||||
type: "process",
|
||||
title: "认真做饭的流程",
|
||||
content: "提前准备食材,现做现出餐,认真沟通每一次需求。",
|
||||
},
|
||||
],
|
||||
inquiryForm: {
|
||||
name: "家庭聚餐咨询",
|
||||
fieldsSnapshot: [
|
||||
{ key: "name", label: "您的称呼", type: "text", required: true },
|
||||
{ key: "phone", label: "联系电话", type: "phone", required: true },
|
||||
{ key: "remark", label: "需求说明", type: "textarea", required: false },
|
||||
],
|
||||
},
|
||||
},
|
||||
doors: {
|
||||
retiredOfferingNames: ["别墅入户大门", "院门与围合系统", "室内户内门系统"],
|
||||
brandConfig: {
|
||||
visualTemplateKey: "linjing-editorial",
|
||||
founder: "林叙安 (Lin XUAN)",
|
||||
title: "高端门系统建筑研造主理人",
|
||||
slogan: "为当代别墅空间,定制有秩序感与呼吸感的门",
|
||||
phone: "186-0218-9908",
|
||||
wechat: "LIN-ATELIER-2024",
|
||||
studioAddress: "上海市静安区威海路设计中心 A 座 / 杭州良渚研造工坊",
|
||||
avatarUrl:
|
||||
"https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?auto=format&fit=crop&w=240&h=240&q=80",
|
||||
profilePresentation: {
|
||||
coverage: [
|
||||
{
|
||||
title: "直派核心圈",
|
||||
content:
|
||||
"上海、杭州、宁波、苏州、无锡、南京及深圳、广州。主理人及资深装配总工亲赴现场。",
|
||||
},
|
||||
{
|
||||
title: "全国其他城市私邸",
|
||||
content: "接受建筑设计师联合委托,安排远程 3D 激光测绘支持与专用物流直运安装。",
|
||||
},
|
||||
],
|
||||
warranty: [
|
||||
"门体内部防变形航空合金骨架承诺 10 年结构质保;",
|
||||
"重型天地轴、进口地弹簧及磁吸五金 5 年免费维护;",
|
||||
"每樘门出厂前进行 5000 次启闭校正;",
|
||||
"原木天然肌理享有首年 2 次木蜡油保养服务。",
|
||||
],
|
||||
},
|
||||
visualPresentation: {
|
||||
home: {
|
||||
founderBadge: "亲自主理量房",
|
||||
proofEyebrow: "主理人工艺与信任凭证",
|
||||
proofTitle: "14 年,只做门与空间的关系",
|
||||
manifestoEyebrow: "林境门作品质宣言",
|
||||
manifestoTitle: "拒绝流水线拼装",
|
||||
worksEyebrow: "SELECTED WORKS",
|
||||
worksTitle: "精选门系统作品",
|
||||
worksAction: "查看全部 →",
|
||||
flowEyebrow: "全程一对一跟进",
|
||||
flowTitle: "主理人私享定制流程",
|
||||
},
|
||||
offerings: {
|
||||
title: "作品与系统",
|
||||
subtitle: "每一扇门,都是建筑秩序的一部分。",
|
||||
materialLabel: "主材构成:",
|
||||
hardwareLabel: "核心五金:",
|
||||
detailAction: "查看工艺详案 →",
|
||||
inquiryAction: "咨询此类定制",
|
||||
},
|
||||
detail: {
|
||||
priceLabel: "参考定制造价",
|
||||
spaceLabel: "适用空间",
|
||||
backgroundTitle: "项目背景与空间诉求",
|
||||
conceptTitle: "构造深化设计理念",
|
||||
craftsTitle: "节点工艺考究",
|
||||
materialsTitle: "选型物料与五金规格",
|
||||
inquiryAction: "预约上门测量 / 咨询此类方案",
|
||||
inquiryHint: "预约后由主理人进行点对点方案分析",
|
||||
},
|
||||
profile: {
|
||||
phoneLabel: "专线电话",
|
||||
wechatLabel: "工作室微信",
|
||||
addressLabel: "实体工坊",
|
||||
callAction: "呼叫",
|
||||
copyAction: "复制",
|
||||
recordsCountUnit: "条记录",
|
||||
recordsTitle: "我的量房与定制咨询",
|
||||
recordsSubtitle: "追踪主理人出图进度与现场勘测排期",
|
||||
coverageTitle: "直派服务区域与履约说明",
|
||||
warrantyTitle: "一门一档 · 终生质保规约",
|
||||
},
|
||||
inquiry: {
|
||||
eyebrow: "私人执业研造服务",
|
||||
title: "高端门系统定制 · 私享测量预约",
|
||||
subtitle: "主理人林叙安亲自沟通,72 小时内提供空间门体构想分析。",
|
||||
submitLabel: "提交量房与定制评估需求",
|
||||
},
|
||||
success: {
|
||||
eyebrow: "PRIVATE CONSULTATION",
|
||||
title: "已收到你的咨询",
|
||||
intro: "主理人会根据你的项目资料,整理初步判断并在 1 个工作日内与你联系。",
|
||||
recordsAction: "查看咨询记录",
|
||||
homeAction: "返回首页",
|
||||
},
|
||||
records: {
|
||||
title: "我的咨询记录",
|
||||
createAction: "+ 新增预约",
|
||||
emptyTitle: "还没有咨询记录",
|
||||
emptyDescription: "预约一次私享沟通,让我们从你的空间开始。",
|
||||
emptyAction: "开始咨询",
|
||||
},
|
||||
},
|
||||
heroImage: runtimeImages.doors[0],
|
||||
homeHero: {
|
||||
eyebrow: "年度落成实景 · 莫干山庄园",
|
||||
title: "万籁系列 · 铸铜冷锻双轴入户门",
|
||||
slogan: "门高 3.4m · 德国静音地轴",
|
||||
cta: "探索全系作品 →",
|
||||
},
|
||||
},
|
||||
offerings: [
|
||||
{
|
||||
name: "当代铸铜木核防暴装甲门",
|
||||
summary:
|
||||
"项目位于浙北山间独栋庄园,业主需要一扇兼具当代东方仪式感与长期耐候能力的入户大门。",
|
||||
image: runtimeImages.doors[0],
|
||||
kind: "product",
|
||||
priceText: "¥38,000 - ¥85,000 / 樘",
|
||||
config: {
|
||||
categoryKey: "entrance-door",
|
||||
categoryLabel: "入户大门",
|
||||
series: "「万籁」重型天地轴入户系统",
|
||||
tag: "主理人年度代表作",
|
||||
area: "浙江·莫干山私家山庄",
|
||||
detailHero: runtimeImages.doors[0],
|
||||
woodMaterial: "60mm 北美特级黑胡桃整板 + 航空蜂窝铝芯",
|
||||
hardware: "德国 dormakaba 重型地弹簧 + 自主定制实心锻铜一体式长执手",
|
||||
spaceType: "独栋别墅建筑主入口 / 挑高大厅玄关",
|
||||
keywords: ["厚重大气", "隐式天地轴", "隔音 42dB", "抗暴防撬"],
|
||||
details: {
|
||||
background:
|
||||
"项目位于浙北山间独栋庄园,常年多雨潮湿,且冬季山风冷峻。业主期望一扇既有古典厚重仪式感,又能抵御风雨、长久耐候的当代东方大门。",
|
||||
designConcept:
|
||||
"提炼江南屋檐与青砖比例。以暗调冷锻手工铜板包裹耐候钢核,内衬大厚度吸音绝热芯,门体内嵌隐藏式天地承重轴,推拉阻尼丝滑沉稳。",
|
||||
crafts: [
|
||||
"无缝冷锻铜边框,经自然氧化着色",
|
||||
"双道三元乙丙航天级发泡密封胶条,气密性达国标 8 级",
|
||||
"指纹识别模组隐于天然胡桃木纹理深处",
|
||||
],
|
||||
materialsList: [
|
||||
{ name: "门扇主体", spec: "航空铝蜂窝 + 防暴钢板 + 黑胡桃" },
|
||||
{ name: "承重结构", spec: "不锈钢重型天地偏心轴(承重 600KG)" },
|
||||
{ name: "五金执手", spec: "实心黄铜拉丝防指纹覆膜" },
|
||||
{ name: "锁具系统", spec: "C 级多向防暴机械锁芯 + 隐匿式生物辨识" },
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "悬挑风琴式耐候双开院门",
|
||||
summary: "以柚木条与耐候钢构建视线遮蔽和透光的微妙平衡,适配长期日晒雨淋的私家庭院入口。",
|
||||
image: runtimeImages.doors[1],
|
||||
kind: "product",
|
||||
priceText: "¥42,000 - ¥98,000 / 樘",
|
||||
config: {
|
||||
categoryKey: "garden-door",
|
||||
categoryLabel: "庭院围墙门",
|
||||
series: "「虚实」透光私家庭院门",
|
||||
tag: "建筑级耐候工艺",
|
||||
area: "上海·佘山高尔夫别墅",
|
||||
detailHero: runtimeImages.doors[1],
|
||||
woodMaterial: "深浸缅甸柚木条格栅 + 氟碳喷涂耐候钢",
|
||||
hardware: "意大利全隐形地埋式液压自闭器 + 静音电控锁",
|
||||
spaceType: "私家庭院入口 / 围墙园林玄关",
|
||||
keywords: ["园林意境", "格栅光影", "耐候耐蚀", "智能对讲协同"],
|
||||
details: {
|
||||
background:
|
||||
"庭院门直面自然日晒雨淋,普通木门易开裂变形,普通铁艺门几年内斑驳锈蚀。本案要求长期免维护的高级自然质感。",
|
||||
designConcept:
|
||||
"利用竖向错落的柚木条构建视线遮蔽与透光的微妙平衡,内部向外望去如薄纱透竹。",
|
||||
crafts: [
|
||||
"微隙热胀冷缩结构槽设计",
|
||||
"隐蔽式水路导流坡口",
|
||||
"院墙铰链锚栓深入混凝土柱芯 300mm",
|
||||
],
|
||||
materialsList: [
|
||||
{ name: "户外木种", spec: "高油脂老料缅甸柚木,经过 180 天自然风干" },
|
||||
{ name: "骨架型材", spec: "4mm 高强度航空铝镁合金" },
|
||||
{ name: "智能五金", spec: "隐藏式地下闭门轴,支持远程授权" },
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "通顶极窄边框实木室内门",
|
||||
summary: "以 2.8m - 3.2m 满高通顶系统维持私宅空间的建筑平直感,并与木作一体深化。",
|
||||
image: runtimeImages.doors[2],
|
||||
kind: "product",
|
||||
priceText: "¥7,800 - ¥16,000 / 樘",
|
||||
config: {
|
||||
categoryKey: "interior-door",
|
||||
categoryLabel: "室内户内门",
|
||||
series: "「空灵」2.8m - 3.2m 满高通顶系统",
|
||||
tag: "极简建筑平直感",
|
||||
area: "江苏·苏州金鸡湖独栋",
|
||||
detailHero: runtimeImages.doors[2],
|
||||
woodMaterial: "天然白栓木拉丝烟熏木饰面 + 磁吸阻尼降噪",
|
||||
hardware: "意大利 AGB 磁吸静音门锁 + 隐藏式暗铰链",
|
||||
spaceType: "别墅主卧套房 / 私人藏书阁 / 视听室",
|
||||
keywords: ["满高通顶", "磁吸静音", "极窄边框", "与木作同色"],
|
||||
details: {
|
||||
background:
|
||||
"室内多道门如果尺寸矮小杂乱,会切割私宅的建筑开阔感。业主希望主卧区实现门与护墙板毫无色差、绝对平齐。",
|
||||
designConcept: "门扇高 3.1 米一通到顶,无传统上门套与压边;内嵌双向碳纤维抗弯龙骨。",
|
||||
crafts: [
|
||||
"门框与墙体批荡层融为一体的无框反装工艺",
|
||||
"磁力吸舌落锁轻无声息",
|
||||
"同批原木切片保证纹理与护墙板连贯",
|
||||
],
|
||||
materialsList: [
|
||||
{ name: "抗弯核心", spec: "双组份碳纤维预应力防变形拉力杆" },
|
||||
{ name: "吸音内衬", spec: "德国均质空心桥洞力学板" },
|
||||
{ name: "隐形铰链", spec: "德国 KRONA 三维可调隐形铰链" },
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "石材及皮质背景墙一体门",
|
||||
summary: "将门体与背景墙材料、纹理和收口一体深化,保留私宅完整的墙面秩序。",
|
||||
image:
|
||||
"https://images.unsplash.com/photo-1600210492486-724fe5c67fb0?auto=format&fit=crop&w=1000&q=85",
|
||||
kind: "product",
|
||||
priceText: "¥18,000 - ¥36,000 / 樘",
|
||||
config: {
|
||||
categoryKey: "stealth-door",
|
||||
categoryLabel: "装饰隐形门",
|
||||
series: "「无垠」密室及背景墙融合门",
|
||||
tag: "精密收口工程",
|
||||
area: "广东·深圳香蜜湖一号",
|
||||
detailHero:
|
||||
"https://images.unsplash.com/photo-1600210492486-724fe5c67fb0?auto=format&fit=crop&w=1000&q=85",
|
||||
woodMaterial: "3mm 超薄大理石复合蜂窝板 / 进口鞍革手工双缝线",
|
||||
hardware: "感应式电动自开闭装置或碰珠反弹器",
|
||||
spaceType: "雪茄室 / 私人金库 / 地下酒窖 / 视听隐藏储物区",
|
||||
keywords: ["视线隐形", "超薄岩板", "毫厘对缝", "无门把设计"],
|
||||
details: {
|
||||
background:
|
||||
"客厅背景墙长达 9 米,中间有一道通往主人密闭酒窖的通道,突兀开门会破坏整面奢石的连贯韵律。",
|
||||
designConcept: "将奢石切割对纹复合于高刚性合金门扇表面,缝隙控制在 1.5mm 以内。",
|
||||
crafts: [
|
||||
"石材水刀无应力薄切与航空蜂窝背栓复合",
|
||||
"脚踏地砖预埋重力复位转轴",
|
||||
"支持指纹电控联动隐藏灯带",
|
||||
],
|
||||
materialsList: [
|
||||
{ name: "表面饰材", spec: "意大利雪山银狐超薄天然大理石" },
|
||||
{ name: "驱动系统", spec: "低噪步进电机伺服闭门器" },
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
trustContent: [
|
||||
{
|
||||
type: "profile",
|
||||
title: "主理人的门作观",
|
||||
content:
|
||||
"国家注册高级室内建筑师,专注高定大门及私宅空间门类系统研发 14 年。拒绝建材量产拼装,以门与空间同构的建筑理念,亲自主理选材、构造深化与落地试装。",
|
||||
config: {
|
||||
stats: [
|
||||
{ value: "14年", label: "高端门系深化经验", sub: "历经百项严苛私宅考验" },
|
||||
{ value: "260+", label: "落地庄园实景案例", sub: "全实景图库,可预约探访" },
|
||||
{ value: "100%", label: "主理人全案跟进", sub: "量房 / 出图 / 选料 / 试装" },
|
||||
{ value: "10年", label: "结构主轴质保承诺", sub: "终生五金润滑维保机制" },
|
||||
],
|
||||
pillars: [
|
||||
{
|
||||
icon: "tree",
|
||||
title: "天然厚板与古铜锻打",
|
||||
desc: "精选 300 年北美黑胡桃、缅甸柚木直拼大板,搭配手工冷锻紫铜及意大利防爆钢核。",
|
||||
},
|
||||
{
|
||||
icon: "ruler",
|
||||
title: "微米级红外高精量房",
|
||||
desc: "德国进口 3D 空间激光扫描,精准捕捉门洞沉降公差与建筑墙体垂直度。",
|
||||
},
|
||||
{
|
||||
icon: "shield",
|
||||
title: "隐匿式重型五金系统",
|
||||
desc: "自主研发三维可调静音承重铰链,单扇承载 450kg,开合轻盈安静。",
|
||||
},
|
||||
],
|
||||
serviceFlow: [
|
||||
{ step: "01", name: "私享沟通", desc: "厘清生活动线与风候环境" },
|
||||
{ step: "02", name: "上门实测", desc: "复核门洞公差与地平基准" },
|
||||
{ step: "03", name: "构造出图", desc: "输出结构图与材质节点方案" },
|
||||
{ step: "04", name: "实样工坊确认", desc: "确认木样、锻铜样与密封节点" },
|
||||
{ step: "05", name: "工坊试装交付", desc: "试装调试后专车直运现场" },
|
||||
{ step: "06", name: "终生私属维护", desc: "建立一门一档数字化档案" },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "portfolio",
|
||||
title: "别墅门系统案例",
|
||||
content: "围绕入户、庭院和室内空间建立完整门系统。",
|
||||
},
|
||||
{
|
||||
type: "process",
|
||||
title: "从测量到交付",
|
||||
content: "现场测量、方案沟通、深化确认和落地交付。",
|
||||
},
|
||||
],
|
||||
inquiryForm: {
|
||||
name: "门系统方案咨询",
|
||||
fieldsSnapshot: [
|
||||
{
|
||||
key: "doorType",
|
||||
label: "期望定制的门类型",
|
||||
type: "select",
|
||||
required: true,
|
||||
options: [
|
||||
"入户大门(防暴铸铜 / 实木)",
|
||||
"庭院围墙门(耐候格栅 / 对开)",
|
||||
"全屋室内门系统(通顶隐形)",
|
||||
"背景墙一体门 / 密室门",
|
||||
"整栋别墅门系统全案一体化",
|
||||
],
|
||||
},
|
||||
{ key: "cityArea", label: "房屋 / 别墅所在城市与楼盘", type: "text", required: true },
|
||||
{
|
||||
key: "projectStage",
|
||||
label: "当前项目阶段",
|
||||
type: "radio",
|
||||
required: true,
|
||||
options: [
|
||||
"土建结构阶段(适合预埋加固)",
|
||||
"水电木工阶段(适合精确测距)",
|
||||
"硬装收尾阶段",
|
||||
"旧宅门体翻新改造",
|
||||
],
|
||||
},
|
||||
{
|
||||
key: "budgetRange",
|
||||
label: "预估门系统投资预算",
|
||||
type: "select",
|
||||
required: false,
|
||||
options: [
|
||||
"5 万 - 10 万",
|
||||
"10 万 - 20 万",
|
||||
"20 万 - 50 万(全宅全案)",
|
||||
"50 万以上(顶级孤品定制)",
|
||||
],
|
||||
},
|
||||
{
|
||||
key: "needMeasure",
|
||||
label: "是否需要主理人上门现场量房",
|
||||
type: "radio",
|
||||
required: true,
|
||||
options: ["需要(预约排期现场勘测)", "暂不需要(先发图纸在线深化评估)"],
|
||||
},
|
||||
{ key: "contactName", label: "贵姓称谓", type: "text", required: true },
|
||||
{ key: "contactPhone", label: "联系手机号(微信同号)", type: "tel", required: true },
|
||||
{ key: "specialNote", label: "空间想法或特殊需求描述", type: "textarea", required: false },
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
async function ensureRuntimeContent(brandId: string, template: RuntimeSeedTemplate): Promise<void> {
|
||||
await prisma.brandProfile.update({
|
||||
where: { id: brandId },
|
||||
data: {
|
||||
config: {
|
||||
founder: templateKey === "doors" ? "林境主理人" : "阿成",
|
||||
title: templateKey === "doors" ? "别墅门系统设计顾问" : "私房菜主理人",
|
||||
slogan:
|
||||
templateKey === "doors" ? "让每一扇门,成为建筑秩序的开始。" : "认真做好每一顿家常饭。",
|
||||
phone: templateKey === "doors" ? "13800000000" : "",
|
||||
wechat: templateKey === "doors" ? "linjing-doors" : "",
|
||||
studioAddress: templateKey === "doors" ? "城市设计中心 3F" : "大学城生活区东门附近",
|
||||
heroImage: runtimeImages[templateKey][0],
|
||||
},
|
||||
config: template.brandConfig,
|
||||
},
|
||||
});
|
||||
for (const [sortOrder, item] of offerings.entries()) {
|
||||
for (const [sortOrder, item] of template.offerings.entries()) {
|
||||
const offering = await prisma.offering.findUnique({
|
||||
where: { brandId_name: { brandId, name: item.name } },
|
||||
});
|
||||
if (!offering) continue;
|
||||
await prisma.offering.update({
|
||||
where: { id: offering.id },
|
||||
data: {
|
||||
coverUrl: item.image,
|
||||
summary: item.summary,
|
||||
sortOrder: sortOrder + 1,
|
||||
isEnabled: true,
|
||||
config: {
|
||||
categoryKey: item.categoryKey,
|
||||
keywords: templateKey === "doors" ? ["定制", "别墅", "门系统"] : ["现做", "家常", "定制"],
|
||||
media: [{ url: item.image, alt: item.name, type: "image" }],
|
||||
sections: [],
|
||||
},
|
||||
const data = {
|
||||
kind: item.kind,
|
||||
coverUrl: item.image,
|
||||
summary: item.summary,
|
||||
priceText: item.priceText ?? "沟通报价",
|
||||
...(item.priceAmount === undefined ? {} : { priceAmount: item.priceAmount }),
|
||||
sortOrder: sortOrder + 1,
|
||||
isEnabled: true,
|
||||
config: {
|
||||
...item.config,
|
||||
media: [{ url: item.image, alt: item.name, type: "image" }],
|
||||
sections: [],
|
||||
},
|
||||
};
|
||||
if (offering) await prisma.offering.update({ where: { id: offering.id }, data });
|
||||
else await prisma.offering.create({ data: { brandId, name: item.name, ...data } });
|
||||
}
|
||||
if (template.retiredOfferingNames?.length) {
|
||||
await prisma.offering.updateMany({
|
||||
where: { brandId, name: { in: template.retiredOfferingNames } },
|
||||
data: { isEnabled: false },
|
||||
});
|
||||
}
|
||||
const moduleDefinitions = [
|
||||
@@ -82,67 +696,74 @@ async function ensureRuntimeContent(
|
||||
select: { id: true, name: true },
|
||||
});
|
||||
for (const [index, item] of incompleteOfferings.entries()) {
|
||||
const image = runtimeImages[templateKey][index % runtimeImages[templateKey].length];
|
||||
const image = template.offerings[index % template.offerings.length].image;
|
||||
await prisma.offering.update({
|
||||
where: { id: item.id },
|
||||
data: {
|
||||
coverUrl: image,
|
||||
config: {
|
||||
categoryKey: "custom",
|
||||
keywords: templateKey === "doors" ? ["定制", "门系统"] : ["家常", "定制"],
|
||||
categoryLabel: "自定义业务",
|
||||
keywords: [],
|
||||
media: [{ url: image, alt: item.name, type: "image" }],
|
||||
sections: [],
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
const trustCount = await prisma.trustContent.count({ where: { brandId } });
|
||||
if (!trustCount) {
|
||||
const trustItems =
|
||||
templateKey === "doors"
|
||||
? [
|
||||
["profile", "主理人的门作观", "从建筑关系出发,认真处理每一扇门。"],
|
||||
["portfolio", "别墅门系统案例", "围绕入户、庭院和室内空间建立完整门系统。"],
|
||||
["process", "从测量到交付", "现场测量、方案沟通、深化确认和落地交付。"],
|
||||
]
|
||||
: [
|
||||
["profile", "关于阿成", "每天认真做好一顿家常饭。"],
|
||||
["process", "认真做饭的流程", "提前准备食材,现做现出餐,认真沟通每一次需求。"],
|
||||
];
|
||||
await prisma.trustContent.createMany({
|
||||
data: trustItems.map(([type, title, content], sortOrder) => ({
|
||||
brandId,
|
||||
type,
|
||||
title,
|
||||
content,
|
||||
sortOrder,
|
||||
isPublished: true,
|
||||
})),
|
||||
});
|
||||
}
|
||||
const formCount = await prisma.inquiryForm.count({ where: { brandId } });
|
||||
if (!formCount) {
|
||||
await prisma.inquiryForm.create({
|
||||
data: {
|
||||
brandId,
|
||||
name: templateKey === "doors" ? "门系统方案咨询" : "家庭聚餐咨询",
|
||||
purpose: "inquiry",
|
||||
targetType: "brand",
|
||||
submissionAction: "create-inquiry",
|
||||
fieldsSnapshot: [
|
||||
{ key: "name", label: "您的称呼", type: "text", required: true },
|
||||
{ key: "phone", label: "联系电话", type: "phone", required: true },
|
||||
{ key: "remark", label: "需求说明", type: "textarea", required: false },
|
||||
],
|
||||
},
|
||||
for (const [sortOrder, item] of template.trustContent.entries()) {
|
||||
const existing = await prisma.trustContent.findFirst({
|
||||
where: { brandId, type: item.type, title: item.title },
|
||||
});
|
||||
const data = { ...item, brandId, sortOrder, isPublished: true };
|
||||
if (existing) await prisma.trustContent.update({ where: { id: existing.id }, data });
|
||||
else await prisma.trustContent.create({ data });
|
||||
}
|
||||
const existingForm = await prisma.inquiryForm.findFirst({
|
||||
where: { brandId, targetType: "brand" },
|
||||
orderBy: { createdAt: "asc" },
|
||||
});
|
||||
const formData = {
|
||||
name: template.inquiryForm.name,
|
||||
purpose: "inquiry",
|
||||
targetType: "brand",
|
||||
submissionAction: "create-inquiry",
|
||||
fieldsSnapshot: template.inquiryForm.fieldsSnapshot,
|
||||
isEnabled: true,
|
||||
} as const;
|
||||
if (existingForm)
|
||||
await prisma.inquiryForm.update({ where: { id: existingForm.id }, data: formData });
|
||||
else await prisma.inquiryForm.create({ data: { brandId, ...formData } });
|
||||
}
|
||||
|
||||
async function ensureSeedRelease(brandId: string, actorId: string): Promise<void> {
|
||||
const snapshot = await buildBrandReleaseSnapshot(prisma, brandId);
|
||||
await prisma.brandRelease.deleteMany({ where: { brandId } });
|
||||
await prisma.brandRelease.create({
|
||||
data: {
|
||||
brandId,
|
||||
version: 1,
|
||||
status: "published",
|
||||
snapshot,
|
||||
actorId,
|
||||
note: "seed 基线发布版本",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function main(): Promise<void> {
|
||||
const brand = await prisma.brandProfile.upsert({
|
||||
where: { id: "00000000-0000-0000-0000-000000000001" },
|
||||
update: {},
|
||||
update: {
|
||||
slug: "default-brand",
|
||||
name: "阿成家常菜",
|
||||
templateKey: "food",
|
||||
tagline: "现做家常套餐,也为小型聚餐定制一桌热饭菜",
|
||||
description: "每天认真做好一顿家常饭。",
|
||||
hours: "周一至周六 10:30-20:00",
|
||||
address: "大学城生活区东门附近",
|
||||
deliveryNote: "目前支持部分学生宿舍楼配送,无法送达时会主动联系。",
|
||||
},
|
||||
create: {
|
||||
slug: "default-brand",
|
||||
id: "00000000-0000-0000-0000-000000000001",
|
||||
@@ -156,58 +777,7 @@ async function main(): Promise<void> {
|
||||
},
|
||||
});
|
||||
|
||||
const offerings = [
|
||||
{
|
||||
brandId: brand.id,
|
||||
name: "红烧肉双拼套餐",
|
||||
description: "红烧肉、时蔬、米饭",
|
||||
priceText: "¥28 / 份",
|
||||
priceAmount: 2800,
|
||||
sortOrder: 1,
|
||||
},
|
||||
{
|
||||
brandId: brand.id,
|
||||
name: "小炒鸡套餐",
|
||||
description: "现炒鸡块、时蔬、米饭",
|
||||
priceText: "¥25 / 份",
|
||||
priceAmount: 2500,
|
||||
sortOrder: 2,
|
||||
},
|
||||
{
|
||||
brandId: brand.id,
|
||||
name: "家庭聚餐私厨",
|
||||
description: "根据人数、地点和口味人工沟通报价",
|
||||
priceText: "面议",
|
||||
sortOrder: 3,
|
||||
},
|
||||
];
|
||||
for (const offering of offerings) {
|
||||
const existing = await prisma.offering.findFirst({
|
||||
where: { brandId: brand.id, name: offering.name },
|
||||
});
|
||||
if (existing) await prisma.offering.update({ where: { id: existing.id }, data: offering });
|
||||
else await prisma.offering.create({ data: { ...offering, kind: "service" } });
|
||||
}
|
||||
await ensureRuntimeContent(brand.id, "food", [
|
||||
{
|
||||
name: "红烧肉双拼套餐",
|
||||
summary: "红烧肉、时蔬、米饭",
|
||||
image: runtimeImages.food[0],
|
||||
categoryKey: "set-meal",
|
||||
},
|
||||
{
|
||||
name: "小炒鸡套餐",
|
||||
summary: "现炒鸡块、时蔬、米饭",
|
||||
image: runtimeImages.food[1],
|
||||
categoryKey: "set-meal",
|
||||
},
|
||||
{
|
||||
name: "家庭聚餐私厨",
|
||||
summary: "根据人数、地点和口味人工沟通报价",
|
||||
image: runtimeImages.food[2],
|
||||
categoryKey: "private-chef",
|
||||
},
|
||||
]);
|
||||
await ensureRuntimeContent(brand.id, runtimeSeedTemplates.food);
|
||||
|
||||
for (const name of ["普通套餐", "私厨", "配送", "自取", "熟客", "重点跟进"]) {
|
||||
await prisma.tag.upsert({
|
||||
@@ -231,9 +801,52 @@ async function main(): Promise<void> {
|
||||
create: { adminUserId: admin.id, brandId: brand.id, role: "owner" },
|
||||
});
|
||||
|
||||
const personalBrand = await prisma.brandProfile.upsert({
|
||||
where: { id: "00000000-0000-0000-0000-000000000003" },
|
||||
update: {
|
||||
slug: "linran-brand",
|
||||
name: "林然品牌顾问",
|
||||
templateKey: "personal",
|
||||
tagline: "用清晰的定位与可执行的表达,让专业被看见。",
|
||||
description: "为专业服务者提供品牌定位、表达与长期顾问支持。",
|
||||
hours: "周一至周五 10:00-18:00",
|
||||
address: "上海市徐汇区创意园区",
|
||||
contactPhone: "13900000003",
|
||||
contactWechat: "linran-brand",
|
||||
},
|
||||
create: {
|
||||
id: "00000000-0000-0000-0000-000000000003",
|
||||
slug: "linran-brand",
|
||||
name: "林然品牌顾问",
|
||||
templateKey: "personal",
|
||||
tagline: "用清晰的定位与可执行的表达,让专业被看见。",
|
||||
description: "为专业服务者提供品牌定位、表达与长期顾问支持。",
|
||||
hours: "周一至周五 10:00-18:00",
|
||||
address: "上海市徐汇区创意园区",
|
||||
contactPhone: "13900000003",
|
||||
contactWechat: "linran-brand",
|
||||
},
|
||||
});
|
||||
await prisma.brandMembership.upsert({
|
||||
where: { adminUserId_brandId: { adminUserId: admin.id, brandId: personalBrand.id } },
|
||||
update: { isEnabled: true, role: "owner" },
|
||||
create: { adminUserId: admin.id, brandId: personalBrand.id, role: "owner" },
|
||||
});
|
||||
await ensureRuntimeContent(personalBrand.id, runtimeSeedTemplates.personal);
|
||||
|
||||
const doorsBrand = await prisma.brandProfile.upsert({
|
||||
where: { id: "00000000-0000-0000-0000-000000000002" },
|
||||
update: {},
|
||||
update: {
|
||||
slug: "linjing-doors",
|
||||
name: "林境门作",
|
||||
templateKey: "doors",
|
||||
tagline: "为别墅空间定制有秩序感的门系统",
|
||||
description: "从入户大门到室内户内门,提供完整的门系统设计与落地服务。",
|
||||
hours: "周一至周六 09:00-18:00",
|
||||
address: "城市设计中心 3F",
|
||||
contactPhone: "13800000000",
|
||||
contactWechat: "linjing-doors",
|
||||
},
|
||||
create: {
|
||||
id: "00000000-0000-0000-0000-000000000002",
|
||||
slug: "linjing-doors",
|
||||
@@ -247,57 +860,15 @@ async function main(): Promise<void> {
|
||||
contactWechat: "linjing-doors",
|
||||
},
|
||||
});
|
||||
for (const offering of [
|
||||
{
|
||||
name: "别墅入户大门",
|
||||
description: "结合建筑立面与入户动线定制门体、五金和安装方案。",
|
||||
priceText: "预约沟通",
|
||||
sortOrder: 1,
|
||||
},
|
||||
{
|
||||
name: "院门与围合系统",
|
||||
description: "院门、围墙和庭院动线的一体化设计与施工配合。",
|
||||
priceText: "预约沟通",
|
||||
sortOrder: 2,
|
||||
},
|
||||
{
|
||||
name: "室内户内门系统",
|
||||
description: "根据空间风格定制户内门、隐形门和装饰门。",
|
||||
priceText: "预约沟通",
|
||||
sortOrder: 3,
|
||||
},
|
||||
]) {
|
||||
await prisma.offering.upsert({
|
||||
where: { brandId_name: { brandId: doorsBrand.id, name: offering.name } },
|
||||
update: offering,
|
||||
create: { ...offering, brandId: doorsBrand.id, kind: "service" },
|
||||
});
|
||||
}
|
||||
await prisma.brandMembership.upsert({
|
||||
where: { adminUserId_brandId: { adminUserId: admin.id, brandId: doorsBrand.id } },
|
||||
update: { isEnabled: true, role: "owner" },
|
||||
create: { adminUserId: admin.id, brandId: doorsBrand.id, role: "owner" },
|
||||
});
|
||||
await ensureRuntimeContent(doorsBrand.id, "doors", [
|
||||
{
|
||||
name: "别墅入户大门",
|
||||
summary: "结合建筑立面与入户动线定制门体、五金和安装方案。",
|
||||
image: runtimeImages.doors[0],
|
||||
categoryKey: "entrance-door",
|
||||
},
|
||||
{
|
||||
name: "院门与围合系统",
|
||||
summary: "院门、围墙和庭院动线的一体化设计与施工配合。",
|
||||
image: runtimeImages.doors[1],
|
||||
categoryKey: "garden-door",
|
||||
},
|
||||
{
|
||||
name: "室内户内门系统",
|
||||
summary: "根据空间风格定制户内门、隐形门和装饰门。",
|
||||
image: runtimeImages.doors[2],
|
||||
categoryKey: "interior-door",
|
||||
},
|
||||
]);
|
||||
await ensureRuntimeContent(doorsBrand.id, runtimeSeedTemplates.doors);
|
||||
await ensureSeedRelease(brand.id, admin.id);
|
||||
await ensureSeedRelease(personalBrand.id, admin.id);
|
||||
await ensureSeedRelease(doorsBrand.id, admin.id);
|
||||
}
|
||||
|
||||
main().finally(() => prisma.$disconnect());
|
||||
@@ -25,4 +25,12 @@ export class AdminAccessService {
|
||||
if (!membership?.isEnabled) throw new ForbiddenException("管理员没有当前品牌权限");
|
||||
return { subject: identity.subject, brandId: identity.brandId, role: membership.role };
|
||||
}
|
||||
|
||||
async requireRole(request: FastifyRequest, allowedRoles: string[]): Promise<boolean> {
|
||||
const access = await this.requireBrand(request);
|
||||
if (!allowedRoles.includes(access.role)) {
|
||||
throw new ForbiddenException("当前账号没有系统设置权限");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,10 @@ import { signIdentity } from "./auth.js";
|
||||
export class AdminAuthService {
|
||||
constructor(private readonly prisma: PrismaService) {}
|
||||
|
||||
async login(username: string, password: string): Promise<{ token: string; displayName: string }> {
|
||||
async login(
|
||||
username: string,
|
||||
password: string,
|
||||
): Promise<{ token: string; displayName: string; mustChangePassword: boolean; role: string }> {
|
||||
const user = await this.prisma.adminUser.findUnique({ where: { username } });
|
||||
if (!user || !user.isEnabled || !(await bcrypt.compare(password, user.passwordHash))) {
|
||||
throw new UnauthorizedException("账号或密码错误");
|
||||
@@ -36,6 +39,23 @@ export class AdminAuthService {
|
||||
role: "admin",
|
||||
}),
|
||||
displayName: user.displayName,
|
||||
mustChangePassword: user.mustChangePassword,
|
||||
role: activeMembership.role,
|
||||
};
|
||||
}
|
||||
|
||||
async changePassword(
|
||||
userId: string,
|
||||
currentPassword: string,
|
||||
newPassword: string,
|
||||
): Promise<void> {
|
||||
const user = await this.prisma.adminUser.findUnique({ where: { id: userId } });
|
||||
if (!user || !(await bcrypt.compare(currentPassword, user.passwordHash))) {
|
||||
throw new UnauthorizedException("当前密码不正确");
|
||||
}
|
||||
await this.prisma.adminUser.update({
|
||||
where: { id: userId },
|
||||
data: { passwordHash: await bcrypt.hash(newPassword, 12), mustChangePassword: false },
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,14 @@ export class AdminMembershipGuard implements CanActivate {
|
||||
const request = context.switchToHttp().getRequest<FastifyRequest>();
|
||||
if (request.url.startsWith("/admin/session/login")) return Promise.resolve(true);
|
||||
if (!request.url.startsWith("/admin/")) return Promise.resolve(true);
|
||||
if (
|
||||
/^\/admin\/workspace\/(install|capabilities(?:\/|$)|template(?:\/|$)|modules(?:\/|$)|fields(?:\/|$))/.test(
|
||||
request.url,
|
||||
) ||
|
||||
/^\/admin\/config\/visual-template(?:\/|$)/.test(request.url)
|
||||
) {
|
||||
return this.access.requireRole(request, ["owner", "admin", "platform-admin"]);
|
||||
}
|
||||
return this.access.requireBrand(request).then(() => true);
|
||||
}
|
||||
}
|
||||
Loaded 100 of 317 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user