This commit is contained in:
yj 2024-10-21 14:27:15 +08:00
parent 7cae77f946
commit fa6b85e4f5
2 changed files with 31 additions and 20 deletions

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,10 +374,7 @@ const Meeting: React.FC = () => {
userId: noticeWindowPostRoomManager.uid userId: noticeWindowPostRoomManager.uid
}) })
break; break;
} case 'currentSpeakUserWindowGetUserName':
}
time = setInterval(() => {
setCurrentSeconds(currentSeconds++)
setSpeackUid((uids: any) => { setSpeackUid((uids: any) => {
const usernames: string[] = []; const usernames: string[] = [];
setRoomUserList((res: any) => { setRoomUserList((res: any) => {
@ -395,9 +392,13 @@ const Meeting: React.FC = () => {
}) })
return res return res
}); });
return [] return []
}) })
break;
}
}
time = setInterval(() => {
setCurrentSeconds(currentSeconds++)
}, 1000) }, 1000)
// 首次加载图标更新 // 首次加载图标更新
const firstFooterList = [...footerList] const firstFooterList = [...footerList]