|
|
|
@ -139,7 +139,9 @@ |
|
|
|
onceCode: '', |
|
|
|
pt: 1, |
|
|
|
afterDone: '', |
|
|
|
backgroundImg: '' |
|
|
|
backgroundImg: '', |
|
|
|
goodShare: '', |
|
|
|
s_id: '' |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
@ -152,6 +154,7 @@ |
|
|
|
onLoad(options) { |
|
|
|
this.goods_id = options.id; |
|
|
|
this.pt = options.pt || 1; |
|
|
|
this.s_id = options.share_id || '' |
|
|
|
this.getGoodsDetail(); |
|
|
|
this.getWxCode() |
|
|
|
this.getBackground() |
|
|
|
@ -190,7 +193,7 @@ |
|
|
|
let nowTime = new Date().toLocaleString(); |
|
|
|
_this.$http(_this.API.API_BINDGOODS, { |
|
|
|
deed: md5TimeDate, |
|
|
|
sid: userInfo.id, |
|
|
|
sid: _this.s_id, |
|
|
|
gid: _this.goods_id, |
|
|
|
gn: _this.goods_detail.name, |
|
|
|
t: gettime |
|
|
|
@ -235,8 +238,13 @@ |
|
|
|
createNewImg() { |
|
|
|
var that = this; |
|
|
|
var context = wx.createCanvasContext('mycanvas'); |
|
|
|
let goods = that.goods_detail; |
|
|
|
let title = goods.name; |
|
|
|
let imageUrl = goods.share_cover || goods.cover; |
|
|
|
var path = that.backgroundImg; |
|
|
|
|
|
|
|
context.drawImage(path, 0, 0, 375, 667); |
|
|
|
|
|
|
|
//绘制二维码 |
|
|
|
let wxcode = that.onceCode |
|
|
|
context.drawImage(wxcode, 18, 530, 120, 120); |
|
|
|
@ -244,7 +252,8 @@ |
|
|
|
// context.setFontSize(24); |
|
|
|
// context.setFillStyle('#fff'); |
|
|
|
// context.setTextAlign('center'); |
|
|
|
// context.fillText(name, 34, 620); |
|
|
|
// context.fillText(title, 34, 620); |
|
|
|
|
|
|
|
context.stroke(); |
|
|
|
context.draw(); |
|
|
|
//将生成好的图片保存到本地,需要延迟一会,绘制期间耗时 |
|
|
|
|