Commit e40abb5a authored by beisir's avatar beisir

feat:getScheme 修改

parent 2ce78d9f
...@@ -2,7 +2,7 @@ import { isAndroid, isIOS, isXyqb } from './validation.service'; ...@@ -2,7 +2,7 @@ import { isAndroid, isIOS, isXyqb } from './validation.service';
import Bridge from '@qg/js-bridge'; import Bridge from '@qg/js-bridge';
const jsBridge = new Bridge(); const jsBridge = new Bridge();
import Vue from 'vue'; import Vue from 'vue';
// import qs from 'qs'; import config from '@/config';
export const EventBus = new Vue(); export const EventBus = new Vue();
/** /**
* 替换邮箱字符 * 替换邮箱字符
...@@ -365,7 +365,36 @@ export function setAppTitleColor(bgcolor = '#fff') { ...@@ -365,7 +365,36 @@ export function setAppTitleColor(bgcolor = '#fff') {
}); });
} }
// export function paramsParentheses(urlPath) { export function getQueryParams(key) {
// console.log(qs); var search = window.location.search;
// // urlPath var regExp = new RegExp('[\\?\\&]([^\\?\\&]+)=([^\\?\\&]+)', 'ig');
// } var queryStringList = {};
var parttern;
while ((parttern = regExp.exec(search))) {
if (!queryStringList[parttern[1].toLowerCase()]) {
queryStringList[parttern[1].toLowerCase()] = parttern[2];
}
}
//返回指定键的值
if (key) {
return queryStringList[key.toLowerCase()] || '';
}
//返回所有查询参数
return queryStringList;
}
export function paramsParentheses() {
let paramsObj = getQueryParams();
let tempString = '';
// !h=0$activityId=39"
for (let key in paramsObj) {
let option = `${key}=${paramsObj[key]}`;
tempString += `$${option}`;
}
if (tempString.length) {
tempString = `${config.localHost}!` + tempString.slice(1);
}
return tempString;
}
import * as types from './type'; import * as types from './type';
import groupBuy from '@/api/groupBuy'; import groupBuy from '@/api/groupBuy';
import { isWxMp } from '@/service/validation.service'; import { isWxMp } from '@/service/validation.service';
// import { paramsParentheses } from '@/service/utils.service'; import { paramsParentheses } from '@/service/utils.service';
const state = { const state = {
header: true, header: true,
title: '支付中心', title: '支付中心',
...@@ -95,6 +95,7 @@ const mutations = { ...@@ -95,6 +95,7 @@ const mutations = {
if (bool) { if (bool) {
// 需要取反 // 需要取反
// 如果非app webview并且非小程序webview,直接拦截提示,到小程序操作 // 如果非app webview并且非小程序webview,直接拦截提示,到小程序操作
// paramsParentheses(window.location.href);
pointer.$dialog({ pointer.$dialog({
message: '请在微信小程序中参与此活动哦~', message: '请在微信小程序中参与此活动哦~',
showCancelButton: false, showCancelButton: false,
...@@ -102,15 +103,13 @@ const mutations = { ...@@ -102,15 +103,13 @@ const mutations = {
onConfirm: () => { onConfirm: () => {
// todo 跳转到小程序 // todo 跳转到小程序
let getScheme = async function() { let getScheme = async function() {
// 'https://group-buy-test1.liangkebang.net/groupBuy/list?h=0&activityId=39'//
const [res] = await groupBuy.getScheme({ const [res] = await groupBuy.getScheme({
miniUrl: 'pages/product/goodDetail', miniUrl: 'pages/product/goodDetail',
// params: `url=${window.location.href}` // params: `url=${window.location.href}`
params: `url=${'https://group-buy-test1.liangkebang.net/groupBuy/list&h=0&activityId=39'}` params: `from=groupBuy&url=${paramsParentheses()}`
}); });
const url = res; const url = res;
window.location.href = url; // todo 需要验证 window.location.href = url; // todo 需要验证
// 'https://group-buy-test1.liangkebang.net/groupBuy/list?h=0&activityId=39'
}; };
getScheme(); getScheme();
getScheme = null; getScheme = null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment