style:证书预览
Showing
2 changed files
with
96 additions
and
15 deletions
1 | <!-- | 1 | <!-- |
2 | * @Description: | 2 | * @Description: |
3 | * @Autor: renchao | 3 | * @Autor: renchao |
4 | * @LastEditTime: 2023-12-18 16:00:55 | 4 | * @LastEditTime: 2024-01-17 09:26:42 |
5 | --> | 5 | --> |
6 | <template> | 6 | <template> |
7 | <div> | 7 | <div> |
... | @@ -327,7 +327,7 @@ | ... | @@ -327,7 +327,7 @@ |
327 | } | 327 | } |
328 | // 权利其他状态 | 328 | // 权利其他状态 |
329 | const maxWidth = 332; // 最大宽度限制 | 329 | const maxWidth = 332; // 最大宽度限制 |
330 | let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : []; | 330 | let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n').filter(i => i && i.trim()) : []; |
331 | for (let i = 0; i < lines.length; i++) { | 331 | for (let i = 0; i < lines.length; i++) { |
332 | let num = Math.ceil(getByteLen(lines[i]) / 37) | 332 | let num = Math.ceil(getByteLen(lines[i]) / 37) |
333 | if (getByteLen(lines[i]) > 37) { | 333 | if (getByteLen(lines[i]) > 37) { |
... | @@ -362,7 +362,7 @@ | ... | @@ -362,7 +362,7 @@ |
362 | } | 362 | } |
363 | } | 363 | } |
364 | 364 | ||
365 | let lines1 = this.bdcqz.fj ? this.bdcqz.fj.split('\n') : []; | 365 | let lines1 = this.bdcqz.fj ? this.bdcqz.fj.split('\n').filter(i => i && i.trim()) : []; |
366 | lines1.forEach((line, index) => { | 366 | lines1.forEach((line, index) => { |
367 | const y = 100 + (index * 30); // 每行文本的垂直位置 | 367 | const y = 100 + (index * 30); // 每行文本的垂直位置 |
368 | let currentLine = ''; | 368 | let currentLine = ''; |
... | @@ -561,7 +561,7 @@ | ... | @@ -561,7 +561,7 @@ |
561 | context.fillText(this.bdcdyh ? this.bdcdyh : '', 775, 373); | 561 | context.fillText(this.bdcdyh ? this.bdcdyh : '', 775, 373); |
562 | // qlqtzk | 562 | // qlqtzk |
563 | const maxWidth = 290; // 最大宽度限制 | 563 | const maxWidth = 290; // 最大宽度限制 |
564 | let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : []; | 564 | let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n').filter(i => i && i.trim()) : []; |
565 | for (let i = 0; i < lines.length; i++) { | 565 | for (let i = 0; i < lines.length; i++) { |
566 | console.log(getByteLen(lines[i])); | 566 | console.log(getByteLen(lines[i])); |
567 | let num = Math.ceil(getByteLen(lines[i]) / 37) | 567 | let num = Math.ceil(getByteLen(lines[i]) / 37) |
... | @@ -597,7 +597,7 @@ | ... | @@ -597,7 +597,7 @@ |
597 | } | 597 | } |
598 | } | 598 | } |
599 | // fj | 599 | // fj |
600 | let lines1 = this.bdcqz.fj ? this.bdcqz.fj.split('\n') : []; | 600 | let lines1 = this.bdcqz.fj ? this.bdcqz.fj.split('\n').filter(i => i && i.trim()) : []; |
601 | for (let i = 0; i < lines1.length; i++) { | 601 | for (let i = 0; i < lines1.length; i++) { |
602 | let num = Math.ceil(getByteLen(lines1[i]) / 37) | 602 | let num = Math.ceil(getByteLen(lines1[i]) / 37) |
603 | if (getByteLen(lines1[i]) > 37) { | 603 | if (getByteLen(lines1[i]) > 37) { | ... | ... |
1 | <!-- | 1 | <!-- |
2 | * @Description: | 2 | * @Description: |
3 | * @Autor: renchao | 3 | * @Autor: renchao |
4 | * @LastEditTime: 2023-12-19 09:17:03 | 4 | * @LastEditTime: 2024-01-17 09:35:40 |
5 | --> | 5 | --> |
6 | <template> | 6 | <template> |
7 | <div class="from-clues loadingtext" v-Loading="loading" element-loading-text="拼命加载中..." style="text-align: center;"> | 7 | <div class="from-clues loadingtext" v-Loading="loading" element-loading-text="拼命加载中..." style="text-align: center;"> |
... | @@ -207,8 +207,6 @@ | ... | @@ -207,8 +207,6 @@ |
207 | this.bdcqz.bdcdyh.slice(12, 19) + ' ' + this.bdcqz.bdcdyh.slice(19, this.bdcqz.bdcdyh.length) | 207 | this.bdcqz.bdcdyh.slice(12, 19) + ' ' + this.bdcqz.bdcdyh.slice(19, this.bdcqz.bdcdyh.length) |
208 | context.fillText(this.bdcdyh ? this.bdcdyh : '', 129, 223); | 208 | context.fillText(this.bdcdyh ? this.bdcdyh : '', 129, 223); |
209 | 209 | ||
210 | |||
211 | |||
212 | context.fillText(this.bdcqz.qllx ? this.bdcqz.qllx : '', 129, 263); | 210 | context.fillText(this.bdcqz.qllx ? this.bdcqz.qllx : '', 129, 263); |
213 | context.fillText(this.bdcqz.qlxz ? this.bdcqz.qlxz : '', 129, 303); | 211 | context.fillText(this.bdcqz.qlxz ? this.bdcqz.qlxz : '', 129, 303); |
214 | context.fillText(this.bdcqz.yt ? this.bdcqz.yt : '', 129, 346); | 212 | context.fillText(this.bdcqz.yt ? this.bdcqz.yt : '', 129, 346); |
... | @@ -256,7 +254,7 @@ | ... | @@ -256,7 +254,7 @@ |
256 | }) | 254 | }) |
257 | } | 255 | } |
258 | // 权利其他状态 | 256 | // 权利其他状态 |
259 | let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : []; | 257 | let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n').filter(i => i && i.trim()) : []; |
260 | for (let i = 0; i < lines.length; i++) { | 258 | for (let i = 0; i < lines.length; i++) { |
261 | let num = Math.ceil(getByteLen(lines[i]) / 38) | 259 | let num = Math.ceil(getByteLen(lines[i]) / 38) |
262 | if (getByteLen(lines[i]) > 37) { | 260 | if (getByteLen(lines[i]) > 37) { |
... | @@ -291,7 +289,7 @@ | ... | @@ -291,7 +289,7 @@ |
291 | } | 289 | } |
292 | } | 290 | } |
293 | 291 | ||
294 | let lines1 = this.bdcqz.fj ? this.bdcqz.fj.split('\n') : []; | 292 | let lines1 = this.bdcqz.fj ? this.bdcqz.fj.split('\n').filter(i => i && i.trim()) : []; |
295 | lines1.forEach((line, index) => { | 293 | lines1.forEach((line, index) => { |
296 | const y = 100 + (index * 30); // 每行文本的垂直位置 | 294 | const y = 100 + (index * 30); // 每行文本的垂直位置 |
297 | let currentLine = ''; | 295 | let currentLine = ''; |
... | @@ -439,13 +437,96 @@ | ... | @@ -439,13 +437,96 @@ |
439 | context.fillText(this.bdcqz.sxqc ? this.bdcqz.sxqc : '', 750, 125); | 437 | context.fillText(this.bdcqz.sxqc ? this.bdcqz.sxqc : '', 750, 125); |
440 | context.fillText(this.bdcqz.sxh ? this.bdcqz.sxh : '', 960, 123); | 438 | context.fillText(this.bdcqz.sxh ? this.bdcqz.sxh : '', 960, 123); |
441 | context.fillText(this.bdcqz.zmqlhsx ? this.bdcqz.zmqlhsx : '', 775, 180); | 439 | context.fillText(this.bdcqz.zmqlhsx ? this.bdcqz.zmqlhsx : '', 775, 180); |
442 | context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 775, 228); | 440 | // context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 775, 228); |
441 | |||
442 | let qlrlines = this.bdcqz.qlr ? this.bdcqz.qlr.split(' ') : []; | ||
443 | if (getByteLen(this.bdcqz.qlr) > 37) { | ||
444 | qlrlines.forEach((line, index) => { | ||
445 | let currentLine = ''; | ||
446 | let arr = []; | ||
447 | for (let word of line) { | ||
448 | const testLine = currentLine + word; | ||
449 | const lineWidth = context.measureText(testLine).width; | ||
450 | if (lineWidth <= 295) { | ||
451 | currentLine = testLine; | ||
452 | } else { | ||
453 | arr.push(currentLine); | ||
454 | currentLine = word; | ||
455 | } | ||
456 | } | ||
457 | arr.push(currentLine); | ||
458 | arr.forEach((line, index) => { | ||
459 | context.fillText(line, 775, 218 + (index * 20)); // 调整行高 | ||
460 | }) | ||
461 | }) | ||
462 | } else { | ||
463 | qlrlines.forEach((line, index) => { | ||
464 | let currentLine = ''; | ||
465 | let arr = []; | ||
466 | for (let word of line) { | ||
467 | const testLine = currentLine + word; | ||
468 | const lineWidth = context.measureText(testLine).width; | ||
469 | if (lineWidth <= 295) { | ||
470 | currentLine = testLine; | ||
471 | } else { | ||
472 | arr.push(currentLine); | ||
473 | currentLine = word; | ||
474 | } | ||
475 | } | ||
476 | arr.push(currentLine); | ||
477 | arr.forEach((line, index) => { | ||
478 | context.fillText(line, 775, 228 + (index * 20)); // 调整行高 | ||
479 | }) | ||
480 | }) | ||
481 | } | ||
482 | |||
483 | |||
443 | // 义务人 | 484 | // 义务人 |
444 | context.fillText(this.bdcqz.ywr ? this.bdcqz.ywr : '', 775, 275); | 485 | let ywrlines = this.bdcqz.ywr ? this.bdcqz.ywr.split(' ') : []; |
486 | if (getByteLen(this.bdcqz.ywr) > 37) { | ||
487 | ywrlines.forEach((line, index) => { | ||
488 | let currentLine = ''; | ||
489 | let arr = []; | ||
490 | for (let word of line) { | ||
491 | const testLine = currentLine + word; | ||
492 | const lineWidth = context.measureText(testLine).width; | ||
493 | if (lineWidth <= 295) { | ||
494 | currentLine = testLine; | ||
495 | } else { | ||
496 | arr.push(currentLine); | ||
497 | currentLine = word; | ||
498 | } | ||
499 | } | ||
500 | arr.push(currentLine); | ||
501 | arr.forEach((line, index) => { | ||
502 | context.fillText(line, 775, 265 + (index * 20)); // 调整行高 | ||
503 | }) | ||
504 | }) | ||
505 | } else { | ||
506 | ywrlines.forEach((line, index) => { | ||
507 | let currentLine = ''; | ||
508 | let arr = []; | ||
509 | for (let word of line) { | ||
510 | const testLine = currentLine + word; | ||
511 | const lineWidth = context.measureText(testLine).width; | ||
512 | if (lineWidth <= 295) { | ||
513 | currentLine = testLine; | ||
514 | } else { | ||
515 | arr.push(currentLine); | ||
516 | currentLine = word; | ||
517 | } | ||
518 | } | ||
519 | arr.push(currentLine); | ||
520 | arr.forEach((line, index) => { | ||
521 | context.fillText(line, 775, 275 + (index * 20)); // 调整行高 | ||
522 | }) | ||
523 | }) | ||
524 | } | ||
525 | |||
445 | // context.fillText(this.bdcqz.zl ? this.bdcqz.zl : '', 775, 325); | 526 | // context.fillText(this.bdcqz.zl ? this.bdcqz.zl : '', 775, 325); |
446 | 527 | ||
447 | let lines2 = this.bdcqz.zl ? this.bdcqz.zl.split(' ') : []; | 528 | let lines2 = this.bdcqz.zl ? this.bdcqz.zl.split(' ') : []; |
448 | if (getByteLen(this.bdcqz.zl) >= 39) { | 529 | if (getByteLen(this.bdcqz.zl) > 37) { |
449 | lines2.forEach((line, index) => { | 530 | lines2.forEach((line, index) => { |
450 | const y = 315 + (index * 20); // 每行文本的垂直位置 | 531 | const y = 315 + (index * 20); // 每行文本的垂直位置 |
451 | let currentLine = ''; | 532 | let currentLine = ''; |
... | @@ -494,7 +575,7 @@ | ... | @@ -494,7 +575,7 @@ |
494 | context.fillText(this.bdcdyh ? this.bdcdyh : '', 775, 373); | 575 | context.fillText(this.bdcdyh ? this.bdcdyh : '', 775, 373); |
495 | // qlqtzk | 576 | // qlqtzk |
496 | const maxWidth = 295; // 最大宽度限制 | 577 | const maxWidth = 295; // 最大宽度限制 |
497 | let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : []; | 578 | let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n').filter(i => i && i.trim()) : []; |
498 | for (let i = 0; i < lines.length; i++) { | 579 | for (let i = 0; i < lines.length; i++) { |
499 | let num = Math.ceil(getByteLen(lines[i]) / 37) | 580 | let num = Math.ceil(getByteLen(lines[i]) / 37) |
500 | if (getByteLen(lines[i]) > 37) { | 581 | if (getByteLen(lines[i]) > 37) { |
... | @@ -529,7 +610,7 @@ | ... | @@ -529,7 +610,7 @@ |
529 | } | 610 | } |
530 | } | 611 | } |
531 | // fj | 612 | // fj |
532 | let lines1 = this.bdcqz.fj ? this.bdcqz.fj.split('\n') : []; | 613 | let lines1 = this.bdcqz.fj ? this.bdcqz.fj.split('\n').filter(i => i && i.trim()) : []; |
533 | for (let i = 0; i < lines1.length; i++) { | 614 | for (let i = 0; i < lines1.length; i++) { |
534 | let num = Math.ceil(getByteLen(lines1[i]) / 37) | 615 | let num = Math.ceil(getByteLen(lines1[i]) / 37) |
535 | if (getByteLen(lines1[i]) > 37) { | 616 | if (getByteLen(lines1[i]) > 37) { | ... | ... |
-
Please register or sign in to post a comment