From 1fd3f421f8c1e340206796eb4dff4291fbaad194 Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Tue, 15 Oct 2024 15:21:17 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.js | 5 + src/App.tsx | 4 +- .../Meeting/NoticeWindow/index.module.scss | 6 + src/page/Meeting/NoticeWindow/index.tsx | 100 ++++++++++++++ src/page/Meeting/index.tsx | 129 +++++++++++------- 5 files changed, 196 insertions(+), 48 deletions(-) create mode 100644 src/page/Meeting/NoticeWindow/index.module.scss create mode 100644 src/page/Meeting/NoticeWindow/index.tsx diff --git a/main.js b/main.js index 271c5f0..363341d 100644 --- a/main.js +++ b/main.js @@ -439,6 +439,11 @@ function windowOperation(config) { x = width - child.getSize()[0]; child.setPosition(x - 40, 40); break; + case 'noticeWindow': + x = width - child.getSize()[0]; + y = height - child.getSize()[1]; + child.setPosition(x, y - 80); + break; } } // 主窗口居中 diff --git a/src/App.tsx b/src/App.tsx index 641852f..f7805ca 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -23,6 +23,7 @@ import UserListWindow from "@/page/Meeting/UserListWindow"; import ChatSmallWindow from "@/page/Meeting/ChatSmallWindow"; import ChatBigWindow from "@/page/Meeting/ChatBigWindow"; import CurrentSpeakUserWindow from "@/page/Meeting/CurrentSpeakUserWindow"; +import NoticeWindow from "@/page/Meeting/NoticeWindow"; const fs = require('fs').promises; const { exec } = require('child_process'); const App: React.FC = () => { @@ -37,7 +38,7 @@ const App: React.FC = () => { }); const [spinning, setSpinning] = useState(false); const [isState, setIsState] = useState(true); - const urlHashArr = ['#/userListWindow', '#/shareScreenWindow', '#/chatSmallWindow', '#/chatBigWindow', '#/currentSpeakUserWindow'] + const urlHashArr = ['#/userListWindow', '#/shareScreenWindow', '#/chatSmallWindow', '#/chatBigWindow', '#/currentSpeakUserWindow', '#/noticeWindow'] if (urlHashArr.indexOf(location.hash) == -1) { useEffect(() => { let userInfo = JSON.parse(storage.getItem('user') as string) @@ -255,6 +256,7 @@ const App: React.FC = () => { } /> } /> } /> + } /> } /> diff --git a/src/page/Meeting/NoticeWindow/index.module.scss b/src/page/Meeting/NoticeWindow/index.module.scss new file mode 100644 index 0000000..2264327 --- /dev/null +++ b/src/page/Meeting/NoticeWindow/index.module.scss @@ -0,0 +1,6 @@ +.noticeWindow { + height: 100%; + width: 100%; + box-sizing: border-box; + background-color: transparent; +} \ No newline at end of file diff --git a/src/page/Meeting/NoticeWindow/index.tsx b/src/page/Meeting/NoticeWindow/index.tsx new file mode 100644 index 0000000..dcf0e96 --- /dev/null +++ b/src/page/Meeting/NoticeWindow/index.tsx @@ -0,0 +1,100 @@ +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 diff --git a/src/page/Meeting/index.tsx b/src/page/Meeting/index.tsx index 6984da7..c7184f4 100644 --- a/src/page/Meeting/index.tsx +++ b/src/page/Meeting/index.tsx @@ -153,7 +153,7 @@ const Meeting: React.FC = () => { }) const [networkOther, setNetworkOther] = useState({}) const [isComputerAudio, setIsComputerAudio] = useState(true) - const [isScreenCapture, setIsScreenCapture] = useState(true) + const [isScreenCapture, setIsScreenCapture] = useState(false) const [isFluencyPriority, setIsFluencyPriority] = useState(false) const [open, setOpen] = useState(false) const [modeOpen, setModeOpen] = useState(false) @@ -222,6 +222,7 @@ const Meeting: React.FC = () => { chatBigWindowEquipmentManagement, chatBigWindowGetRoomKickout, chatBigWindowSendChannelMsg, + noticeWindowPostRoomManager } = event.data; switch (type) { case 'shareScreenWindowClose': @@ -320,6 +321,13 @@ const Meeting: React.FC = () => { case 'chatBigWindowSendChannelMsg': sendMsg(chatBigWindowSendChannelMsg.msg) break; + case 'noticeWindowPostRoomManager': + postRoomManager({ + roomId: state.roomId, + roomNum: state.channelId, + userId: noticeWindowPostRoomManager.uid + }) + break; } } time = setInterval(() => { @@ -576,59 +584,86 @@ const Meeting: React.FC = () => { break; // 申请发言 case 'ApplyToSpeak': - api.open({ - message: '', - description:
- {item.uname}申请发言 -
- - + -
-
, - duration: 10, - placement: 'bottomRight', - showProgress: true, - pauseOnHover: false, - }); + }} + style={{ backgroundColor: '#EC3C3C', marginLeft: '14px' }} + >拒绝 + + , + duration: 10, + placement: 'bottomRight', + showProgress: true, + pauseOnHover: false, + }); + } + return bool + }) break; // 管理员查看随机用户 case 'Watch':