|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <view style="padding: 30rpx">
|
|
|
+ <view class="infos" style="padding: 30rpx">
|
|
|
<nav-bar title="填写审核资料"></nav-bar>
|
|
|
<view v-show="!agreementModal">
|
|
|
<view class="topBox">
|
|
@@ -480,6 +480,16 @@
|
|
|
v-model="showTableDown"
|
|
|
@click="clickIndex"
|
|
|
></u-action-sheet>
|
|
|
+
|
|
|
+ <!--用于图片压缩的canvas画布,不在页面中展示,且id固定不可变 position: absolute; z-index: -1; left: -10000rpx;; top: -10000rpx;-->
|
|
|
+ <!-- style="width: {{cw}}px; height: {{cw}}px;" -->
|
|
|
+ <view class="photo_can">
|
|
|
+ <canvas
|
|
|
+ class="zip_canvas"
|
|
|
+ canvas-id="zipCanvas"
|
|
|
+ ></canvas>
|
|
|
+ </view>
|
|
|
+
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -487,9 +497,11 @@
|
|
|
import * as baseUrls from "@/common/request.js";
|
|
|
import { mapGetters, mapActions } from "vuex";
|
|
|
import Handwriting from "@/common/signature.js";
|
|
|
+import getLessLimitSizeImage from '@/common/compressPhoto.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ cw: wx.getSystemInfoSync().windowWidth, //画板边长默认是屏幕宽度,正方形画布
|
|
|
list: [
|
|
|
{
|
|
|
text: "上传图片",
|
|
@@ -798,9 +810,6 @@ export default {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- console.log(data);
|
|
|
- console.log(self.copyData);
|
|
|
- console.log(444);
|
|
|
|
|
|
if (this.remarkStatus) {
|
|
|
var arsty = {};
|
|
@@ -905,8 +914,7 @@ export default {
|
|
|
this.apply_post_disabled = true;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if (this.userInfo.companyName) {
|
|
|
+ if (this.userInfo && this.userInfo.companyName) {
|
|
|
this.$set(this.form, "work_unit", this.userInfo.companyName);
|
|
|
}
|
|
|
resolve();
|
|
@@ -914,28 +922,39 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
uploadImgs() {
|
|
|
- var self = this;
|
|
|
uni.chooseImage({
|
|
|
count: 1, //默认9
|
|
|
sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
|
|
|
- success: function (res) {
|
|
|
+ success: (res) => {
|
|
|
if (res.tempFiles[0].size > 2097152) {
|
|
|
- self.$method.showToast("上传图片不得大于2M");
|
|
|
+ // this.$method.showToast("上传图片不得大于2M");
|
|
|
+ // 需要压缩
|
|
|
+ let canvasId = 'zipCanvas'
|
|
|
+ let imagePath = res.tempFiles[0].path //原图的路径
|
|
|
+ let limitSize = 2048 //大小限制2048kb
|
|
|
+ let drawWidth = wx.getSystemInfoSync().windowWidth //初始绘画区域是画布自身的宽度也就是屏幕宽度
|
|
|
+ getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, async (resPath)=>{
|
|
|
+ //resPath就是压缩后图片的路径
|
|
|
+ this.uploadImgsChild(resPath)
|
|
|
+ })
|
|
|
return;
|
|
|
} else {
|
|
|
- var type = res.tempFiles[0].path.split(".").splice(-1);
|
|
|
- if (type[0] != "jpg" && type[0] != "png" && type[0] != "jpeg") {
|
|
|
- self.$method.showToast("请上传图片格式");
|
|
|
- return;
|
|
|
- }
|
|
|
- self.$set(self.form, "commitment_seal", res.tempFiles[0].path);
|
|
|
- self.$nextTick(function () {
|
|
|
- this.resultForm();
|
|
|
- });
|
|
|
+ this.uploadImgsChild(res.tempFiles[0].path)
|
|
|
}
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
+ uploadImgsChild(path) {
|
|
|
+ var type = path.split(".").splice(-1)
|
|
|
+ if (type[0] != "jpg" && type[0] != "png" && type[0] != "jpeg") {
|
|
|
+ this.$method.showToast("请上传图片格式")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$set(this.form, "commitment_seal", path)
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.resultForm()
|
|
|
+ });
|
|
|
+ },
|
|
|
uploadFieds() {
|
|
|
var self = this;
|
|
|
wx.chooseMessageFile({
|
|
@@ -1431,33 +1450,39 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
async changePhotoListHeader1(lists, name) {
|
|
|
- console.log('个人近照---',lists);
|
|
|
if (lists.length) {
|
|
|
this.fileList1 = lists;
|
|
|
- console.log(lists, "lists1");
|
|
|
+ // console.log(lists, "lists1");
|
|
|
if (
|
|
|
lists[0].url.indexOf("//tmp") !== -1 ||
|
|
|
lists[0].url.indexOf("//temp") !== -1
|
|
|
) {
|
|
|
- console.log('----')
|
|
|
- this.$set(
|
|
|
- this.form,
|
|
|
- "recent_photos",
|
|
|
- await this.$method.imageInfos(lists[0].url)
|
|
|
- );
|
|
|
+ if (lists[0].file.size < 2 * 1024 * 1024) {
|
|
|
+ // 以前的
|
|
|
+ this.$set(this.form, "recent_photos", await this.$method.imageInfos(lists[0].url))
|
|
|
+ } else {
|
|
|
+ // 需要压缩
|
|
|
+ let canvasId = 'zipCanvas'
|
|
|
+ let imagePath = lists[0].url; //原图的路径
|
|
|
+ let limitSize = 2048; //大小限制2048kb
|
|
|
+ let drawWidth = wx.getSystemInfoSync().windowWidth //初始绘画区域是画布自身的宽度也就是屏幕宽度
|
|
|
+ getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, async (resPath)=>{
|
|
|
+ //resPath就是压缩后图片的路径
|
|
|
+ this.$set(this.form, "recent_photos", await this.$method.imageInfos(resPath))
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
this.fileList1 = [];
|
|
|
this.$set(this.form, "recent_photos", "");
|
|
|
- console.log(3, this.form.recent_photos);
|
|
|
}
|
|
|
this.openVerify = false;
|
|
|
this.$nextTick(function () {
|
|
|
- console.log(4);
|
|
|
this.resultForm();
|
|
|
});
|
|
|
},
|
|
|
async changePhotoListHeader2(lists, name) {
|
|
|
+ // console.log('身份证照片zhengmian:', lists, this.$refs.idcard_face_photo)
|
|
|
if (lists.length) {
|
|
|
this.fileList2 = lists;
|
|
|
if (
|
|
@@ -1465,39 +1490,56 @@ export default {
|
|
|
lists[0].url.indexOf("//temp") !== -1
|
|
|
) {
|
|
|
let url = lists[0].url;
|
|
|
+ let size = lists[0].file.size
|
|
|
this.$refs.idcard_face_photo[0].remove(0);
|
|
|
|
|
|
- uni.compressImage({
|
|
|
- src: url,
|
|
|
- quality: 75,
|
|
|
- width: "50%",
|
|
|
- height: "50%",
|
|
|
- success: async (rest) => {
|
|
|
- let res = await this.faceCertificationIDCardOCR(
|
|
|
- 1,
|
|
|
- rest.tempFilePath
|
|
|
- );
|
|
|
+ // console.log('url', url, size)
|
|
|
+ let titleMsg = '请上传正确清晰的身份证人像面照片'
|
|
|
+ if (size < 2 * 1024 * 1024) {
|
|
|
+ this.checkIdCard(1, url, titleMsg, 'idcard_face_photo')
|
|
|
+ } else {
|
|
|
+ // 需要压缩
|
|
|
+ let canvasId = 'zipCanvas'
|
|
|
+ let imagePath = url //原图的路径
|
|
|
+ let limitSize = 2048 //大小限制2048kb
|
|
|
+ let drawWidth = wx.getSystemInfoSync().windowWidth //初始绘画区域是画布自身的宽度也就是屏幕宽度
|
|
|
+ getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, async (resPath)=>{
|
|
|
+ //resPath就是压缩后图片的路径
|
|
|
+ this.checkIdCard(1, resPath, titleMsg, 'idcard_face_photo')
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
- if (res.data.code == 500) {
|
|
|
- uni.showToast({
|
|
|
- icon: "none",
|
|
|
- title: "请上传正确清晰的身份证人像面照片",
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- this.$refs.idcard_face_photo[0].lists = [
|
|
|
- {
|
|
|
- url: this.$method.splitImgHost(res.data.data.IdImgPath),
|
|
|
- },
|
|
|
- ];
|
|
|
- this.$set(
|
|
|
- this.form,
|
|
|
- "idcard_face_photo",
|
|
|
- res.data.data.IdImgPath
|
|
|
- );
|
|
|
- console.log(this.form, "idcard_face_photo");
|
|
|
- },
|
|
|
- });
|
|
|
+ // uni.compressImage({
|
|
|
+ // src: url,
|
|
|
+ // quality: 75,
|
|
|
+ // width: "50%",
|
|
|
+ // height: "50%",
|
|
|
+ // success: async (rest) => {
|
|
|
+ // let res = await this.faceCertificationIDCardOCR(
|
|
|
+ // 1,
|
|
|
+ // rest.tempFilePath
|
|
|
+ // );
|
|
|
+
|
|
|
+ // if (res.data.code == 500) {
|
|
|
+ // uni.showToast({
|
|
|
+ // icon: "none",
|
|
|
+ // title: "请上传正确清晰的身份证人像面照片",
|
|
|
+ // });
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // this.$refs.idcard_face_photo[0].lists = [
|
|
|
+ // {
|
|
|
+ // url: this.$method.splitImgHost(res.data.data.IdImgPath),
|
|
|
+ // },
|
|
|
+ // ];
|
|
|
+ // this.$set(
|
|
|
+ // this.form,
|
|
|
+ // "idcard_face_photo",
|
|
|
+ // res.data.data.IdImgPath
|
|
|
+ // );
|
|
|
+ // console.log(this.form, "idcard_face_photo");
|
|
|
+ // },
|
|
|
+ // });
|
|
|
}
|
|
|
} else {
|
|
|
this.fileList2 = [];
|
|
@@ -1517,37 +1559,23 @@ export default {
|
|
|
) {
|
|
|
console.log("//tem");
|
|
|
let url = lists[0].url;
|
|
|
+ let size = lists[0].file.size
|
|
|
this.$refs.idcard_national_photo[0].remove(0);
|
|
|
- uni.compressImage({
|
|
|
- src: url,
|
|
|
- quality: 75,
|
|
|
- width: "50%",
|
|
|
- height: "50%",
|
|
|
- success: async (rest) => {
|
|
|
- let res = await this.faceCertificationIDCardOCR(
|
|
|
- 2,
|
|
|
- rest.tempFilePath
|
|
|
- );
|
|
|
- if (res.data.code == 500) {
|
|
|
- uni.showToast({
|
|
|
- icon: "none",
|
|
|
- title: "请上传正确清晰的身份证国徽面照片",
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- this.$refs.idcard_national_photo[0].lists = [
|
|
|
- {
|
|
|
- url: this.$method.splitImgHost(res.data.data.IdImgPath),
|
|
|
- },
|
|
|
- ];
|
|
|
- this.$set(
|
|
|
- this.form,
|
|
|
- "idcard_national_photo",
|
|
|
- res.data.data.IdImgPath
|
|
|
- );
|
|
|
- console.log(this.form, "idcard_national_photo");
|
|
|
- },
|
|
|
- });
|
|
|
+
|
|
|
+ let titleMsg = '请上传正确清晰的身份证国徽面照片'
|
|
|
+ if (size < 2 * 1024 * 1024) {
|
|
|
+ this.checkIdCard(2, url, titleMsg, 'idcard_national_photo')
|
|
|
+ } else {
|
|
|
+ // 需要压缩
|
|
|
+ let canvasId = 'zipCanvas'
|
|
|
+ let imagePath = url //原图的路径
|
|
|
+ let limitSize = 2048 //大小限制2048kb
|
|
|
+ let drawWidth = wx.getSystemInfoSync().windowWidth //初始绘画区域是画布自身的宽度也就是屏幕宽度
|
|
|
+ getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, async (resPath)=>{
|
|
|
+ //resPath就是压缩后图片的路径
|
|
|
+ this.checkIdCard(2, resPath, titleMsg, 'idcard_national_photo')
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
this.fileList3 = [];
|
|
@@ -1558,6 +1586,24 @@ export default {
|
|
|
this.resultForm();
|
|
|
});
|
|
|
},
|
|
|
+ async checkIdCard(cardSide, url, titleMsg, paramType) {
|
|
|
+ let res = await this.faceCertificationIDCardOCR(cardSide, url);
|
|
|
+
|
|
|
+ if (res.data.code == 500) {
|
|
|
+ uni.showToast({
|
|
|
+ icon: "none",
|
|
|
+ title: titleMsg,
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$refs[paramType][0].lists = [
|
|
|
+ {
|
|
|
+ url: this.$method.splitImgHost(res.data.data.IdImgPath),
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ this.$set(this.form, paramType, res.data.data.IdImgPath);
|
|
|
+ // console.log(this.form[paramType], '《===',paramType);
|
|
|
+ },
|
|
|
getTimes(key) {
|
|
|
if (this.form[key]) {
|
|
|
return this.form[key];
|
|
@@ -1900,6 +1946,24 @@ page {
|
|
|
}
|
|
|
</style>
|
|
|
<style scope lang="scss">
|
|
|
+.infos {
|
|
|
+ position: relative;
|
|
|
+ top: 0rpx;
|
|
|
+ left: 0rpx;
|
|
|
+ .photo_can {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ position: absolute;
|
|
|
+ z-index: -1;
|
|
|
+ left: -10000rpx;
|
|
|
+ top: -10000rpx;
|
|
|
+ }
|
|
|
+ .zip_canvas {
|
|
|
+ width: 100%;
|
|
|
+ height: 600rpx;
|
|
|
+ border: 2rpx solid #333;
|
|
|
+ }
|
|
|
+}
|
|
|
.ctoples {
|
|
|
position: absolute;
|
|
|
top: 0;
|