Files
one-pipe-system/openspec/changes/add-notification-center/proposal.md
luo d1ff4d5f6c
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m7s
feat: 顶部通知铃铛与站内通知中心
2026-07-24 17:12:29 +08:00

47 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Change: 顶部通知铃铛与站内通知中心
## Why
当前顶部通知组件仍使用硬编码 mock 数据,通知按钮也未启用,运营人员无法统一查看余额预警、临期提醒、审批结果和系统告警。需要建立真实的站内通知数据链路,并在全局导航和通知中心之间保持未读状态同步。
## What Changes
- 在顶部全局导航的设置按钮与用户头像入口区域增加通知铃铛。
- 铃铛展示未读数量,统一格式为 `0``1``99``99+`
- 点击铃铛展示最近 10 条通知抽屉,支持全部、审批、临期、同步/系统分类。
- 抽屉提供进入 `/notifications` 通知中心的入口。
- 新增通知中心页面,支持分类、通知类型、严重级别、已读状态筛选和全部已读。
- 点击通知时先调用标记已读接口,再根据受控 `ref_type` 获取目标并跳转;未知目标只展示通知正文,不执行任意 URL 跳转。
- 接入未读数、未读摘要、通知列表、单条已读和全部已读接口。
- 替换现有 `ArtNotification` 硬编码 mock 数据实现,并复用现有顶部布局和设置/头像区域的视觉位置。
## Impact
- Affected specs:
- `notification-center`
- Affected code:
- `src/components/core/layouts/art-header-bar/index.vue`
- `src/components/core/layouts/art-notification/index.vue`
- `src/components/core/layouts/art-notification/style.scss`
- `src/views/notifications/index.vue`
- `src/api/modules/notification.ts`
- `src/types/api/notification.ts`
- 路由、菜单和通知相关权限配置
- API contracts:
- `GET /api/admin/notifications/unread-count`
- `GET /api/admin/notifications/unread-summary`
- `GET /api/admin/notifications`
- `PUT /api/admin/notifications/{id}/read`
- `PUT /api/admin/notifications/read-all`
- `GET /api/admin/notifications/{id}/target`
- Dependencies:
- 后端按当前用户返回通知数据、未读统计和受控跳转目标。
- 后端明确通知分类、类型、严重级别、已读状态和 `ref_type` 枚举。
- 目标接口不得返回可被前端直接执行的任意外部 URL。
- Out of scope:
- C 端 `/api/c/v1/notifications` 接口和页面。
- 前端创建、编辑或删除通知。
- 浏览器推送、WebSocket 或轮询之外的实时推送机制。
- Breaking changes:
- 现有 `ArtNotification` mock 通知数据和无效的空操作按钮将被真实通知数据及接口行为替换。