Browse Source

上传

master
前端-胡立永 3 months ago
parent
commit
1dfda155e5
3 changed files with 44 additions and 34 deletions
  1. +1
    -4
      manifest.json
  2. +39
    -30
      pages_order/mine/promotion.vue
  3. +4
    -0
      store/store.js

+ 1
- 4
manifest.json View File

@ -58,14 +58,11 @@
},
"usingComponents" : true,
"permission" : {
"scope.userLocation" : {
"desc" : "你的位置信息将用于小程序位置接口的效果展示"
},
"scope.userFuzzyLocation" : {
"desc" : "你的位置信息将用于小程序位置接口的效果展示"
}
},
"requiredPrivateInfos" : [ "chooseLocation", "getLocation" ]
"requiredPrivateInfos" : [ "chooseLocation" ]
},
"mp-alipay" : {
"usingComponents" : true


+ 39
- 30
pages_order/mine/promotion.vue View File

@ -53,7 +53,7 @@
export default {
name: 'Promotion',
computed: {
...mapState(['userInfo']),
...mapState(['userInfo', 'promotionUrl']),
},
data() {
return {
@ -65,6 +65,7 @@
show : false,
bgColor : '#fe6c17',
load : false,
index : 0,
}
},
onShow() {
@ -86,7 +87,9 @@
clickTab(){
this.bgColor = '#de0917'
this.show = true
if(this.load){
if(this.promotionUrl){
this.imagePath = this.promotionUrl
}else if(this.load){
uni.showLoading({
title: "拼命绘画中..."
})
@ -134,13 +137,25 @@
const bgImage = canvas.createImage()
bgImage.src = this.configList.qr_image
const coderImage = canvas.createImage()
coderImage.src = this.baseUrl + this.url
bgImage.onload = () => {
canvas.width = bgImage.width
canvas.height = bgImage.height
ctx.drawImage(bgImage,
0, 0, bgImage.width, bgImage.height)
0, 0, bgImage.width, bgImage.height)
//
coderImage.onload = () => {
ctx.drawImage(coderImage,
canvas.width / 2 - 175, canvas.height / 2 - 100, 350, 350)
this.canvasToTempFilePath()
}
}
//
@ -163,36 +178,30 @@
let s = this.title || ''
// ctx.fillText(s, canvas.width / Ratio - s.length * 11, 50);
//
const coderImage = canvas.createImage()
coderImage.src = this.baseUrl + this.url
coderImage.onload = () => {
ctx.drawImage(coderImage,
canvas.width / 2 - 175, canvas.height / 2 - 100, 350, 350)
}
//
setTimeout(() => {
wx.canvasToTempFilePath({
x: 0,
y: 0,
width: this.canvas.width,
height: this.canvas.height,
canvas,
success: (res) => {
var tempFilePath = res.tempFilePath;
this.imagePath = tempFilePath
uni.hideLoading()
this.load = false
}
});
}, 600);
})
},
canvasToTempFilePath(){
//
setTimeout(() => {
wx.canvasToTempFilePath({
x: 0,
y: 0,
width: this.canvas.width,
height: this.canvas.height,
canvas : this.canvas,
success: (res) => {
var tempFilePath = res.tempFilePath;
this.imagePath = tempFilePath
this.$store.commit('setPromotionUrl', res.tempFilePath)
uni.hideLoading()
this.load = false
}
});
}, 200);
},
back() {
uni.navigateBack(-1)
},


+ 4
- 0
store/store.js View File

@ -13,6 +13,7 @@ const store = new Vuex.Store({
riceInfo : {},//用户相关信息
category : [],//分类信息
payOrderProduct : [],//支付订单中的商品
promotionUrl : '',//分享二维码
},
getters: {
},
@ -143,6 +144,9 @@ const store = new Vuex.Store({
setPayOrderProduct(state, data){
state.payOrderProduct = data
},
setPromotionUrl(state, data){
state.promotionUrl = data
},
},
actions: {},
})


Loading…
Cancel
Save