mine.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. const _my = require("../../__antmove/api/index.js")(my);
  2. const wx = _my;
  3. // pages/mine/mine.js
  4. import international from "../../international/appointment_scence/index";
  5. const {
  6. desensitizationPhone,
  7. desensitizationIdNumber
  8. } = require("../../utils/util");
  9. const app = getApp();
  10. Page({
  11. /**
  12. * 页面的初始数据
  13. */
  14. data: {
  15. international: international,
  16. //国际化语言包
  17. language: app.data.language,
  18. statusBarHeight: 0,
  19. titleBarHeight: 0,
  20. type: 2,
  21. //1常客2访客
  22. userInfo: null,
  23. // 功能列表
  24. component_list: [{
  25. id: 1,
  26. name_ch: "邀请人员",
  27. name_en: "Invite people",
  28. icon: "../../static/mine/my_appointment.png",
  29. url: ""
  30. }, {
  31. id: 2,
  32. name_ch: "常客邀请/申请记录",
  33. name_en: "Visiting records",
  34. icon: "../../static/mine/appointment_records.png",
  35. url: ""
  36. }, {
  37. id: 6,
  38. name_ch: "访客申请记录",
  39. name_en: "Visiting records",
  40. icon: "../../static/mine/visitors.png",
  41. url: ""
  42. }, {
  43. id: 3,
  44. name_ch: "更改信息",
  45. name_en: "Change the information",
  46. icon: "../../static/mine/company_msg.png",
  47. url: ""
  48. }, {
  49. id: 4,
  50. name_ch: "企业信息",
  51. name_en: "Enterprise information",
  52. icon: "../../static/mine/change_msg.png",
  53. url: ""
  54. }],
  55. adminInfo: null
  56. },
  57. // /pages/regular_visit_details/regular_visit_details 拜访详情
  58. // /pages/regular_company_manage/regular_company_manage 企业信息
  59. // /pages/company_register/company_register 企业信息录入
  60. // 跳转
  61. goto(e) {
  62. let id = e.currentTarget.dataset.id;
  63. if (this.data.userInfo) {
  64. let url = "";
  65. if (id == 1) {
  66. wx.requestSubscribeMessage({
  67. entityIds: ["486ef1e5652a4629b6e95245f7cb44a9"],
  68. success(res) {
  69. if(res.behavior === 'subscribe') {
  70. url = "/pages/regular_invite/regular_invite";
  71. wx.navigateTo({
  72. url
  73. })
  74. return
  75. }
  76. }
  77. });
  78. } else if (id == 2) {
  79. url = "/pages/regular_visit_records/regular_visit_records";
  80. } else if (id == 3) {
  81. url = "/pages/changeUserInfo/index";
  82. } else if (id == 4) {
  83. url = "/pages/regular_company_manage/regular_company_manage";
  84. } else if (id == 6) {
  85. url = "/pages/visit_records/visit_records";
  86. }
  87. if(url) {
  88. wx.navigateTo({
  89. url
  90. });
  91. }
  92. } else {
  93. wx.showToast({
  94. icon: "none",
  95. title: this.data.language == "ch" ? "请先认证!" : "Please first certification!"
  96. });
  97. }
  98. },
  99. // 认证
  100. Certification() {
  101. wx.navigateTo({
  102. url: "/pages/changeUserInfo/index"
  103. });
  104. },
  105. //图片预览
  106. preview(e) {
  107. let url = e.currentTarget.dataset.src;
  108. wx.previewImage({
  109. current: url,
  110. // 当前显示图片的http链接
  111. urls: [url] // 需要预览的图片http链接列表
  112. });
  113. },
  114. getUserInfo() {
  115. if (app.data.userInfo) {
  116. let userInfo = JSON.parse(JSON.stringify(wx.getStorageSync("userInfo")));
  117. userInfo.idNumber = desensitizationIdNumber(userInfo.idNumber);
  118. userInfo.phone = desensitizationPhone(userInfo.phone);
  119. this.setData({
  120. userInfo,
  121. type: app.data.extraMessage ? 2 : 1,
  122. adminInfo: app.data.adminInfo
  123. });
  124. }
  125. },
  126. /**
  127. * 生命周期函数--监听页面加载
  128. */
  129. onLoad: function (options) {
  130. this.setData({
  131. statusBarHeight: app.globalData.statusBarHeight,
  132. titleBarHeight: app.globalData.titleBarHeight
  133. })
  134. },
  135. /**
  136. * 生命周期函数--监听页面初次渲染完成
  137. */
  138. onReady: function () {},
  139. /**
  140. * 生命周期函数--监听页面显示
  141. */
  142. onShow: function () {
  143. this.getUserInfo();
  144. this.setData({
  145. language: app.data.language
  146. });
  147. },
  148. /**
  149. * 生命周期函数--监听页面隐藏
  150. */
  151. onHide: function () {},
  152. /**
  153. * 生命周期函数--监听页面卸载
  154. */
  155. onUnload: function () {},
  156. /**
  157. * 页面相关事件处理函数--监听用户下拉动作
  158. */
  159. onPullDownRefresh: function () {},
  160. /**
  161. * 页面上拉触底事件的处理函数
  162. */
  163. onReachBottom: function () {},
  164. /**
  165. * 用户点击右上角分享
  166. */
  167. onShareAppMessage: function () {},
  168. antmoveAction: function () {
  169. //执行时动态赋值,请勿删除
  170. }
  171. });