Browse Source

Merge branch 'new' of http://8.134.10.79:3000/Leadfyy.co/uniapp-shikongwang into new

# Conflicts:
#	pages/goodsDetail/index.vue
threedate
Enzo 5 years ago
parent
commit
b064851b42
  1. 26
      pages/goodsDetail/index.vue

26
pages/goodsDetail/index.vue

@ -142,7 +142,6 @@
backgroundImg: '',
goodShare: '',
s_id: '',
isShowButtonCount: 0,
userInfo: {}
}
},
@ -169,12 +168,11 @@
}).then(res => {
let img = res.data.img_url
if (img) {
wx.getImageInfo({
uni.getImageInfo({
src: img,
success: function(sres) {
uni.showLoading({title:'生成海报中...'})
_this.backgroundImg = sres.path;
_this.isShowButtonCount++;
resolve(); //
}
})
@ -187,7 +185,7 @@
let _this = this
let goods = _this.goods_detail;
let imageUrl = goods.share_cover || goods.cover;
wx.getImageInfo({
uni.getImageInfo({
src: imageUrl,
success: function(sres) {
_this.goodShare = sres.path
@ -255,21 +253,21 @@
})
},
//
//
//
getwxCodeImg(resolve, reject) {
var imgSrc = this.wxCode; //base64
var save = wx.getFileSystemManager();
var save = uni.getFileSystemManager();
var number = Math.random();
uni.showLoading({
title: '生成海报中...'
})
var filePath = wx.env.USER_DATA_PATH + '/pic' + number + '.jpg';
save.writeFile({
filePath: wx.env.USER_DATA_PATH + '/pic' + number + '.jpg',
filePath: filePath,
data: imgSrc,
encoding: 'base64',
success: res => {
this.onceCode = wx.env.USER_DATA_PATH + '/pic' + number + '.jpg';
this.isShowButtonCount++;
this.onceCode = filePath;
resolve(); //
console.log('二维码临时路径',this.onceCode)
},
@ -281,7 +279,7 @@
},
createNewImg() {
var that = this;
var context = wx.createCanvasContext('mycanvas');
var context = uni.createCanvasContext('mycanvas');
let goods = that.goods_detail;
let title = goods.name;
let price = '¥'+goods.specs[0].selling_price;
@ -332,6 +330,7 @@
context.draw();
//
setTimeout(function() {
wx.canvasToTempFilePath({
canvasId: 'mycanvas',
success: function(res) {
@ -341,6 +340,7 @@
that.maskHidden = true
}
uni.hideLoading()
console.log('海报生成成功')
console.log(res)
console.log('图片链接', that.imagePath)
@ -353,10 +353,10 @@
},
saveBill() {
var that = this
wx.saveImageToPhotosAlbum({
uni.saveImageToPhotosAlbum({
filePath: that.imagePath,
success(res) {
wx.showModal({
uni.showModal({
content: '图片已保存到相册,赶紧晒一下吧~',
showCancel: false,
confirmText: '好的',
@ -378,7 +378,7 @@
var that = this;
uni.showLoading({
title: '生成海报中...'
})
});
if(that.backgroundImg && that.onceCode){
that.createNewImg();
}else {

Loading…
Cancel
Save