diff --git a/root/bind/myMain copy.vue b/root/bind/myMain copy.vue new file mode 100644 index 0000000..02c517e --- /dev/null +++ b/root/bind/myMain copy.vue @@ -0,0 +1,511 @@ + + + + + diff --git a/root/bind/myMain.vue b/root/bind/myMain.vue index 5a076ec..0343fd5 100644 --- a/root/bind/myMain.vue +++ b/root/bind/myMain.vue @@ -353,8 +353,18 @@ export default { img.src = res.path; console.log("img111", img); img.onload = (info) => { - ctx.drawImage(img, 0, 0, canvas.width, canvas.height); - console.log("info111", info); + // 绘制背景色 + that.G.roundRect1(ctx, 0, 0, canvas.width, canvas.height, 0, "#fea702"); + // 绘制中间白色背景 + that.G.roundRect1(ctx, (mycenter - canvas.width + 120 ) / 2, 280, (canvas.width - 120), (canvas.height - 360), 180, "#fff"); + // 绘制关注发单号背景色 + that.G.roundRect1(ctx, (mycenter - 800 ) / 2, canvas.height - 300, 800, 136, 136, "#fea702"); + // that.G.fillTextLineBreak(ctx, '扫一扫关注我的发单号',(mycenter - 800 ) / 2 + 50, canvas.height - 320, '扫一扫关注我的发单号' * 88, 88, "#333", 88, 600); // 总职位 + + // 绘制头像背景色 + that.G.roundRect_yuan(ctx, (mycenter - 360 ) / 2, 110, 360, "#ffffff"); + + console.log("info111", info); resolve(true); }; }, @@ -445,7 +455,7 @@ export default { console.log("res333", res); img.src = res.path; img.onload = () => { - that.G.roundRect(ctx, img, (mycenter - 488) / 2, 1160, 488, 488, 0); + that.G.roundRect(ctx, img, (mycenter - 600) / 2, 1260, 600, 600, 0); let info = that.recommendList; console.log("info", info); if (!info.logo) { @@ -459,17 +469,27 @@ export default { const img = canvas.createImage(); img.src = res.path; img.onload = () => { - that.G.roundRect(ctx, img, 915, 218, 272, 272, 136); // logo - that.G.fillTextLineBreak(ctx, info.fullName, 140, 300, info.fullName.length * 80, 80, "#333", 80, 600, "left"); // 企业名称 - that.G.fillTextLineBreak(ctx, "今日更新职位" + info.jobUpdateNum, 140, 400, ("今日更新职位" + info.jobUpdateNum).length * 56, 56, "#999", 56, 500, "left"); // 今日更新职位 + let numBase = 200 + let numBase2 = numBase + (info.jobNum.toString().length * 88 + "总职位".length * 56 + 80) + let numBase3 = numBase + (info.jobNum.toString().length * 88 + "总职位".length * 56 + 80) + (info.recruitmentJobNum.toString().length * 88 + "在招数".length * 56 + 80) + that.G.roundRect(ctx, img, (mycenter - 300) / 2, 140, 300, 300, 150); // logo + that.G.fillTextLineBreak(ctx, info.fullName, (mycenter - info.fullName.length * 80) / 2, 600, info.fullName.length * 80, 200, "#333", 80, 600, "left"); // 企业名称 + that.G.fillTextLineBreak(ctx, info.agencyDesp + info.agencyDesp+ info.agencyDesp+ info.agencyDesp+ info.agencyDesp+ info.agencyDesp+ info.agencyDesp+ info.agencyDesp+ info.agencyDesp,numBase - 50, 900,mycenter - 360, 56, "#999", 56, 500,'left'); // 总职位 + + // that.G.fillTextLineBreak(ctx, "今日更新职位" + info.jobUpdateNum, 140, 400, ("今日更新职位" + info.jobUpdateNum).length * 56, 56, "#999", 56, 500, "left"); // 今日更新职位 + + that.G.fillTextLineBreak(ctx, info.jobNum.toString(), numBase, 760, info.jobNum.toString().length * 88, 88, "#333", 88, 600); // 总职位 - that.G.fillTextLineBreak(ctx, info.jobNum.toString(), 230, 620, info.jobNum.toString().length * 88, 88, "#333", 88, 600); // 总职位 - that.G.fillTextLineBreak(ctx, info.recruitmentJobNum.toString(), 480, 620, info.recruitmentJobNum.toString().length * 88, 88, "#333", 88, 600); // 在招数 - that.G.fillTextLineBreak(ctx, info.downNum.toString(), 730, 620, info.downNum.toString().length * 88, 88, "#333", 88, 600); // 粉丝数 + that.G.fillTextLineBreak(ctx, info.recruitmentJobNum.toString(), numBase2, 760, info.recruitmentJobNum.toString().length * 88, 88, "#333", 88, 600); // 在招数 + that.G.fillTextLineBreak(ctx, info.downNum.toString(),numBase3, 760, info.downNum.toString().length * 88, 88, "#333", 88, 600); // 粉丝数 - that.G.fillTextLineBreak(ctx, "总职位", 230, 700, "总职位".length * 56, 56, "#999", 56, 500); // 总职位 - that.G.fillTextLineBreak(ctx, "在招数", 480, 700, "在招数".length * 56, 56, "#999", 56, 500); // 在招数 - that.G.fillTextLineBreak(ctx, "粉丝数", 730, 700, "粉丝数".length * 56, 56, "#999", 56, 500); // 粉丝数 + + console.log('info.jobNum.toString().length * 88',info.jobNum.toString().length * 88); + + + that.G.fillTextLineBreak(ctx, "总职位",numBase + info.jobNum.toString().length * 70, 755, "总职位".length * 56, 56, "#999", 56, 500); // 总职位 + that.G.fillTextLineBreak(ctx, "在招数", numBase2 + info.recruitmentJobNum.toString().length * 70, 755, "在招数".length * 56, 56, "#999", 56, 500); // 在招数 + that.G.fillTextLineBreak(ctx, "粉丝", numBase3 + info.downNum.toString().length * 60, 755, "粉丝".length * 56, 56, "#999", 56, 500); // 粉丝数 imgres(canvas); }; }, diff --git a/utils/common.js b/utils/common.js index 48afd9d..3688d61 100644 --- a/utils/common.js +++ b/utils/common.js @@ -1283,12 +1283,16 @@ let data = { // 恢复之前保存的绘图上下文 ctx.restore(); }, - roundRect_yuan (ctx, x, y, size) { + roundRect_yuan (ctx, x, y, size, color) { // 开始绘制 ctx.save(); // 保存 + ctx.beginPath(); // 开始绘制 // ctx.arc(100, 75, 50, 0, 2 * Math.PI) ctx.arc(size / 2 + x, size / 2 + y, size / 2, 0, Math.PI * 2, false); + ctx.fillStyle = color; + ctx.strokeStyle = color; + ctx.fill(); ctx.clip(); // 恢复之前保存的绘图上下文 ctx.restore();