全员退出会议

This commit is contained in:
yj 2024-07-16 15:09:02 +08:00
parent 4f023da7d7
commit 1ef7b31bed
2 changed files with 30 additions and 12 deletions

View File

@ -173,6 +173,10 @@ const Meeting: React.FC = () => {
case 'RefreshUserList':
getRoomUser()
break;
case 'Operation':
console.log('嘻嘻', item);
leaveChannel()
break;
}
})
}, [])
@ -262,7 +266,12 @@ const Meeting: React.FC = () => {
break;
}
}
// 退出房间
const leaveChannel = (): void => {
agora.leaveChannel()
agora.stopScreenCapture()
navigate(-1)
}
// 分享屏幕
const clickSharedScreen = async (): Promise<void> => {
let data = sharedScreenList.find((item: any) => item.sourceId === sharedScreenItem.sourceId)
@ -508,16 +517,14 @@ const Meeting: React.FC = () => {
<Popover key={rowIndex}
content={
<div className='meetingContentFooterPopover'>
<div onClick={() => {
agora.leaveChannel()
agora.stopScreenCapture()
navigate(-1)
<div onClick={async () => {
await onInvoke('sendOper', {
roomNum: state.channelId,
type: 1,
})
leaveChannel()
}}></div>
<div onClick={() => {
agora.leaveChannel()
agora.stopScreenCapture()
navigate(-1)
}}></div>
<div onClick={() => leaveChannel()}></div>
<div onClick={() => { setOpen(false) }}></div>
</div>
}

View File

@ -17,10 +17,10 @@ export const startSignalr = () => {
}
export const onSignalr = (callBack: Function) => {
if (connection){
if (connection) {
connection.on("ReceiveMessage", (uid: string, userName: string, message: string) => {
callBack({
key:'ReceiveMessage',
key: 'ReceiveMessage',
uid, message, userName
})
});
@ -29,6 +29,12 @@ export const onSignalr = (callBack: Function) => {
key: 'RefreshUserList'
})
});
connection.on("Operation", (type: number) => {
callBack({
key: 'Operation',
type
})
});
}
}
export const onInvoke = async (str: string, data: any) => {
@ -42,6 +48,11 @@ export const onInvoke = async (str: string, data: any) => {
case 'sendChannelMsg':
await connection.invoke(str, data.roomNum, data.msg)
break;
case 'sendOper':
// 1:全员退出会议
console.log(data);
await connection.invoke(str, data.roomNum, data.type)
break;
}
}