diff --git a/frontend/src/components/NotificationBell.vue b/frontend/src/components/NotificationBell.vue index 38d6718..f428900 100644 --- a/frontend/src/components/NotificationBell.vue +++ b/frontend/src/components/NotificationBell.vue @@ -2,19 +2,7 @@
- +
@@ -137,7 +125,7 @@ const handleClick = () => { // 点击通知项 const handleNotificationClick = async (notification: Notification) => { // 标记为已读 - if (notification.isRead === 0) { + if (notification.isRead === 0 && currentUserId.value) { try { await markAsRead(notification.id, currentUserId.value) loadUnreadCount() @@ -160,6 +148,10 @@ const handleViewAll = () => { // 全部已读 const handleMarkAllRead = async () => { + if (!currentUserId.value) { + return + } + try { const count = await markAllAsRead(currentUserId.value) message.success(`已标记 ${count} 条消息为已读`) @@ -278,15 +270,6 @@ onUnmounted(() => { background: $bg-card; color: $text-primary; } - - .bell-icon { - width: 18px; - height: 18px; - display: inline-block; - fill: currentColor; - stroke: currentColor; - stroke-width: 0; - } } .notification-dropdown {