| | |
| | | }) |
| | | } |
| | | const faceApiCheck=async(path:any)=>{ |
| | | const faceScore=confingInfoStore().confingInfo.face_score |
| | | fs.readFile(path, (err, data) => { |
| | | if (err) throw err; |
| | | let blobFile = new File([data], 'name.png', {type:"image/png"}) |
| | | console.log(blobFile) |
| | | const formData = new FormData() // 下面有备注 |
| | | formData.append('file', blobFile) |
| | | formData.append('image', blobFile) |
| | | checkUploadFile(formData).then(re=>{ |
| | | console.log('-----',re) |
| | | if(re.code===200&&re?.data?.data.result.length>0&&re?.data?.data.result[0]){ |
| | | const result=re?.data?.data.result[0] |
| | | const entityId=result.user_id |
| | | const distance=result.score |
| | | console.log(`entityId=`+entityId+','+'distance='+distance) |
| | | //设置识别的的两 要大于多少 |
| | | if(entityId!=='unknown'&&distance>=faceScore){ |
| | | console.log(entityId,'得到了人脸识别id,存患者code到vuex') |
| | | console.log(entityId,'得到了人脸识别id,存患者code到vuex') |
| | | sockteStore().setfaceSockte({ |
| | | type: "人脸识别", |
| | | deviceName: "人脸识别", |
| | | result: entityId, |
| | | resultTime: '', |
| | | state:2, |
| | | }) |
| | | } |
| | | // |
| | | }else{ |
| | | console.log('本地没识别') |
| | | } |
| | | |
| | | }).finally(()=>{ |
| | | // 删除图片 |
| | | delImg(path) |
| | |
| | | // 是否本地识别 |
| | | const isLanFace= confingInfoStore().confingInfo.isLanFace |
| | | if(isLanFace===true){ |
| | | console.log('本地识别') |
| | | //本地识别 |
| | | faceApiCheck(path) |
| | | }else{ |
| | | //阿里验证外网 |
| | | console.log('阿里识别') |
| | | faceShibie(path) |
| | | } |
| | | |