k8_ampe.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. Page({
  2. data: {
  3. certNo: null,
  4. certName: null,
  5. result: null
  6. },
  7. onLoad() {
  8. // 90s后无操作,app发起的退出登录操作
  9. my.on('logOff', e => {
  10. my.alert({
  11. title: 'app发过来的',
  12. content: '90s无操作,请退出登录',
  13. buttonText: '确定',
  14. success: () => {}
  15. });
  16. })
  17. },
  18. onUnload() {
  19. my.off('logOff')
  20. },
  21. inputChange(e) {
  22. if(e.currentTarget.dataset.type === 'no') {
  23. // 身份证
  24. this.setData({
  25. certNo: e.detail.value
  26. })
  27. } else if(e.currentTarget.dataset.type === 'name') {
  28. // 姓名
  29. this.setData({
  30. certName: e.detail.value
  31. })
  32. }
  33. },
  34. // 初始化bpaas刷脸服务
  35. aromeInitBpaasService() {
  36. const that = this
  37. my.call('aromeInitBpaasService', {
  38. appId: '2021004113614021',
  39. appVersion: '*',
  40. }, (res) => {
  41. that.setData({
  42. result: JSON.stringify(res)
  43. })
  44. my.alert({
  45. title: '初始化bpaas刷脸服务',
  46. content: JSON.stringify(res),
  47. buttonText: '确定',
  48. success: () => {}
  49. });
  50. });
  51. },
  52. // 启动bpaas刷脸服务
  53. aromeStartBpaasService() {
  54. if(!this.data.certName || !this.data.certNo) {
  55. my.alert({
  56. title: '提示',
  57. content: '身份证或姓名不能为空!',
  58. buttonText: '确定'
  59. })
  60. return
  61. }
  62. const that = this
  63. 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}
  64. const verifyExtParams = {"certType": "IDCARD","certNo": this.data.certNo,"certName": this.data.certName}
  65. // 刷脸
  66. // const paramsXD = {"serviceId":"faceAuth","query":"QUERY","scopes":"auth_user","zolozConfig": zolozConfig, "merchantAppId": "2021004113634033"}
  67. // 人证1:1
  68. const paramsXD = {"serviceId":"auth","captureUIMode":"3","noZeroConfirm":"true","verifyExtParams":verifyExtParams,"zolozConfig":zolozConfig}
  69. // serviceCode: BPaaSSmileFaceAuth 刷脸
  70. // serviceCode: BPaaSNonZimInitFaceAuth 人证1:1
  71. my.call('aromeStartBpaasService', {serviceCode:"BPaaSNonZimInitFaceAuth",params: paramsXD, taskId:1000}, (res) => {
  72. that.setData({
  73. result: JSON.stringify(res)
  74. })
  75. my.alert({
  76. title: '启动bpaas刷脸服务',
  77. content: JSON.stringify(res),
  78. buttonText: '确定',
  79. success: () => {}
  80. });
  81. })
  82. }
  83. });