|
@@ -80,12 +80,12 @@ Component({
|
|
|
wx.canvasToTempFilePath({
|
|
|
x: 0,
|
|
|
y: 0,
|
|
|
- width: 375,
|
|
|
- height: 667,
|
|
|
+ width: 300,
|
|
|
+ height: 525,
|
|
|
// destWidth: 370,
|
|
|
- destWidth: 1500,
|
|
|
+ destWidth: 1200,
|
|
|
// destHeight: 507,
|
|
|
- destHeight: 2668,
|
|
|
+ destHeight: 2100,
|
|
|
canvasId: 'myCanvas',
|
|
|
success: (res) => {
|
|
|
console.log(res.tempFilePath)
|
|
@@ -264,9 +264,9 @@ Component({
|
|
|
mask: true
|
|
|
})
|
|
|
if (this.data.shareType === 'works') {
|
|
|
- ctx.drawImage('../../../static/image/works_poster.jpg', 0, 0, 1500, 2668, 0, 0, 750, 1334); //插入图片
|
|
|
+ ctx.drawImage('../../../static/image/works_poster.jpg', 0, 0, 1200, 2100, 0, 0, 600, 1050); //插入图片
|
|
|
} else {
|
|
|
- ctx.drawImage('../../../static/image/group_poster.jpg', 0, 0, 1500, 2668, 0, 0, 750, 1334); //插入图片
|
|
|
+ ctx.drawImage('../../../static/image/group_poster.jpg', 0, 0, 1200, 2100, 0, 0, 600, 1050); //插入图片
|
|
|
}
|
|
|
ctx.save()
|
|
|
ctx.beginPath()
|
|
@@ -286,14 +286,14 @@ Component({
|
|
|
ctx.restore(); //恢复之前保存的绘图上下文 恢复之前保存的绘图上下午即状态 可以继续绘制
|
|
|
ctx.setFontSize(18)
|
|
|
ctx.setFillStyle('#444444')
|
|
|
- ctx.fillText(this.data.author, (375 - ctx.measureText(this.data.author).width) / 2, 232)
|
|
|
+ ctx.fillText(this.data.author, (300 - ctx.measureText(this.data.author).width) / 2, 232)
|
|
|
ctx.setFontSize(16)
|
|
|
ctx.setFillStyle('#ff9209')
|
|
|
- ctx.fillText('播音主持特长生', (375 - ctx.measureText('播音主持特长生').width) / 2, 253)
|
|
|
+ ctx.fillText('播音主持特长生', (300 - ctx.measureText('播音主持特长生').width) / 2, 253)
|
|
|
} else {
|
|
|
ctx.arc(52, 58, 36, 0, 2 * Math.PI, false)
|
|
|
ctx.clip(); //剪切头像区域
|
|
|
- ctx.fill('red')
|
|
|
+ ctx.fill('ff6f42')
|
|
|
ctx.drawImage(this.data.avatar, 16, 22, 72, 72); //插入图片
|
|
|
ctx.restore(); //恢复之前保存的绘图上下文 恢复之前保存的绘图上下午即状态 可以继续绘制
|
|
|
ctx.setFontSize(20)
|
|
@@ -313,16 +313,16 @@ Component({
|
|
|
console.log('开始画内容')
|
|
|
ctx.setFillStyle('#fff')
|
|
|
ctx.setFontSize(18)
|
|
|
- ctx.fillText('小学语文 最新全国统一教材', (375 - ctx.measureText('小学语文 最新全国统一教材').width) / 2, 55);
|
|
|
+ ctx.fillText('小学语文 最新全国统一教材', (300 - ctx.measureText('小学语文 最新全国统一教材').width) / 2, 55);
|
|
|
ctx.setFontSize(30)
|
|
|
- ctx.fillText('课文朗读 从未如此有趣', (375 - ctx.measureText('课文朗读 从未如此有趣').width) / 2, 103);
|
|
|
+ ctx.fillText('课文朗读 从未如此有趣', (300 - ctx.measureText('课文朗读 从未如此有趣').width) / 2, 103);
|
|
|
ctx.setFontSize(16)
|
|
|
ctx.setFillStyle('#444')
|
|
|
- ctx.fillText('使出洪荒之力,声情并茂地朗诵了', (375 - ctx.measureText('使出洪荒之力,声情并茂地朗诵了').width) / 2, 297)
|
|
|
+ ctx.fillText('使出洪荒之力,声情并茂地朗诵了', (300 - ctx.measureText('使出洪荒之力,声情并茂地朗诵了').width) / 2, 297)
|
|
|
// ctx.fillText(`配了一段惊世之作`, 90, 240)
|
|
|
// ctx.setFontSize(16)
|
|
|
// ctx.setFillStyle('red')
|
|
|
- ctx.fillText(`《${this.data.title}》`, (375 - ctx.measureText(`《${this.data.title}》`).width) / 2, 322)
|
|
|
+ ctx.fillText(`《${this.data.title}》`, (300 - ctx.measureText(`《${this.data.title}》`).width) / 2, 322)
|
|
|
|
|
|
ctx.setFontSize(16)
|
|
|
ctx.setFillStyle('#000')
|
|
@@ -330,10 +330,10 @@ Component({
|
|
|
ctx.setFontSize(16)
|
|
|
// ctx.setFillStyle('#c90000')
|
|
|
ctx.setFillStyle('#ff9209')
|
|
|
- ctx.fillText('为TA疯狂打CALL 快去听听', (375 - ctx.measureText('为TA疯狂打CALL 快去听听').width) / 2, 401)
|
|
|
+ ctx.fillText('为TA疯狂打CALL 快去听听', (300 - ctx.measureText('为TA疯狂打CALL 快去听听').width) / 2, 401)
|
|
|
ctx.setFontSize(12)
|
|
|
ctx.setFillStyle('#666666')
|
|
|
- ctx.fillText('长按识别二维码', (375 - ctx.measureText('长按识别二维码').width) / 2, 574)
|
|
|
+ ctx.fillText('长按识别二维码', (300 - ctx.measureText('长按识别二维码').width) / 2, 574)
|
|
|
// })
|
|
|
resolve();
|
|
|
})
|
|
@@ -345,10 +345,10 @@ Component({
|
|
|
let group = new Promise((resolve, reject) => {
|
|
|
ctx.setFontSize(28)
|
|
|
ctx.setFillStyle('#ff670d')
|
|
|
- ctx.fillText('小学语文 朗读配音', (375 - ctx.measureText('小学语文 朗读配音').width) / 2, 152)
|
|
|
+ ctx.fillText('小学语文 朗读配音', (300 - ctx.measureText('小学语文 朗读配音').width) / 2, 152)
|
|
|
ctx.setFontSize(16)
|
|
|
ctx.setFillStyle('#444')
|
|
|
- ctx.fillText('朗朗读书声,是世上最美的声音', (375 - ctx.measureText('朗朗读书声,是世上最美的声音').width) / 2, 351)
|
|
|
+ ctx.fillText('朗朗读书声,是世上最美的声音', (300 - ctx.measureText('朗朗读书声,是世上最美的声音').width) / 2, 351)
|
|
|
// if (this.data.groupPurchaseInfo.productId === 1) {
|
|
|
ctx.drawImage(this.data.iconImg, 12, 176, 351, 145);
|
|
|
// }
|
|
@@ -362,7 +362,7 @@ Component({
|
|
|
console.log(this.data.groupType)
|
|
|
if(this.data.groupType === 'IOS'){
|
|
|
ctx.setFillStyle('#ff670d')
|
|
|
- ctx.fillText(`助力成功,您还可以获得本课程7天VIP`, (375 - ctx.measureText('助力成功,您还可以获得本课程7天VIP').width) / 2, 412)
|
|
|
+ ctx.fillText(`助力成功,您还可以获得本课程7天VIP`, (300 - ctx.measureText('助力成功,您还可以获得本课程7天VIP').width) / 2, 412)
|
|
|
|
|
|
|
|
|
} else {
|
|
@@ -379,7 +379,7 @@ Component({
|
|
|
|
|
|
ctx.setFontSize(12)
|
|
|
ctx.setFillStyle('#666666')
|
|
|
- ctx.fillText('长按识别二维码', (375 - ctx.measureText('长按识别二维码').width) / 2, 574)
|
|
|
+ ctx.fillText('长按识别二维码', (300 - ctx.measureText('长按识别二维码').width) / 2, 574)
|
|
|
//})
|
|
|
resolve();
|
|
|
})
|