getAccessToken(){ //获取access_token
this.$httpRequest('POST','/getAccessToken').then(res=>{
if(res&&res.status==200){
this.shareToken = res.access_token;
this.getWxCode(res.access_token)
}
})
},
getWxCode(shareToken) { //获取小程序码
let that = this
uni.showLoading({
title: '加载中',
mask: true
})
uni.request({
url: `https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=${shareToken}`,
method: "POST",
data: {
access_token:shareToken,
width: 280,
path: 'pages/detail/detail?data='+this.detaiId
},
responseType: 'arraybuffer',
success: function(res) {
uni.hideLoading();
let src = uni.arrayBufferToBase64(res.data);
that.codeImg = 'data:image/png;base64,' + src;
}
})
},
网友评论