@@ -91,11 +96,28 @@ import { useRouter } from 'vue-router' import { useAuthStore } from '@/stores/auth' import { workOrderService } from '@/services/workOrderService' +import { notificationService } from '@/services/notificationService' const authStore = useAuthStore() const userInfo = authStore.getUserInfo() const router = useRouter() +// 添加未读通知数量 +const unreadCount = ref(0) +// 获取未读通知数量 +const loadUnreadNotifications = async () => { + try { + const repairmanId = authStore.getRepairmanId + if (repairmanId) { + const response = await notificationService.getUnreadNotifications(repairmanId) + if (response.code === 200) { + unreadCount.value = response.data.length + } + } + } catch (error) { + console.error('获取未读通知失败:', error) + } +} // 工单数据 const processingOrders = ref([]) const loading = ref(false) @@ -195,9 +217,15 @@ const goToProfile = () => { router.push('/profile') } +// 添加跳转到通知页面的函数 +const goToNotifications = () => { + router.push('/notifications') +} + // 页面加载时获取工单数据 onMounted(() => { fetchProcessingOrders() + loadUnreadNotifications() }) @@ -435,4 +463,28 @@ onMounted(() => { padding: 20px; color: #666; } + +.notification-icon { + position: relative; + cursor: pointer; + font-size: 20px; + display: inline-block; +} + +.notification-badge { + position: absolute; + top: -6px; + right: -8px; + background: #ff4d4f; + color: white; + font-size: 10px; + font-weight: 600; + border-radius: 50%; + width: 18px; + height: 18px; + display: flex; + align-items: center; + justify-content: center; + min-width: 18px; +} diff --git a/src/main/resources/zzz/src/views/NotificationsPage.vue b/src/main/resources/zzz/src/views/NotificationsPage.vue new file mode 100644 index 0000000..eae92b3 --- /dev/null +++ b/src/main/resources/zzz/src/views/NotificationsPage.vue @@ -0,0 +1,459 @@ + + + + + + diff --git a/src/main/resources/zzz/src/views/ProfilePage.vue b/src/main/resources/zzz/src/views/ProfilePage.vue index d01bb40..3a4cae0 100644 --- a/src/main/resources/zzz/src/views/ProfilePage.vue +++ b/src/main/resources/zzz/src/views/ProfilePage.vue @@ -1,3 +1,4 @@ +