人员管理(管理人员):新增上传身份证头像压缩逻辑
This commit is contained in:
parent
a5fc697513
commit
7d0ecdebe4
@ -1222,16 +1222,16 @@
|
||||
</div>
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
:action="uploadUrl"
|
||||
action="uploadUrl"
|
||||
:on-remove="(file) => handleRemove(file, 3)"
|
||||
:on-success="(file) => handleSuccess(file, 3)"
|
||||
:on-error="(file) => handleError(file, 3)"
|
||||
:on-preview="(file) => handlePreview(file, 3)"
|
||||
:beforeUpload="(file) => handleBeforeUpload(file, 3)"
|
||||
name="files"
|
||||
:show-file-list="false"
|
||||
:file-list="idCardBigPhotoUrlFile"
|
||||
list-type="picture"
|
||||
:http-request="
|
||||
(val) => handleUpload(val, 'idCardAvatar')
|
||||
"
|
||||
>
|
||||
<el-button
|
||||
size="medium"
|
||||
@ -1769,6 +1769,8 @@ import {
|
||||
} from '@/assets/js/util.js'
|
||||
import { VueCropper } from 'vue-cropper'
|
||||
|
||||
import { apiUploadImage } from '@/assets/js/api/common'
|
||||
import lrz from 'lrz'
|
||||
export default {
|
||||
components: {
|
||||
VueCropper
|
||||
@ -1953,6 +1955,43 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleUpload(fileData, type) {
|
||||
const file = fileData.file
|
||||
// 压缩图片
|
||||
lrz(file, { quality: 1 }).then((result) => {
|
||||
const formData = new FormData()
|
||||
formData.append('files', result.file)
|
||||
// 图片上传
|
||||
apiUploadImage(formData).then((res) => {
|
||||
if (res.code == 200 || res.status == 'SUCCESS') {
|
||||
const imgInfo = res.data[0]
|
||||
|
||||
switch (type) {
|
||||
case 'idCardAvatar': // 身份证头像
|
||||
this.personForm.idCardBigPhotoUrl = imgInfo.imageUrl
|
||||
this.idCardUpPhotoFile = this.idCardBigPhotoUrlFile = [
|
||||
{ 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
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
changePeople(val) {},
|
||||
issuePersonFn() {
|
||||
batchSendWorkerInfoApi({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user