浏览代码

Merge pull request #210 from John-Hong/John/release-2.13.0/SCRM-4320

fix(SCRM-4320): [DE][C端]临时停车,扫描纸质优惠券以后,缴费页面会直接刷新
Tron 2 年之前
父节点
当前提交
23eb638bcd

+ 10 - 2
src/App.vue

@@ -77,7 +77,15 @@ export default {
         // 如果刷新之后没有与微信小程序建立链接则提示用户,关闭小程序重新进入
         const isReloadLoop = await isReloadBefore();
         if (isReloadLoop) {
-          const isReload = await theCommunicationBetweenWechatAndH5IsNormal();
+          uni.removeStorageSync('isReload');
+            const { theme } = getsTheCurrentTopic();
+            this.$dialog({
+              title: '温馨提示',
+              message: '当前网络异常,请重新进入小程序',
+              confirmButtonColor: this.$theme[theme].primaryColor,
+            });
+            return;
+          /* const isReload = await theCommunicationBetweenWechatAndH5IsNormal();
           if (isReload) {
             uni.removeStorageSync('isReload');
             const { theme } = getsTheCurrentTopic();
@@ -87,7 +95,7 @@ export default {
               confirmButtonColor: this.$theme[theme].primaryColor,
             });
             return;
-          }
+          } */
         }
         if (window.location.href.indexOf('cryptojs') > -1) {
           return;

+ 8 - 1
src/pages/parkingFee/mixins/parkingFee.js

@@ -4,7 +4,7 @@ import LoginDom from '@/components/Login/Login.vue';
 import { mapState } from 'vuex';
 import { initWxJsSdkConfig } from '@/utils/login';
 import { getPlatform,requestInit } from '@/utils/index';
-import { wxToLoginCallback, getUrlParams } from '@/utils';
+import { wxToLoginCallback, getUrlParams, theCommunicationBetweenWechatAndH5IsNormal } from '@/utils';
 import {getAccessH5} from '@/utils/api-crm-member'
 const app = {
   globalData: {
@@ -617,6 +617,13 @@ export default {
         // 微信小程序
         const platform = getPlatform();
         if (platform === 'miniprogram') {
+          // 判断微信小程序与 h5 是否正常通信
+          const isReload = await theCommunicationBetweenWechatAndH5IsNormal()
+          if(!isReload) {
+            uni.setStorageSync('isReload', 1)
+            window.location.reload()
+            return
+          }
           window.toWXSendMsg({
             type: 'scanQRCode',
           });

+ 1 - 0
src/pages/parkingFee/mixins/parkingFeeDetail.js

@@ -154,6 +154,7 @@ export default {
       if(!isReload) {
         uni.setStorageSync('isReload', 1)
         window.location.reload()
+        return
       }
       if (this.btnLoading) return
       this.btnLoading = true

+ 9 - 2
src/pages/parkingFee/mixins/parkingFeePaperCoupon.js

@@ -5,7 +5,7 @@ const app = {};
 import { mapState } from 'vuex';
 import fuiToast from '@/components/fui-toast/fui-toast.vue';
 import { initWxJsSdkConfig } from '@/utils/login';
-import { getPlatform } from '@/utils';
+import { getPlatform, theCommunicationBetweenWechatAndH5IsNormal } from '@/utils';
 import { paperCoupon } from '@/api/parking'
 
 export default {
@@ -87,7 +87,7 @@ export default {
       this.$refs.toast.show(options);
     },
     // 扫码
-    scanCode() {
+   async scanCode() {
       const runScanFn = ( res ) => {
         if ( res.scanType == 'QR_CODE' && res.scanType ) {
           console.log(res.result);
@@ -108,6 +108,13 @@ export default {
       // 微信小程序
       const platform = getPlatform();
       if ( platform === 'miniprogram' ) {
+        // 判断微信小程序与 h5 是否正常通信
+        const isReload = await theCommunicationBetweenWechatAndH5IsNormal()
+        if(!isReload) {
+          uni.setStorageSync('isReload', 1)
+          window.location.reload()
+          return
+        }
         window.toWXSendMsg({
           type: 'scanQRCode',
         });

+ 9 - 2
src/pages/parkingFee/parkingFeeMsg.vue

@@ -59,7 +59,7 @@ import { qrCodes,unlicensedCarCheckIn } from "@/api/parking";
 import baseMixins from "@/pages/parkingFee/mixins/base";
 import uni from '@/utils/uniHooks';
 import { initWxJsSdkConfig } from '@/utils/login';
-import { getPlatform,getUrlParams } from '@/utils';
+import { getPlatform,getUrlParams, theCommunicationBetweenWechatAndH5IsNormal } from '@/utils';
 import {mapState} from "vuex";
 
 export default {
@@ -101,7 +101,7 @@ export default {
       this.$store.commit('SET_UNLICENSED_INFO', {});
     },
     // 无牌车闸机扫码
-    scanCarCode() {
+    async scanCarCode() {
       const runScanFn = (res) => {
         /*
          针对微信的小程序码进行的兼容改造
@@ -130,6 +130,13 @@ export default {
       // 微信小程序
       const platform = getPlatform();
       if (platform === 'miniprogram') {
+        // 判断微信小程序与 h5 是否正常通信
+        const isReload = await theCommunicationBetweenWechatAndH5IsNormal()
+        if(!isReload) {
+          uni.setStorageSync('isReload', 1)
+          window.location.reload()
+          return
+        }
         window.toWXSendMsg({
           type: 'scanQRCode',
         });

+ 1 - 1
src/utils/index.js

@@ -302,7 +302,7 @@ export function wssInit() {
     try {
       const socket = new SockJS(`${ getUrl() }/hafengWebsocket?token=${ window.token }`);
       window.stompClient = Stomp.over(socket);
-      // window.stompClient.debug = false;
+      window.stompClient.debug = false;
       windowSendInit();
       window.stompClient.connect({},( frame ) => {
         // 请求 projectId