|
| xqd
@@ -15,6 +15,8 @@ Page({
|
|
|
clock: '00:00:00', //计时
|
|
|
shareCanvasWidth: 280,
|
|
|
shareCanvasHeight: 375,
|
|
|
+ imageWidth: 280,
|
|
|
+ imageHeight: 375,
|
|
|
shareImage: '',
|
|
|
shareText: '',
|
|
|
shareTextPosX: '',
|
|
| xqd
@@ -112,6 +114,8 @@ Page({
|
|
|
this.setData({
|
|
|
// shareCanvasWidth: res.data.width,
|
|
|
// shareCanvasHeight: res.data.height,
|
|
|
+ imageWidth: res.data.width,
|
|
|
+ imageHeight: res.data.height,
|
|
|
shareImage: res.data.shareImage,
|
|
|
shareText: res.data.shareText,
|
|
|
shareTextPosX: res.data.shareTextPosX,
|
|
| xqd
@@ -296,15 +300,20 @@ Page({
|
|
|
// let text_y = this.data.shareTextPosY
|
|
|
// ctx.fillStyle = "#fff"
|
|
|
// ctx.fillRect(0, 0, width, height)
|
|
|
+ // ctx.drawImage(image, 0, 0, 280, 375)
|
|
|
ctx.drawImage(image, 0, 0, 280, 375)
|
|
|
// ctx.fillStyle = "#fff"
|
|
|
// ctx.setFontSize(18)
|
|
|
// ctx.textAlign = 'center'
|
|
|
// ctx.fillText('我已成功打卡14天', width / 2, height / 2 - 7)
|
|
|
// ctx.fillText(text, text_x, text_y)
|
|
|
- ctx.draw(false, this.getTempFilePath)
|
|
|
+ ctx.draw(false)
|
|
|
+ // var ctx_save = wx.createCanvasContext('saveCanvas')
|
|
|
+ // ctx_save.drawImage(image, 0, 0, width, height)
|
|
|
+ // ctx_save.draw(false, this.getTempFilePath)
|
|
|
this.setData({
|
|
|
- shareImage: res.tempFilePath
|
|
|
+ shareImage: res.tempFilePath,
|
|
|
+ shareTempFilePath: res.tempFilePath
|
|
|
})
|
|
|
}
|
|
|
})
|
|
| xqd
@@ -320,14 +329,14 @@ Page({
|
|
|
});
|
|
|
},
|
|
|
getTempFilePath: function () {
|
|
|
- wx.canvasToTempFilePath({
|
|
|
- canvasId: 'shareCanvas',
|
|
|
- success: (res) => {
|
|
|
- this.setData({
|
|
|
- shareTempFilePath: res.tempFilePath
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
+ // wx.canvasToTempFilePath({
|
|
|
+ // canvasId: 'shareCanvas',
|
|
|
+ // success: (res) => {
|
|
|
+ // this.setData({
|
|
|
+ // shareTempFilePath: res.tempFilePath
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // })
|
|
|
},
|
|
|
handleShare() {
|
|
|
// wx.canvasToTempFilePath({
|