import styles from '@/page/Meeting/NoticeWindow/index.module.scss' 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'); useEffect(() => { window.electron.setChildWindowShow({ key: 'noticeWindow', bool: false }) channel.onmessage = function (event) { const { type, noticeItem } = event.data; switch (type) { case 'noticeItem': api.open({ message: '', description:
{noticeItem.uname}
申请发言
, onClose: () => { setTimeout(() => { const dom = document.getElementsByClassName('ant-notification') if (dom.length === 0) { window.electron.setChildWindowShow({ key: 'noticeWindow', bool: false }) } }, 500); }, duration: 10, placement: 'bottomRight', showProgress: true, pauseOnHover: false, }); break; } } return () => { channel.close(); }; }, []); return ( <>
{contextHolder}
) } export default NoticeWindow