app.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. import "./__antmove/component/componentClass.js";
  2. my.global = {};
  3. const _my = require("./__antmove/api/index.js")(my);
  4. const wx = _my;
  5. App({
  6. data: {
  7. systemInfo: null,
  8. isKEightDevice: false,
  9. //初始化入参
  10. initParams: {
  11. appVersion: "*",
  12. "appId": "2021004113614021"
  13. },
  14. /**
  15. * 调用1:N刷脸
  16. */
  17. //调用服务入参
  18. oneVNParams: {
  19. "serviceId": "faceAuthAuth",
  20. "query": "QUERY",
  21. "scopes": "auth_user,order_service",
  22. "appId": "2021004113614021",
  23. "merchantAppId": "2021003181682188",
  24. zolozConfig: {
  25. "cameraID": 0,
  26. "supCameraID": 1,
  27. "toygerPowerMode": 0,
  28. "algorithmAngle": 90,
  29. "supAlgorithmAngle": 90,
  30. "isMirror": false,
  31. "supIsMirror": false,
  32. "isDisplayMirror": true,
  33. "supIsDisplayMirror": false,
  34. "displayAngle": 0,
  35. "supDisplayAngle": 0,
  36. "minIod": 0.02
  37. },
  38. extInfo: {
  39. "useTranslucentTheme": true
  40. }
  41. },
  42. //服务编码
  43. oneVNServiceCode: "BPaaSSmileFaceAuth",
  44. /**
  45. * 调用订阅授权服务
  46. */
  47. //调用服务入参
  48. authParams: {
  49. "auth_center_scope_nicks": "order_service",
  50. "user_id": "",
  51. "ftoken": "",
  52. "merchantAppId": "2021003181682188"
  53. },
  54. //服务编码
  55. authServiceCode: "BPaaSNoFaceAuth",
  56. /**
  57. * 访客使用
  58. */
  59. //判断二维码类型 1常客码
  60. type: null,
  61. // (过审专用,禁止删除)- start
  62. fake: true,
  63. // (过审专用,禁止删除)- end
  64. disinfectAreaId: null, //区域码id,
  65. userInfo: null
  66. },
  67. globalData: {
  68. authAppId: '2021003181682188',
  69. authAppToken: 'e9e2faf62fdd538e27ad3eaf30f7ef48d00a2fc3'
  70. },
  71. onLaunch(options) {
  72. // my.call('ampeStartOperationWatcher', {}, res => {
  73. // console.log("result", res);
  74. // });
  75. my.on('ampeOperationTimeout', e => {
  76. console.log("event", e);
  77. })
  78. // 第一次打开
  79. // my.getSystemInfo({
  80. // success: (res) => {
  81. // // 判断获取设备系统信息中arome.deviceId参数是否为空
  82. // if (res.arome_deviceId != null) {
  83. // //todo 设置信标,当前为 ampe 设备
  84. // //todo 获取用户信息
  85. // console.log(333);
  86. // } else {
  87. // //todo 设置信标,当前为手机端
  88. // //todo 获取用户信息
  89. // }
  90. // },
  91. // fail: (err) => {
  92. // console.log(err);
  93. // }
  94. // })
  95. this.getSystemInfoSync()
  96. //本地缓存-初始化刷脸服务
  97. my.setStorageSync({
  98. key: "defaultInitParams",
  99. data: JSON.parse(JSON.stringify(this.data.initParams))
  100. });
  101. //本地缓存-调用刷脸服务
  102. my.setStorageSync({
  103. key: "defaultOneVNParams",
  104. data: JSON.parse(JSON.stringify(this.data.oneVNParams))
  105. });
  106. my.setStorageSync({
  107. key: "defaultOneVNServiceCode",
  108. data: this.data.oneVNServiceCode
  109. });
  110. //本地缓存-调用授权服务
  111. my.setStorageSync({
  112. key: "defaultAuthParams",
  113. data: JSON.parse(JSON.stringify(this.data.authParams))
  114. });
  115. my.setStorageSync({
  116. key: "defaultAuthServiceCode",
  117. data: this.data.authServiceCode
  118. });
  119. },
  120. //获取系统信息
  121. getSystemInfoSync() {
  122. this.data.systemInfo = my.getSystemInfoSync()
  123. //判断是否是在安卓小程序容器中运行
  124. if (this.data.systemInfo.arome_hardwareName) {
  125. this.data.isK8Device = true
  126. }
  127. },
  128. onShow(options) {
  129. // 从后台被 scheme 重新打开
  130. // options.query == {number:1}
  131. },
  132. });