@@ -115,10 +115,19 @@ export default {
}
},
methods: {
+ determineSize(file) {
+ const isLt5M = file.size / 1024 / 1024 < 5;
+ console.log(isLt5M);
+ if (!isLt5M) {
+ this.$message.error('上传头像图片大小不能超过 5MB!')
+ this.$refs.IDposi.clearFiles();
+ this.$refs.IDnega.clearFiles();
+ return
+ }
+ },
handleUploading(file) {
this.dataList.push(file);
- console.log(this.dataList.length);
-
+ this.determineSize(file)
},
handleDownload(file) {
if (!file || !file.url) {
@@ -165,7 +174,16 @@ export default {
console.error('处理移除文件时出错:', error);
}
},
-
+ reset() {
+ this.name = '';
+ this.gender = '';
+ this.nation = '';
+ this.birth = '';
+ this.address = '';
+ this.id = '';
+ this.authority = '';
+ this.date = '';
+ },
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
@@ -180,19 +198,10 @@ export default {
return;
}
console.log(this.dataList);
- this.name = '';
- this.gender = '';
- this.nation = '';
- this.birth = '';
- this.address = '';
- this.id = '';
- this.authority = '';
- this.date = '';
+ this.reset();
let formData = new FormData();
-
formData.append('type', 1)
console.log(formData.getAll('type'))
-
Object.keys(this.dataList).forEach(item => {
formData.append('files', this.dataList[item].raw)
})
@@ -200,7 +209,6 @@ export default {
this.$modal.loading("数据上传中,请稍后。。。");
updateIDCardPic(formData).then(res => {
if (res.code == 200) {
-
this.name = res.data.data.data.name;
this.gender = res.data.data.data.gender;
this.nation = res.data.data.data.ethnicity;
@@ -211,29 +219,22 @@ export default {
this.date = res.data.data.data.validTime;
if (res.data.data.code == 20000) {
this.$modal.msgSuccess("识别成功");
-
}
else if (res.data.data.code == 20001) {
this.$modal.msgError("身份证信息不完整,请重新上传");
- }
+ }
else if (res.data.data.code == 20003) {
this.$modal.msgError("图片base64编码转换异常,请重新上传");
}
else if (res.data.data.code == 20005) {
this.$modal.msgError("没有识别到文字,请传入正常的身份证图片");
- }
- else {
-
}
this.$modal.closeLoading();
}
-
this.$emit('custom-event');
this.open = false;
-
}).catch(error => {
- // if()
- this.$modal.msgError("出错了,请重新上传图片");
+ this.$modal.msgError("识别失败,请重新上传");
this.$modal.closeLoading();
})
},
diff --git a/src/views/updateIDCard/pieIDResultCount.vue b/src/views/updateIDCard/pieIDResultCount.vue
index 1b4341a..e59bb94 100644
--- a/src/views/updateIDCard/pieIDResultCount.vue
+++ b/src/views/updateIDCard/pieIDResultCount.vue
@@ -3,10 +3,10 @@
- 调用正确数
+ 调用正确率
- 调用失败数
+ 调用失败率
diff --git a/src/views/updateIDCard/updateIDCard.vue b/src/views/updateIDCard/updateIDCard.vue
index a52f918..ea8111c 100644
--- a/src/views/updateIDCard/updateIDCard.vue
+++ b/src/views/updateIDCard/updateIDCard.vue
@@ -60,10 +60,6 @@ export default {
props: {
value: [String, Object, Array],
// 图片数量限制
- limit: {
- type: Number,
- default: 1,
- },
// 大小限制(MB)
fileSize: {
type: Number,
@@ -93,8 +89,7 @@ export default {
data() {
return {
- dataList: [],
-
+ dataList: [],
}
},
methods: {
@@ -104,11 +99,9 @@ export default {
this.$refs.rectData.getRectIDData();
this.$refs.listWatch.getListWatchData();
}
-
}
}
-
\ No newline at end of file