This commit is contained in:
yj 2024-10-21 10:02:15 +08:00
parent 70469962be
commit 6449efb56d
1 changed files with 10 additions and 16 deletions

View File

@ -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 = () => {
></Button>
</div>
</div>,
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 (
<>
<div className={`${styles.noticeWindow} drag`}>