From 7928916143e24b65e2c94e153d1578ecb27707aa Mon Sep 17 00:00:00 2001 From: pipi Date: Sat, 24 Jul 2021 17:52:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E4=BA=AB1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/member/member.vue | 42 ++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/pages/member/member.vue b/pages/member/member.vue index a796f11..1b3f3b2 100644 --- a/pages/member/member.vue +++ b/pages/member/member.vue @@ -83,31 +83,35 @@ }); uni.request({ url: this.baseUrl + '/api/member/get-wxa-qrcode', - method: 'POST', + method: 'GET', data: { path: '', scene: this.user_info.id }, success: r => { if (r.data.status === 1) { - let img_qr = r.data.data // 二维码 - let ctx = uni.createCanvasContext('firstCanvas') - // ctx.fillStyle = '#fff'; - // ctx.fillRect(0, 0, 214, 342); - ctx.drawImage('../../static/bg_haibao@2x.png', 0, 0, 220, 220); - ctx.drawImage(img_qr, 43, 43, 128, 128); - ctx.draw() - setTimeout(()=>{ - uni.canvasToTempFilePath({ - canvasId: 'firstCanvas', - fileType: 'jpg', - success: (res) => { - uni.hideLoading() - this.$refs.shareCode.open() - this.img = res.tempFilePath - }, - }) - },100) + uni.getImageInfo({ + src: this.baseUrl + r.data.data, // 二维码 + success: res => { + let ctx = uni.createCanvasContext('firstCanvas') + // ctx.fillStyle = '#fff'; + // ctx.fillRect(0, 0, 214, 342); + ctx.drawImage('../../static/bg_haibao@2x.png', 0, 0, 220, 220); + ctx.drawImage(res.path, 43, 43, 128, 128); + ctx.draw() + setTimeout(()=>{ + uni.canvasToTempFilePath({ + canvasId: 'firstCanvas', + fileType: 'jpg', + success: (res) => { + uni.hideLoading() + this.$refs.shareCode.open() + this.img = res.tempFilePath + }, + }) + },100) + } + }) } else { this.alert(r.data.msg) }