From d69d4b99f1245bf7c9040bd15f8bf617c2d6a5d5 Mon Sep 17 00:00:00 2001
From: 董国庆 <364620639@qq.com>
Date: 星期二, 25 二月 2025 14:13:10 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/H5/threeSide

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

diff --git a/management/src/components/RightContent/AvatarDropdown.tsx b/management/src/components/RightContent/AvatarDropdown.tsx
index 2d09633..fa54d86 100644
--- a/management/src/components/RightContent/AvatarDropdown.tsx
+++ b/management/src/components/RightContent/AvatarDropdown.tsx
@@ -1,7 +1,8 @@
-import { outLogin } from './service';
+import { outLogin, getUnreadCount } from './service';
 import { LogoutOutlined } from '@ant-design/icons';
 import { useModel } from '@umijs/max';
-import React from 'react';
+import React, { useEffect, useState } from 'react';
+import { Access, history, useAccess } from 'umi';
 import { flushSync } from 'react-dom';
 import './style.less';
 
@@ -22,6 +23,17 @@
 
   const { initialState, setInitialState } = useModel('@@initialState');
 
+  const [unreadCount, setUnreadCount] = useState(0);
+  useEffect(() => {
+    const timer = setInterval(() => {
+      getUnreadCount().then((res: any) => {
+        setUnreadCount(res.data || 0);
+      });
+    }, 1000 * 5)
+
+    return () => clearInterval(timer);
+  }, []);
+
 
   const onMenuClick = async () => {
     await outLogin();
@@ -33,10 +45,13 @@
   }
 
   return <div style={{ display: 'flex', alignItems: 'center', color: '#000' }}>
-    <div className='unread' >
-      <div>未读提醒</div>
-      <div style={{ border: '1px solid red', borderRadius: '50%', width: '18px', lineHeight: '18px', marginLeft: '5px', textAlign: 'center', color: 'red' }}>1</div>
-    </div>
+    {
+      unreadCount > 0 &&
+      <div className='unread' onClick={() => { history.push('/message-notification/list') }}>
+        <div>未读提醒</div>
+        <div style={{ border: '1px solid red', borderRadius: '50%', width: '18px', lineHeight: '16px', marginLeft: '5px', textAlign: 'center', color: 'red', flexShrink: 0 }}>{unreadCount}</div>
+      </div>
+    }
     <div className="logoOut" onClick={onMenuClick}>退出登录<LogoutOutlined style={{ marginLeft: '5px' }} /></div>
   </div>
 };

--
Gitblit v1.7.1