Commit 834628c5 by zhengxiao

feat(custom):

优化canvas
parent 6ec18700
......@@ -77,9 +77,6 @@ export default {
return new Promise(async (resolve, reject) => {
try {
const ctx = uni.createCanvasContext('shareCanvas', this)
// 绘制背景图
// ctx.fillStyle = '#FF3E3E'
// ctx.fillRect(0, 0, 211, 170)
try {
const { path } = await this.getImge(info.cardBg)
ctx.drawImage(path, 0, 0, 211, 170)
......@@ -88,11 +85,9 @@ export default {
}
// 商品模块
ctx.save()
this.setRadius(ctx, 4, 8, 62, 195, 99)
ctx.fillStyle = '#ffffff'
ctx.fill()
ctx.restore()
// 商品图
ctx.save()
......@@ -113,21 +108,17 @@ export default {
}
ctx.restore()
ctx.save()
this.setRadius(ctx, 2, 15, 69, 31, 14)
ctx.fillStyle = '#FF644D'
ctx.fill()
ctx.restore()
ctx.font = '9px sans-serif'
ctx.textAlign = 'left'
ctx.fillStyle = '#ffffff'
ctx.fillText(`${info.requiredNum}人团`, 19, 80)
ctx.restore()
// 商品标题
this.drawText(ctx, info.title, 92, 82, 18, 106, 12)
ctx.restore()
// 已学人数
ctx.font = '10px sans-serif'
......@@ -162,7 +153,6 @@ export default {
},
fail: function (error) {
console.log('fail----fail', error)
// TODO
return reject(error)
},
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment