faceCheck.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. const _my = require("../../__antmove/api/index.js")(my);
  2. const wx = _my;
  3. // pages/make_appointment/faceCheck/faceCheck.js
  4. // const {
  5. // BaiDuFaceComparison,
  6. // } = require("../../utils/api/make_appointment")
  7. const upload_image = require("../../utils/upload/upload_image");
  8. const app = getApp();
  9. const { doConfirmFaceNotifyNew } = require("../../utils/api/api");
  10. Page({
  11. /**
  12. * 页面的初始数据
  13. */
  14. data: {
  15. cardAvatarUrl: null,
  16. form: {},
  17. // (过审专用,禁止删除)- start
  18. fake: null
  19. // (过审专用,禁止删除)- start
  20. },
  21. getPhotoPath(e) {
  22. upload_image({
  23. url: e.detail
  24. }).then(img => {
  25. if (img.url) {
  26. this.doConfirmFaceNotifyNew(img.url);
  27. }
  28. });
  29. },
  30. // 获取用户信息
  31. doConfirmFaceNotifyNew(img) {
  32. let data = {
  33. avatar: img,
  34. idNumber: this.data.form.inputIdcard,
  35. username: this.data.form.inputName,
  36. phone: this.data.form.phoneNumber
  37. };
  38. doConfirmFaceNotifyNew(data).then(res => {
  39. if (res.code == 200) {
  40. res.data.org = this.data.form.org;
  41. res.data.orgId = this.data.form.orgId;
  42. res.data.cardIdEx = this.data.form.cardIdEx;
  43. wx.setStorageSync("userInfo", res.data);
  44. this.changePage();
  45. } else {
  46. wx.showToast({
  47. title: res.mag,
  48. icon: "none"
  49. });
  50. }
  51. });
  52. },
  53. //跳转页面 (是否缓存进入)
  54. changePage() {
  55. let { form } = this.data;
  56. if (form.isShowApplet != "false") {
  57. wx.navigateTo({
  58. url:
  59. "/pages/wx_airport/rlxf_userMsg/index?orgId=" +
  60. form.orgId +
  61. "&&org=" +
  62. form.org +
  63. "&showModal=" +
  64. true
  65. });
  66. } else {
  67. wx.reLaunch({
  68. url:
  69. "/pages/wx_airport/rlxf_pass/rlxf_pass?orgId=" +
  70. this.data.form.orgId +
  71. "&org=" +
  72. this.data.form.org +
  73. "&showModal=" +
  74. true
  75. });
  76. }
  77. },
  78. /**
  79. * 生命周期函数--监听页面加载
  80. */
  81. onLoad: function(options) {
  82. console.log(options);
  83. if (options) {
  84. this.setData({
  85. form: options
  86. });
  87. }
  88. // this.doConfirmFaceNotifyNew('http://192.168.11.14:9100/yx-fyzd/file/upload/imagesnew/20220614/16551962558484660.jpg')
  89. // (过审专用,禁止删除)- start
  90. if (
  91. this.data.form.inputIdcard == "330821199603150212" ||
  92. this.data.form.inputIdcard == null
  93. ) {
  94. app.data.fake = true;
  95. } else {
  96. app.data.fake = false;
  97. }
  98. this.setData({
  99. fake: app.data.fake
  100. });
  101. // (过审专用,禁止删除)- end
  102. },
  103. /**
  104. * 生命周期函数--监听页面初次渲染完成
  105. */
  106. onReady: function() {},
  107. /**
  108. * 生命周期函数--监听页面显示
  109. */
  110. onShow: function() {},
  111. /**
  112. * 生命周期函数--监听页面隐藏
  113. */
  114. onHide: function() {},
  115. /**
  116. * 生命周期函数--监听页面卸载
  117. */
  118. onUnload: function() {},
  119. /**
  120. * 页面相关事件处理函数--监听用户下拉动作
  121. */
  122. onPullDownRefresh: function() {},
  123. /**
  124. * 页面上拉触底事件的处理函数
  125. */
  126. onReachBottom: function() {},
  127. /**
  128. * 用户点击右上角分享
  129. */
  130. onShareAppMessage: function() {}
  131. });