This commit is contained in:
yj 2024-11-12 16:45:16 +08:00
parent 2bb36d0d78
commit d2cf731a34
6 changed files with 54 additions and 117 deletions

View File

@ -552,6 +552,7 @@ app.on('ready', () => {
} }
} }
mainWindow.setSkipTaskbar(false) mainWindow.setSkipTaskbar(false)
mainWindow.setResizable(true)
mainWindow.setAlwaysOnTop(false) mainWindow.setAlwaysOnTop(false)
} else { } else {
childWindow[key].close() childWindow[key].close()
@ -574,7 +575,6 @@ app.on('ready', () => {
mainWindow.setMinimumSize(250, config.height); mainWindow.setMinimumSize(250, config.height);
mainWindow.setMaximumSize(250, config.height); mainWindow.setMaximumSize(250, config.height);
mainWindow.setSize(250, config.height) mainWindow.setSize(250, config.height)
mainWindow.setBounds({ height: config.height })
break; break;
} }
}); });
@ -695,16 +695,13 @@ function windowOperation(config) {
x = Math.round((display.workArea.width - child.getSize()[0]) / 2); x = Math.round((display.workArea.width - child.getSize()[0]) / 2);
child.setPosition(x, 0); child.setPosition(x, 0);
mainWindow.setSkipTaskbar(true) mainWindow.setSkipTaskbar(true)
mainWindow.setResizable(false)
mainWindow.setAlwaysOnTop(true, 'screen-saver') mainWindow.setAlwaysOnTop(true, 'screen-saver')
break; break;
case 'chatSmallWindow': case 'chatSmallWindow':
y = height - child.getSize()[1]; y = height - child.getSize()[1];
child.setPosition(40, y - 200); child.setPosition(40, y - 200);
break; break;
case 'currentSpeakUserWindow':
x = width - child.getSize()[0];
child.setPosition(x - 40, 210);
break;
case 'noticeWindow': case 'noticeWindow':
x = width - child.getSize()[0]; x = width - child.getSize()[0];
y = height - child.getSize()[1]; y = height - child.getSize()[1];

View File

@ -20,7 +20,6 @@ import ShareScreenWindow from "@/page/Meeting/ShareScreenWindow";
import UserListWindow from "@/page/Meeting/UserListWindow"; 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 NoticeWindow from "@/page/Meeting/NoticeWindow"; import NoticeWindow from "@/page/Meeting/NoticeWindow";
import { getKeyOpenChildWindow, setKeyOpenChildWindow, storageSeeting } from "./utils/package/public"; import { getKeyOpenChildWindow, setKeyOpenChildWindow, storageSeeting } from "./utils/package/public";
const fs = require('fs').promises; const fs = require('fs').promises;
@ -37,7 +36,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', '#/noticeWindow'] const urlHashArr = ['#/userListWindow', '#/shareScreenWindow', '#/chatSmallWindow', '#/chatBigWindow', '#/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)
@ -276,7 +275,6 @@ const App: React.FC = () => {
<Route path='/userListWindow' element={<UserListWindow />} /> <Route path='/userListWindow' element={<UserListWindow />} />
<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='/noticeWindow' element={<NoticeWindow />} /> <Route path='/noticeWindow' element={<NoticeWindow />} />
<Route path='*' element={<NotFound />} /> <Route path='*' element={<NotFound />} />
</Routes> </Routes>

View File

@ -1,19 +0,0 @@
.currentSpeakUserWindow {
color: white;
width: 100%;
display: flex;
flex-direction: column;
height: 100%;
background-color: #16191E;
padding: 4px;
box-sizing: border-box;
>div {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
max-width: 100%;
width: fit-content;
font-size: 14px;
}
}

View File

@ -1,36 +0,0 @@
import styles from '@/page/Meeting/CurrentSpeakUserWindow/index.module.scss'
import { useEffect, useState } from "react";
const CurrentSpeakUserWindow: React.FC = () => {
const [inputValue, setInputValue] = useState('')
const channel = new BroadcastChannel('meeting_channel');
useEffect(() => {
let time: NodeJS.Timeout;
time = setInterval(() => {
channel.postMessage({
type: 'currentSpeakUserWindowGetUserName'
})
}, 1000)
window.electron.windowHandleMessageCallBack((_e: any, data: any) => {
if (data.parmes.currentSpeakUser.length) {
setInputValue(data.parmes.currentSpeakUser.join(';'))
} else {
setInputValue('')
}
})
return () => {
clearInterval(time)
}
}, []);
return (
<>
<div className={styles.currentSpeakUserWindow}>
<div title={`正在说话: ${inputValue}`}>
{`正在说话: ${inputValue}`}
</div>
</div >
</>
)
}
export default CurrentSpeakUserWindow

View File

@ -121,14 +121,16 @@
.meetingAbsoluteText { .meetingAbsoluteText {
position: absolute; position: absolute;
width: 100%; width: 100%;
bottom: 0;
left: 0; left: 0;
color: white; color: white;
text-align: center; text-align: center;
z-index: 1; z-index: 2;
background-color: rgba(0, 0, 0, 0.5); background-color: rgba(0, 0, 0, 0.5);
cursor: pointer; cursor: pointer;
font-size: 14px; font-size: 14px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
} }
} }

