ae1a2884 by renchao@pashanhoo.com

style:扫描仪

1 parent 524cc4e6
......@@ -67,6 +67,9 @@ export function uploadSjClmx (data) {
return request({
url: SERVER.SERVERAPI + '/rest/ywbl/clxx/uploadSjClmx',
method: 'post',
headers: {
'Content-Type': 'multipart/form-data'
},
data
})
}
......
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-06-14 09:25:12
* @LastEditTime: 2023-06-14 11:10:26
-->
<template>
<div class="rlPopup">
......@@ -127,6 +127,29 @@
* @author: renchao
*/
handleViewScan () {
function dataURLtoBlob (base64String) {
const arr = base64String.split(',');
if (arr.length !== 2) {
throw new Error('Invalid Base64 format');
}
const mime = arr[0].match(/:(.*?);/)[1];
if (!mime) {
throw new Error('Cannot retrieve MIME type');
}
const bstr = atob(arr[1]);
const n = bstr.length;
const u8arr = new Uint8Array(n);
for (let i = 0; i < n; i++) {
u8arr[i] = bstr.charCodeAt(i);
}
return new Blob([u8arr], { type: mime });
}
function blobToFile (blob) {
const options = { type: blob.type };
const file = new File([blob], options);
return file;
}
let data = {
"filepath": "base64",
"rotate": "0",
......@@ -136,7 +159,21 @@
"quality": "3"
}
axios.post("http://127.0.0.1:38088/video=grabimage", JSON.stringify(data)).then((res) => {
console.log(res.data);
let blob = dataURLtoBlob('data:image/png;base64,' + res.data.photoBase64);
let file = blobToFile(blob);
var formData = new FormData();
formData.append('file', file.raw)
formData.append("bsmSj", this.previewImg.bsmSj);
formData.append("bsmSlsq", this.previewImg.bsmSlsq);
uploadSjClmx(formData).then((res) => {
if (res.code == 200) {
this.$emit('updateList', res.result)
this.$message({
message: '上传成功!',
type: 'success'
})
}
})
})
},
prev () {
......@@ -189,8 +226,6 @@
this.$refs.upload.clearFiles();
setTimeout(() => {
if (length !== this.maxLength) return
console.log(files);
// let data = _.cloneDeep(this.previewImg.imgList[this.previewImg.index])
var formData = new FormData();
files.forEach(file => {
formData.append('file', file.raw)
......@@ -204,10 +239,9 @@
message: '上传成功!',
type: 'success'
})
}
})
})
}, 0)
},
handleDelete () {
let that = this
......
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-06-14 09:01:30
* @LastEditTime: 2023-06-14 09:47:38
-->
<template>
<div>
......@@ -201,8 +201,11 @@
if (res.data.code == 0) {
let data = res.data.IDCardInfo
row.sqrmc = data.name
row.zjzl = 1
row.zjzl = '1'
row.zjh = data.cardID
row.xb = data.sexCode
row.txdz = data.address
row.fzjg = data.issueOrgan
this.$message({
message: '读取成功!',
type: 'success'
......