From 727002278a4deb89ceae14a6373e4953509cf990 Mon Sep 17 00:00:00 2001 From: wangxia <779219182@qq.com> Date: Thu, 3 Jul 2025 16:33:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- root/bind/myMain.vue | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/root/bind/myMain.vue b/root/bind/myMain.vue index 84229ae..2c27eb7 100644 --- a/root/bind/myMain.vue +++ b/root/bind/myMain.vue @@ -370,7 +370,7 @@ export default { that.G.roundRect1(ctx, (mycenter - 600 ) / 2 - 5, qrTop + 475, 136, 136, 80, baseColor); // 二维码右下角的 that.G.roundRect1(ctx, (mycenter - 600 ) / 2 + 470, qrTop + 475, 136, 136, 80, baseColor); - that.G.fillTextLineBreak(ctx, '扫一扫关注我的发单号',mycenter / 2 + 40, canvas.height - 215, '扫一扫关注我的发单号'.length * 54, 58, "#333", 54, 600); // 总职位 + that.G.fillTextLineBreak(ctx, '扫一扫关注我的发单号',(mycenter - '扫一扫关注我的发单号'.length * 54) / 2 + 40, canvas.height - 215, '扫一扫关注我的发单号'.length * 54, 58, "#333", 54, 600); // 总职位 // 绘制头像背景色 that.G.roundRect_yuan(ctx, (mycenter - 360 ) / 2, 110, 360, "#ffffff"); @@ -466,8 +466,7 @@ export default { }, }); }, - - // 设置分享布局 + // 设置分享布局 setShareJobImg(ctx, canvas, mycenter, funObj) { let that = this; return new Promise((imgres) => { @@ -492,15 +491,23 @@ export default { const img = canvas.createImage(); img.src = res.path; img.onload = () => { - 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) + // info.jobNum = 10000 + // info.recruitmentJobNum = 1000 + // info.downNum = 32 + let numBase = 150 + let numBase2 = numBase + (ctx.measureText(info.jobNum.toString()).width + ctx.measureText("总职位").width + 150) + let numBase3 = numBase2 + (ctx.measureText(info.recruitmentJobNum.toString()).width + ctx.measureText("在招数").width + 150) 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, 870,mycenter - 360, 86, "#666", 56, 500,'left'); // slogan + that.G.fillTextLineBreak(ctx, info.agencyDesp ,numBase , 870,mycenter - 360, 86, "#666", 56, 500,'left'); // slogan // that.G.fillTextLineBreak(ctx, "今日更新职位" + info.jobUpdateNum, 140, 400, ("今日更新职位" + info.jobUpdateNum).length * 56, 56, "#999", 56, 500, "left"); // 今日更新职位 - + let jobL =info.jobNum.toString().length + let recL =info.recruitmentJobNum.toString().length + let downL =info.downNum.toString().length + // if(){ + + // } that.G.fillTextLineBreak(ctx, info.jobNum.toString(), numBase, 760, info.jobNum.toString().length * 80, 88, "#000", 80, 500); // 总职位 that.G.fillTextLineBreak(ctx, info.recruitmentJobNum.toString(), numBase2, 760, info.recruitmentJobNum.toString().length * 80, 88, "#000", 80, 500); // 在招数 that.G.fillTextLineBreak(ctx, info.downNum.toString(),numBase3, 760, info.downNum.toString().length * 80, 88, "#000", 80, 500); // 粉丝数 @@ -509,9 +516,13 @@ export default { 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, "#666", 56, 400); // 总职位 - that.G.fillTextLineBreak(ctx, "在招数", numBase2 + info.recruitmentJobNum.toString().length * 70, 755, "在招数".length * 56, 56, "#666", 56, 400); // 在招数 - that.G.fillTextLineBreak(ctx, "粉丝", numBase3 + info.downNum.toString().length * 60, 755, "粉丝".length * 56, 56, "#666", 56, 400); // 粉丝数 + // that.G.fillTextLineBreak(ctx, "总职位",numBase + (info.jobNum.toString().length <=1 ?70 * 2 :info.jobNum.toString().length * 70), 755, "总职位".length * 56, 56, "#666", 56, 400); // 总职位 + // that.G.fillTextLineBreak(ctx, "在招数", numBase2 + (info.recruitmentJobNum.toString().length <=1 ?70 * 2 :info.recruitmentJobNum.toString().length * 70), 755, "在招数".length * 56, 56, "#666", 56, 400); // 在招数 + // that.G.fillTextLineBreak(ctx, "粉丝", numBase3 + (info.downNum.toString().length <=1 ?60 * 2 :info.downNum.toString().length * 60), 755, "粉丝".length * 56, 56, "#666", 56, 400); // 粉丝数 + + that.G.fillTextLineBreak(ctx, "总职位",numBase + (info.jobNum.toString().length <=1 ?60 * 2 :info.jobNum.toString().length * 50), 755, "总职位".length * 56, 56, "#666", 56, 400); // 总职位 + that.G.fillTextLineBreak(ctx, "在招数", numBase2 + (info.recruitmentJobNum.toString().length <=1 ?60 * 2 :info.recruitmentJobNum.toString().length * 50), 755, "在招数".length * 56, 56, "#666", 56, 400); // 在招数 + that.G.fillTextLineBreak(ctx, "粉丝", numBase3 + (info.downNum.toString().length <=1 ?40 * 2 :info.downNum.toString().length * 50), 755, "粉丝".length * 56, 56, "#666", 56, 400); // 粉丝数 imgres(canvas); }; },