Browse Source

修复提交

master
主管理员 1 week ago
parent
commit
b68dfbed49
2 changed files with 32 additions and 24 deletions
  1. +1
    -1
      manifest.json
  2. +31
    -23
      pages_order/mine/promotion.vue

+ 1
- 1
manifest.json View File

@ -1,6 +1,6 @@
{
"name" : "unapp模板",
"appid" : "__UNI__197A38F",
"appid" : "__UNI__FB049D5",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",


+ 31
- 23
pages_order/mine/promotion.vue View File

@ -41,20 +41,25 @@ import index from '../../uni_modules/uv-ui-tools'
}
},
onShow() {
if(this.promotionUrl){
this.imagePath = this.promotionUrl
let that = this;
if(that.promotionUrl){
that.imagePath = that.promotionUrl
console.log("当前地址:"+that.imagePath)
}else{
this.getQrCode()
that.getQrCode()
}
this.$store.commit('getUserInfo')
that.$store.commit('getUserInfo')
},
methods: {
getQrCode() {
this.$api('getInviteCode', res => {
let that = this;
that.$api('getInviteCode', res => {
if (res.code == 200) {
this.url = res.result.url
this.title = res.result.name
this.draw()
console.log("----------")
console.log(res)
that.url = res.result.url
that.title = res.result.name
that.draw()
}
})
},
@ -63,6 +68,7 @@ import index from '../../uni_modules/uv-ui-tools'
uni.showLoading({
title: "拼命绘画中..."
})
let that = this;
wx.createSelectorQuery()
.select('#myCanvas') // canvasid
@ -71,6 +77,7 @@ import index from '../../uni_modules/uv-ui-tools'
size: true
})
.exec((res) => {
console.log("----------1")
const canvas = res[0].node
//
const ctx = canvas.getContext('2d')
@ -90,7 +97,7 @@ import index from '../../uni_modules/uv-ui-tools'
canvas.width = width * dpr
canvas.height = height * dpr
this.canvas = canvas
that.canvas = canvas
ctx.scale(dpr, dpr)
ctx.clearRect(0, 0, width, height)
@ -100,14 +107,14 @@ import index from '../../uni_modules/uv-ui-tools'
//
const bgImage = canvas.createImage()
bgImage.src = this.configList.qr_code
bgImage.src = that.configList.qr_code
//
const coderImage = canvas.createImage()
coderImage.src = this.baseUrl + this.url
coderImage.src = that.baseUrl + that.url
let size = 0;
console.log("----------2")
bgImage.onload = () => {
canvas.width = bgImage.width
canvas.height = bgImage.height
@ -115,21 +122,22 @@ import index from '../../uni_modules/uv-ui-tools'
0, 0, bgImage.width, bgImage.height)
size = Math.floor(canvas.width / 3)
this.canvasToTempFilePath()
that.canvasToTempFilePath()
}
console.log("----------3")
coderImage.onload = () => {
ctx.drawImage(coderImage,
canvas.width / 2 - (size / 2), canvas.height * 0.6, size, size)
this.canvasToTempFilePath()
that.canvasToTempFilePath()
}
})
},
canvasToTempFilePath(){
this.index++
if(this.index < 2){
let that = this;
that.index++
if(that.index < 2){
return
}
//
@ -137,17 +145,17 @@ import index from '../../uni_modules/uv-ui-tools'
wx.canvasToTempFilePath({
x: 0,
y: 0,
width: this.canvas.width,
height: this.canvas.height,
canvas : this.canvas,
width: that.canvas.width,
height: that.canvas.height,
canvas : that.canvas,
success: (res) => {
var tempFilePath = res.tempFilePath;
this.imagePath = tempFilePath
that.imagePath = tempFilePath
this.$store.commit('setPromotionUrl', res.tempFilePath)
that.$store.commit('setPromotionUrl', res.tempFilePath)
uni.hideLoading()
this.load = false
that.load = false
}
});
}, 200);


Loading…
Cancel
Save