Commit d5714dd0 by 高淑倩

add: utils_params_url

parent 8a535c50
......@@ -34,10 +34,12 @@ wxService.page({
wx.showLoading({
title: '加载中'
})
// this.handleGoActivateCard()
this.handleGoActivateCard(this.options)
},
handleGoActivateCard() {
wxService.post(`/coupon/coupon/get?cardNo=${1111}`).then(res => {
handleGoActivateCard(options) {
const urls = utils.parseUrl(options)
console.log('urls', urls)
wxService.post(`/coupon/coupon/get?cardNo=${urls}`).then(res => {
const {result,data} = res.data
if(result == 0){
// wx.hideLoading()
......
......@@ -39,6 +39,24 @@ function getCurrentPageUrlWithArgs() {
return urlWithArgs
}
/**
* 解析 url 参数
*/
function parseUrl(query){
var result = [];
// var query = url.split("?")[1];
var queryArr = query.split("&");
queryArr.forEach(function(item){
var obj = {};
var value = item.split("=")[0];
var key = item.split("=")[1];
obj[key] = value;
result.push(obj);
});
return result;
}
function getCurrentRouter() {
var pages = getCurrentPages() // 获取加载的页面
var currentPage = pages[pages.length - 1] // 获取当前页面的对象
......@@ -191,6 +209,7 @@ module.exports = {
getNowTime,
getUserInfoByBtn,
moment,
parseUrl,
_,
// _: underscore,
HandlerDataOnPage,
......
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