From 6449efb56dbe3795cff319c15c55874204d2bf3d Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Mon, 21 Oct 2024 10:02:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/Meeting/NoticeWindow/index.tsx | 26 ++++++++++--------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/page/Meeting/NoticeWindow/index.tsx b/src/page/Meeting/NoticeWindow/index.tsx index 31ca198..ea9a79a 100644 --- a/src/page/Meeting/NoticeWindow/index.tsx +++ b/src/page/Meeting/NoticeWindow/index.tsx @@ -9,7 +9,6 @@ const NoticeWindow: React.FC = () => { } }); const channel = new BroadcastChannel('meeting_channel'); - let time: NodeJS.Timeout; useEffect(() => { channel.onmessage = function (event) { const { type, noticeItem } = event.data; @@ -64,6 +63,15 @@ const NoticeWindow: React.FC = () => { >拒绝 , + onClose: () => { + const dom = document.getElementsByClassName('ant-notification') + if (dom.length === 0) { + window.electron.setChildWindowShow({ + key: 'noticeWindow', + bool: false + }) + } + }, duration: 10, placement: 'bottomRight', showProgress: true, @@ -72,24 +80,10 @@ const NoticeWindow: React.FC = () => { break; } } - }, []); - useEffect(() => { - setTimeout(() => { - time = setInterval(() => { - const dom = document.getElementsByClassName('ant-notification') - if (dom.length === 0) { - window.electron.setChildWindowShow({ - key: 'noticeWindow', - bool: false - }) - } - }, 1000) - }, 4000); return () => { - clearInterval(time) channel.close(); }; - }, []) + }, []); return ( <>