cc616e46 by renchao@pashanhoo.com

style;证书预览

1 parent 5f8c1bc9
......@@ -189,30 +189,52 @@
})
})
}
// context.fillText(this.bdcqz.syqx ? this.bdcqz.syqx : '', 129, 429);
// qlqtzk
const maxWidth = 330; // 最大宽度限制
// 权利其他状态
const maxWidth = 332; // 最大宽度限制
let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : [];
lines.forEach((line, index) => {
const y = 463 + (index * 40); // 每行文本的垂直位置
let currentLine = '';
let arr = [];
for (let word of line) {
const testLine = currentLine + word;
const lineWidth = context.measureText(testLine).width;
if (lineWidth <= maxWidth) {
currentLine = testLine;
} else {
arr.push(currentLine);
currentLine = word;
// lines.forEach((line, index) => {
// const y = 463 + (index * 33); // 每行文本的垂直位置
// let currentLine = '';
// let arr = [];
// for (let word of line) {
// const testLine = currentLine + word;
// const lineWidth = context.measureText(testLine).width;
// if (lineWidth <= maxWidth) {
// currentLine = testLine;
// } else {
// arr.push(currentLine);
// currentLine = word;
// }
// }
// arr.push(currentLine);
// arr.forEach((line, index) => {
// context.fillText(line, 129, y + (index * 17)); // 调整行高
// })
// })
for (let i = 0; i < lines.length; i++) {
if (getByteLen(lines[i]) > 41) {
let currentLine = '';
let arr = [];
for (let word of lines[i]) {
const testLine = currentLine + word;
const lineWidth = context.measureText(testLine).width;
if (lineWidth <= maxWidth) {
currentLine = testLine;
} else {
arr.push(currentLine);
currentLine = word;
}
}
arr.push(currentLine);
arr.forEach((line, index) => {
context.fillText(line, 129, 490 + (28 * (i - 1)) + (index * 14)); // 调整行高
})
} else {
context.fillText(lines[i] ? lines[i] : '', 129, 495 + (30 * (i - 1)));
}
arr.push(currentLine);
arr.forEach((line, index) => {
context.fillText(line, 129, y + (index * 20)); // 调整行高
})
})
}
let lines1 = this.bdcqz.fj ? this.bdcqz.fj.split('\n') : [];
lines1.forEach((line, index) => {
const y = 100 + (index * 30); // 每行文本的垂直位置
......