This commit is contained in:
yj 2024-08-15 14:23:32 +08:00
parent 8ef5988cea
commit 69c88ba6d9
3 changed files with 23 additions and 22 deletions

View File

@ -97,13 +97,16 @@ const Index: React.FC = () => {
style={{ style={{
cursor: 'pointer', cursor: 'pointer',
}} }}
onClick={() => getRoomList()} onClick={() => {
message.success('刷新成功')
getRoomList()
}}
/> />
</div> </div>
{list.data.length ? <div className={styles.indexContentList}> {list.data.length ? <div className={`drag ${styles.indexContentList}`}>
{list.data.map((item: any, index: number) => { {list.data.map((item: any, index: number) => {
return ( return (
<div className={`${styles.indexContentListItem} drag`} key={index}> <div className={`${styles.indexContentListItem}`} key={index}>
<div> <div>
<div>{item.roomName}</div> <div>{item.roomName}</div>
<div> <div>

View File

@ -265,12 +265,8 @@ const Meeting: React.FC = () => {
break; break;
// 扩展操作 // 扩展操作
case 'Operation': case 'Operation':
// 1:全员退出会议
// 4:屏幕共享 // 4:屏幕共享
switch (item.type) { switch (item.type) {
case 1:
leaveChannel()
break;
case 4: case 4:
setIsShare((res: any) => { setIsShare((res: any) => {
if (userInfo.screenShareId === String(res)) { if (userInfo.screenShareId === String(res)) {
@ -284,8 +280,12 @@ const Meeting: React.FC = () => {
} }
break; break;
// 全员离开房间 // 全员离开房间
case 'AllLeave':
leaveChannel(false)
break;
// 踢出房间
case 'ForceExitRoom': case 'ForceExitRoom':
leaveChannel() console.log(item);
break; break;
// 更新视图模式 // 更新视图模式
case 'RefreshView': case 'RefreshView':
@ -301,11 +301,7 @@ const Meeting: React.FC = () => {
break; break;
// 用户退出频道回调 // 用户退出频道回调
case 'UserLeave': case 'UserLeave':
if (item.uid === userInfo.uid) { setAllUserListData('UserLeave', item)
leaveChannel()
} else {
setAllUserListData('UserLeave', item)
}
break; break;
// 所有用户开闭麦 // 所有用户开闭麦
case 'OperAllMicr': case 'OperAllMicr':
@ -630,9 +626,9 @@ const Meeting: React.FC = () => {
setMediaStream('') setMediaStream('')
} }
// 退出房间 // 退出房间
const leaveChannel = async (bool?: boolean): Promise<void> => { const leaveChannel = async (bool: boolean = true): Promise<void> => {
await stopRecorderMedia() await stopRecorderMedia()
if (!bool) { if (bool) {
await getLeave() await getLeave()
} }
agora.leaveChannel() agora.leaveChannel()
@ -1213,11 +1209,7 @@ const Meeting: React.FC = () => {
title="提示" title="提示"
description={`结束会议后,所有人将退出,是否结束?`} description={`结束会议后,所有人将退出,是否结束?`}
onConfirm={async () => { onConfirm={async () => {
await onInvoke('sendOper', {
roomNum: state.channelId,
type: 1,
})
leaveChannel(true)
}} }}
onCancel={() => { onCancel={() => {

View File

@ -70,12 +70,18 @@ export const onSignalr = (callBack: Function) => {
type type
}) })
}); });
// 全员离开房间 // 踢出房间
connection.on("ForceExitRoom", () => { connection.on("ForceExitRoom", () => {
callBack({ callBack({
key: 'ForceExitRoom', key: 'ForceExitRoom',
}) })
}); });
// 全员离开房间
connection.on("AllLeave", () => {
callBack({
key: 'AllLeave',
})
});
// 全员看他 // 全员看他
connection.on("ShowUser", () => { connection.on("ShowUser", () => {
callBack({ callBack({
@ -139,6 +145,7 @@ export const offSignalr = () => {
connection.off('ReceiveMessage'); connection.off('ReceiveMessage');
connection.off('Operation'); connection.off('Operation');
connection.off('ForceExitRoom'); connection.off('ForceExitRoom');
connection.off('AllLeave');
connection.off('ShowUser'); connection.off('ShowUser');
connection.off('RefreshView'); connection.off('RefreshView');
connection.off('UserJoined'); connection.off('UserJoined');
@ -155,7 +162,6 @@ export const onInvoke = async (str: string, data: any) => {
await connection.invoke(str, data.roomNum, data.msg) await connection.invoke(str, data.roomNum, data.msg)
break; break;
case 'sendOper': case 'sendOper':
// 1:全员退出会议
// 4:屏幕共享 // 4:屏幕共享
await connection.invoke(str, data.roomNum, data.type) await connection.invoke(str, data.roomNum, data.type)
break; break;