浏览代码

人脸核身

rongxin_prod
makaba 1年前
父节点
当前提交
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'" >
<p class="userName">{{responseData.memberName}}<span class="noCheck">待认证</span></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="btn_block">验证</p>
<p class="btn_block" @click="facialVerify">验证</p>
</div>

<!-- 已认证-->
@@ -20,7 +20,7 @@
<span class="yesCheck">已认证<span class="yesTime" >{{responseData.facialAt}}</span></span>
</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="">-->

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

<script>
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 {
name: "identityCheck",
data() {
return {
fileList:[],
openPic:[],
openPic2:[],
responseData: null,
remainingSeconds: 3, // 剩余秒数,初始值为3秒
formData:null,
};
},
created() {
@@ -55,12 +56,50 @@
this.remainingSeconds--;
}
}, 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: {
onOversize(file) {
console.log(file);
this.$toast.fail('图片大小不能超过 20MB');
},
setDefaultImage(event) {
event.target.src = require("../../../static/images/zwtpxw.jpg");
},
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) {
this.$toast.loading({
@@ -68,26 +107,8 @@
forbidClick: true,
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() {
allowFaceVerify().then(response => {
console.log("****");
this.formData.identityCheck = JSON.parse(response.data);
});
}


正在加载...
取消
保存