cc616e46 by renchao@pashanhoo.com

style;证书预览

1 parent 5f8c1bc9
...@@ -189,30 +189,52 @@ ...@@ -189,30 +189,52 @@
189 }) 189 })
190 }) 190 })
191 } 191 }
192
193 // context.fillText(this.bdcqz.syqx ? this.bdcqz.syqx : '', 129, 429); 192 // context.fillText(this.bdcqz.syqx ? this.bdcqz.syqx : '', 129, 429);
194 // qlqtzk 193 // 权利其他状态
195 const maxWidth = 330; // 最大宽度限制 194 const maxWidth = 332; // 最大宽度限制
196 let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : []; 195 let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : [];
197 lines.forEach((line, index) => { 196 // lines.forEach((line, index) => {
198 const y = 463 + (index * 40); // 每行文本的垂直位置 197 // const y = 463 + (index * 33); // 每行文本的垂直位置
199 let currentLine = ''; 198 // let currentLine = '';
200 let arr = []; 199 // let arr = [];
201 for (let word of line) { 200 // for (let word of line) {
202 const testLine = currentLine + word; 201 // const testLine = currentLine + word;
203 const lineWidth = context.measureText(testLine).width; 202 // const lineWidth = context.measureText(testLine).width;
204 if (lineWidth <= maxWidth) { 203 // if (lineWidth <= maxWidth) {
205 currentLine = testLine; 204 // currentLine = testLine;
206 } else { 205 // } else {
207 arr.push(currentLine); 206 // arr.push(currentLine);
208 currentLine = word; 207 // currentLine = word;
208 // }
209 // }
210 // arr.push(currentLine);
211 // arr.forEach((line, index) => {
212 // context.fillText(line, 129, y + (index * 17)); // 调整行高
213 // })
214 // })
215 for (let i = 0; i < lines.length; i++) {
216 if (getByteLen(lines[i]) > 41) {
217 let currentLine = '';
218 let arr = [];
219 for (let word of lines[i]) {
220 const testLine = currentLine + word;
221 const lineWidth = context.measureText(testLine).width;
222 if (lineWidth <= maxWidth) {
223 currentLine = testLine;
224 } else {
225 arr.push(currentLine);
226 currentLine = word;
227 }
209 } 228 }
229 arr.push(currentLine);
230 arr.forEach((line, index) => {
231 context.fillText(line, 129, 490 + (28 * (i - 1)) + (index * 14)); // 调整行高
232 })
233 } else {
234 context.fillText(lines[i] ? lines[i] : '', 129, 495 + (30 * (i - 1)));
210 } 235 }
211 arr.push(currentLine); 236 }
212 arr.forEach((line, index) => { 237
213 context.fillText(line, 129, y + (index * 20)); // 调整行高
214 })
215 })
216 let lines1 = this.bdcqz.fj ? this.bdcqz.fj.split('\n') : []; 238 let lines1 = this.bdcqz.fj ? this.bdcqz.fj.split('\n') : [];
217 lines1.forEach((line, index) => { 239 lines1.forEach((line, index) => {
218 const y = 100 + (index * 30); // 每行文本的垂直位置 240 const y = 100 + (index * 30); // 每行文本的垂直位置
......