Quellcode durchsuchen

Merge branch 'release-3.2.0' into develop

# Conflicts:
#	src/pages/parkingFeeV2/mixins/parkingFee.js
john vor 1 Jahr
Ursprung
Commit
ec2d1b28d0

+ 3 - 0
src/pages/parkingFee/mixins/parkingReceipt/parkingReceipt.js

@@ -90,6 +90,9 @@ export default {
     }),
   },
   created() {
+    if(window?.history?.scrollRestoration) {
+      window.history.scrollRestoration = 'manual';
+    }
     // 埋点本地化
     this.preUrl = uni.getStorageSync('previousUrl');
     this.$store.dispatch('invoice/init')

+ 36 - 22
src/pages/parkingFeeV2/mixins/parkingFee.js

@@ -824,28 +824,40 @@ export default {
             runScanFn(options.options);
           });
         } else {
-          this.$wx.scanQRCode({
-            onlyFromCamera: false,
-            // desc: 'scanQRCode desc',
-            needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
-            // scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
-            success: (res) => {
-              console.log('H5页面扫码获取到的参数——成功1', res);
-              // const res = {"resultStr": "lo$Qed.3YuVi*D7vXilrrV0571a1&type=unlicensedIn", "errMsg": "scanQRCode:ok"}
-              // const test = {"resultStr": "lp$Qed.3YuVi*D7vXilrrV0571a2&type=unlicensedOut", "errMsg": "scanQRCode:ok"}
-              let path = res.resultStr.replace(/.*([a-z0-9]{6}&type)/g, '8b$1')
-              const regex = /(\w+)&type=(\w+)/;
-              const match = path.match(regex);
-              const obj = {code: match[1], type: match[2]};
-              this.$store.commit('SET_UNLICENSED_INFO', obj);
-              this.$nextTick(() => {
-                this.qrCodesRule(obj.code, 'scan');
-              })
-            },
-            error: (res) => {
-              console.log('H5页面扫码获取到的参数——失败', res);
-            },
-          });
+          try {
+            this.$wx.scanQRCode({
+              needResult: 0, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
+              // onlyFromCamera: false,
+              // desc: 'scanQRCode desc',
+              // needResult: 0, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
+              // scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
+              success: (res) => {
+                console.log('H5页面扫码获取到的参数——成功1', res);
+                // const res = {"resultStr": "lo$Qed.3YuVi*D7vXilrrV0571a1&type=unlicensedIn", "errMsg": "scanQRCode:ok"}
+                // const test = {"resultStr": "lp$Qed.3YuVi*D7vXilrrV0571a2&type=unlicensedOut", "errMsg": "scanQRCode:ok"}
+                let path = res.resultStr.replace(/.*([a-z0-9]{6}&type)/g, '8b$1')
+                console.log(614, path);
+                const regex = /(\w+)&type=(\w+)/;
+                const match = path.match(regex);
+                const obj = {code: match[1], type: match[2]};
+                console.log(618, obj);
+                console.log(696, this.qrCodesRule);
+                this.$store.commit('SET_UNLICENSED_INFO', obj);
+                this.$nextTick(() => {
+                  this.qrCodesRule(obj.code, 'scan');
+                })
+                // runScanFn(res);
+                // this.formMsg.deviceCode = res.resultStr;
+              },
+              error: (res) => {
+                console.log('H5页面扫码获取到的参数——失败res', res);
+                // console.log(242, res);
+              },
+            });  
+          } catch (err) {
+            console.log('H5页面扫码获取到的参数——失败err', err);
+          }
+          
         }
       } catch (err) {
         console.log(624, err);
@@ -910,6 +922,7 @@ export default {
         this.$store.commit('setPageHistory', {
           parkingFeeMsg: 1
         })
+        console.log(919, query)
         // 前往 缴费支付页面
         this.$router.push({
           path: 'parkingFeeMsg',
@@ -933,6 +946,7 @@ export default {
           this.$store.commit('setPageHistory', {
             parkingFeeMsg: 1
           })
+          console.log(943, query)
           // 如果是其他错误的话,则继续往下执行
           this.$router.push({
             path: 'parkingFeeMsg',

+ 3 - 0
src/pages/parkingFeeV2/mixins/parkingReceipt/parkingReceipt.js

@@ -90,6 +90,9 @@ export default {
     }),
   },
   created() {
+    if(window.history?.scrollRestoration) {
+      window.history.scrollRestoration = 'manual';
+    }
     // 埋点本地化
     this.preUrl = uni.getStorageSync('previousUrl');
     this.$store.dispatch('invoice/init')

+ 35 - 20
src/pages/parkingFeeV2/parkingFeeMsg.vue

@@ -75,6 +75,7 @@ export default {
   computed:{
     ...mapState({
       unlicensedInfo: (state) => state.unlicensedInfo,
+      isLogin: (state) => state.isLogin,
     })
   },
   async created() {
@@ -95,7 +96,7 @@ export default {
     // console.log(this.$route.query);
     this.pageInit()
     try {
-      await initWxJsSdkConfig(['checkJsApi', 'scanQRCode']);
+      // await initWxJsSdkConfig(['checkJsApi', 'scanQRCode']);
     } catch (e) {
       console.log(e)
     }
@@ -157,25 +158,33 @@ export default {
           runScanFn(options.options);
         });
       } else {
-        this.$wx.scanQRCode({
-          desc: 'scanQRCode desc',
-          needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
-          // scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
-          success: (res) => {
-            let path = res.resultStr.replace(/.*([a-z0-9]{6}&type)/g, '8b$1')
-              const regex = /(\w+)&type=(\w+)/;
-              const match = path.match(regex);
-              const obj = {code: match[1], type: match[2]};
-              this.$store.commit('SET_UNLICENSED_INFO', obj);
-              this.$nextTick(() => {
-                this.qrCodesRule(obj.code);
-              })
-          },
-          error: (res) => {
-            console.log('H5页面扫码获取到的参数——失败', res);
-            // console.log(242, res);
-          },
-        });
+        try {
+          this.$wx.scanQRCode({
+            needResult: 0, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
+            // onlyFromCamera: false,
+            // desc: 'scanQRCode desc',
+            // needResult: 0, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
+            // scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
+            success: (res) => {
+              console.log('H5页面扫码获取到的参数——成功res2', res);
+              // let path = res.resultStr.replace(/.*([a-z0-9]{6}&type)/g, '8b$1')
+              // const regex = /(\w+)&type=(\w+)/;
+              // const match = path.match(regex);
+              // const obj = {code: match[1], type: match[2]};
+              // this.$store.commit('SET_UNLICENSED_INFO', obj);
+              // this.$nextTick(() => {
+              //   this.qrCodesRule(obj.code);
+              // })
+            },
+            error: (res) => {
+              console.log('H5页面扫码获取到的参数——失败res', res);
+              // console.log(242, res);
+            },
+          });  
+        } catch (err) {
+          console.log('H5页面扫码获取到的参数——失败err', err);
+        }
+        
       }
     },
     // 处理扫码结果: 组装参数,剩余流程,在 缴费支付页面 实现
@@ -237,6 +246,12 @@ export default {
       }
     },
     goHome() {
+      if ((this.isLogin === 'notLoggedIn' || this.isLogin === 'loginDenied') && this.$route.query?.loginCount === 'undefined') {
+        wx.miniProgram.redirectTo({
+          "url": "/pages/package-parkingFee/parkingFeeWebViewLogin?needLogin=1&fromPage=home" // 去 login 页面 1 去登录
+        })
+        return
+      }
       this.$router.replace({
         path: 'home',
       });