makaba 1 год назад
Родитель
Сommit
be4dff85d5
3 измененных файлов: 58 добавлений и 29 удалений
  1. +9
    -0
      src/api/sunVillage_info/fixedAssets.js
  2. +49
    -28
      src/views/sunVillage_info/identity_check.vue
  3. +0
    -1
      src/views/sunVillage_info/login_code.vue

+ 9
- 0
src/api/sunVillage_info/fixedAssets.js Просмотреть файл

@@ -1053,3 +1053,12 @@ export function delResource(id) {
}) })
} }


export function faceVerification(data) {
return request({
url: '/register/face/verified',
method: 'post',
data:data
})

}


+ 49
- 28
src/views/sunVillage_info/identity_check.vue Просмотреть файл

@@ -9,9 +9,9 @@
<div class="list_main"v-if="responseData.isFacial ==='N'" > <div class="list_main"v-if="responseData.isFacial ==='N'" >
<p class="userName">{{responseData.memberName}}<span class="noCheck">待认证</span></p> <p class="userName">{{responseData.memberName}}<span class="noCheck">待认证</span></p>
<p class="id_card" >{{responseData.idcard}}</p> <p class="id_card" >{{responseData.idcard}}</p>
<van-uploader v-model="fileList" :max-count="1" multiple :after-read="afterRead" @delete="deleteFile1" />
<van-uploader v-model="fileList" :max-size="20 * 1024 * 1024" @oversize="onOversize" :max-count="1" multiple :after-read="afterRead" @delete="deleteFile1" />
<p class="text_block">上传或拍摄人像图进行认证</p> <p class="text_block">上传或拍摄人像图进行认证</p>
<p class="btn_block">验证</p>
<p class="btn_block" @click="facialVerify">验证</p>
</div> </div>


<!-- 已认证--> <!-- 已认证-->
@@ -20,7 +20,7 @@
<span class="yesCheck">已认证<span class="yesTime" >{{responseData.facialAt}}</span></span> <span class="yesCheck">已认证<span class="yesTime" >{{responseData.facialAt}}</span></span>
</p> </p>
<p class="id_card" >{{responseData.idcard}}</p> <p class="id_card" >{{responseData.idcard}}</p>
<img class="img_block" :src="'/api'+responseData.headSculpture" alt="">
<img class="img_block" :src="'/api'+responseData.headSculpture" alt="" @error="setDefaultImage">


<!-- <img class="img_block" src="../../assets/images/sunVillage_info/check_icon_02.png" alt="">--> <!-- <img class="img_block" src="../../assets/images/sunVillage_info/check_icon_02.png" alt="">-->


@@ -31,16 +31,17 @@


<script> <script>
import Cookies from "js-cookie"; import Cookies from "js-cookie";
import {attachmentUpload} from "@/api/sunVillage_info/fixedAssets";
import {faceVerification} from "@/api/sunVillage_info/fixedAssets";
// import {attachmentUpload} from "@/api/sunVillage_info/fixedAssets";

export default { export default {
name: "identityCheck", name: "identityCheck",
data() { data() {
return { return {
fileList:[], fileList:[],
openPic:[],
openPic2:[],
responseData: null, responseData: null,
remainingSeconds: 3, // 剩余秒数,初始值为3秒 remainingSeconds: 3, // 剩余秒数,初始值为3秒
formData:null,
}; };
}, },
created() { created() {
@@ -55,12 +56,50 @@
this.remainingSeconds--; this.remainingSeconds--;
} }
}, 1000); // 1000 毫秒等于1秒 }, 1000); // 1000 毫秒等于1秒
} else {
this.formData = new FormData();
this.formData.append("name", this.responseData.memberName);
this.formData.append("idCard",this.responseData.idcard);
this.formData.append("deptId",this.responseData.deptId);
} }
}, },
methods: { methods: {
onOversize(file) {
console.log(file);
this.$toast.fail('图片大小不能超过 20MB');
},
setDefaultImage(event) {
event.target.src = require("../../../static/images/zwtpxw.jpg");
},
deleteFile1(detail){ deleteFile1(detail){
this.openPic2.splice(detail.index,1)
// this.form.openPic.splice(index,1);
this.formData.delete("file");
},
facialVerify(){
const file = this.formData.get("file");
if (!file) {
this.$toast({
icon: 'warning', // 找到自己需要的图标
message: '请上传头像',
duration: "1000"
});
return ;
}
this.$toast.loading({
message: "人脸识别中",
forbidClick: true,
duration: 0,
});
faceVerification(this.formData).then((response) => {
if(response.code === 200) {
this.$toast.clear();
this.$toast({
icon: 'success',
message: '人脸验证成功',
duration: "1000"
});
this.$router.push({path: '/sunVillage_info/index_code_rights'})
}
})
}, },
afterRead(file) { afterRead(file) {
this.$toast.loading({ this.$toast.loading({
@@ -68,26 +107,8 @@
forbidClick: true, forbidClick: true,
duration: 0, duration: 0,
}); });
console.log(file instanceof Array)
if (file instanceof Array){//判断是否为数组,单张图片为array,多张为数组,数组返回true否则为false
file.map(res=>{
this.openPic.push(res.file);
let params1 = new FormData();
params1.append("file", res.file);
attachmentUpload(params1).then((r1) => {
this.openPic2.push(r1.fileName);
})
})
}else{
this.openPic.push(file);
let params1 = new FormData();
params1.append("file", file.file);
//提交方法
attachmentUpload(params1).then((r1) => {
this.openPic2.push(r1.fileName);
})

}
this.formData.append("file", file.file);
this.$toast.clear();
}, },
}, },
}; };


+ 0
- 1
src/views/sunVillage_info/login_code.vue Просмотреть файл

@@ -156,7 +156,6 @@
}, },
allowIdentityVerified() { allowIdentityVerified() {
allowFaceVerify().then(response => { allowFaceVerify().then(response => {
console.log("****");
this.formData.identityCheck = JSON.parse(response.data); this.formData.identityCheck = JSON.parse(response.data);
}); });
} }


Загрузка…
Отмена
Сохранить