diff --git a/root/detail/job.vue b/root/detail/job.vue index 336b1a1..ef030f4 100644 --- a/root/detail/job.vue +++ b/root/detail/job.vue @@ -1388,21 +1388,24 @@ export default { }else{ // 月工资 that.G.fillTextLineBreak(ctx, that.G.getSalaryClassifyValue(that.jobDetail.salaryClassify, that.jobDetail.salaryClassifyValue), baseLeft, line3, 400, 40, "#ff4400", titleFontSize + 6, "600", "left"); - that.G.fillTextLineBreak(ctx, that.jobDetail.monthPay, 750 - that.jobDetail.monthPay.length * 20 , line3 + 6, 400, 20, "#ff4400", titleFontSize, "400"); + that.G.fillTextLineBreak(ctx, that.jobDetail.monthPay, 750 - ctx.measureText( that.jobDetail.monthPay).width , line3 + 6, 400, 20, "#ff4400", titleFontSize, "400"); } if (that.jobDetail.jobSpecialLabelNames.length > 0) { that.jobDetail.jobSpecialLabelNames.forEach((item1, index) => { if (index <= 3) { - that.G.fillTextLineBreak(ctx, item1, baseLeft + labelLeft + 80, line4 + 4, 500, 40, "#666", mainFontSize); - labelLeft += ctx.measureText(item1).width + 40; - if (index == 3) { - labelLeft = 0; - } + that.G.fillTextLineBreak(ctx, item1, baseLeft + labelLeft + 12, line4 + 4, 400, 40, "#666", mainFontSize); // 标签字符 + that.G.roundRect1(ctx, baseLeft + labelLeft, line4 - 38, ctx.measureText(item1).width + 24, 56, 8, "#00000012"); + labelLeft += ctx.measureText(item1).width + 42; + if (index == 3) { + labelLeft = 0; + } } else if (index > 3 && index <= 6) { - that.G.fillTextLineBreak(ctx, item1, baseLeft + labelLeft + 80, line5 + 4, 500, 40, "#666", mainFontSize); - labelLeft += ctx.measureText(item1).width + 40; + that.G.roundRect1(ctx, baseLeft + labelLeft, line5 - 38, ctx.measureText(item1).width + 24, 56, 8, "#00000012"); + that.G.fillTextLineBreak(ctx, item1, baseLeft + labelLeft + 12, line5 + 4, 400, 40, "#666", mainFontSize); // 标签字符 + labelLeft += ctx.measureText(item1).width + 42; + } }); } @@ -1443,7 +1446,7 @@ export default { // 宣传标语 ["安全保障", "工资保障", "补贴保障"].forEach((item1, index) => { // 根据标签数量调整安全标识位置 - that.G.fillTextLineBreak(ctx, item1, baseLeft + safeMarkPosition + 70, line6 + 40, 100, 32, "#fca025"); + that.G.fillTextLineBreak(ctx, item1, baseLeft + safeMarkPosition , line6 + 40, 100, 32, "#fca025"); that.G.roundRect(ctx, img1, baseLeft + safeMarkPosition - 36, line6 + 12, 32, 32, 12); safeMarkPosition += 130 + ctx.measureText(item1).width; }); diff --git a/utils/common.js b/utils/common.js index 2b6050d..84ef6cb 100644 --- a/utils/common.js +++ b/utils/common.js @@ -1257,8 +1257,8 @@ let data = { // var initHeight = 0; ctx.font = weight + " " + font + "px Arial"; //字体大小 ctx.fillStyle = color; //字体颜色 - ctx.textBaseline = align; - ctx.textAlign = align; + // ctx.textBaseline = align; + // ctx.textAlign = align; while (i < text.length) { while (ctx.measureText(text.substring(n, i)).width < lw && i < text.length) { i++;