|
|
|
@ -16,10 +16,10 @@ |
|
|
|
</button> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="flex justify-center align-center lf-m-t-30"> |
|
|
|
<!-- <view class="flex justify-center align-center lf-m-t-30"> |
|
|
|
<view class="lf-color-gray lf-font-28">https://hbdsufiewhuifusikj.com</view> |
|
|
|
<view class="lf-font-24 text-orange lf-m-l-30" @click="copy('https://hbdsufiewhuifusikj.com')">复制</view> |
|
|
|
</view> |
|
|
|
</view> --> |
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
@ -44,7 +44,8 @@ |
|
|
|
|
|
|
|
userToken: '', |
|
|
|
wxCode: '', |
|
|
|
onceCode: '' |
|
|
|
onceCode: '', |
|
|
|
backgroundImg: '' |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
@ -54,24 +55,37 @@ |
|
|
|
duration: 1000 |
|
|
|
}); |
|
|
|
this.getWxCode() |
|
|
|
this.getBackground() |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
getBackground() { |
|
|
|
let _this = this |
|
|
|
_this.$http(_this.API.API_BILLBACKGROUND, { |
|
|
|
type: 'telent_share' |
|
|
|
}).then(res => { |
|
|
|
let img = res.data.img_url |
|
|
|
if (img) { |
|
|
|
wx.getImageInfo({ |
|
|
|
src: img, |
|
|
|
success: function(sres) { |
|
|
|
_this.backgroundImg = sres.path |
|
|
|
console.log('临时路径',_this.backgroundImg) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
methods:{ |
|
|
|
getWxCode() { |
|
|
|
uni.request({ |
|
|
|
url: 'http://dev-gxsky.com/api/salesman/qrcode', //仅为示例,并非真实接口地址。 |
|
|
|
data: { |
|
|
|
this.$http(this.API.API_WXBILL, { |
|
|
|
scene: 'route=home&id=2&pt=2', |
|
|
|
page: 'pages/route/index', |
|
|
|
width: '2800' |
|
|
|
}, |
|
|
|
method: 'POST', |
|
|
|
success: (res) => { |
|
|
|
this.wxCode = res.data.data.base_url |
|
|
|
}).then(res => { |
|
|
|
this.wxCode = res.data.base_url |
|
|
|
if (this.wxCode) { |
|
|
|
this.getwxCodeImg() |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
//保存二维码 |
|
|
|
getwxCodeImg() { |
|
|
|
@ -84,9 +98,13 @@ |
|
|
|
encoding: 'base64', |
|
|
|
success: res => { |
|
|
|
this.onceCode = wx.env.USER_DATA_PATH + '/pic' + number + '.jpg' |
|
|
|
if(this.onceCode) { |
|
|
|
console.log('小程序二维码',this.onceCode) |
|
|
|
console.log(this.onceCode) |
|
|
|
if (this.onceCode && this.backgroundImg) { |
|
|
|
this.createNewImg() |
|
|
|
}else if(!this.onceCode){ |
|
|
|
this.$msg('小程序码生成失败!') |
|
|
|
}else if(!this.backgroundImg){ |
|
|
|
this.$msg('海报背景图生成失败!') |
|
|
|
} |
|
|
|
}, |
|
|
|
fail: err => { |
|
|
|
@ -97,7 +115,8 @@ |
|
|
|
createNewImg() { |
|
|
|
var that = this; |
|
|
|
var context = wx.createCanvasContext('mycanvas'); |
|
|
|
var path = "../../static/images/bill.png"; |
|
|
|
console.log('画布', that.backgroundImg) |
|
|
|
var path = that.backgroundImg; |
|
|
|
context.drawImage(path, 0, 0, 375, 667); |
|
|
|
//绘制二维码 |
|
|
|
let wxcode = that.onceCode |
|
|
|
@ -115,7 +134,7 @@ |
|
|
|
canvasId: 'mycanvas', |
|
|
|
success: function(res) { |
|
|
|
that.imagePath = res.tempFilePath; |
|
|
|
if(that.imagePath) { |
|
|
|
if (that.imagePath) { |
|
|
|
that.canvasHidden = true |
|
|
|
that.maskHidden = true |
|
|
|
} |
|
|
|
@ -125,7 +144,7 @@ |
|
|
|
console.log(res); |
|
|
|
} |
|
|
|
}); |
|
|
|
},900); |
|
|
|
}, 900); |
|
|
|
}, |
|
|
|
saveBill() { |
|
|
|
var that = this |
|
|
|
|