Browse Source

修复二层四维看看互跳检查

gemercheung 1 year ago
parent
commit
2f52985447

+ 1 - 1
packages/qjkankan-kankan-view/src/app.js

@@ -13,7 +13,7 @@ export function createApp(opitons = {}, forceNew = false) {
         target: 'self',
         onAction: function (url) {
             const newUrl = new URL(url);
-            const isV4 = newUrl.pathname.indexOf('spg.html') > -1;
+            const isV4 = newUrl.pathname.indexOf('spg.html') > -1 || newUrl.pathname.indexOf('smg.html') > -1;
             console.log('场景原Link:', url, isV4);
             let result
             if (isV4) {

+ 11 - 0
packages/qjkankan-kankan-view/src/pages/SMG.vue

@@ -88,6 +88,17 @@ const { t } = useI18n({ useScope: "global" });
 useAppHeight();
 let app = null;
 
+onMounted(async () => {
+  if (!browser.isMobile()) {
+    window.location.href = window.location.href.replace(
+      "smg.html",
+      "spg.html"
+    );
+    console.warn('重跳后::',window.location.href);
+    return;
+  }
+});
+
 const autoPlayMedia = (player) => {
   function onclick() {
     window.parent.postMessage(

+ 23 - 7
packages/qjkankan-kankan-view/src/pages/SPG.vue

@@ -25,7 +25,6 @@ import LoadingLogo from "@/components/shared/Loading.vue";
 import { createApp } from "@/app";
 import { listenMessage } from "@/utils/messageHandler";
 import { Dialog } from "@/global_components";
-
 import { ref, onMounted, computed } from "vue";
 import { useStore } from "vuex";
 import { useApp, getApp } from "@/app";
@@ -33,6 +32,17 @@ import browser from "@/utils/browser";
 import { useI18n, getLocale } from "@/i18n";
 const { t } = useI18n({ useScope: "global" });
 
+onMounted(async () => {
+  if (browser.isMobile()) {
+    window.location.href = window.location.href.replace(
+      "spg.html",
+      "smg.html"
+    );
+    console.warn('重跳后::',window.location.href);
+    return;
+  }
+});
+
 const autoPlayMedia = (player) => {
   function onclick() {
     window.parent.postMessage(
@@ -90,23 +100,29 @@ onMounted(() => {
         );
         break;
       case 5034:
-        window.location.replace( `/5034.html?m=${browser.getURLParam("m")}&lang=${browser.getURLParam(
+        window.location.replace(
+          `/5034.html?m=${browser.getURLParam("m")}&lang=${browser.getURLParam(
             "lang"
-          )}`);
+          )}`
+        );
         break;
       case 5009:
-        window.location.replace( `/5034.html?m=${browser.getURLParam("m")}&lang=${browser.getURLParam(
+        window.location.replace(
+          `/5034.html?m=${browser.getURLParam("m")}&lang=${browser.getURLParam(
             "lang"
-          )}`);
+          )}`
+        );
         break;
       case 5005:
         // Dialog.toast({
         //     content: t('guide.no_scene'),
         //     type: 'error',
         // })
-        window.location.replace( `/5033.html?m=${browser.getURLParam("m")}&lang=${browser.getURLParam(
+        window.location.replace(
+          `/5033.html?m=${browser.getURLParam("m")}&lang=${browser.getURLParam(
             "lang"
-          )}`);
+          )}`
+        );
         break;
     }
   });