skyblued 2 jaren geleden
bovenliggende
commit
293f8378d1
2 gewijzigde bestanden met toevoegingen van 24 en 46 verwijderingen
  1. 23 26
      index.html
  2. 1 20
      src/subpages/colexiu/App.tsx

+ 23 - 26
index.html

@@ -147,19 +147,17 @@
          */
         var onlyPostmessage = (instanceKey) => {
           var _a, _b
-          const win = window
+          const win = window;
           win.originalPostMessage = win.originalPostMessage || window.postMessage
-          const instance =
-            win[instanceKey] ||
-            ((_b = (_a = win.webkit) === null || _a === void 0 ? void 0 : _a.messageHandlers) === null || _b === void 0
-              ? void 0
-              : _b[instanceKey])
+          const instance = window.ORCHESTRA || (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.ORCHESTRA) 
+          console.log("🚀 ~ instance", instance)
           return function (data) {
+            console.log("🚀 ~ data", data)
             if (instance) {
               const uuid = getRandomKey()
               data.content = data.content ? Object.assign(Object.assign({}, data.content), { uuid }) : { uuid }
+              console.log('index-send:', JSON.stringify(data))
               instance.postMessage(JSON.stringify(data))
-              console.log('send:', JSON.stringify(data))
             }
           }
         }
@@ -167,30 +165,29 @@
         return onlyPostmessage
       })()
 
-      window._setupMessage = _onlyPostmessage('COLEXIU')
+      window._setupMessage = _onlyPostmessage('ORCHESTRA')
       if (location.origin.indexOf('192.168') > -1 && location.href.indexOf('&acc=1') === -1 && !document.hidden) {
-        window._setupMessage({
-          api: 'openAccompanyWebView',
-          content: {
-            // url: location.origin + '/accompany?id=' + item.id, 
-            url: location.origin + location.pathname + '?id=50970&acc=1',
-            orientation: 0,
-            isHideTitle: true,
-            statusBarTextColor: false,
-            isOpenLight: true,
-          },
-        })
+        // window._setupMessage({
+        //   api: 'openAccompanyWebView',
+        //   content: {
+        //     url: location.origin + location.pathname + '?id=50970&acc=1',
+        //     orientation: 0,
+        //     isHideTitle: true,
+        //     statusBarTextColor: false,
+        //     isOpenLight: true,
+        //   },
+        // })
       }
 
       ;(function () {
         window.isLoading = true
-        window._setupMessage({
-          api: 'cloudLoading',
-          content: {
-            show: true,
-            type: 'fullscreen',
-          },
-        })
+        // window._setupMessage({
+        //   api: 'cloudLoading',
+        //   content: {
+        //     show: true,
+        //     type: 'fullscreen',
+        //   },
+        // })
         try {
           setTimeout(() => {
             var tips = document.querySelector('#loading div')

+ 1 - 20
src/subpages/colexiu/App.tsx

@@ -7,27 +7,8 @@ import { useRoute } from 'vue-router'
 export default defineComponent({
   setup() {
     const route = useRoute()
+    console.log("🚀 ~ APP里面的route", route)
     sessionStorage.setItem('Authorization', route.query.Authorization as string)
-    onMounted(() => {
-      // document.addEventListener('touchstart', () => {
-      //   console.log('子页面touchstart')
-      //   window.parent.postMessage(
-      //     {
-      //       api: 'touchstart',
-      //     },
-      //     '*'
-      //   )
-      // })
-      // document.addEventListener('touchend', () => {
-      //   console.log('子页面touchend')
-      //   window.parent.postMessage(
-      //     {
-      //       api: 'touchend',
-      //     },
-      //     '*'
-      //   )
-      // })
-    })
   },
   render() {
     return <router-view></router-view>