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];
child.setPosition(x - 40, 40);
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 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 />

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 [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: <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
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>
<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
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()
}}
></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,
});
}}
style={{ backgroundColor: '#EC3C3C', marginLeft: '14px' }}
></Button>
</div>
</div>,
duration: 10,
placement: 'bottomRight',
showProgress: true,
pauseOnHover: false,
});
}
return bool
})
break;
// 管理员查看随机用户
case 'Watch':