style:证书预览
Showing
1 changed file
with
41 additions
and
19 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Description: | 2 | * @Description: |
| 3 | * @Autor: renchao | 3 | * @Autor: renchao |
| 4 | * @LastEditTime: 2023-08-25 09:23:55 | 4 | * @LastEditTime: 2023-08-25 09:31:57 |
| 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;"> |
| ... | @@ -148,7 +148,7 @@ | ... | @@ -148,7 +148,7 @@ |
| 148 | context.fillText(this.bdcqz.mj ? this.bdcqz.mj : '', 129, 386); | 148 | context.fillText(this.bdcqz.mj ? this.bdcqz.mj : '', 129, 386); |
| 149 | // context.fillText(this.bdcqz.syqx ? this.bdcqz.syqx : '', 129, 429); | 149 | // context.fillText(this.bdcqz.syqx ? this.bdcqz.syqx : '', 129, 429); |
| 150 | // qlqtzk | 150 | // qlqtzk |
| 151 | const maxWidth = 336; // 最大宽度限制 | 151 | const maxWidth = 333; // 最大宽度限制 |
| 152 | let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : []; | 152 | let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : []; |
| 153 | lines.forEach((line, index) => { | 153 | lines.forEach((line, index) => { |
| 154 | const y = 463 + (index * 40); // 每行文本的垂直位置 | 154 | const y = 463 + (index * 40); // 每行文本的垂直位置 |
| ... | @@ -190,25 +190,47 @@ | ... | @@ -190,25 +190,47 @@ |
| 190 | }) | 190 | }) |
| 191 | }) | 191 | }) |
| 192 | let lines3 = this.bdcqz.syqx ? this.bdcqz.syqx.split(' ') : []; | 192 | let lines3 = this.bdcqz.syqx ? this.bdcqz.syqx.split(' ') : []; |
| 193 | lines3.forEach((line, index) => { | 193 | if (lines3.length >= 22) { |
| 194 | const y = 423 + (index * 27); // 每行文本的垂直位置 | 194 | lines3.forEach((line, index) => { |
| 195 | let currentLine = ''; | 195 | const y = 423 + (index * 27); // 每行文本的垂直位置 |
| 196 | let arr = []; | 196 | let currentLine = ''; |
| 197 | for (let word of line) { | 197 | let arr = []; |
| 198 | const testLine = currentLine + word; | 198 | for (let word of line) { |
| 199 | const lineWidth = context.measureText(testLine).width; | 199 | const testLine = currentLine + word; |
| 200 | if (lineWidth <= 315) { | 200 | const lineWidth = context.measureText(testLine).width; |
| 201 | currentLine = testLine; | 201 | if (lineWidth <= 315) { |
| 202 | } else { | 202 | currentLine = testLine; |
| 203 | arr.push(currentLine); | 203 | } else { |
| 204 | currentLine = word; | 204 | arr.push(currentLine); |
| 205 | currentLine = word; | ||
| 206 | } | ||
| 205 | } | 207 | } |
| 206 | } | 208 | arr.push(currentLine); |
| 207 | arr.push(currentLine); | 209 | arr.forEach((line, index) => { |
| 208 | arr.forEach((line, index) => { | 210 | context.fillText(line, 129, y + (index * 20)); // 调整行高 |
| 209 | context.fillText(line, 129, y + (index * 20)); // 调整行高 | 211 | }) |
| 210 | }) | 212 | }) |
| 211 | }) | 213 | } else { |
| 214 | lines3.forEach((line, index) => { | ||
| 215 | const y = 430 + (index * 27); // 每行文本的垂直位置 | ||
| 216 | let currentLine = ''; | ||
| 217 | let arr = []; | ||
| 218 | for (let word of line) { | ||
| 219 | const testLine = currentLine + word; | ||
| 220 | const lineWidth = context.measureText(testLine).width; | ||
| 221 | if (lineWidth <= 315) { | ||
| 222 | currentLine = testLine; | ||
| 223 | } else { | ||
| 224 | arr.push(currentLine); | ||
| 225 | currentLine = word; | ||
| 226 | } | ||
| 227 | } | ||
| 228 | arr.push(currentLine); | ||
| 229 | arr.forEach((line, index) => { | ||
| 230 | context.fillText(line, 129, y + (index * 20)); // 调整行高 | ||
| 231 | }) | ||
| 232 | }) | ||
| 233 | } | ||
| 212 | 234 | ||
| 213 | 235 | ||
| 214 | 236 | ... | ... |
-
Please register or sign in to post a comment