Merge branch 'dev' of http://yun.pashanhoo.com:9090/bdc/bdcdj-web into dev
Showing
3 changed files
with
48 additions
and
8 deletions
| ... | @@ -67,6 +67,9 @@ export function uploadSjClmx (data) { | ... | @@ -67,6 +67,9 @@ export function uploadSjClmx (data) { |
| 67 | return request({ | 67 | return request({ |
| 68 | url: SERVER.SERVERAPI + '/rest/ywbl/clxx/uploadSjClmx', | 68 | url: SERVER.SERVERAPI + '/rest/ywbl/clxx/uploadSjClmx', |
| 69 | method: 'post', | 69 | method: 'post', |
| 70 | headers: { | ||
| 71 | 'Content-Type': 'multipart/form-data' | ||
| 72 | }, | ||
| 70 | data | 73 | data |
| 71 | }) | 74 | }) |
| 72 | } | 75 | } | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Description: | 2 | * @Description: |
| 3 | * @Autor: renchao | 3 | * @Autor: renchao |
| 4 | * @LastEditTime: 2023-06-14 09:25:12 | 4 | * @LastEditTime: 2023-06-14 11:10:26 |
| 5 | --> | 5 | --> |
| 6 | <template> | 6 | <template> |
| 7 | <div class="rlPopup"> | 7 | <div class="rlPopup"> |
| ... | @@ -127,6 +127,29 @@ | ... | @@ -127,6 +127,29 @@ |
| 127 | * @author: renchao | 127 | * @author: renchao |
| 128 | */ | 128 | */ |
| 129 | handleViewScan () { | 129 | handleViewScan () { |
| 130 | function dataURLtoBlob (base64String) { | ||
| 131 | const arr = base64String.split(','); | ||
| 132 | if (arr.length !== 2) { | ||
| 133 | throw new Error('Invalid Base64 format'); | ||
| 134 | } | ||
| 135 | const mime = arr[0].match(/:(.*?);/)[1]; | ||
| 136 | if (!mime) { | ||
| 137 | throw new Error('Cannot retrieve MIME type'); | ||
| 138 | } | ||
| 139 | const bstr = atob(arr[1]); | ||
| 140 | const n = bstr.length; | ||
| 141 | const u8arr = new Uint8Array(n); | ||
| 142 | for (let i = 0; i < n; i++) { | ||
| 143 | u8arr[i] = bstr.charCodeAt(i); | ||
| 144 | } | ||
| 145 | return new Blob([u8arr], { type: mime }); | ||
| 146 | } | ||
| 147 | function blobToFile (blob) { | ||
| 148 | const options = { type: blob.type }; | ||
| 149 | const file = new File([blob], options); | ||
| 150 | return file; | ||
| 151 | } | ||
| 152 | |||
| 130 | let data = { | 153 | let data = { |
| 131 | "filepath": "base64", | 154 | "filepath": "base64", |
| 132 | "rotate": "0", | 155 | "rotate": "0", |
| ... | @@ -136,7 +159,21 @@ | ... | @@ -136,7 +159,21 @@ |
| 136 | "quality": "3" | 159 | "quality": "3" |
| 137 | } | 160 | } |
| 138 | axios.post("http://127.0.0.1:38088/video=grabimage", JSON.stringify(data)).then((res) => { | 161 | axios.post("http://127.0.0.1:38088/video=grabimage", JSON.stringify(data)).then((res) => { |
| 139 | console.log(res.data); | 162 | let blob = dataURLtoBlob('data:image/png;base64,' + res.data.photoBase64); |
| 163 | let file = blobToFile(blob); | ||
| 164 | var formData = new FormData(); | ||
| 165 | formData.append('file', file.raw) | ||
| 166 | formData.append("bsmSj", this.previewImg.bsmSj); | ||
| 167 | formData.append("bsmSlsq", this.previewImg.bsmSlsq); | ||
| 168 | uploadSjClmx(formData).then((res) => { | ||
| 169 | if (res.code == 200) { | ||
| 170 | this.$emit('updateList', res.result) | ||
| 171 | this.$message({ | ||
| 172 | message: '上传成功!', | ||
| 173 | type: 'success' | ||
| 174 | }) | ||
| 175 | } | ||
| 176 | }) | ||
| 140 | }) | 177 | }) |
| 141 | }, | 178 | }, |
| 142 | prev () { | 179 | prev () { |
| ... | @@ -189,8 +226,6 @@ | ... | @@ -189,8 +226,6 @@ |
| 189 | this.$refs.upload.clearFiles(); | 226 | this.$refs.upload.clearFiles(); |
| 190 | setTimeout(() => { | 227 | setTimeout(() => { |
| 191 | if (length !== this.maxLength) return | 228 | if (length !== this.maxLength) return |
| 192 | console.log(files); | ||
| 193 | // let data = _.cloneDeep(this.previewImg.imgList[this.previewImg.index]) | ||
| 194 | var formData = new FormData(); | 229 | var formData = new FormData(); |
| 195 | files.forEach(file => { | 230 | files.forEach(file => { |
| 196 | formData.append('file', file.raw) | 231 | formData.append('file', file.raw) |
| ... | @@ -204,10 +239,9 @@ | ... | @@ -204,10 +239,9 @@ |
| 204 | message: '上传成功!', | 239 | message: '上传成功!', |
| 205 | type: 'success' | 240 | type: 'success' |
| 206 | }) | 241 | }) |
| 207 | |||
| 208 | } | 242 | } |
| 209 | }) | 243 | }) |
| 210 | }) | 244 | }, 0) |
| 211 | }, | 245 | }, |
| 212 | handleDelete () { | 246 | handleDelete () { |
| 213 | let that = this | 247 | let that = this | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Description: | 2 | * @Description: |
| 3 | * @Autor: renchao | 3 | * @Autor: renchao |
| 4 | * @LastEditTime: 2023-06-14 09:01:30 | 4 | * @LastEditTime: 2023-06-14 09:47:38 |
| 5 | --> | 5 | --> |
| 6 | <template> | 6 | <template> |
| 7 | <div> | 7 | <div> |
| ... | @@ -201,8 +201,11 @@ | ... | @@ -201,8 +201,11 @@ |
| 201 | if (res.data.code == 0) { | 201 | if (res.data.code == 0) { |
| 202 | let data = res.data.IDCardInfo | 202 | let data = res.data.IDCardInfo |
| 203 | row.sqrmc = data.name | 203 | row.sqrmc = data.name |
| 204 | row.zjzl = 1 | 204 | row.zjzl = '1' |
| 205 | row.zjh = data.cardID | 205 | row.zjh = data.cardID |
| 206 | row.xb = data.sexCode | ||
| 207 | row.txdz = data.address | ||
| 208 | row.fzjg = data.issueOrgan | ||
| 206 | this.$message({ | 209 | this.$message({ |
| 207 | message: '读取成功!', | 210 | message: '读取成功!', |
| 208 | type: 'success' | 211 | type: 'success' | ... | ... |
-
Please register or sign in to post a comment