|
@@ -8,6 +8,7 @@ import { useRoom, SceneItemType } from '/@/hooks/useRoom';
|
|
import { useI18n } from '/@/hooks/useI18n';
|
|
import { useI18n } from '/@/hooks/useI18n';
|
|
import browser from '/@/utils/browser';
|
|
import browser from '/@/utils/browser';
|
|
import { unref } from 'vue';
|
|
import { unref } from 'vue';
|
|
|
|
+import { useAppStore } from '/@/store/modules/app';
|
|
interface ActionDataType {
|
|
interface ActionDataType {
|
|
type: string;
|
|
type: string;
|
|
data: any;
|
|
data: any;
|
|
@@ -82,6 +83,10 @@ export function handleActions({
|
|
case 'error':
|
|
case 'error':
|
|
// Dialog.toast({ content: `房间未找到`, type: 'error' });
|
|
// Dialog.toast({ content: `房间未找到`, type: 'error' });
|
|
handleError();
|
|
handleError();
|
|
|
|
+
|
|
|
|
+ case 'sync-floor':
|
|
|
|
+ handleSyncFloor(data);
|
|
|
|
+
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -143,7 +148,7 @@ function handleUserJoin(members?: UserInfoType[], user?: UserInfoType) {
|
|
message: '有人进来了',
|
|
message: '有人进来了',
|
|
});
|
|
});
|
|
const rtcStore = useRtcStore();
|
|
const rtcStore = useRtcStore();
|
|
-
|
|
|
|
|
|
+ const appStore = useAppStore();
|
|
members && rtcStore.setMemberList(members);
|
|
members && rtcStore.setMemberList(members);
|
|
const isMaxAlert = rtcStore.memberList.length > Number(import.meta.env.VITE_ROOM_MEMBER);
|
|
const isMaxAlert = rtcStore.memberList.length > Number(import.meta.env.VITE_ROOM_MEMBER);
|
|
|
|
|
|
@@ -154,6 +159,7 @@ function handleUserJoin(members?: UserInfoType[], user?: UserInfoType) {
|
|
name = t('action.hoster');
|
|
name = t('action.hoster');
|
|
Dialog.toast({ content: t('action.hosterEnterRoom') });
|
|
Dialog.toast({ content: t('action.hosterEnterRoom') });
|
|
socket.emit('action', { type: 'user-init' });
|
|
socket.emit('action', { type: 'user-init' });
|
|
|
|
+ socket.emit('sync-floor', { floorId: appStore.floorId });
|
|
}
|
|
}
|
|
const data: ChatContentType = {
|
|
const data: ChatContentType = {
|
|
role: user?.Role,
|
|
role: user?.Role,
|
|
@@ -301,7 +307,7 @@ const handleLeaderDismiss = () => {
|
|
closeTxt: t('base.cancel'),
|
|
closeTxt: t('base.cancel'),
|
|
isSingle: true,
|
|
isSingle: true,
|
|
},
|
|
},
|
|
- () => {},
|
|
|
|
|
|
+ () => { },
|
|
);
|
|
);
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
closeSocket();
|
|
closeSocket();
|
|
@@ -327,3 +333,15 @@ const handleError = () => {
|
|
},
|
|
},
|
|
);
|
|
);
|
|
};
|
|
};
|
|
|
|
+
|
|
|
|
+interface FloorType {
|
|
|
|
+ floorId: string;
|
|
|
|
+}
|
|
|
|
+const handleSyncFloor = (data: FloorType) => {
|
|
|
|
+ const rtcStore = useRtcStore();
|
|
|
|
+ const appStore = useAppStore();
|
|
|
|
+ if (!rtcStore.isLeader) {
|
|
|
|
+ console.log('data', data, rtcStore);
|
|
|
|
+ appStore.setFloor(data.floorId);
|
|
|
|
+ }
|
|
|
|
+};
|