# Admin 消息中心模块指引 ## 路径基准与读取顺序 - 本文件适用于 `src/modules/notifications/`,代码路径相对本目录;应用公共规则见 `../../../AGENTS.md`。 - 消息中心只在顶部入口,不进入左侧菜单;模板维护在系统设置下,两者共用同一套通知契约。 - 后端只查 `iam/` 的 `notification/` 子域;不读其他服务。 ## 页面与入口 | 目标 | 页面/路由 | API 与后端 | |---|---|---| | 消息收件箱与已读 | `pages/PlatformNotificationsView.vue`;`notifications` | `api/notificationCenter.ts`;`iam/` notification | | 消息管理(发送与记录) | `pages/MessageManagementView.vue`、`components/MessageComposerDialog.vue`;`notifications/messages` | `api/notificationCenter.ts`;`iam/` notification | | 消息模板维护 | `pages/MessageTemplatesView.vue`、`components/TemplateEditorDialog.vue`;`notifications/templates` | `api/notificationCenter.ts`;`iam/` notification | | 展示文案与类型映射 | `presentation.ts`、`types.ts` | 服务端模板变量 | ## 关键边界 - 消息只展示服务端返回的业务文案与业务编号,不把内部数据库 ID 作为标题或链接参数回退。 - 模板变量必须来自服务端模板定义,前端不硬编码业务字段名或补默认值。 - 发送类操作需要确认、处理中与失败反馈;失败保留用户输入,不静默清空草稿。 - 未读计数与已读状态以服务端为准,不在本地累加或乐观改写后不回读。 - 顶部入口不擅自扩展到左侧菜单,也不为单条消息新增独立路由页。 ## 验证 - 定向:`pnpm test src/modules/notifications/<目标测试>`;模板变量或发送字段变更同时核对 `iam` 通知契约。 - 本文件或索引变更后,从后端根运行 `./scripts/agents-index-contract.ps1`。