master
pipi 4 years ago
parent e43c76df15
commit 7928916143

@ -83,31 +83,35 @@
}); });
uni.request({ uni.request({
url: this.baseUrl + '/api/member/get-wxa-qrcode', url: this.baseUrl + '/api/member/get-wxa-qrcode',
method: 'POST', method: 'GET',
data: { data: {
path: '', path: '',
scene: this.user_info.id scene: this.user_info.id
}, },
success: r => { success: r => {
if (r.data.status === 1) { if (r.data.status === 1) {
let img_qr = r.data.data // uni.getImageInfo({
let ctx = uni.createCanvasContext('firstCanvas') src: this.baseUrl + r.data.data, //
// ctx.fillStyle = '#fff'; success: res => {
// ctx.fillRect(0, 0, 214, 342); let ctx = uni.createCanvasContext('firstCanvas')
ctx.drawImage('../../static/bg_haibao@2x.png', 0, 0, 220, 220); // ctx.fillStyle = '#fff';
ctx.drawImage(img_qr, 43, 43, 128, 128); // ctx.fillRect(0, 0, 214, 342);
ctx.draw() ctx.drawImage('../../static/bg_haibao@2x.png', 0, 0, 220, 220);
setTimeout(()=>{ ctx.drawImage(res.path, 43, 43, 128, 128);
uni.canvasToTempFilePath({ ctx.draw()
canvasId: 'firstCanvas', setTimeout(()=>{
fileType: 'jpg', uni.canvasToTempFilePath({
success: (res) => { canvasId: 'firstCanvas',
uni.hideLoading() fileType: 'jpg',
this.$refs.shareCode.open() success: (res) => {
this.img = res.tempFilePath uni.hideLoading()
}, this.$refs.shareCode.open()
}) this.img = res.tempFilePath
},100) },
})
},100)
}
})
} else { } else {
this.alert(r.data.msg) this.alert(r.data.msg)
} }

Loading…
Cancel
Save