gemercheung 1 rok pred
rodič
commit
d84db26605

+ 1 - 1
src/App.vue

@@ -366,7 +366,7 @@
       {{ maxNumber }}
     </span> -->
     <span>
-      {{ t('base.debuginfo') }}:公告,测试1.2.0-9-7-01,角色:{{ rtcStore.role }} rId:{{
+      {{ t('base.debuginfo') }}:公告,测试1.2.0-9-8-01,角色:{{ rtcStore.role }} rId:{{
         rtcStore.roomId || browser.getURLParam('roomId')
       }}
       sceneIndex:{{ currentSceneIndex }} uid::

+ 27 - 18
src/components/chatRoom/controls/actions.ts

@@ -7,7 +7,7 @@ import { useSocket } from '/@/hooks/userSocket';
 import { useRoom, SceneItemType } from '/@/hooks/useRoom';
 import { useI18n } from '/@/hooks/useI18n';
 import browser from '/@/utils/browser';
-import { unref } from 'vue';
+import { computed, unref } from 'vue';
 import { useAppStore } from '/@/store/modules/app';
 import dayjs from 'dayjs';
 import duration from 'dayjs/plugin/duration';
@@ -16,6 +16,10 @@ import { useMiniApp } from '/@/hooks/useMiniApp';
 import { useSceneStore } from '/@/store/modules/scene';
 dayjs.extend(duration);
 const { isUsingMiniApp } = useMiniApp();
+
+const isOtherPlatform = computed(
+  () => browser.getURLParam('platform') && browser.getURLParam('platform').length > 0,
+);
 // import { useRtcSdk } from '/@/hooks/useTRTC';
 interface ActionDataType {
   type: string;
@@ -405,27 +409,32 @@ const handleLeaderDismiss = () => {
       if (isUsingMiniApp.value) {
         closeRoomForWechat();
       } else {
-        window.parent &&
-          window.parent.postMessage(
-            {
-              type: 'exit',
-            },
-            '*',
-          );
         closeSocket();
       }
     },
   );
-  setTimeout(() => {
-    if (isUsingMiniApp.value) {
-      //@ts-ignore
-      wx.miniProgram.switchTab({
-        url: '/pages/index/index',
-      });
-    } else {
-      closeSocket();
-    }
-  }, 5000);
+  if (!isOtherPlatform.value) {
+    setTimeout(() => {
+      if (isUsingMiniApp.value) {
+        //@ts-ignore
+        wx.miniProgram.switchTab({
+          url: '/pages/index/index',
+        });
+      } else {
+        closeSocket();
+      }
+    }, 5000);
+  } else {
+    setTimeout(() => {
+      window.parent &&
+        window.parent.postMessage(
+          {
+            type: 'redirect',
+          },
+          '*',
+        );
+    }, 2000);
+  }
 };
 
 //

+ 1 - 8
src/components/chatRoom/dialog/createdName.vue

@@ -84,14 +84,7 @@
       Dialog.toast({ content: t('base.saveSuccess'), type: 'success' });
       ifShow.value = false;
       emit('confirmDialog', unref(userName));
-      window.parent &&
-        window.parent.postMessage(
-          {
-            type: 'fillName',
-            data: unref(userName),
-          },
-          '*',
-        );
+
     }
   };
 </script>

+ 11 - 1
src/components/chatRoom/index.vue

@@ -209,7 +209,6 @@
   import duration from 'dayjs/plugin/duration';
   import { useMiniApp } from '/@/hooks/useMiniApp';
 
-
   const { closeSocket } = useSocket();
   dayjs.extend(duration);
   // hook
@@ -382,6 +381,17 @@
       console.log('replaceUrl', replaceUrl);
       history.replaceState(null, '', replaceUrl);
     });
+    window.parent &&
+      window.parent.postMessage(
+        {
+          type: 'fillName',
+          data: {
+            name: unref(userName),
+            userId: rtcStore.userId,
+          },
+        },
+        '*',
+      );
   };
 
   const sceneInit = (app, val) => {

+ 1 - 1
src/hooks/userSocket.ts

@@ -48,7 +48,7 @@ async function closeSocket() {
   window.parent &&
     window.parent.postMessage(
       {
-        type: 'exit',
+        type: 'redirect',
       },
       '*',
     );