From 9999f3f26b3e922fede12aee5967e17ad405aee0 Mon Sep 17 00:00:00 2001 From: ouyangxq <775153912@qq.com> Date: Wed, 12 Aug 2026 19:30:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 1 + src/modules/notifications/notifications.test.mjs | 4 ++++ src/modules/notifications/views/NotificationDetailView.vue | 2 +- src/modules/notifications/views/NotificationsView.vue | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index c4b3789..15fcc2a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -38,6 +38,7 @@ | 登录、注册与会话 | `src/modules/auth/` | Backend `auth/`、`iam/` | | 企业资料、成员与角色 | `src/modules/tenant-management/`、`src/modules/account/` | Backend `iam/`、`file/` | | 工作台与系统入口 | `src/modules/dashboard/`、`src/modules/system/` | `src/navigation/clientNavigation.ts`、`src/router/index.ts` | +| 企业成员消息收件箱 | `src/modules/notifications/` | Backend `iam/src/main/java/com/baiyue/iam/notification/`;列表、详情、已读与未读数契约见 `iam/src/main/resources/openapi/notification-v1.yaml` | | 头程下单、订单与履约进度 | `src/modules/first-leg/` | Backend `order/`、`firstleg/`、`warehouse/` | | 统一订单展示 | `src/modules/order-management/` | `src/modules/first-leg/` 与对应后端订单契约 | | 客户财务账单、收款与未收余额 | `src/modules/finance/` | Backend `finance/`;以登录态客户隔离,只读接口从 `api/finance.ts` 进入 | diff --git a/src/modules/notifications/notifications.test.mjs b/src/modules/notifications/notifications.test.mjs index 4474723..8c5d2db 100644 --- a/src/modules/notifications/notifications.test.mjs +++ b/src/modules/notifications/notifications.test.mjs @@ -16,6 +16,8 @@ test('does not accept browser-selected customer or user scope in the API boundar assert.doesNotMatch(source, /tenantId|customerId|merchantId|userId/) assert.match(source, /merchant\/v1\/notifications/) assert.match(source, /unread-count/) + assert.match(source, /notifications\/\$\{encodeURIComponent\(id\)\}/) + assert.match(source, /notifications\/\$\{encodeURIComponent\(id\)\}\/read/) assert.match(source, /read-all/) assert.match(source, /category: query\.type/) assert.match(source, /method: 'PUT'/) @@ -31,4 +33,6 @@ test('keeps customer message actions first and covers the requested local states assert.match(source, /标为已读/) assert.match(source, /state-panel--error/) assert.match(source, /暂无消息/) + assert.doesNotMatch(source, /清空已读|删除消息/) + assert.match(source, /Promise\.all\(\[load\(\), notifications\.refreshUnreadCount\(\)\]\)/) }) diff --git a/src/modules/notifications/views/NotificationDetailView.vue b/src/modules/notifications/views/NotificationDetailView.vue index 915fad8..c588830 100644 --- a/src/modules/notifications/views/NotificationDetailView.vue +++ b/src/modules/notifications/views/NotificationDetailView.vue @@ -10,5 +10,5 @@ const route = useRoute(); const router = useRouter(); const notifications = useN async function load(){loading.value=true;errorMessage.value='';try{detail.value=await getMyNotification(String(route.params.notificationId));if(detail.value.status==='UNREAD'){await markMyNotificationRead(detail.value.id);detail.value={...detail.value,status:'READ'};await notifications.refreshUnreadCount()}}catch(error){errorMessage.value=error instanceof ApiError?error.message:'消息加载失败,请稍后重试'}finally{loading.value=false}} onMounted(()=>{void load()}) -返回我的消息消息详情{{ detail?.title || '消息详情' }}{{ errorMessage }}重试{{ detail?.sentAt }} · {{ detail?.type }}{{ detail?.content || '暂无消息内容' }} +返回我的消息消息详情{{ detail?.title || '消息详情' }}{{ errorMessage }}重试{{ detail?.sentAt }} · {{ detail?.type }}{{ detail?.content || '暂无消息内容' }} diff --git a/src/modules/notifications/views/NotificationsView.vue b/src/modules/notifications/views/NotificationsView.vue index 8b1780d..439146a 100644 --- a/src/modules/notifications/views/NotificationsView.vue +++ b/src/modules/notifications/views/NotificationsView.vue @@ -22,7 +22,7 @@ async function load(nextPage = page.value.page) { async function markRead(row: NotificationSummary) { try { await markMyNotificationRead(row.id); await Promise.all([load(), notifications.refreshUnreadCount()]) } catch (error) { errorMessage.value = messageOf(error) } } async function markAllRead() { try { await markAllMyNotificationsRead(); await Promise.all([load(), notifications.refreshUnreadCount()]) } catch (error) { errorMessage.value = messageOf(error) } } function openDetail(row: NotificationSummary) { void router.push({ name: 'notification-detail', params: { notificationId: row.id } }) } -onMounted(() => { void load() }) +onMounted(() => { void Promise.all([load(), notifications.refreshUnreadCount()]) })
消息详情
{{ errorMessage }}
{{ detail?.sentAt }} · {{ detail?.type }}
{{ detail?.content || '暂无消息内容' }}