|
@@ -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);
|
|
|
+ })
|
|
|
}
|
|
|
};
|
|
|
// 微信小程序
|