style:证书预览
Showing
1 changed file
with
54 additions
and
6 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Description: | 2 | * @Description: |
| 3 | * @Autor: renchao | 3 | * @Autor: renchao |
| 4 | * @LastEditTime: 2023-08-16 17:02:36 | 4 | * @LastEditTime: 2023-08-16 17:31:25 |
| 5 | --> | 5 | --> |
| 6 | <template> | 6 | <template> |
| 7 | <div class="from-clues loadingtext" v-Loading="loading" element-loading-text="拼命加载中..." style="height:720px;text-align: center;"> | 7 | <div class="from-clues loadingtext" v-Loading="loading" element-loading-text="拼命加载中..." style="height:720px;text-align: center;"> |
| ... | @@ -12,8 +12,8 @@ | ... | @@ -12,8 +12,8 @@ |
| 12 | </el-tab-pane> | 12 | </el-tab-pane> |
| 13 | </el-tabs> | 13 | </el-tabs> |
| 14 | <el-empty description="暂无数据" v-if="headTabBdcqz.length == 0 && noData"></el-empty> | 14 | <el-empty description="暂无数据" v-if="headTabBdcqz.length == 0 && noData"></el-empty> |
| 15 | <canvas ref="zs" width="1000" v-show="headTabBdcqz[0]&&headTabBdcqz[0].bdcqzlx==1" height="700"></canvas> | 15 | <canvas ref="zs" width="1024" v-show="headTabBdcqz[0]&&headTabBdcqz[0].bdcqzlx==1" height="739"></canvas> |
| 16 | <canvas ref="zm" width="1180" v-show="headTabBdcqz[0]&&headTabBdcqz[0].bdcqzlx!=1" height="780"></canvas> | 16 | <canvas ref="zm" width="1169" v-show="headTabBdcqz[0]&&headTabBdcqz[0].bdcqzlx!=1" height="828"></canvas> |
| 17 | </div> | 17 | </div> |
| 18 | </template> | 18 | </template> |
| 19 | 19 | ||
| ... | @@ -266,7 +266,7 @@ | ... | @@ -266,7 +266,7 @@ |
| 266 | const image = new Image(); | 266 | const image = new Image(); |
| 267 | image.onload = () => { | 267 | image.onload = () => { |
| 268 | context.drawImage(image, 0, 0); | 268 | context.drawImage(image, 0, 0); |
| 269 | context.font = '18px 楷体'; | 269 | context.font = '16px 楷体'; |
| 270 | context.fillStyle = '#000000'; | 270 | context.fillStyle = '#000000'; |
| 271 | // ysxlh | 271 | // ysxlh |
| 272 | context.fillText(this.bdcqz.ysxlh ? this.bdcqz.ysxlh : '', 280, 712); | 272 | context.fillText(this.bdcqz.ysxlh ? this.bdcqz.ysxlh : '', 280, 712); |
| ... | @@ -285,9 +285,57 @@ | ... | @@ -285,9 +285,57 @@ |
| 285 | context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 775, 228); | 285 | context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 775, 228); |
| 286 | // 义务人 | 286 | // 义务人 |
| 287 | context.fillText(this.bdcqz.ywr ? this.bdcqz.ywr : '', 775, 275); | 287 | context.fillText(this.bdcqz.ywr ? this.bdcqz.ywr : '', 775, 275); |
| 288 | context.fillText(this.bdcqz.zl ? this.bdcqz.zl : '', 775, 325); | 288 | |
| 289 | let lines2 = this.bdcqz.zl ? this.bdcqz.zl.split(' ') : []; | ||
| 290 | if (lines2.length > 22) { | ||
| 291 | lines2.forEach((line, index) => { | ||
| 292 | const y = 305 + (index * 20); // 每行文本的垂直位置 | ||
| 293 | let currentLine = ''; | ||
| 294 | let arr = []; | ||
| 295 | for (let word of line) { | ||
| 296 | const testLine = currentLine + word; | ||
| 297 | const lineWidth = context.measureText(testLine).width; | ||
| 298 | if (lineWidth <= 360) { | ||
| 299 | currentLine = testLine; | ||
| 300 | } else { | ||
| 301 | arr.push(currentLine); | ||
| 302 | currentLine = word; | ||
| 303 | } | ||
| 304 | } | ||
| 305 | arr.push(currentLine); | ||
| 306 | arr.forEach((line, index) => { | ||
| 307 | context.fillText(line, 775, y + (index * 20)); // 调整行高 | ||
| 308 | }) | ||
| 309 | }) | ||
| 310 | } else { | ||
| 311 | lines2.forEach((line, index) => { | ||
| 312 | const y = 325 + (index * 20); // 每行文本的垂直位置 | ||
| 313 | let currentLine = ''; | ||
| 314 | let arr = []; | ||
| 315 | for (let word of line) { | ||
| 316 | const testLine = currentLine + word; | ||
| 317 | const lineWidth = context.measureText(testLine).width; | ||
| 318 | if (lineWidth <= 360) { | ||
| 319 | currentLine = testLine; | ||
| 320 | } else { | ||
| 321 | arr.push(currentLine); | ||
| 322 | currentLine = word; | ||
| 323 | } | ||
| 324 | } | ||
| 325 | arr.push(currentLine); | ||
| 326 | arr.forEach((line, index) => { | ||
| 327 | context.fillText(line, 775, y + (index * 20)); // 调整行高 | ||
| 328 | }) | ||
| 329 | }) | ||
| 330 | } | ||
| 331 | |||
| 332 | |||
| 289 | // bdcdyh | 333 | // bdcdyh |
| 290 | context.fillText(this.bdcqz.bdcdyh ? this.bdcqz.bdcdyh : '', 775, 373); | 334 | this.bdcdyh = this.bdcqz.bdcdyh.slice(0, 6) + ' ' + this.bdcqz.bdcdyh.slice(6, 12) + ' ' + |
| 335 | this.bdcqz.bdcdyh.slice(12, 19) + ' ' + this.bdcqz.bdcdyh.slice(19, this.bdcqz.bdcdyh.length) | ||
| 336 | context.fillText(this.bdcdyh ? this.bdcdyh : '', 775, 373); | ||
| 337 | |||
| 338 | |||
| 291 | // qlqtzk | 339 | // qlqtzk |
| 292 | const maxWidth = 280; // 最大宽度限制 | 340 | const maxWidth = 280; // 最大宽度限制 |
| 293 | let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : []; | 341 | let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : []; | ... | ... |
-
Please register or sign in to post a comment