Files
one-pipe-system/openspec/changes/update-admin-notification-center-api/proposal.md
luo 9289a6e940
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m5s
feat: 完善接口19-顶部通知铃铛与站内通知中心
2026-07-25 10:20:53 +08:00

41 lines
2.2 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
通知中心已有前端链路,但当前类型和页面仍兼容旧字段,例如 `content``read_status`、旧的未读摘要结构和可路由目标结构。后端接口文档已更新为实际可用的管理端 API需要按真实响应字段和受控目标协议修正通知铃铛、抽屉、通知中心及状态同步逻辑。
## What Changes
- 按实际接口更新通知项字段:`body``is_read``read_at``ref_type``ref_id``ref_key`
- 按实际接口更新通知列表筛选参数:使用 `is_read` boolean支持 `category``type``severity``page``page_size`
- 接入真实未读数响应 `{ count, display_count }`,顶部徽标直接展示后端 `display_count`
- 接入真实未读分类汇总 `{ approval, expiry, sync, system, total }`抽屉最近通知通过通知列表接口获取最多展示10条。
- 全部已读调用 `PUT /api/admin/notifications/read-all`,支持可选 `category` 请求体。
- 受控目标按 `target_type``target_id``target_key` 建立前端白名单映射,不接受或执行任意 URL/路由字段。
- 通知中心展示正文 `body`、读取状态 `is_read`、首次已读时间 `read_at`,并支持余额、审批、临期、同步/系统分类。
- 本变更只覆盖管理端,明确不接入 C 端 `/api/c/v1/notifications`
## Impact
- Affected specs:
- `notification-center`
- Affected code:
- `src/types/api/notification.ts`
- `src/api/modules/notification.ts`
- `src/store/modules/notification.ts`
- `src/components/core/layouts/art-header-bar/index.vue`
- `src/components/core/layouts/art-notification/index.vue`
- `src/views/notifications/index.vue`
- `src/utils/business/notificationNavigation.ts`
- API contracts:
- `GET /api/admin/notifications`
- `PUT /api/admin/notifications/{id}/read`
- `PUT /api/admin/notifications/read-all`
- `GET /api/admin/notifications/unread-count`
- `GET /api/admin/notifications/unread-summary`
- `GET /api/admin/notifications/{id}/target`
- Out of scope:
- C 端 `/api/c/v1/notifications` 接口和页面
- 创建、编辑或删除通知
- WebSocket、浏览器推送和新的实时推送机制