|
@ -9,7 +9,7 @@ |
|
|
|
|
|
|
|
|
<image |
|
|
<image |
|
|
class="image" |
|
|
class="image" |
|
|
:src="promotionUrl" mode="aspectFill"></image> |
|
|
|
|
|
|
|
|
:src="imagePath" mode="aspectFill"></image> |
|
|
|
|
|
|
|
|
<canvas id="myCanvas" type="2d" canvas-id="firstCanvas1"></canvas> |
|
|
<canvas id="myCanvas" type="2d" canvas-id="firstCanvas1"></canvas> |
|
|
|
|
|
|
|
@ -36,36 +36,37 @@ import index from '../../uni_modules/uv-ui-tools' |
|
|
title: '', |
|
|
title: '', |
|
|
baseUrl: 'https://image.hhlm1688.com/', |
|
|
baseUrl: 'https://image.hhlm1688.com/', |
|
|
canvas: {}, |
|
|
canvas: {}, |
|
|
imagePath: '', |
|
|
|
|
|
|
|
|
imagePath: 'https://image.hhlm1688.com/2025-02-26/6539d2fa-558d-47db-9681-ecffec5b6c5d.png', |
|
|
index : 0, |
|
|
index : 0, |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
onShow() { |
|
|
onShow() { |
|
|
let that = this; |
|
|
|
|
|
if(!that.promotionUrl){ |
|
|
|
|
|
// that.getQrCode() |
|
|
|
|
|
uni.showLoading({ |
|
|
|
|
|
title: "拼命绘画中..." |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
that.$store.commit('getUserInfo') |
|
|
|
|
|
|
|
|
// let that = this; |
|
|
|
|
|
// that.draw() |
|
|
|
|
|
// if(!that.promotionUrl){ |
|
|
|
|
|
// // that.getQrCode() |
|
|
|
|
|
// uni.showLoading({ |
|
|
|
|
|
// title: "拼命绘画中..." |
|
|
|
|
|
// }) |
|
|
|
|
|
// } |
|
|
|
|
|
// that.$store.commit('getUserInfo') |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
getQrCode() { |
|
|
getQrCode() { |
|
|
uni.showLoading({ |
|
|
|
|
|
title: "拼命绘画中..." |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
// uni.showLoading({ |
|
|
|
|
|
// title: "拼命绘画中..." |
|
|
|
|
|
// }) |
|
|
let that = this; |
|
|
let that = this; |
|
|
that.$api('getInviteCode', res => { |
|
|
that.$api('getInviteCode', res => { |
|
|
if (res.code == 200) { |
|
|
if (res.code == 200) { |
|
|
that.url = res.result.url |
|
|
that.url = res.result.url |
|
|
that.title = res.result.name |
|
|
that.title = res.result.name |
|
|
|
|
|
|
|
|
that.imagePath = that.$config.aliOss.url + res.result.url |
|
|
|
|
|
|
|
|
// that.imagePath = that.$config.aliOss.url + res.result.url |
|
|
|
|
|
|
|
|
that.$store.commit('setPromotionUrl', that.imagePath) |
|
|
|
|
|
|
|
|
// that.$store.commit('setPromotionUrl', that.imagePath) |
|
|
|
|
|
|
|
|
// that.draw() |
|
|
|
|
|
|
|
|
that.draw() |
|
|
uni.hideLoading() |
|
|
uni.hideLoading() |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
@ -118,7 +119,8 @@ import index from '../../uni_modules/uv-ui-tools' |
|
|
|
|
|
|
|
|
//二维码图片 |
|
|
//二维码图片 |
|
|
const coderImage = canvas.createImage() |
|
|
const coderImage = canvas.createImage() |
|
|
coderImage.src = that.baseUrl + that.url |
|
|
|
|
|
|
|
|
coderImage.src = '../static/p.jpg' |
|
|
|
|
|
// coderImage.src = that.baseUrl + that.url |
|
|
|
|
|
|
|
|
let size = 0; |
|
|
let size = 0; |
|
|
console.log("----------2") |
|
|
console.log("----------2") |
|
@ -129,12 +131,16 @@ import index from '../../uni_modules/uv-ui-tools' |
|
|
0, 0, bgImage.width, bgImage.height) |
|
|
0, 0, bgImage.width, bgImage.height) |
|
|
|
|
|
|
|
|
size = Math.floor(canvas.width / 3) |
|
|
size = Math.floor(canvas.width / 3) |
|
|
|
|
|
|
|
|
|
|
|
ctx.drawImage(coderImage, |
|
|
|
|
|
canvas.width / 2 - (size / 2), canvas.height * 0.46, size, size) |
|
|
|
|
|
|
|
|
that.canvasToTempFilePath() |
|
|
that.canvasToTempFilePath() |
|
|
} |
|
|
} |
|
|
console.log("----------3") |
|
|
console.log("----------3") |
|
|
coderImage.onload = () => { |
|
|
coderImage.onload = () => { |
|
|
ctx.drawImage(coderImage, |
|
|
ctx.drawImage(coderImage, |
|
|
canvas.width / 2 - (size / 2), canvas.height * 0.6, size, size) |
|
|
|
|
|
|
|
|
canvas.width / 2 - (size / 2), canvas.height * 0.46, size, size) |
|
|
that.canvasToTempFilePath() |
|
|
that.canvasToTempFilePath() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|