人员管理(劳务人员):新增上传现场采集人脸压缩逻辑
This commit is contained in:
parent
127eac97b1
commit
a5fc697513
@ -1534,7 +1534,9 @@
|
|||||||
:show-file-list="false"
|
:show-file-list="false"
|
||||||
:file-list="idCardUpPhotoFile"
|
:file-list="idCardUpPhotoFile"
|
||||||
:disabled="titleType == 'detail'"
|
:disabled="titleType == 'detail'"
|
||||||
:http-request="handleUpload"
|
:http-request="
|
||||||
|
(val) => handleUpload(val, 'idCardAvatar')
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
size="medium"
|
size="medium"
|
||||||
@ -1587,18 +1589,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<el-upload
|
<el-upload
|
||||||
class="upload-demo"
|
class="upload-demo"
|
||||||
:action="uploadUrl"
|
action="uploadUrl"
|
||||||
:on-remove="(file) => handleRemove(file, 7)"
|
:on-remove="(file) => handleRemove(file, 7)"
|
||||||
:on-success="
|
|
||||||
(res, file, filelist) => handleSuccess(res, 7, file)
|
|
||||||
"
|
|
||||||
:on-error="(file) => handleError(file, 7)"
|
|
||||||
:on-preview="(file) => handlePreview(file, 7)"
|
:on-preview="(file) => handlePreview(file, 7)"
|
||||||
:before-upload="(file) => handleBeforeUpload(file, 7)"
|
:before-upload="(file) => handleBeforeUpload(file, 7)"
|
||||||
name="files"
|
|
||||||
:file-list="fieldAcquisitionFile"
|
:file-list="fieldAcquisitionFile"
|
||||||
:disabled="titleType == 'detail'"
|
:disabled="titleType == 'detail'"
|
||||||
:show-file-list="false"
|
:show-file-list="false"
|
||||||
|
:http-request="(val) => handleUpload(val, 'livesFace')"
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
size="medium"
|
size="medium"
|
||||||
@ -2239,29 +2237,39 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleUpload(params) {
|
handleUpload(fileData, type) {
|
||||||
const file = params.file
|
const file = fileData.file
|
||||||
if (
|
|
||||||
file.type != 'image/jpeg' &&
|
|
||||||
file.type != 'image/png' &&
|
|
||||||
file.type != 'image/jpg' &&
|
|
||||||
file.type != 'image/bmp'
|
|
||||||
) {
|
|
||||||
this.$message.error(this.$t('message.companyDiagram.uploadMsg')) //只能上传图片
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// 压缩图片
|
// 压缩图片
|
||||||
lrz(file, { quality: 1 }).then((result) => {
|
lrz(file, { quality: 1 }).then((result) => {
|
||||||
const formData = new FormData()
|
const formData = new FormData()
|
||||||
formData.append('files', result.file)
|
formData.append('files', result.file)
|
||||||
|
// 图片上传
|
||||||
apiUploadImage(formData).then((res) => {
|
apiUploadImage(formData).then((res) => {
|
||||||
if (res.code == 200 || res.status == 'SUCCESS') {
|
if (res.code == 200 || res.status == 'SUCCESS') {
|
||||||
const imgInfo = res.data[0]
|
const imgInfo = res.data[0]
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 'idCardAvatar': // 身份证头像
|
||||||
this.personForm.idCardBigPhotoUrl = imgInfo.imageUrl
|
this.personForm.idCardBigPhotoUrl = imgInfo.imageUrl
|
||||||
this.idCardUpPhotoFile = [
|
this.idCardUpPhotoFile = [
|
||||||
{ name: imgInfo.filename, url: imgInfo.imageUrl }
|
{ name: imgInfo.filename, url: imgInfo.imageUrl }
|
||||||
]
|
]
|
||||||
|
break
|
||||||
|
case 'livesFace': // 现场采集人脸
|
||||||
|
let imgStatus = result.file.size / 1024 < 500
|
||||||
|
if (!imgStatus) {
|
||||||
|
this.cropperOption.img =
|
||||||
|
this.$store.state.FILEURL + imgInfo.imageUrl
|
||||||
|
this.cropperDialog = true
|
||||||
|
} else {
|
||||||
|
if (this.isSzProject == 1) {
|
||||||
|
this.checkImgLibrary(imgInfo.imageUrl)
|
||||||
|
} else {
|
||||||
|
this.checkFace(imgInfo.imageUrl)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -3344,18 +3352,8 @@ export default {
|
|||||||
this.$message.error(this.$t('message.companyDiagram.hint8'))
|
this.$message.error(this.$t('message.companyDiagram.hint8'))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// if(type==7){
|
|
||||||
// const isLt2M = file.size / 1024 < 500;
|
|
||||||
// if (!isLt2M) {
|
|
||||||
// this.$message.error('现场采集照图片大小不能超过 500kb!');
|
|
||||||
// }
|
|
||||||
// return isLt2M;
|
|
||||||
// }else{
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
},
|
},
|
||||||
|
|
||||||
//删除 身份证头像 或 现场采集照片
|
//删除 身份证头像 或 现场采集照片
|
||||||
@ -3499,21 +3497,6 @@ export default {
|
|||||||
arrJoin.push(data)
|
arrJoin.push(data)
|
||||||
}
|
}
|
||||||
this.personForm.employmentCard = arrJoin.join(',')
|
this.personForm.employmentCard = arrJoin.join(',')
|
||||||
} else if (type == 6) {
|
|
||||||
this.personForm.idCardBigPhotoUrl = obj.url
|
|
||||||
this.idCardUpPhotoFile = [obj]
|
|
||||||
} else if (type == 7) {
|
|
||||||
let imgStatus = file2.size / 1024 < 500
|
|
||||||
if (!imgStatus) {
|
|
||||||
this.cropperOption.img = this.$store.state.FILEURL + obj.url
|
|
||||||
this.cropperDialog = true
|
|
||||||
} else {
|
|
||||||
if (this.isSzProject == 1) {
|
|
||||||
this.checkImgLibrary(file.data[0].imageUrl)
|
|
||||||
} else {
|
|
||||||
this.checkFace(file.data[0].imageUrl)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (type == 8) {
|
} else if (type == 8) {
|
||||||
console.log(file)
|
console.log(file)
|
||||||
let data = {
|
let data = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user