-
+
+
+
+ {notification.title}
+
+ {formatDate(notification.created_at)}
-
-
-
- {notification.title}
-
- {notification.time}
-
-
{notification.content}
-
- {notification.hasDetail && (
-
- )}
- {!notification.isRead && (
-
- )}
-
+
{notification.content}
+
+ {notification.type === 'permission_request' && (
+
+ )}
+ {!notification.is_read && (
+
+ )}
diff --git a/src/layouts/HeaderWithNav.jsx b/src/layouts/HeaderWithNav.jsx
index 1a923d8..2578e59 100644
--- a/src/layouts/HeaderWithNav.jsx
+++ b/src/layouts/HeaderWithNav.jsx
@@ -1,10 +1,11 @@
-import React, { useState } from 'react';
+import React, { useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { Link, useNavigate, useLocation } from 'react-router-dom';
import { logoutThunk } from '../store/auth/auth.thunk';
import UserSettingsModal from '../components/UserSettingsModal';
import NotificationCenter from '../components/NotificationCenter';
import SvgIcon from '../components/SvgIcon';
+import { fetchNotifications } from '../store/notificationCenter/notificationCenter.thunks';
export default function HeaderWithNav() {
const dispatch = useDispatch();
@@ -32,6 +33,10 @@ export default function HeaderWithNav() {
// 检查用户是否有管理权限(leader 或 admin)
const hasManagePermission = user && (user.role === 'leader' || user.role === 'admin');
+ useEffect(() => {
+ dispatch(fetchNotifications());
+ }, [dispatch]);
+
return (