xiongzhu 4 yıl önce
ebeveyn
işleme
69fec95db9
1 değiştirilmiş dosya ile 38 ekleme ve 35 silme
  1. 38 35
      src/main/nine-space/src/router/index.js

+ 38 - 35
src/main/nine-space/src/router/index.js

@@ -5,43 +5,46 @@ import { Dialog } from 'vant';
 import http from '../plugins/http';
 
 function jsapiSign() {
-    if (/micromessenger/i.test(navigator.userAgent)) {
-        http.http
-            .get('/wx/jsapiSign', { url: store.state.firstUrl })
-            .then(res => {
-                wx.config({
-                    debug: false,
-                    appId: res.appId,
-                    timestamp: res.timestamp,
-                    nonceStr: res.nonceStr,
-                    signature: res.signature,
-                    jsApiList: [
-                        'chooseWXPay',
-                        'updateAppMessageShareData',
-                        'updateTimelineShareData',
-                        'hideAllNonBaseMenuItem',
-                        'scanQRCode'
-                    ]
-                });
-                wx.error(function (res) {
-                    console.log(res);
-                });
-                wx.ready(function () {
-                    wx.updateAppMessageShareData({
-                        title: '第九空间',
-                        desc: '全球首个基于区块链的游戏资产集换中心',
-                        link: location.origin + '/9th',
-                        imgUrl: 'https://9space-2021.oss-cn-shenzhen.aliyuncs.com/nft/2021-11-05-15-58-30YwqLzMjy.jpg'
+    setTimeout(() => {
+        if (/micromessenger/i.test(navigator.userAgent)) {
+            let isIOS = /iphone|ipad/i.test(navigator.userAgent);
+            http.http
+                .get('/wx/jsapiSign', { url: isIOS ? store.state.firstUrl : location.origin + location.href })
+                .then(res => {
+                    wx.config({
+                        debug: false,
+                        appId: res.appId,
+                        timestamp: res.timestamp,
+                        nonceStr: res.nonceStr,
+                        signature: res.signature,
+                        jsApiList: [
+                            'chooseWXPay',
+                            'updateAppMessageShareData',
+                            'updateTimelineShareData',
+                            'hideAllNonBaseMenuItem',
+                            'scanQRCode'
+                        ]
                     });
-                    wx.updateTimelineShareData({
-                        title: '第九空间-全球首个基于区块链的游戏资产集换中心',
-                        link: location.origin + '/9th',
-                        imgUrl: 'https://9space-2021.oss-cn-shenzhen.aliyuncs.com/nft/2021-11-05-15-58-30YwqLzMjy.jpg'
+                    wx.error(function (res) {
+                        console.log(res);
                     });
-                });
-            })
-            .catch(e => {});
-    }
+                    wx.ready(function () {
+                        wx.updateAppMessageShareData({
+                            title: '第九空间',
+                            desc: '全球首个基于区块链的游戏资产集换中心',
+                            link: location.origin + '/9th',
+                            imgUrl: 'https://9space-2021.oss-cn-shenzhen.aliyuncs.com/nft/2021-11-05-15-58-30YwqLzMjy.jpg'
+                        });
+                        wx.updateTimelineShareData({
+                            title: '第九空间-全球首个基于区块链的游戏资产集换中心',
+                            link: location.origin + '/9th',
+                            imgUrl: 'https://9space-2021.oss-cn-shenzhen.aliyuncs.com/nft/2021-11-05-15-58-30YwqLzMjy.jpg'
+                        });
+                    });
+                })
+                .catch(e => {});
+        }
+    }, 200);
 }
 jsapiSign();
 const routes = [