Forráskód Böngészése

【DE】【C端】临时停车。在无牌缴费界面里使用“扫描进场二维码领取无牌车号牌”后不会生成临时车牌。

john.hong 2 éve
szülő
commit
c6c1f6a52d
2 módosított fájl, 19 hozzáadás és 17 törlés
  1. 18 16
      src/pages/parkingFee/mixins/parkingFee.js
  2. 1 1
      vue.config.js

+ 18 - 16
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 } from '@/utils';
+import { wxToLoginCallback, getUrlParams } from '@/utils';
 
 const app = {
   globalData: {
@@ -510,25 +510,27 @@ export default {
         // this.qrCodesRule('e41d4d9dd5534f4aa3de88326a2e6f85')
         // return
         const runScanFn = (res) => {
-          if (res.scanType == 'QR_CODE' && res.scanType) {
+          console.log(513, res);
+          if (res.scanType && res.scanType == 'QR_CODE') {
             console.log(res.result);
             // 获取二维码参数之后,模拟提取参数
             const url = res.result;
-            if (url.indexOf('auth/') === -1) { // 单纯的code
-              console.log('提取到的参数', res.result);
-              this.qrCodesRule(res.result)
-              // this.getPaperCouponInfo(res.result);
-            } else { // 从url中提取参数
-              const start = url.indexOf('auth/');
-              const end = url.indexOf('?');
-              const params = url.slice(start, end).split('/');
-              if (params && params.length) {
-                const couponCode = params[1];
-                console.log('提取到的参数', couponCode);
-                this.qrCodesRule(couponCode)
-                // this.getPaperCouponInfo(couponCode);
-              }
+            const {path} = getUrlParams(res.result)
+            let params = null
+            if(path) {
+              params = getUrlParams(decodeURIComponent(path))
+            }
+            /*
+            微信扫码之后,处理过的参数 {"code": "e41d4d9dd5534f4aa3de88326a2e6f85", "type": "unlicensedIn#wechat-redirect"}
+            */
+            if (params?.type.indexOf('wechat-redirect') > -1) {
+              params.type = params.type.replace('#wechat-redirect', '');
             }
+            console.log('微信扫码之后,处理过的参数', params);
+            this.$store.commit('SET_UNLICENSED_INFO', params);
+            this.$nextTick(() => {
+              this.qrCodesRule(params.code);
+            })
           }
         };
         // 微信小程序

+ 1 - 1
vue.config.js

@@ -80,7 +80,7 @@ module.exports = {
       .end();
       if ( process.env.NODE_ENV === 'production' ) {
         // 编译之后清理console.log
-        config.optimization.minimizer('vue').use(TerserPlugin, [{ terserOptions: { compress: { drop_console: true } } }])  
+        // config.optimization.minimizer('vue').use(TerserPlugin, [{ terserOptions: { compress: { drop_console: true } } }])  // TODO: 临时注释
       }
       
   },