From 573193bb8ba686b06b5132cd233f953cc06d310d Mon Sep 17 00:00:00 2001
From: 落日与鲸 <10806022+gong-jinbao@user.noreply.gitee.com>
Date: 星期五, 28 二月 2025 18:41:19 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/H5/threeSide

---
 management/src/components/RightContent/AvatarDropdown.tsx |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/management/src/components/RightContent/AvatarDropdown.tsx b/management/src/components/RightContent/AvatarDropdown.tsx
index dffd8ba..20ae03c 100644
--- a/management/src/components/RightContent/AvatarDropdown.tsx
+++ b/management/src/components/RightContent/AvatarDropdown.tsx
@@ -16,6 +16,7 @@
   // 
 
   const { currentUser } = initialState || {};
+  console.log('currentUser currentUser currentUser currentUser',currentUser)
   return <span className="anticon">{currentUser?.userName || '超级管理员'}</span>;
 };
 
@@ -24,20 +25,22 @@
   const { initialState, setInitialState } = useModel('@@initialState');
 
   const [unreadCount, setUnreadCount] = useState(0);
+  const { currentUser } = initialState || {};
   useEffect(() => {
-    // const timer = setInterval(() => {
-    //   getUnreadCount().then((res: any) => {
-    //     setUnreadCount(res.data || 0);
-    //   });
-    // }, 1000 * 5)
+    const timer = setInterval(() => {
+      getUnreadCount().then((res: any) => {
+        setUnreadCount(res.data || 0);
+      });
+    }, 1000 * 5)
 
-    // return () => clearInterval(timer);
+    return () => clearInterval(timer);
   }, []);
 
 
   const onMenuClick = async () => {
     await outLogin();
     localStorage.clear();
+    history.push('/login');
     flushSync(() => {
       setInitialState((s) => ({ ...s, currentUser: undefined }));
     });
@@ -52,6 +55,7 @@
         <div style={{ border: '1px solid red', borderRadius: '50%', width: '18px', lineHeight: '16px', marginLeft: '5px', textAlign: 'center', color: 'red', flexShrink: 0 }}>{unreadCount}</div>
       </div>
     }
+    <div style={{ marginRight: '25px' }} >{currentUser?.userName || '超级管理员'}</div>
     <div className="logoOut" onClick={onMenuClick}>退出登录<LogoutOutlined style={{ marginLeft: '5px' }} /></div>
   </div>
 };

--
Gitblit v1.7.1