追加参数
queryShareCode() {
var that = this;
wx.request({
url: getApp().baseUrl + '/api/v3/wx/index/share_qr_code',
method: 'POST',
data: {
// code: code,
token: wx.getStorageSync('userInfo').token,
page: 'pages/taskdetail/taskdetail',
scene: 'id=' + that.data.id + '&inviteID=' + wx.getStorageSync('userInfo').uid
},
success(ress) {
if (ress.data.code && ress.data.code == '1') {
that.setBase64Save(ress.data.data.img).then(function(resimg){
that.setData({
ewmPath: resimg
})
})
} else {
}
}
})
},
接收参数
onLoad: function (options) {
if (options.scene) {
const scene = decodeURIComponent(options.scene)//获取加密后的scene参数
//获取scene参数转json
var url = '?' + scene; //获取url中"?"符后的字串
var theRequest = new Object();
if (url.indexOf("?") != -1) {
var str = url.substr(1);
var strs = str.split("&");
for (var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
}
}
// 判断是扫码进来的还是小程序的分享点进来的
if (theRequest.inviteID) {
wx.setStorageSync('inviteID', theRequest.inviteID)
this.setData({
id: theRequest.id
})
} else {
wx.setStorageSync('inviteID', '')
}
} else {
this.setData({
id: options.id
})
if (options.inviteID) {
wx.setStorageSync('inviteID', options.inviteID)
} else {
wx.setStorageSync('inviteID', '')
}
}
this.queryDetail()
},