Browse Source

商品详情

threedate
Enzo 4 years ago
parent
commit
35fa766a98
  1. 74
      pages/goodsDetail/index.vue

74
pages/goodsDetail/index.vue

@ -10,7 +10,7 @@
@click="lookImg(index)"></image> @click="lookImg(index)"></image>
</swiper-item> </swiper-item>
</swiper> </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 class="cu-btn1 margin-left-sm lf-font-28 lf-m-20">
分享海报 分享海报
</button> </button>
@ -157,8 +157,6 @@
this.pt = options.pt || 1; this.pt = options.pt || 1;
this.s_id = options.share_id || '' this.s_id = options.share_id || ''
this.getGoodsDetail(); this.getGoodsDetail();
this.getWxCode()
this.getBackground()
}, },
methods: { methods: {
getBackground() { getBackground() {
@ -310,37 +308,6 @@
context.fillText(before, 10, 448); context.fillText(before, 10, 448);
context.fillText(last, 10, 472); 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.stroke();
context.draw(); context.draw();
// //
@ -389,22 +356,29 @@
}, },
formSubmit() { formSubmit() {
var that = this; 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.createNewImg()
}else if(!that.onceCode){
this.$msg('小程序码生成失败!')
}else if(!that.backgroundImg){
this.$msg('海报背景图生成失败!')
}
}, 500);
that.getWxCode()
that.getBackground()
if(that.isShowButtonCount >= 2) {
that.createNewImg()
}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() { getGoodsDetail() {

Loading…
Cancel
Save