style:证书预览
Showing
1 changed file
with
46 additions
and
17 deletions
1 | <!-- | 1 | <!-- |
2 | * @Description: | 2 | * @Description: |
3 | * @Autor: renchao | 3 | * @Autor: renchao |
4 | * @LastEditTime: 2023-05-17 10:40:23 | 4 | * @LastEditTime: 2023-05-29 14:22:48 |
5 | --> | 5 | --> |
6 | <template> | 6 | <template> |
7 | <div class="from-clues loadingtext" v-Loading="loading" element-loading-text="拼命加载中..." style="height:720px"> | 7 | <div class="from-clues loadingtext" v-Loading="loading" element-loading-text="拼命加载中..." style="height:720px"> |
... | @@ -11,7 +11,8 @@ | ... | @@ -11,7 +11,8 @@ |
11 | v-for="(item, index) in headTabBdcqz" :key="index"></el-tab-pane> | 11 | v-for="(item, index) in headTabBdcqz" :key="index"></el-tab-pane> |
12 | </el-tabs> | 12 | </el-tabs> |
13 | <div class="no-data" v-if="headTabBdcqz.length == 0">暂无数据</div> | 13 | <div class="no-data" v-if="headTabBdcqz.length == 0">暂无数据</div> |
14 | <img :src="previewImage" class="imgClass"> | 14 | <!-- <img :src="previewImage" class="imgClass"> --> |
15 | <canvas ref="canvas" :width="canvasWidth" :height="canvasHeight"></canvas> | ||
15 | </div> | 16 | </div> |
16 | </template> | 17 | </template> |
17 | 18 | ||
... | @@ -20,8 +21,6 @@ | ... | @@ -20,8 +21,6 @@ |
20 | import { getSlsqBdcqzList, bdcqzPreview } from "@/api/bdcqz.js" | 21 | import { getSlsqBdcqzList, bdcqzPreview } from "@/api/bdcqz.js" |
21 | export default { | 22 | export default { |
22 | name: "zsyl", | 23 | name: "zsyl", |
23 | components: { | ||
24 | }, | ||
25 | props: { | 24 | props: { |
26 | formData: { | 25 | formData: { |
27 | type: Object, | 26 | type: Object, |
... | @@ -30,6 +29,10 @@ | ... | @@ -30,6 +29,10 @@ |
30 | }, | 29 | }, |
31 | data () { | 30 | data () { |
32 | return { | 31 | return { |
32 | imgSrc: require('@/image/bdcqz/bdcqzs2.jpg'), | ||
33 | canvasWidth: 1018, | ||
34 | canvasHeight: 720, | ||
35 | |||
33 | loading: false, | 36 | loading: false, |
34 | //印刷序列号集合 | 37 | //印刷序列号集合 |
35 | ysxlh: [], | 38 | ysxlh: [], |
... | @@ -79,28 +82,54 @@ | ... | @@ -79,28 +82,54 @@ |
79 | this.activeName = res.result[0].bsmBdcqz | 82 | this.activeName = res.result[0].bsmBdcqz |
80 | this.bdcqz = res.result[0] | 83 | this.bdcqz = res.result[0] |
81 | this.headTabBdcqz = res.result | 84 | this.headTabBdcqz = res.result |
82 | this.getBdcqzPreview(); | 85 | this.drawTextOnImage(); |
83 | } else { | ||
84 | this.loading = false | ||
85 | } | 86 | } |
86 | } | 87 | } |
87 | 88 | this.loading = false | |
88 | }) | 89 | }) |
89 | }, | 90 | }, |
90 | //tab表头切换方法 | 91 | //tab表头切换方法 |
91 | handleClick (e) { | 92 | handleClick (e) { |
92 | this.bdcqz = this.headTabBdcqz[e.index - 0] | 93 | this.bdcqz = this.headTabBdcqz[e.index - 0] |
93 | this.activeName = this.headTabBdcqz.bsmBdcqz | 94 | this.activeName = this.headTabBdcqz.bsmBdcqz |
94 | this.getBdcqzPreview(); | 95 | // this.getBdcqzPreview(); |
95 | }, | 96 | this.drawTextOnImage() |
96 | getBdcqzPreview () { | ||
97 | bdcqzPreview(this.bdcqz).then(res => { | ||
98 | this.loading = false | ||
99 | let blob = new Blob([res]); | ||
100 | let url = window.URL.createObjectURL(blob); | ||
101 | this.previewImage = url; | ||
102 | }) | ||
103 | }, | 97 | }, |
98 | // getBdcqzPreview () { | ||
99 | // bdcqzPreview(this.bdcqz).then(res => { | ||
100 | // this.loading = false | ||
101 | // let blob = new Blob([res]); | ||
102 | // let url = window.URL.createObjectURL(blob); | ||
103 | // this.previewImage = url; | ||
104 | // this.drawTextOnImage() | ||
105 | // }) | ||
106 | // }, | ||
107 | drawTextOnImage () { | ||
108 | const canvas = this.$refs.canvas; | ||
109 | const context = canvas.getContext('2d'); | ||
110 | const image = new Image(); | ||
111 | image.onload = () => { | ||
112 | context.drawImage(image, 0, 0); | ||
113 | context.font = '15px 楷体'; | ||
114 | context.fillStyle = '#000000'; | ||
115 | context.fillText(this.bdcqz.sjjc ? this.bdcqz.sjjc : '', 60, 56); | ||
116 | context.fillText(this.bdcqz.djnd ? this.bdcqz.djnd : '', 113, 56); | ||
117 | context.fillText(this.bdcqz.sxqc ? this.bdcqz.sxqc : '', 180, 56); | ||
118 | context.fillText(this.bdcqz.sxh ? this.bdcqz.sxh : '', 370, 56); | ||
119 | context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 138, 97); | ||
120 | context.fillText(this.bdcqz.gyqk ? this.bdcqz.gyqk : '', 138, 138); | ||
121 | context.fillText(this.bdcqz.zl ? this.bdcqz.zl : '', 138, 180); | ||
122 | context.fillText(this.bdcqz.bdcdyh ? this.bdcqz.bdcdyh : '', 138, 223); | ||
123 | context.fillText(this.bdcqz.qllx ? this.bdcqz.qllx : '', 138, 263); | ||
124 | context.fillText(this.bdcqz.qlxz ? this.bdcqz.qlxz : '', 138, 303); | ||
125 | context.fillText(this.bdcqz.yt ? this.bdcqz.yt : '', 138, 346); | ||
126 | context.fillText(this.bdcqz.mj ? this.bdcqz.mj : '', 138, 386); | ||
127 | context.fillText(this.bdcqz.syqx ? this.bdcqz.syqx : '', 138, 429); | ||
128 | context.fillText(this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk : '', 138, 469); | ||
129 | context.fillText(this.bdcqz.fj ? this.bdcqz.fj : '', 580, 100); | ||
130 | } | ||
131 | image.src = this.imgSrc; | ||
132 | } | ||
104 | } | 133 | } |
105 | } | 134 | } |
106 | </script> | 135 | </script> | ... | ... |
-
Please register or sign in to post a comment