yangjie #22
5
main.js
5
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;
|
||||
}
|
||||
}
|
||||
// 主窗口居中
|
||||
|
|
|
|||
|
|
@ -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 = () => {
|
|||
<Route path='/chatSmallWindow' element={<ChatSmallWindow />} />
|
||||
<Route path='/chatBigWindow' element={<ChatBigWindow />} />
|
||||
<Route path='/currentSpeakUserWindow' element={<CurrentSpeakUserWindow />} />
|
||||
<Route path='/noticeWindow' element={<NoticeWindow />} />
|
||||
<Route path='*' element={<NotFound />} />
|
||||
</Routes>
|
||||
<Spin spinning={spinning} fullscreen />
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
.noticeWindow {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -153,7 +153,7 @@ const Meeting: React.FC = () => {
|
|||
})
|
||||
const [networkOther, setNetworkOther] = useState<RtcStats>({})
|
||||
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,6 +584,30 @@ const Meeting: React.FC = () => {
|
|||
break;
|
||||
// 申请发言
|
||||
case 'ApplyToSpeak':
|
||||
const noticeWindow = await getKeyOpenChildWindow('noticeWindow')
|
||||
setIsScreenCapture(bool => {
|
||||
if (bool) {
|
||||
if (noticeWindow) {
|
||||
channel.postMessage({
|
||||
type: 'noticeItem',
|
||||
noticeItem: item
|
||||
});
|
||||
} else {
|
||||
window.electron.createChildWindow({
|
||||
url: location.origin + `/#/noticeWindow`,
|
||||
width: 388,
|
||||
height: 150,
|
||||
key: 'noticeWindow',
|
||||
})
|
||||
setTimeout(() => {
|
||||
channel.postMessage({
|
||||
type: 'noticeItem',
|
||||
noticeItem: item
|
||||
});
|
||||
}, 1000);
|
||||
setKeyOpenChildWindow('noticeWindow', true)
|
||||
}
|
||||
} else {
|
||||
api.open({
|
||||
message: '',
|
||||
description: <div>
|
||||
|
|
@ -629,6 +661,9 @@ const Meeting: React.FC = () => {
|
|||
showProgress: true,
|
||||
pauseOnHover: false,
|
||||
});
|
||||
}
|
||||
return bool
|
||||
})
|
||||
break;
|
||||
// 管理员查看随机用户
|
||||
case 'Watch':
|
||||
|
|
|
|||
Loading…
Reference in New Issue