|
@@ -18,7 +18,8 @@ Page({
|
|
shareCanvasHeight: 280,
|
|
shareCanvasHeight: 280,
|
|
shareImage: '',
|
|
shareImage: '',
|
|
shareText: '',
|
|
shareText: '',
|
|
- shareTextPos: ''
|
|
|
|
|
|
+ shareTextPosX: '',
|
|
|
|
+ shareTextPosY: ''
|
|
},
|
|
},
|
|
onLoad: function () {
|
|
onLoad: function () {
|
|
wx.getSystemInfo({
|
|
wx.getSystemInfo({
|
|
@@ -46,7 +47,8 @@ Page({
|
|
shareCanvasHeight: res.data.height,
|
|
shareCanvasHeight: res.data.height,
|
|
shareImage: res.data.shareImage,
|
|
shareImage: res.data.shareImage,
|
|
shareText: res.data.shareText,
|
|
shareText: res.data.shareText,
|
|
- shareTextPos: res.data.shareTextPos
|
|
|
|
|
|
+ shareTextPosX: res.data.shareTextPosX,
|
|
|
|
+ shareTextPosY: res.data.shareTextPosY,
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -185,14 +187,19 @@ Page({
|
|
const ctx = wx.createCanvasContext('shareCanvas')
|
|
const ctx = wx.createCanvasContext('shareCanvas')
|
|
let width = this.data.shareCanvasWidth
|
|
let width = this.data.shareCanvasWidth
|
|
let height = this.data.shareCanvasHeight
|
|
let height = this.data.shareCanvasHeight
|
|
|
|
+ let image = this.data.shareImage
|
|
|
|
+ let text = this.data.shareText
|
|
|
|
+ let text_x = this.data.shareTextPosX
|
|
|
|
+ let text_y = this.data.shareTextPosY
|
|
|
|
+ // ctx.fillStyle = "#fff"
|
|
|
|
+ // ctx.fillRect(0, 0, width, height)
|
|
|
|
+ ctx.drawImage(image)
|
|
ctx.fillStyle = "#fff"
|
|
ctx.fillStyle = "#fff"
|
|
- ctx.fillRect(0, 0, width, height)
|
|
|
|
- ctx.fillStyle = "#000"
|
|
|
|
- ctx.setFontSize(16)
|
|
|
|
|
|
+ ctx.setFontSize(24)
|
|
ctx.textAlign = 'center'
|
|
ctx.textAlign = 'center'
|
|
- ctx.fillText('我已成功打卡14天', width / 2, height / 2 - 7)
|
|
|
|
|
|
+ // ctx.fillText('我已成功打卡14天', width / 2, height / 2 - 7)
|
|
|
|
+ ctx.fillText(text, text_x, text_y)
|
|
ctx.draw()
|
|
ctx.draw()
|
|
-
|
|
|
|
},
|
|
},
|
|
togglePopup() {
|
|
togglePopup() {
|
|
this.setData({
|
|
this.setData({
|