Переглянути джерело

Merge pull request #284 from John-Hong/John/release-2.18.0/SCRM-4861

fix(SCRM-4861): [DE][C端]临时停车,无牌车,用户没有压地感时扫入场码提示领取失败以后,压地感,点击重新扫码,应该展示…
John-Hong 1 рік тому
батько
коміт
935747e3ef

+ 9 - 4
src/pages/parkingFeeV2/parkingFeeMsg.vue

@@ -60,7 +60,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, theCommunicationBetweenWechatAndH5IsNormal } from '@/utils';
+import { getPlatform,getUrlParams, theCommunicationBetweenWechatAndH5IsNormal, extractValuesFromString } from '@/utils';
 import {mapState} from "vuex";
 
 export default {
@@ -162,9 +162,14 @@ export default {
           needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
           // scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
           success: (res) => {
-            console.log('H5页面扫码获取到的参数——成功', res);
-            runScanFn(res);
-            // this.formMsg.deviceCode = res.resultStr;
+            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);

+ 14 - 1
src/utils/common/function.js

@@ -11,4 +11,17 @@ export const getQuery = (url) => {
         result[item[0]] = item[1]
     }
     return result
-}
+}
+
+export function extractValuesFromString(inputString) {
+  // 使用正则表达式来匹配 "&" 前面的 6 个字符和 "type" 及其值
+  const regex = /([^&]{6})&type=([^&]+)/;
+  const matches = inputString.match(regex);
+
+  if (matches) {
+    const extractedValueBeforeAmpersand = matches[1];
+    const extractedType = matches[2];
+    return { value: `8b${extractedValueBeforeAmpersand}`, type: extractedType };
+  }
+  return false; // 如果没有匹配,返回 null 或者其他适当的值
+}