Page({ data: { certNo: null, certName: null, result: null }, onLoad() { // 90s后无操作,app发起的退出登录操作 my.on('logOff', e => { my.alert({ title: 'app发过来的', content: '90s无操作,请退出登录', buttonText: '确定', success: () => {} }); }) }, onUnload() { my.off('logOff') }, inputChange(e) { if(e.currentTarget.dataset.type === 'no') { // 身份证 this.setData({ certNo: e.detail.value }) } else if(e.currentTarget.dataset.type === 'name') { // 姓名 this.setData({ certName: e.detail.value }) } }, // 初始化bpaas刷脸服务 aromeInitBpaasService() { const that = this my.call('aromeInitBpaasService', { appId: '2021004113614021', appVersion: '*', }, (res) => { that.setData({ result: JSON.stringify(res) }) my.alert({ title: '初始化bpaas刷脸服务', content: JSON.stringify(res), buttonText: '确定', success: () => {} }); }); }, // 启动bpaas刷脸服务 aromeStartBpaasService() { if(!this.data.certName || !this.data.certNo) { my.alert({ title: '提示', content: '身份证或姓名不能为空!', buttonText: '确定' }) return } const that = this const zolozConfig = {"cameraID":0,"supCameraID":1,"toygerPowerMode":0,"algorithmAngle":90,"supAlgorithmAngle":90,"isMirror":false,"supIsMirror":false,"isDisplayMirror":true,"supIsDisplayMirror":false,"displayAngle":90,"supDisplayAngle":0,"minIod":0.02} const verifyExtParams = {"certType": "IDCARD","certNo": this.data.certNo,"certName": this.data.certName} // 刷脸 // const paramsXD = {"serviceId":"faceAuth","query":"QUERY","scopes":"auth_user","zolozConfig": zolozConfig, "merchantAppId": "2021004113634033"} // 人证1:1 const paramsXD = {"serviceId":"auth","captureUIMode":"3","noZeroConfirm":"true","verifyExtParams":verifyExtParams,"zolozConfig":zolozConfig} // serviceCode: BPaaSSmileFaceAuth 刷脸 // serviceCode: BPaaSNonZimInitFaceAuth 人证1:1 my.call('aromeStartBpaasService', {serviceCode:"BPaaSNonZimInitFaceAuth",params: paramsXD, taskId:1000}, (res) => { that.setData({ result: JSON.stringify(res) }) my.alert({ title: '启动bpaas刷脸服务', content: JSON.stringify(res), buttonText: '确定', success: () => {} }); }) } });