1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
| drawShareImg() { const ctx = wx.createCanvasContext('shareImg'); const covers = this.data.localCovers;
ctx.save() ctx.setFillStyle('white') ctx.fillRect(0, 0, 260, 370); ctx.restore()
ctx.setFillStyle('#111111'); ctx.setFontSize(14); ctx.setTextAlign('center'); ctx.fillText(this.data.userInfo.nickName, 130, 42, 260);
ctx.setFillStyle('#111111'); ctx.setTextAlign('center'); ctx.font = "30px SourceHanSerifCNMedium"; ctx.fillText('心愿书屋', 130, 82, 260);
ctx.setStrokeStyle('rgba(0,0,0,0.1)'); if(covers[3]) ctx.strokeRect(21, 150, 42, 56); if(covers[4]) ctx.strokeRect(197, 150, 42, 56); if(covers[1]) ctx.strokeRect(51, 126, 60, 80); if(covers[2]) ctx.strokeRect(149, 126, 60, 80); if(covers[0]) ctx.strokeRect(91, 102, 78, 104);
if(covers[3]) ctx.drawImage(covers[3], 21, 150, 42, 56); if(covers[4]) ctx.drawImage(covers[4], 197, 150, 42, 56); if(covers[1]) ctx.drawImage(covers[1], 51, 126, 60, 80); if(covers[2]) ctx.drawImage(covers[2], 149, 126, 60, 80); if(covers[0]) ctx.drawImage(covers[0], 91, 102, 78, 104);
ctx.rect(0, 226, 260, 66); ctx.setFillStyle('#FFDCE7'); ctx.fill();
ctx.drawImage('/assets/images/share/share_icon_left.png', 20, 242, 20, 12); ctx.drawImage('/assets/images/share/share_icon_right.png', 220, 264, 20, 12);
ctx.drawImage(this.data.appCode, 108, 309, 44, 44);
ctx.setFillStyle('#773A4D'); ctx.font = "14px SourceHanSerifCNMedium"; ctx.setTextAlign('center'); ctx.fillText('我已经领了129书币', 130, 254, 260);
ctx.setFillStyle('#773A4D'); ctx.font = "14px SourceHanSerifCNMedium"; ctx.setTextAlign('center'); ctx.fillText('天天领币,免费看书', 130, 274, 260);
ctx.setFillStyle('#9B9B9B'); ctx.setFontSize(12); ctx.setTextAlign('left'); ctx.fillText('识别小程序码', 30, 337, 260);
ctx.setFillStyle('#9B9B9B'); ctx.font = "12px SourceHanSerifCNMedium"; ctx.setTextAlign('left'); ctx.fillText('进入心愿书屋', 158, 337, 260);
ctx.draw(); },
|