|
@@ -8,6 +8,10 @@ Component({
|
|
shareType: {
|
|
shareType: {
|
|
type: 'String',
|
|
type: 'String',
|
|
value: ''
|
|
value: ''
|
|
|
|
+ },
|
|
|
|
+ shareId: {
|
|
|
|
+ type: 'String',
|
|
|
|
+ value: ''
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
@@ -22,7 +26,9 @@ Component({
|
|
iconImg: '',
|
|
iconImg: '',
|
|
title: '',
|
|
title: '',
|
|
path: '',
|
|
path: '',
|
|
- QRCode:''
|
|
|
|
|
|
+ QRCodeImagePath:'',
|
|
|
|
+ QRCodeImageLocalPath:'',
|
|
|
|
+ groupPurchaseInfo:{}
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -55,36 +61,52 @@ Component({
|
|
}
|
|
}
|
|
})
|
|
})
|
|
.then(() => {
|
|
.then(() => {
|
|
- ctx.drawImage(this.data.QRCode, 217, 374, 135, 135);
|
|
|
|
- console.log(ctx)
|
|
|
|
- ctx.draw(true, function (res) {
|
|
|
|
- wx.canvasToTempFilePath({
|
|
|
|
- x: 0,
|
|
|
|
- y: 0,
|
|
|
|
- width: 370,
|
|
|
|
- height: 507,
|
|
|
|
- destWidth: 370,
|
|
|
|
- destHeight: 507,
|
|
|
|
- canvasId: 'myCanvas',
|
|
|
|
- success: (res) => {
|
|
|
|
- console.log(res.tempFilePath)
|
|
|
|
- wx.saveImageToPhotosAlbum({
|
|
|
|
- filePath: res.path,
|
|
|
|
- success(res) {
|
|
|
|
- console.log(res);
|
|
|
|
|
|
+ debugger;
|
|
|
|
+ wx.getImageInfo({
|
|
|
|
+ src: this.data.QRCodeImagePath,//服务器返回的图片地址
|
|
|
|
+ success: function (res) {
|
|
|
|
+ //res.path是网络图片的本地地址
|
|
|
|
+ ctx.drawImage(res.path, 227, 364, 135, 135);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ ctx.draw(true, function (res) {
|
|
|
|
+ wx.canvasToTempFilePath({
|
|
|
|
+ x: 0,
|
|
|
|
+ y: 0,
|
|
|
|
+ width: 370,
|
|
|
|
+ height: 507,
|
|
|
|
+ destWidth: 370,
|
|
|
|
+ destHeight: 507,
|
|
|
|
+ canvasId: 'myCanvas',
|
|
|
|
+ success: (res) => {
|
|
|
|
+ console.log(res.tempFilePath)
|
|
|
|
+ wx.saveImageToPhotosAlbum({
|
|
|
|
+ filePath: res.path,
|
|
|
|
+ success(res) {
|
|
|
|
+ console.log(res);
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ that.setData({
|
|
|
|
+ imgUrls: res.tempFilePath
|
|
|
|
+ }, () => {
|
|
|
|
+ wx.hideLoading();
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ fail: (res) => {
|
|
|
|
+ console.log(res)
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- that.setData({
|
|
|
|
- imgUrls: res.tempFilePath
|
|
|
|
- }, () => {
|
|
|
|
- wx.hideLoading();
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- fail: (res) => {
|
|
|
|
- console.log(res)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ fail: function (res) {
|
|
|
|
+ //失败回调
|
|
|
|
+ }
|
|
|
|
+ });
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
@@ -92,6 +114,7 @@ Component({
|
|
|
|
|
|
},
|
|
},
|
|
share: function (data) {
|
|
share: function (data) {
|
|
|
|
+ debugger;
|
|
if (this.data.shareType === 'works') {
|
|
if (this.data.shareType === 'works') {
|
|
|
|
|
|
this.setData({
|
|
this.setData({
|
|
@@ -103,7 +126,8 @@ Component({
|
|
// path: data.path,
|
|
// path: data.path,
|
|
QRData:{
|
|
QRData:{
|
|
page: data.path,
|
|
page: data.path,
|
|
- scene: data.scene
|
|
|
|
|
|
+ scene: data.scene,
|
|
|
|
+ qrCodeId: this.data.shareId
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
@@ -111,7 +135,18 @@ Component({
|
|
if (this.data.shareType === 'group') {
|
|
if (this.data.shareType === 'group') {
|
|
console.log('团购分享')
|
|
console.log('团购分享')
|
|
this.setData({
|
|
this.setData({
|
|
- shareFlag: !this.data.shareFlag
|
|
|
|
|
|
+ shareFlag: !this.data.shareFlag,
|
|
|
|
+ avatar: data.avatar,
|
|
|
|
+ author: data.author,
|
|
|
|
+ iconImg: data.iconImg,
|
|
|
|
+ title: data.title,
|
|
|
|
+ // path: data.path,
|
|
|
|
+ QRData:{
|
|
|
|
+ page: data.path,
|
|
|
|
+ scene: data.scene,
|
|
|
|
+ qrCodeId: this.data.shareId
|
|
|
|
+ },
|
|
|
|
+ groupPurchaseInfo: data.groupPurchaseInfo
|
|
})
|
|
})
|
|
}
|
|
}
|
|
if (this.data.shareType === 'class') {
|
|
if (this.data.shareType === 'class') {
|
|
@@ -127,11 +162,12 @@ Component({
|
|
let download = new Promise((resolve, reject) => {
|
|
let download = new Promise((resolve, reject) => {
|
|
let QRCode = () => {
|
|
let QRCode = () => {
|
|
// 生成二维码并下载
|
|
// 生成二维码并下载
|
|
|
|
+ debugger;
|
|
httpRequestApi.createQRCode(this.data.QRData).success(res => {
|
|
httpRequestApi.createQRCode(this.data.QRData).success(res => {
|
|
// let base64 = wx.arrayBufferToBase64(res.data);
|
|
// let base64 = wx.arrayBufferToBase64(res.data);
|
|
// console.log(a)
|
|
// console.log(a)
|
|
this.setData({
|
|
this.setData({
|
|
- QRCode: res.data
|
|
|
|
|
|
+ QRCodeImagePath: res.data.data
|
|
})
|
|
})
|
|
// wx.downloadFile({
|
|
// wx.downloadFile({
|
|
// url: res,
|
|
// url: res,
|
|
@@ -146,7 +182,7 @@ Component({
|
|
|
|
|
|
// }
|
|
// }
|
|
// });
|
|
// });
|
|
- console.log(this.data.QRCode)
|
|
|
|
|
|
+ console.log(this.data.QRCodeImagePath)
|
|
console.log(res)
|
|
console.log(res)
|
|
resolve();
|
|
resolve();
|
|
})
|
|
})
|
|
@@ -251,27 +287,27 @@ Component({
|
|
// 分享团购的主体内容
|
|
// 分享团购的主体内容
|
|
drawGroupGut: function (ctx) {
|
|
drawGroupGut: function (ctx) {
|
|
let group = new Promise((resolve, reject) => {
|
|
let group = new Promise((resolve, reject) => {
|
|
- resolve(() => {
|
|
|
|
|
|
+ //resolve(() => {
|
|
ctx.fillText('郎朗读书声是世上最美的声音', 50, 138)
|
|
ctx.fillText('郎朗读书声是世上最美的声音', 50, 138)
|
|
- ctx.drawImage('../../../static/groupImg/Combined Shape.png', 11, 348, 196, 65);
|
|
|
|
|
|
+ ctx.drawImage(this.data.groupPurchaseInfo.bgImg, 9, 205, 352, 145);
|
|
ctx.drawImage('../../../static/groupImg/Rectangle 41.png', 134, 358, 59, 20);
|
|
ctx.drawImage('../../../static/groupImg/Rectangle 41.png', 134, 358, 59, 20);
|
|
ctx.setFontSize(14)
|
|
ctx.setFontSize(14)
|
|
ctx.setFillStyle('#fff')
|
|
ctx.setFillStyle('#fff')
|
|
- ctx.fillText('五人团', 149, 373)
|
|
|
|
|
|
+ ctx.fillText(`${this.data.groupPurchaseInfo.headcount}人团`, 149, 373)
|
|
ctx.setFontSize(16)
|
|
ctx.setFontSize(16)
|
|
ctx.setFillStyle('#A95A00')
|
|
ctx.setFillStyle('#A95A00')
|
|
- ctx.fillText('原价', 24, 373)
|
|
|
|
|
|
+ ctx.fillText('原价', 20, 373)
|
|
ctx.setStrokeStyle('red')
|
|
ctx.setStrokeStyle('red')
|
|
ctx.moveTo(64, 368)
|
|
ctx.moveTo(64, 368)
|
|
ctx.lineTo(114, 368)
|
|
ctx.lineTo(114, 368)
|
|
ctx.stroke()
|
|
ctx.stroke()
|
|
- ctx.fillText('¥99元', 64, 373)
|
|
|
|
|
|
+ ctx.fillText(`¥${parseFloat(this.data.groupPurchaseInfo.originPrice / 100).toFixed(2)}元`, 64, 373)
|
|
ctx.setFontSize(18)
|
|
ctx.setFontSize(18)
|
|
ctx.fillText('团购价仅需', 20, 403)
|
|
ctx.fillText('团购价仅需', 20, 403)
|
|
- ctx.fillText('元', 144, 403)
|
|
|
|
|
|
+ ctx.fillText('元', 174, 403)
|
|
ctx.setFontSize(20)
|
|
ctx.setFontSize(20)
|
|
ctx.setFillStyle('red')
|
|
ctx.setFillStyle('red')
|
|
- ctx.fillText('¥1', 109, 403)
|
|
|
|
|
|
+ ctx.fillText(`¥${parseFloat(this.data.groupPurchaseInfo.price / 100).toFixed(2)}`, 109, 403)
|
|
ctx.drawImage('../../../static/groupImg/share_bottom.png', 3, 419, 370, 192);
|
|
ctx.drawImage('../../../static/groupImg/share_bottom.png', 3, 419, 370, 192);
|
|
ctx.setFontSize(20)
|
|
ctx.setFontSize(20)
|
|
ctx.setFillStyle('red')
|
|
ctx.setFillStyle('red')
|
|
@@ -279,9 +315,10 @@ Component({
|
|
ctx.setFontSize(18)
|
|
ctx.setFontSize(18)
|
|
ctx.setFillStyle('#000')
|
|
ctx.setFillStyle('#000')
|
|
ctx.fillText('长按识别二维码参加团购', 9, 493)
|
|
ctx.fillText('长按识别二维码参加团购', 9, 493)
|
|
- })
|
|
|
|
|
|
+ //})
|
|
|
|
+ resolve();
|
|
})
|
|
})
|
|
- return group();
|
|
|
|
|
|
+ return group;
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|