yangjie #22

Merged
yangqiang merged 99 commits from yangjie into master 2024-10-22 16:11:46 +08:00
5 changed files with 196 additions and 48 deletions
Showing only changes of commit 1fd3f421f8 - Show all commits

View File

@ -439,6 +439,11 @@ function windowOperation(config) {
x = width - child.getSize()[0]; x = width - child.getSize()[0];
child.setPosition(x - 40, 40); child.setPosition(x - 40, 40);
break; break;
case 'noticeWindow':
x = width - child.getSize()[0];
y = height - child.getSize()[1];
child.setPosition(x, y - 80);
break;
} }
} }
// 主窗口居中 // 主窗口居中

View File

@ -23,6 +23,7 @@ import UserListWindow from "@/page/Meeting/UserListWindow";
import ChatSmallWindow from "@/page/Meeting/ChatSmallWindow"; import ChatSmallWindow from "@/page/Meeting/ChatSmallWindow";
import ChatBigWindow from "@/page/Meeting/ChatBigWindow"; import ChatBigWindow from "@/page/Meeting/ChatBigWindow";
import CurrentSpeakUserWindow from "@/page/Meeting/CurrentSpeakUserWindow"; import CurrentSpeakUserWindow from "@/page/Meeting/CurrentSpeakUserWindow";
import NoticeWindow from "@/page/Meeting/NoticeWindow";
const fs = require('fs').promises; const fs = require('fs').promises;
const { exec } = require('child_process'); const { exec } = require('child_process');
const App: React.FC = () => { const App: React.FC = () => {
@ -37,7 +38,7 @@ const App: React.FC = () => {
}); });
const [spinning, setSpinning] = useState(false); const [spinning, setSpinning] = useState(false);
const [isState, setIsState] = useState(true); 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) { if (urlHashArr.indexOf(location.hash) == -1) {
useEffect(() => { useEffect(() => {
let userInfo = JSON.parse(storage.getItem('user') as string) let userInfo = JSON.parse(storage.getItem('user') as string)
@ -255,6 +256,7 @@ const App: React.FC = () => {
<Route path='/chatSmallWindow' element={<ChatSmallWindow />} /> <Route path='/chatSmallWindow' element={<ChatSmallWindow />} />
<Route path='/chatBigWindow' element={<ChatBigWindow />} /> <Route path='/chatBigWindow' element={<ChatBigWindow />} />
<Route path='/currentSpeakUserWindow' element={<CurrentSpeakUserWindow />} /> <Route path='/currentSpeakUserWindow' element={<CurrentSpeakUserWindow />} />
<Route path='/noticeWindow' element={<NoticeWindow />} />
<Route path='*' element={<NotFound />} /> <Route path='*' element={<NotFound />} />
</Routes> </Routes>
<Spin spinning={spinning} fullscreen /> <Spin spinning={spinning} fullscreen />

View File

@ -0,0 +1,6 @@
.noticeWindow {
height: 100%;
width: 100%;
box-sizing: border-box;
background-color: transparent;
}

View File

@ -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: <div>
<span style={{ fontSize: '16px' }}>{noticeItem.uname}</span>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<Button
type="primary"
className='m-ant-btn'
onClick={async (e: any) => {
let i = e.nativeEvent.path;
if (i) {
i.forEach((i: any) => {
if (i.className === 'ant-notification-notice ant-notification-notice-closable') {
i.childNodes.forEach((row: any) => {
if (row.className === 'ant-notification-notice-close') {
row.click()
channel.postMessage({
type: 'noticeWindowPostRoomManager',
noticeWindowPostRoomManager: {
uid: noticeItem.uid
}
});
}
})
}
})
}
}}
></Button>
<Button
type="primary"
onClick={(e: any) => {
let item = e.nativeEvent.path;
if (item) {
item.forEach((item: any) => {
if (item.className === 'ant-notification-notice ant-notification-notice-closable') {
item.childNodes.forEach((row: any) => {
if (row.className === 'ant-notification-notice-close') {
row.click()
}
})
}
})
}
}}
style={{ backgroundColor: '#EC3C3C', marginLeft: '14px' }}
></Button>
</div>
</div>,
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 (
<>
<div className={`${styles.noticeWindow} drag`}>
{contextHolder}
</div>
</>
)
}
export default NoticeWindow

View File

@ -153,7 +153,7 @@ const Meeting: React.FC = () => {
}) })
const [networkOther, setNetworkOther] = useState<RtcStats>({}) const [networkOther, setNetworkOther] = useState<RtcStats>({})
const [isComputerAudio, setIsComputerAudio] = useState(true) const [isComputerAudio, setIsComputerAudio] = useState(true)
const [isScreenCapture, setIsScreenCapture] = useState(true) const [isScreenCapture, setIsScreenCapture] = useState(false)
const [isFluencyPriority, setIsFluencyPriority] = useState(false) const [isFluencyPriority, setIsFluencyPriority] = useState(false)
const [open, setOpen] = useState(false) const [open, setOpen] = useState(false)
const [modeOpen, setModeOpen] = useState(false) const [modeOpen, setModeOpen] = useState(false)
@ -222,6 +222,7 @@ const Meeting: React.FC = () => {
chatBigWindowEquipmentManagement, chatBigWindowEquipmentManagement,
chatBigWindowGetRoomKickout, chatBigWindowGetRoomKickout,
chatBigWindowSendChannelMsg, chatBigWindowSendChannelMsg,
noticeWindowPostRoomManager
} = event.data; } = event.data;
switch (type) { switch (type) {
case 'shareScreenWindowClose': case 'shareScreenWindowClose':
@ -320,6 +321,13 @@ const Meeting: React.FC = () => {
case 'chatBigWindowSendChannelMsg': case 'chatBigWindowSendChannelMsg':
sendMsg(chatBigWindowSendChannelMsg.msg) sendMsg(chatBigWindowSendChannelMsg.msg)
break; break;
case 'noticeWindowPostRoomManager':
postRoomManager({
roomId: state.roomId,
roomNum: state.channelId,
userId: noticeWindowPostRoomManager.uid
})
break;
} }
} }
time = setInterval(() => { time = setInterval(() => {
@ -576,59 +584,86 @@ const Meeting: React.FC = () => {
break; break;
// 申请发言 // 申请发言
case 'ApplyToSpeak': case 'ApplyToSpeak':
api.open({ const noticeWindow = await getKeyOpenChildWindow('noticeWindow')
message: '', setIsScreenCapture(bool => {
description: <div> if (bool) {
<span style={{ fontSize: '16px' }}>{item.uname}</span> if (noticeWindow) {
<div style={{ display: 'flex', justifyContent: 'flex-end' }}> channel.postMessage({
<Button type: 'noticeItem',
type="primary" noticeItem: item
className='m-ant-btn' });
onClick={async (e: any) => { } else {
let i = e.nativeEvent.path; window.electron.createChildWindow({
if (i) { url: location.origin + `/#/noticeWindow`,
i.forEach((i: any) => { width: 388,
if (i.className === 'ant-notification-notice ant-notification-notice-closable') { height: 150,
i.childNodes.forEach((row: any) => { key: 'noticeWindow',
if (row.className === 'ant-notification-notice-close') { })
row.click() setTimeout(() => {
postRoomManager({ channel.postMessage({
roomId: state.roomId, type: 'noticeItem',
roomNum: state.channelId, noticeItem: item
userId: item.uid });
}, 1000);
setKeyOpenChildWindow('noticeWindow', true)
}
} else {
api.open({
message: '',
description: <div>
<span style={{ fontSize: '16px' }}>{item.uname}</span>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<Button
type="primary"
className='m-ant-btn'
onClick={async (e: any) => {
let i = e.nativeEvent.path;
if (i) {
i.forEach((i: any) => {
if (i.className === 'ant-notification-notice ant-notification-notice-closable') {
i.childNodes.forEach((row: any) => {
if (row.className === 'ant-notification-notice-close') {
row.click()
postRoomManager({
roomId: state.roomId,
roomNum: state.channelId,
userId: item.uid
})
}
}) })
} }
}) })
} }
}) }}
} ></Button>
}} <Button
></Button> type="primary"
<Button onClick={(e: any) => {
type="primary" let item = e.nativeEvent.path;
onClick={(e: any) => { if (item) {
let item = e.nativeEvent.path; item.forEach((item: any) => {
if (item) { if (item.className === 'ant-notification-notice ant-notification-notice-closable') {
item.forEach((item: any) => { item.childNodes.forEach((row: any) => {
if (item.className === 'ant-notification-notice ant-notification-notice-closable') { if (row.className === 'ant-notification-notice-close') {
item.childNodes.forEach((row: any) => { row.click()
if (row.className === 'ant-notification-notice-close') { }
row.click() })
} }
}) })
} }
}) }}
} style={{ backgroundColor: '#EC3C3C', marginLeft: '14px' }}
}} ></Button>
style={{ backgroundColor: '#EC3C3C', marginLeft: '14px' }} </div>
></Button> </div>,
</div> duration: 10,
</div>, placement: 'bottomRight',
duration: 10, showProgress: true,
placement: 'bottomRight', pauseOnHover: false,
showProgress: true, });
pauseOnHover: false, }
}); return bool
})
break; break;
// 管理员查看随机用户 // 管理员查看随机用户
case 'Watch': case 'Watch':