style:证书预览
Showing
1 changed file
with
24 additions
and
2 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,6 +190,7 @@ | ... | @@ -190,6 +190,7 @@ |
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 | if (lines3.length >= 22) { | ||
193 | lines3.forEach((line, index) => { | 194 | lines3.forEach((line, index) => { |
194 | const y = 423 + (index * 27); // 每行文本的垂直位置 | 195 | const y = 423 + (index * 27); // 每行文本的垂直位置 |
195 | let currentLine = ''; | 196 | let currentLine = ''; |
... | @@ -209,6 +210,27 @@ | ... | @@ -209,6 +210,27 @@ |
209 | context.fillText(line, 129, y + (index * 20)); // 调整行高 | 210 | context.fillText(line, 129, y + (index * 20)); // 调整行高 |
210 | }) | 211 | }) |
211 | }) | 212 | }) |
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