小程序生成当前页面的小程序码,在本地和体验版中都是好的,但是在发布的版本中显示不出来,是什么原因?
wx.request({
method: ‘GET’,
success: function (res) {
console.log(res)
var access_token = res.data.access_token;
// 获取二维码
wx.request({
url: ‘https://api.weixin.qq.com/wxa/getwxacode?access_token=’ + access_token,
method: ‘POST’,
responseType: ‘arraybuffer’,//这个是转化成base64需要加的
data: {
path: ‘pages/bargainDetail/bargainDetail?refid=’ + that.data.refId + ‘&attendMemberId=’ + that.data.attendMemberId,
width: ‘200’,
},
success: function (res) {
console.log(’-----------******************************’)
var imgUrl2 = wx.arrayBufferToBase64(res.data)
var imgUrl3 = ‘data:image/png;base64,’ + imgUrl2
console.log(’---------------------------//////////////////////////////’)
that.setData({
imgUrl1: ‘data:image/png;base64,’ + imgUrl2,
imgUrll: imgUrl3.replace(/\r\n/g,’’)
})