From 9bc6007ba1d6ac8afbf58a805840cfbaf292cc6a Mon Sep 17 00:00:00 2001 From: Jack <1638169491@qq.com> Date: Thu, 28 Jul 2022 17:57:29 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BA=BA=E5=91=98=E7=AE=A1=E7=90=86(?= =?UTF-8?q?=E5=8A=B3=E5=8A=A1=E4=BA=BA=E5=91=98)=EF=BC=9A=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=B8=8A=E4=BC=A0=E8=BA=AB=E4=BB=BD=E8=AF=81=E5=A4=B4?= =?UTF-8?q?=E5=83=8F=E5=8E=8B=E7=BC=A9=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/js/http.js | 2 +- .../personModule/laborComponent.vue | 28 +++++++++++-------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/assets/js/http.js b/src/assets/js/http.js index 3ccdd318..e3460b1b 100644 --- a/src/assets/js/http.js +++ b/src/assets/js/http.js @@ -56,7 +56,7 @@ if (process.env.NODE_ENV == 'development') { // axios.defaults.baseURL = 'http://117.156.17.59:9090/'; // // axios.defaults.baseURL = 'http://120.236.247.200:9000/'; //横琴线上 // axios.defaults.baseURL = 'http://223.82.100.80:9000/'; //南昌地铁 - axios.defaults.baseURL = 'http://139.9.66.234:40001/'; //南昌地铁二期 + // axios.defaults.baseURL = 'http://139.9.66.234:40001/'; //南昌地铁二期 // axios.defaults.baseURL = 'http://124.71.178.44:30/'; // axios.defaults.baseURL = 'http://192.168.34.125:9090/'; // axios.defaults.baseURL = 'http://192.168.88.220:6023/'; diff --git a/src/views/projectFront/laborManage/personModule/laborComponent.vue b/src/views/projectFront/laborManage/personModule/laborComponent.vue index 6f4dc9ae..43df6ce0 100644 --- a/src/views/projectFront/laborManage/personModule/laborComponent.vue +++ b/src/views/projectFront/laborManage/personModule/laborComponent.vue @@ -1997,7 +1997,6 @@ import { updateByIdWorkerInfo, sendBatchWokerApi } from '@/assets/js/api/laborPerson' -import axios from 'axios' import { selectUserDevAuthorityByUserIdApi, exporExcelWorkerTemplateApi @@ -2011,6 +2010,7 @@ import { getProjectConfigListApi } from '@/assets/js/api/project.js' import { VueCropper } from 'vue-cropper' import { apiUploadImage } from '@/assets/js/api/common' +import lrz from 'lrz' export default { components: { VueCropper @@ -2249,18 +2249,22 @@ export default { this.$message.error(this.$t('message.companyDiagram.uploadMsg')) //只能上传图片 return false } - const formData = new FormData() - formData.append('files', file) - apiUploadImage(formData).then((res) => { - if (res.code == 200 || res.status == 'SUCCESS') { - const data = res.data - let obj = {} - for (let i in data) { - obj = { name: data[i].filename, url: data[i].imageUrl } + + // 压缩图片 + 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 data = res.data + let obj = {} + for (let i in data) { + obj = { name: data[i].filename, url: data[i].imageUrl } + } + this.personForm.idCardBigPhotoUrl = obj.url + this.idCardUpPhotoFile = [obj] } - this.personForm.idCardBigPhotoUrl = obj.url - this.idCardUpPhotoFile = [obj] - } + }) }) }, checkImg() { From 127eac97b190de95a6067a91f5e9a7c5603c9345 Mon Sep 17 00:00:00 2001 From: Jack <1638169491@qq.com> Date: Thu, 28 Jul 2022 18:24:33 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BA=BA=E5=91=98=E7=AE=A1=E7=90=86(?= =?UTF-8?q?=E5=8A=B3=E5=8A=A1=E4=BA=BA=E5=91=98)=EF=BC=9A=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=20handleUpload=20=E5=9B=BE=E7=89=87=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../laborManage/personModule/laborComponent.vue | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/views/projectFront/laborManage/personModule/laborComponent.vue b/src/views/projectFront/laborManage/personModule/laborComponent.vue index 43df6ce0..e3cddd39 100644 --- a/src/views/projectFront/laborManage/personModule/laborComponent.vue +++ b/src/views/projectFront/laborManage/personModule/laborComponent.vue @@ -1524,6 +1524,7 @@ * {{ $t('message.laborMange.IdCardHead') }} + { if (res.code == 200 || res.status == 'SUCCESS') { - const data = res.data - let obj = {} - for (let i in data) { - obj = { name: data[i].filename, url: data[i].imageUrl } - } - this.personForm.idCardBigPhotoUrl = obj.url - this.idCardUpPhotoFile = [obj] + const imgInfo = res.data[0] + this.personForm.idCardBigPhotoUrl = imgInfo.imageUrl + this.idCardUpPhotoFile = [ + { name: imgInfo.filename, url: imgInfo.imageUrl } + ] } }) }) From a5fc697513e5c8da183e81fb06a70e2d38f8092d Mon Sep 17 00:00:00 2001 From: Jack <1638169491@qq.com> Date: Thu, 28 Jul 2022 19:07:06 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BA=BA=E5=91=98=E7=AE=A1=E7=90=86(?= =?UTF-8?q?=E5=8A=B3=E5=8A=A1=E4=BA=BA=E5=91=98)=EF=BC=9A=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=B8=8A=E4=BC=A0=E7=8E=B0=E5=9C=BA=E9=87=87=E9=9B=86?= =?UTF-8?q?=E4=BA=BA=E8=84=B8=E5=8E=8B=E7=BC=A9=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../personModule/laborComponent.vue | 81 ++++++++----------- 1 file changed, 32 insertions(+), 49 deletions(-) diff --git a/src/views/projectFront/laborManage/personModule/laborComponent.vue b/src/views/projectFront/laborManage/personModule/laborComponent.vue index e3cddd39..a0049f59 100644 --- a/src/views/projectFront/laborManage/personModule/laborComponent.vue +++ b/src/views/projectFront/laborManage/personModule/laborComponent.vue @@ -1534,7 +1534,9 @@ :show-file-list="false" :file-list="idCardUpPhotoFile" :disabled="titleType == 'detail'" - :http-request="handleUpload" + :http-request=" + (val) => handleUpload(val, 'idCardAvatar') + " > { 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] - this.personForm.idCardBigPhotoUrl = imgInfo.imageUrl - this.idCardUpPhotoFile = [ - { name: imgInfo.filename, url: imgInfo.imageUrl } - ] + + switch (type) { + case 'idCardAvatar': // 身份证头像 + this.personForm.idCardBigPhotoUrl = imgInfo.imageUrl + this.idCardUpPhotoFile = [ + { 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')) 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) } 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) { console.log(file) let data = { From 7d0ecdebe4a0c1fed526c2e25945ab3f86b8288f Mon Sep 17 00:00:00 2001 From: Jack <1638169491@qq.com> Date: Thu, 28 Jul 2022 19:28:21 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BA=BA=E5=91=98=E7=AE=A1=E7=90=86(?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E4=BA=BA=E5=91=98)=EF=BC=9A=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=B8=8A=E4=BC=A0=E8=BA=AB=E4=BB=BD=E8=AF=81=E5=A4=B4?= =?UTF-8?q?=E5=83=8F=E5=8E=8B=E7=BC=A9=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../personModule/administration.vue | 47 +++++++++++++++++-- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/src/views/projectFront/laborManage/personModule/administration.vue b/src/views/projectFront/laborManage/personModule/administration.vue index c9d71a61..28ef949f 100644 --- a/src/views/projectFront/laborManage/personModule/administration.vue +++ b/src/views/projectFront/laborManage/personModule/administration.vue @@ -1222,16 +1222,16 @@ { + 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({ From 776c34b6b1ad560c72c6504c0f4efca3715b1747 Mon Sep 17 00:00:00 2001 From: Jack <1638169491@qq.com> Date: Fri, 29 Jul 2022 09:46:10 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BA=BA=E5=91=98=E7=AE=A1=E7=90=86(?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E4=BA=BA=E5=91=98)=EF=BC=9A=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=B8=8A=E4=BC=A0=E7=8E=B0=E5=9C=BA=E9=87=87=E9=9B=86?= =?UTF-8?q?=E4=BA=BA=E8=84=B8=E5=9B=BE=E7=89=87=E5=8E=8B=E7=BC=A9=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../personModule/administration.vue | 26 ++----------------- 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/src/views/projectFront/laborManage/personModule/administration.vue b/src/views/projectFront/laborManage/personModule/administration.vue index 28ef949f..e0aa2d72 100644 --- a/src/views/projectFront/laborManage/personModule/administration.vue +++ b/src/views/projectFront/laborManage/personModule/administration.vue @@ -1221,7 +1221,6 @@ {{ $t('message.laborMange.IdCardHead') }}