View File

@ -146,6 +146,7 @@ const Meeting: React.FC = () => {
}); });
const [roomUserList, setRoomUserList] = useState<any>([]) const [roomUserList, setRoomUserList] = useState<any>([])
const [_speackUid, setSpeackUid] = useState<any>([]) const [_speackUid, setSpeackUid] = useState<any>([])
const [currentSpeakUser, setCurrentSpeakUser] = useState<any>([])
const [chatList, setChatList] = useState<any>([]) const [chatList, setChatList] = useState<any>([])
const [isExpand, setIsExpand] = useState(false) const [isExpand, setIsExpand] = useState(false)
const [currentVideoId, setCurrentVideoId] = useState('') const [currentVideoId, setCurrentVideoId] = useState('')
@ -380,33 +381,26 @@ const Meeting: React.FC = () => {
userId: noticeWindowPostRoomManager.uid userId: noticeWindowPostRoomManager.uid
}) })
break; break;
case 'currentSpeakUserWindowGetUserName':
setSpeackUid((uids: any) => {
const usernames: string[] = [];
setRoomUserList((res: any) => {
uids.forEach((uid: any) => {
const user = res.find((item: any) => item.uid == uid);
if (user) {
usernames.push(user.userName);
}
})
window.electron.windowHandleMessage({
key: 'currentSpeakUserWindow',
parmes: {
currentSpeakUser: usernames,
}
})
return res
});
return []
})
break;
} }
} }
time = setInterval(() => { time = setInterval(() => {
setCurrentSeconds(currentSeconds => { setCurrentSeconds(currentSeconds => {
return currentSeconds += 1 return currentSeconds += 1
}) })
setSpeackUid((uids: any) => {
const usernames: string[] = [];
setRoomUserList((res: any) => {
uids.forEach((uid: any) => {
const user = res.find((item: any) => item.uid == uid);
if (user) {
usernames.push(user.userName);
}
})
setCurrentSpeakUser(usernames)
return res
});
return []
})
}, 1000) }, 1000)
// 首次加载图标更新 // 首次加载图标更新
const firstFooterList = [...footerList] const firstFooterList = [...footerList]
@ -418,27 +412,34 @@ const Meeting: React.FC = () => {
setTimeout(async () => { setTimeout(async () => {
const setting = await JSON.parse(storage.getItem('setting') as string); const setting = await JSON.parse(storage.getItem('setting') as string);
const stateInfo = await JSON.parse(storage.getItem('stateInfo') as string); const stateInfo = await JSON.parse(storage.getItem('stateInfo') as string);
if (stateInfo && setting.isRecordingTips && !recorder) { console.log(isScreenCapture);
if (stateInfo && setting.isRecordingTips) {
setRecorder((data: any) => { setRecorder((data: any) => {
if (!data) { if (!data) {
confirm({ setIsScreenCapture(bool => {
title: '提示', if (!bool) {
icon: <ExclamationCircleFilled />, confirm({
content: `是否录制本次会议?`, title: '提示',
centered: true, icon: <ExclamationCircleFilled />,
okText: '确定', content: `是否录制本次会议?`,
cancelText: '取消', centered: true,
async onOk() { okText: '确定',
if (stateInfo) { cancelText: '取消',
changeStatusList({ async onOk() {
title: '录制' if (stateInfo) {
}, 1, 3) changeStatusList({
} else { title: '录制'
message.error('当前不在会议室!') }, 1, 3)
} } else {
}, message.error('当前不在会议室!')
onCancel() { }
},
onCancel() {
}
})
} }
return bool
}) })
} }
return data return data
@ -1628,13 +1629,6 @@ const Meeting: React.FC = () => {
key: 'chatSmallWindow', key: 'chatSmallWindow',
show: true, show: true,
}) })
window.electron.createChildWindow({
url: location.origin + `/#/currentSpeakUserWindow`,
width: 200,
height: 30,
key: 'currentSpeakUserWindow',
show: true,
})
window.electron.createChildWindow({ window.electron.createChildWindow({
url: location.origin + `/#/chatBigWindow`, url: location.origin + `/#/chatBigWindow`,
width: 540, width: 540,
@ -2090,13 +2084,14 @@ const Meeting: React.FC = () => {
<> <>
<div className={styles.meeting}> <div className={styles.meeting}>
{isScreenCapture ? <div className={`${styles.meetingAbsolute}`} id='meetingAbsoluteVideo'> {isScreenCapture ? <div className={`${styles.meetingAbsolute}`} id='meetingAbsoluteVideo'>
<div style={{ top: '0px' }} className={`${styles.meetingAbsoluteText}`}>{currentSpeakUser.length ? '正在说话:' + currentSpeakUser.join(';') : '正在说话:'}</div>
{footerList[0][1].active ? <div className={styles.meetingAbsoluteLoading}> {footerList[0][1].active ? <div className={styles.meetingAbsoluteLoading}>
<Avatar name={user.userName} /> <Avatar name={user.userName} />
</div> : null} </div> : null}
<div className={`${styles.meetingAbsoluteText} drag`} onClick={() => { <div style={{ bottom: '0px' }} className={`${styles.meetingAbsoluteText} drag`} onClick={() => {
setIsExpand(!isExpand) setIsExpand(!isExpand)
window.electron.setChildWindow({ window.electron.setChildWindow({
height: isExpand ? 160 : 20, height: isExpand ? 160 : 40,
key: 'main' key: 'main'
}) })
}}><span>{isExpand ? '展开' : '收起'}</span></div> }}><span>{isExpand ? '展开' : '收起'}</span></div>
@ -2104,7 +2099,7 @@ const Meeting: React.FC = () => {
{contextHolder} {contextHolder}
<div className={styles.meetingHeader}> <div className={styles.meetingHeader}>
<div> <div>
<Popover {isScreenCapture ? null : <Popover
content={ content={
<div style={{ color: 'white' }}> <div style={{ color: 'white' }}>
<div> <div>
@ -2148,7 +2143,7 @@ const Meeting: React.FC = () => {
{networkIcon(currentEffective)} {networkIcon(currentEffective)}
<span></span> <span></span>
</div> </div>
</Popover> </Popover>}
<div>{changeCurrentSeconds()}</div> <div>{changeCurrentSeconds()}</div>
</div> </div>
<div>{state.channelId} {state.roomName}</div> <div>{state.channelId} {state.roomName}</div>
@ -2663,7 +2658,7 @@ const Meeting: React.FC = () => {
) : null ) : null
} }
</div> </div>
<div className={styles.meetingContentFooter}> {isScreenCapture ? null : <div className={styles.meetingContentFooter}>
{footerList.map((item: any, itemIndex: number) => { {footerList.map((item: any, itemIndex: number) => {
return ( return (
<div key={itemIndex}> <div key={itemIndex}>
@ -2816,7 +2811,7 @@ const Meeting: React.FC = () => {
</div> </div>
) )
})} })}
</div> </div>}
</div> </div>
</div> </div>
<Modal title="共享屏幕" open={isSharedScreenModal} footer={null} closable={false} centered width={'800px'}> <Modal title="共享屏幕" open={isSharedScreenModal} footer={null} closable={false} centered width={'800px'}>