106ec41a by renchao@pashanhoo.com

style:证书证明预览

1 parent 2c8b0b2a
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-09-06 15:32:50
* @LastEditTime: 2023-10-25 13:49:56
-->
<template>
<div>
......@@ -67,6 +67,7 @@
import { getPrintTemplateByCode } from "@/api/print";
import { getLodop } from "@/utils/LodopFuncs"
import { readYsxlh, certificate, getBdcqzDetail, invalidCertificate } from "@/api/bdcqz.js";
import { log } from 'bpmn-js-token-simulation';
export default {
props: {
formData: {
......@@ -239,7 +240,7 @@
context.fillText(this.bdcqz.qlxz ? this.bdcqz.qlxz : '', 129, 303);
context.fillText(this.bdcqz.yt ? this.bdcqz.yt : '', 129, 346);
let lines6 = this.bdcqz.mj ? this.bdcqz.mj.split(' ') : [];
if (getByteLen(this.bdcqz.mj) > 41) {
if (getByteLen(this.bdcqz.mj) > 37) {
lines6.forEach((line, index) => {
const y = 378 + (index * 27); // 每行文本的垂直位置
let currentLine = '';
......@@ -247,7 +248,7 @@
for (let word of line) {
const testLine = currentLine + word;
const lineWidth = context.measureText(testLine).width;
if (lineWidth <= 330) {
if (lineWidth <= 336) {
currentLine = testLine;
} else {
arr.push(currentLine);
......@@ -267,7 +268,7 @@
for (let word of line) {
const testLine = currentLine + word;
const lineWidth = context.measureText(testLine).width;
if (lineWidth <= 330) {
if (lineWidth <= 336) {
currentLine = testLine;
} else {
arr.push(currentLine);
......@@ -284,8 +285,8 @@
const maxWidth = 332; // 最大宽度限制
let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : [];
for (let i = 0; i < lines.length; i++) {
let num = Math.ceil(getByteLen(lines[i]) / 41)
if (getByteLen(lines[i]) > 41) {
let num = Math.ceil(getByteLen(lines[i]) / 37)
if (getByteLen(lines[i]) > 37) {
let currentLine = '';
let arr = [];
for (let word of lines[i]) {
......@@ -301,18 +302,18 @@
arr.push(currentLine);
if (i > 0) {
arr.forEach((line, index) => {
context.fillText(line, 129, 480 + (26 * (i - 1)) + 5 * num + (index * 13)); // 调整行高
context.fillText(line, 129, 485 + (26 * (i - 1)) + 5 * num + (index * 15)); // 调整行高
})
} else {
arr.forEach((line, index) => {
context.fillText(line, 129, 480 + (26 * (i - 1)) + (index * 13)); // 调整行高
context.fillText(line, 129, 495 + (26 * (i - 1)) + (index * 13)); // 调整行高
})
}
} else {
if (i > 0) {
context.fillText(lines[i] ? lines[i] : '', 129, 490 + 4 * num + (24 * (i - 1)));
context.fillText(lines[i] ? lines[i] : '', 129, 495 + 4 * num + (24 * (i - 1)));
} else {
context.fillText(lines[i] ? lines[i] : '', 129, 490 + (24 * (i - 1)));
context.fillText(lines[i] ? lines[i] : '', 129, 500 + (24 * (i - 1)));
}
}
}
......@@ -338,7 +339,7 @@
})
})
let lines3 = this.bdcqz.syqx ? this.bdcqz.syqx.split(' ') : [];
if (getByteLen(this.bdcqz.syqx) > 41) {
if (getByteLen(this.bdcqz.syqx) > 37) {
lines3.forEach((line, index) => {
const y = 423 + (index * 27); // 每行文本的垂直位置
let currentLine = '';
......@@ -381,7 +382,7 @@
}
let lines2 = this.bdcqz.zl ? this.bdcqz.zl.split(' ') : [];
if (getByteLen(this.bdcqz.zl) > 41) {
if (getByteLen(this.bdcqz.zl) > 37) {
lines2.forEach((line, index) => {
const y = 170 + (index * 20); // 每行文本的垂直位置
let currentLine = '';
......@@ -469,7 +470,7 @@
// 义务人
context.fillText(this.bdcqz.ywr ? this.bdcqz.ywr : '', 775, 275);
let lines2 = this.bdcqz.zl ? this.bdcqz.zl.split(' ') : [];
if (getByteLen(this.bdcqz.zl) > 41) {
if (getByteLen(this.bdcqz.zl) >= 39) {
lines2.forEach((line, index) => {
const y = 315 + (index * 20); // 每行文本的垂直位置
let currentLine = '';
......@@ -518,6 +519,7 @@
const maxWidth = 290; // 最大宽度限制
let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : [];
for (let i = 0; i < lines.length; i++) {
console.log(getByteLen(lines[i]));
let num = Math.ceil(getByteLen(lines[i]) / 37)
if (getByteLen(lines[i]) > 37) {
let currentLine = '';
......@@ -588,7 +590,6 @@
}
image.src = this.bdczmSrc;
},
// 打印
/**
* @description: 打印
* @author: renchao
......
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-10-19 10:00:27
* @LastEditTime: 2023-10-25 13:50:43
-->
<template>
<div class="from-clues loadingtext" v-Loading="loading" element-loading-text="拼命加载中..." style="height:720px;text-align: center;">
......@@ -163,7 +163,7 @@
context.fillText(this.bdcqz.yt ? this.bdcqz.yt : '', 129, 346);
// context.fillText(this.bdcqz.mj ? this.bdcqz.mj : '', 129, 386);
let lines6 = this.bdcqz.mj ? this.bdcqz.mj.split(' ') : [];
if (getByteLen(this.bdcqz.mj) > 41) {
if (getByteLen(this.bdcqz.mj) > 37) {
lines6.forEach((line, index) => {
const y = 378 + (index * 27); // 每行文本的垂直位置
let currentLine = '';
......@@ -207,8 +207,8 @@
// 权利其他状态
let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : [];
for (let i = 0; i < lines.length; i++) {
let num = Math.ceil(getByteLen(lines[i]) / 38)
if (getByteLen(lines[i]) > 38) {
let num = Math.ceil(getByteLen(lines[i]) / 37)
if (getByteLen(lines[i]) > 37) {
let currentLine = '';
let arr = [];
for (let word of lines[i]) {
......@@ -261,7 +261,7 @@
})
})
let lines3 = this.bdcqz.syqx ? this.bdcqz.syqx.split(' ') : [];
if (getByteLen(this.bdcqz.syqx) > 41) {
if (getByteLen(this.bdcqz.syqx) > 37) {
lines3.forEach((line, index) => {
const y = 423 + (index * 27); // 每行文本的垂直位置
let currentLine = '';
......@@ -304,7 +304,7 @@
}
let lines2 = this.bdcqz.zl ? this.bdcqz.zl.split(' ') : [];
if (getByteLen(this.bdcqz.zl) > 41) {
if (getByteLen(this.bdcqz.zl) > 37) {
lines2.forEach((line, index) => {
const y = 170 + (index * 20); // 每行文本的垂直位置
let currentLine = '';
......