Page({ data: { state: 'wait', name: '', idCard: '' }, onLoad(options) { if (!options.name || !options.idCard || !options.userId) { return } this.setData({ 'state': 'wait' }) const _this = this; wx.startFacialRecognitionVerify({ name: options.name, idCardNumber: options.idCard, success(res) { _this.setData({ 'state': 'success' }) }, fail(res) { _this.setData({ 'state': 'error' }) }, complete: (res) => { console.log('complete ', res) if (res.errCode === 0) { _this.setData({ 'state': 'success' }) const data = { userId: options.userId, realName: options.name, idCard: options.idCard, errMsg: res.errMsg, errCode: res.errCode, verifyResult: res.verifyResult } console.log('开始 request ', data) wx.request({ url: 'https://jzxx.hncsga.cn/api/auth/wx/faceAuth', //url method: 'POST', //请求方式 header: { 'Content-Type': 'application/json', }, data: data, success(response) { console.log('success ', response) }, complete(response) { console.log('complete ', response) }, fail(err) { console.log('err ', err) } }) } else { _this.setData({ 'state': 'error' }) } } }) }, inputChangeName(e) { this.setData({ name: e.detail.value }) }, inputChangeIdCard(e) { this.setData({ idCard: e.detail.value }) }, fastVerify() { if (!this.data.name || !this.data.idCard) { return } wx.startFacialRecognitionVerify({ name: this.data.name, idCardNumber: this.data.idCard, complete: (res) => { } }) }, close() { wx.exitMiniProgram({ success: (res) => {} }) } })