Commit d5714dd0 by 高淑倩

add: utils_params_url

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