wangfumin 1 ヶ月 前
コミット
8f16cfabab
3 ファイル変更11 行追加7 行削除
  1. 6 4
      src/components/chatRoom/index.vue
  2. 1 0
      src/hooks/useRoom.ts
  3. 4 3
      src/hooks/userSocket.ts

+ 6 - 4
src/components/chatRoom/index.vue

@@ -338,10 +338,9 @@
     await initialRoom();
     const { room, currentSceneIndex, firstNum } = useRoom();
     console.log('room', room);
-    // if (unref(room)?.takeLookLock === 1) {
-    //   showPasswordDialog.value = true;
-    //   return;
-    // }
+    if (unref(room)?.roomStatus == 2) {
+      window.parent && window.parent.postMessage({ type: 'hostStatus' }, '*');
+    }
     if (unref(room)?.takeLookLock === 1) {
       if (unref(currentSceneIndex) > 0) {
         const hasInput = localStorage.getItem(`${rtcStore.roomId}-${unref(firstNum)}`);
@@ -461,6 +460,9 @@
             } else {
               closeSocket();
             }
+            if (browser.getURLParam('role') == 'leader') {
+              window.parent && window.parent.postMessage({ type: 'exit' }, '*');
+            }
             if (authCheckInterval) clearInterval(authCheckInterval);
             rtcStore.showBaseDialog(
               {

+ 1 - 0
src/hooks/useRoom.ts

@@ -35,6 +35,7 @@ export interface SceneItemType {
   video?: string[];
   image?: string[];
   head?: string;
+  roomStatus: number;
 }
 
 export const room = ref<Nullable<roomDataType>>(null);

+ 4 - 3
src/hooks/userSocket.ts

@@ -36,6 +36,7 @@ export function createSocket() {
 }
 
 async function closeSocket() {
+  console.log('到期closeSocket');
   const { leaveRoom, createNewURLEntry } = useRoom();
   const rtcStore = useRtcStore();
   const appStore = useAppStore();
@@ -69,9 +70,9 @@ async function closeSocket() {
     roomId: rtcStore.roomId,
     avatar: '',
   });
-  setTimeout(() => {
-    location.reload();
-  }, 100);
+  // setTimeout(() => {
+  //   location.reload();
+  // }, 100);
 }
 
 async function closeRoomForWechat() {