|
|
|
@ -10,7 +10,7 @@ |
|
|
|
@click="lookImg(index)"></image> |
|
|
|
</swiper-item> |
|
|
|
</swiper> |
|
|
|
<view class="bill-position" @tap='formSubmit()' v-if="isShowButtonCount >= 2"> |
|
|
|
<view class="bill-position" @tap='formSubmit()'> |
|
|
|
<button class="cu-btn1 margin-left-sm lf-font-28 lf-m-20"> |
|
|
|
分享海报 |
|
|
|
</button> |
|
|
|
@ -157,8 +157,6 @@ |
|
|
|
this.pt = options.pt || 1; |
|
|
|
this.s_id = options.share_id || '' |
|
|
|
this.getGoodsDetail(); |
|
|
|
this.getWxCode() |
|
|
|
this.getBackground() |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
getBackground() { |
|
|
|
@ -310,37 +308,6 @@ |
|
|
|
context.fillText(before, 10, 448); |
|
|
|
context.fillText(last, 10, 472); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
console.log('标题长度',title.length) |
|
|
|
if(title.length < 18 ) { |
|
|
|
context.fillText(title, 10, 350); |
|
|
|
}else if(18<title.length && title.length<36) { |
|
|
|
console.log('1111') |
|
|
|
let before = title.substr(0,18) |
|
|
|
let last = title.substr(18,title.length) |
|
|
|
//绘制标题 |
|
|
|
context.setFontSize(20); |
|
|
|
context.setFillStyle('#222'); |
|
|
|
context.setTextAlign('left'); |
|
|
|
context.fillText(before, 10, 350); |
|
|
|
context.fillText(last, 10, 374); |
|
|
|
}else if(title.length > 36) { |
|
|
|
console.log('22222') |
|
|
|
console.log(title.substr(18,41)) |
|
|
|
let before = title.substr(0,18) |
|
|
|
let last = title.substr(18,28) |
|
|
|
// let last1 = title.substr(36,title.length) |
|
|
|
//绘制标题 |
|
|
|
context.setFontSize(20); |
|
|
|
context.setFillStyle('#222'); |
|
|
|
context.setTextAlign('left'); |
|
|
|
context.fillText(before, 10, 350); |
|
|
|
context.fillText(last, 10, 374); |
|
|
|
// context.fillText(last1, 10, 398); |
|
|
|
} |
|
|
|
*/ |
|
|
|
context.stroke(); |
|
|
|
context.draw(); |
|
|
|
//将生成好的图片保存到本地,需要延迟一会,绘制期间耗时 |
|
|
|
@ -389,22 +356,29 @@ |
|
|
|
}, |
|
|
|
formSubmit() { |
|
|
|
var that = this; |
|
|
|
that.$u.throttle(() => { |
|
|
|
wx.showToast({ |
|
|
|
title: '生成海报中...', |
|
|
|
icon: 'loading', |
|
|
|
duration: 1000 |
|
|
|
}); |
|
|
|
console.log(that.onceCode) |
|
|
|
console.log(that.backgroundImg) |
|
|
|
if(that.onceCode && that.backgroundImg) { |
|
|
|
that.getWxCode() |
|
|
|
that.getBackground() |
|
|
|
if(that.isShowButtonCount >= 2) { |
|
|
|
that.createNewImg() |
|
|
|
}else if(!that.onceCode){ |
|
|
|
this.$msg('小程序码生成失败!') |
|
|
|
}else if(!that.backgroundImg){ |
|
|
|
this.$msg('海报背景图生成失败!') |
|
|
|
} |
|
|
|
}, 500); |
|
|
|
}else { |
|
|
|
this.$msg('请稍后重试!') |
|
|
|
} |
|
|
|
// that.$u.throttle(() => { |
|
|
|
// wx.showToast({ |
|
|
|
// title: '生成海报中...', |
|
|
|
// icon: 'loading', |
|
|
|
// duration: 1000 |
|
|
|
// }); |
|
|
|
// console.log(that.onceCode) |
|
|
|
// console.log(that.backgroundImg) |
|
|
|
// if(that.onceCode && that.backgroundImg) { |
|
|
|
|
|
|
|
// }else if(!that.onceCode){ |
|
|
|
// this.$msg('小程序码生成失败!') |
|
|
|
// }else if(!that.backgroundImg){ |
|
|
|
// this.$msg('海报背景图生成失败!') |
|
|
|
// } |
|
|
|
// }, 500); |
|
|
|
}, |
|
|
|
//海报结束 |
|
|
|
getGoodsDetail() { |
|
|
|
|