# ios 设置字体(sans-serif)画布正常画字体
ctx.font = "bold small-caps 36px sans-serif";
ctx.textAlign = "center";
ctx.fillStyle = "#666";
ctx.fillText("刮奖区",c1.width/2,c1.height/2+12);
poster(codeurl = 'https://ysch-1318476842.cos.ap-guangzhou.myqcloud.com/ccs/gjzyjgs_v2.jpg') {
const query = wx.createSelectorQuery()
query.select('#canvas')
.fields({
node: true,
size: true
})
.exec((res) => {
const canvas = res[0].node
const dpr = wx.getSystemInfoSync().pixelRatio;
canvas.width = res[0].width * dpr
canvas.height = res[0].height * dpr
this.Acanvas = canvas;
this.width = res[0].width * dpr;
this.height = res[0].height * dpr;
const ctx = canvas.getContext('2d')
const img = canvas.createImage()
img.onload = () => {
ctx.drawImage(img, 0, 0, res[0].width * dpr, res[0].height * dpr)
const img1 = canvas.createImage()
img1.onload = () => {
ctx.drawImage(img1, rpx2px(562.9 * dpr), rpx2px(352.8 * dpr), rpx2px(78 * dpr), rpx2px(78 * dpr))
const img2 = canvas.createImage()
img2.onload = () => {
ctx.drawImage(img2, rpx2px(158 * dpr), rpx2px(76 * dpr), rpx2px(62 * dpr), rpx2px(78 * dpr))
ctx.font = "small-caps "+8*dpr+"px sans-serif";
ctx.textAlign = "center";
ctx.fillStyle = "#000";
ctx.fillText('朱海兵', rpx2px(158 * dpr), rpx2px(208 * dpr))
ctx.fillText('男', rpx2px(288 * dpr), rpx2px(208 * dpr))
ctx.fillText('**************', rpx2px(230 * dpr), rpx2px(248 * dpr))
ctx.fillText('1993', rpx2px(178 * dpr), rpx2px(292 * dpr))
ctx.fillText('03', rpx2px(230 * dpr), rpx2px(292 * dpr))
ctx.fillText('24', rpx2px(276 * dpr), rpx2px(292 * dpr))
ctx.fillText('GJZY00230301387586', rpx2px(246 * dpr), rpx2px(342 * dpr))
ctx.fillText('2023年07月04日', rpx2px(226 * dpr), rpx2px(382 * dpr))
ctx.fillText('朱海兵', rpx2px(490 * dpr), rpx2px(118 * dpr))
ctx.fillText('朱海兵', rpx2px(568 * dpr), rpx2px(222 * dpr))
ctx.fillText('2023', rpx2px(398 * dpr), rpx2px(419 * dpr))
ctx.fillText('07', rpx2px(462 * dpr), rpx2px(419 * dpr))
ctx.fillText('04', rpx2px(516 * dpr), rpx2px(419 * dpr))
ctx.scale(dpr, dpr)
}
img2.src = this.data.idphotoUrl
}
img1.src = codeurl
}
img.src = codeurl
})
},