| | |
| | | videoCtx.takePhoto({ |
| | | quality: 'original', |
| | | success: (e) => { |
| | | console.log(e.tempImagePath,'e.tempImagePath'); |
| | | //上传照片接口,图片换成远端url地址 自行替换 |
| | | uploadImage(e.tempImagePath).then((res) => { |
| | | this.setData({ |
| | | faceImg: res |
| | | }) |
| | | wx.showLoading({ |
| | | title: '正在验证', |
| | | }) |
| | | // uploadImage(e.tempImagePath).then((res) => { |
| | | // this.setData({ |
| | | // faceImg: res |
| | | // }) |
| | | // wx.showLoading({ |
| | | // title: '正在验证', |
| | | // }) |
| | | |
| | | try { |
| | | // 执行后端分析人脸 |
| | | api({ |
| | | img: res |
| | | }).then((writeoffRes) => { |
| | | //识别成功 |
| | | //自行处理识别成功结果 |
| | | }).catch(err => { |
| | | wx.hideLoading(); |
| | | wx.showModal({ |
| | | title: err.msg, |
| | | showCancel: false, |
| | | confirmText: '重新核验', |
| | | complete: (res) => { |
| | | if (res.confirm) { |
| | | this.setData({ |
| | | startVerify: false, |
| | | faceImg: "", |
| | | verifyText: '请移动面容到框内', |
| | | isCentre: false, |
| | | face: {} |
| | | }, () => { |
| | | this.handleStart() |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }) |
| | | } catch (error) { |
| | | console.log(error) |
| | | } |
| | | }).catch(() => { |
| | | this.setData({ |
| | | startVerify: false, |
| | | faceImg: "", |
| | | verifyText: '请移动面容到框内', |
| | | isCentre: false, |
| | | face: {} |
| | | }, () => { |
| | | this.handleStart() |
| | | wx.showToast({ |
| | | title: '网络连接失败,请重试', |
| | | }) |
| | | }) |
| | | }) |
| | | // try { |
| | | // // 执行后端分析人脸 |
| | | // api({ |
| | | // img: res |
| | | // }).then((writeoffRes) => { |
| | | // //识别成功 |
| | | // //自行处理识别成功结果 |
| | | // }).catch(err => { |
| | | // wx.hideLoading(); |
| | | // wx.showModal({ |
| | | // title: err.msg, |
| | | // showCancel: false, |
| | | // confirmText: '重新核验', |
| | | // complete: (res) => { |
| | | // if (res.confirm) { |
| | | // this.setData({ |
| | | // startVerify: false, |
| | | // faceImg: "", |
| | | // verifyText: '请移动面容到框内', |
| | | // isCentre: false, |
| | | // face: {} |
| | | // }, () => { |
| | | // this.handleStart() |
| | | // }) |
| | | // } |
| | | // } |
| | | // }) |
| | | // }) |
| | | // } catch (error) { |
| | | // console.log(error) |
| | | // } |
| | | // }).catch(() => { |
| | | // this.setData({ |
| | | // startVerify: false, |
| | | // faceImg: "", |
| | | // verifyText: '请移动面容到框内', |
| | | // isCentre: false, |
| | | // face: {} |
| | | // }, () => { |
| | | // this.handleStart() |
| | | // wx.showToast({ |
| | | // title: '网络连接失败,请重试', |
| | | // }) |
| | | // }) |
| | | // }) |
| | | } |
| | | }) |
| | | }) |
| | |
| | | } |
| | | |
| | | .camera { |
| | | width: 600rpx; |
| | | height: 600rpx; |
| | | border-radius: 50% 50%; |
| | | width: 800rpx; |
| | | height: 800rpx; |
| | | /* border-radius: 50% 50%; */ |
| | | margin: 0 auto; |
| | | } |
| | | |
| | | .faceImg { |
| | | width: 600rpx; |
| | | height: 600rpx; |
| | | width: 800rpx; |
| | | height: 800rpx; |
| | | border-radius: 50% 50%; |
| | | margin: 0 auto; |
| | | position: absolute; |