yangjie #22

Merged
yangqiang merged 99 commits from yangjie into master 2024-10-22 16:11:46 +08:00
2 changed files with 31 additions and 20 deletions
Showing only changes of commit fa6b85e4f5 - Show all commits

View File

@ -2,7 +2,14 @@ import styles from '@/page/Meeting/CurrentSpeakUserWindow/index.module.scss'
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
const CurrentSpeakUserWindow: React.FC = () => { const CurrentSpeakUserWindow: React.FC = () => {
const [inputValue, setInputValue] = useState('') const [inputValue, setInputValue] = useState('')
const channel = new BroadcastChannel('meeting_channel');
useEffect(() => { useEffect(() => {
let time: NodeJS.Timeout;
time = setInterval(() => {
channel.postMessage({
type: 'currentSpeakUserWindowGetUserName'
})
}, 1000)
window.electron.windowHandleMessageCallBack((_e: any, data: any) => { window.electron.windowHandleMessageCallBack((_e: any, data: any) => {
if (data.parmes.currentSpeakUser.length) { if (data.parmes.currentSpeakUser.length) {
setInputValue(data.parmes.currentSpeakUser.join(';')) setInputValue(data.parmes.currentSpeakUser.join(';'))
@ -10,6 +17,9 @@ const CurrentSpeakUserWindow: React.FC = () => {
setInputValue('') setInputValue('')
} }
}) })
return () => {
clearInterval(time)
}
}, []); }, []);
return ( return (

View File

@ -374,30 +374,31 @@ 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++)
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 []
})
}, 1000) }, 1000)
// 首次加载图标更新 // 首次加载图标更新
const firstFooterList = [...footerList] const firstFooterList = [...footerList]