import styles from '@/page/Meeting/NoticeWindow/index.module.scss' import { setKeyOpenChildWindow } from '@/utils/package/public'; import { Button, notification } from 'antd'; import { useEffect } from "react"; const NoticeWindow: React.FC = () => { const [api, contextHolder] = notification.useNotification({ stack: { threshold: 3 } }); const channel = new BroadcastChannel('meeting_channel'); let time: NodeJS.Timeout; useEffect(() => { channel.onmessage = function (event) { const { type, noticeItem } = event.data; switch (type) { case 'noticeItem': api.open({ message: '', description:
{noticeItem.uname}申请发言
, duration: 10, placement: 'bottomRight', showProgress: true, pauseOnHover: false, }); break; } } }, []); useEffect(() => { setTimeout(() => { time = setInterval(() => { const dom = document.getElementsByClassName('ant-notification') if (dom.length === 0) { window.electron.closeChildWindow('noticeWindow') setKeyOpenChildWindow('noticeWindow', false) } }, 1000) }, 3000); return () => { clearInterval(time) }; }, []) return ( <>
{contextHolder}
) } export default NoticeWindow