|
|
|
@ -317,7 +317,7 @@ Page({ |
|
|
|
context.setFontSize(18); |
|
|
|
context.setFillStyle('#000000'); |
|
|
|
context.setTextAlign('center'); |
|
|
|
context.fillText(this.data.momentDetail.title, 187, 152); |
|
|
|
context.fillText(this.data.momentDetail.title, 170, 152); |
|
|
|
context.stroke() |
|
|
|
|
|
|
|
//绘制内容
|
|
|
|
@ -330,7 +330,7 @@ Page({ |
|
|
|
context.setFillStyle("#000") |
|
|
|
//内容自动换行
|
|
|
|
for (var a = 0; a < chr.length; a++) { |
|
|
|
if (context.measureText(temp).width < 330) { |
|
|
|
if (context.measureText(temp).width < 310) { |
|
|
|
temp += chr[a]; |
|
|
|
} else { |
|
|
|
a--; //这里添加了a-- 是为了防止字符丢失,效果图中有对比
|
|
|
|
@ -339,13 +339,13 @@ Page({ |
|
|
|
} |
|
|
|
} |
|
|
|
row.push(temp); |
|
|
|
if (row.length > 12) { |
|
|
|
var rowCut = row.slice(0, 12); |
|
|
|
var rowPart = rowCut[11]; |
|
|
|
if (row.length > 10) { |
|
|
|
var rowCut = row.slice(0, 10); |
|
|
|
var rowPart = rowCut[9]; |
|
|
|
var test = ""; |
|
|
|
var empty = []; |
|
|
|
for (var a = 0; a < rowPart.length; a++) { |
|
|
|
if (context.measureText(test).width < 330) { |
|
|
|
if (context.measureText(test).width < 310) { |
|
|
|
test += rowPart[a]; |
|
|
|
} |
|
|
|
else { |
|
|
|
@ -358,7 +358,7 @@ Page({ |
|
|
|
row = rowCut; |
|
|
|
} |
|
|
|
for (var b = 0; b < row.length; b++) { |
|
|
|
context.fillText(row[b], 20, 185+ b * 30, 500); |
|
|
|
context.fillText(row[b], 15, 185+ b * 30, 500); |
|
|
|
} |
|
|
|
|
|
|
|
//如果纸厂名字存在则在顶部图片区域中心绘制纸厂名称
|
|
|
|
@ -368,7 +368,7 @@ Page({ |
|
|
|
context.font="normal bold 24px sans-serif" |
|
|
|
context.setFillStyle('#3539F8'); |
|
|
|
context.setTextAlign('center'); |
|
|
|
context.fillText(this.data.momentDetail.millPaperName, 187, 55); |
|
|
|
context.fillText(this.data.momentDetail.millPaperName, 170, 55); |
|
|
|
context.stroke() |
|
|
|
} |
|
|
|
|
|
|
|
|