From 08ab1f457f8d536900e8d9bbd4726179feed4d42 Mon Sep 17 00:00:00 2001 From: luoyuehang <2830398107@qq.com> Date: Sat, 27 Dec 2025 12:50:54 +0800 Subject: [PATCH 1/2] =?UTF-8?q?app2=E7=9A=84=E8=A2=AB=E6=B4=BE=E5=8D=95?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/zzz/src/router/index.js | 6 + .../zzz/src/services/notificationService.js | 40 ++ src/main/resources/zzz/src/views/HomePage.vue | 54 ++- .../zzz/src/views/NotificationsPage.vue | 459 ++++++++++++++++++ .../resources/zzz/src/views/ProfilePage.vue | 66 ++- 5 files changed, 609 insertions(+), 16 deletions(-) create mode 100644 src/main/resources/zzz/src/services/notificationService.js create mode 100644 src/main/resources/zzz/src/views/NotificationsPage.vue diff --git a/src/main/resources/zzz/src/router/index.js b/src/main/resources/zzz/src/router/index.js index 5ab741e..f0c378d 100644 --- a/src/main/resources/zzz/src/router/index.js +++ b/src/main/resources/zzz/src/router/index.js @@ -81,6 +81,12 @@ const router = createRouter({ name: 'InspectionForm', component: () => import('../views/InspectionForm.vue'), meta: { requiresAuth: true } + }, + { + path: '/notifications', + name: 'NotificationsPage', + component: () => import('../views/NotificationsPage.vue'), + meta: { requiresAuth: true } } ] }) diff --git a/src/main/resources/zzz/src/services/notificationService.js b/src/main/resources/zzz/src/services/notificationService.js new file mode 100644 index 0000000..8db84cb --- /dev/null +++ b/src/main/resources/zzz/src/services/notificationService.js @@ -0,0 +1,40 @@ +// src/services/notificationService.js +import api from './api' + +export const notificationService = { + // 获取未读通知 + async getUnreadNotifications(repairmanId) { + try { + const response = await api.get('/api/app/repairman/notification/unread', { + params: { repairmanId } + }) + return response.data + } catch (error) { + throw error.response?.data || error.message + } + }, + + // 获取所有通知 + async getAllNotifications(repairmanId) { + try { + const response = await api.get('/api/app/repairman/notification/all', { + params: { repairmanId } + }) + return response.data + } catch (error) { + throw error.response?.data || error.message + } + }, + + // 标记通知为已读 + async markNotificationAsRead(notificationId) { + try { + const response = await api.post('/api/app/repairman/notification/read', null, { + params: { notificationId } + }) + return response.data + } catch (error) { + throw error.response?.data || error.message + } + } +} diff --git a/src/main/resources/zzz/src/views/HomePage.vue b/src/main/resources/zzz/src/views/HomePage.vue index a6b810a..64048c2 100644 --- a/src/main/resources/zzz/src/views/HomePage.vue +++ b/src/main/resources/zzz/src/views/HomePage.vue @@ -9,7 +9,12 @@