首先先传当前导航栏的地址传给后端获取appId,timestamp,nonceStr和signature信息再返回给前端这边
wxpayments() {
var surl = window.location.href.split('#')[0];
uni.request({
// url: 'http://192.168.1.209:8085/api/wx/redirect/wx36b6d5f7fd683e55/getJSSDK',
url: '/api/wx/redirect/wx36b6d5f7fd683e55/getJSSDK',
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded' //post一定要带这个header,被这里坑了半天
},
data: {
url: surl
},
success: res => {
this.getconfig(res.data.data);
}
}