全员退出会议

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

View File

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