resitor_scence.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. const _my = require("../../__antmove/api/index.js")(my);
  2. const wx = _my;
  3. // pages/resitor_scence/resitor_scence.js
  4. import international from "../../international/appointment_scence/index";
  5. import { getBuildingAndCompanyInfo } from "../../utils/api/api";
  6. const app = getApp();
  7. Page({
  8. /**
  9. * 页面的初始数据
  10. */
  11. data: {
  12. international: international,
  13. //国际化语言包
  14. language: app.data.language,
  15. type: app.data.language === "ch" ? "1" : "2",
  16. statusBarHeight: 0,
  17. titleBarHeight: 0,
  18. adminInfo: wx.getStorageSync("adminInfo"),
  19. userInfo: wx.getStorageSync("userInfo"),
  20. // 功能列表
  21. component_list: [{
  22. id: 1,
  23. name_ch: "邀请人员",
  24. name_en: "Invite people",
  25. icon: "../../static/home/my_appointment.png",
  26. url: ""
  27. }, {
  28. id: 2,
  29. name_ch: "邀请记录/申请记录",
  30. name_en: "Visiting records",
  31. icon: "../../static/home/appointment_records.png",
  32. url: ""
  33. }, {
  34. id: 6,
  35. name_ch: "访客申请记录",
  36. name_en: "Visiting records",
  37. icon: "../../static/home/visitors.png",
  38. url: ""
  39. }, {
  40. id: 3,
  41. name_ch: "更改信息",
  42. name_en: "Change the information",
  43. icon: "../../static/home/company_msg.png",
  44. url: ""
  45. }, {
  46. id: 4,
  47. name_ch: "企业信息",
  48. name_en: "Enterprise information",
  49. icon: "../../static/home/change_msg.png",
  50. url: ""
  51. }]
  52. },
  53. // 内外宾
  54. changeRadio(e) {
  55. e.detail == 1 ? app.data.language = "ch" : app.data.language = "en";
  56. this.setData({
  57. type: e.detail + "",
  58. language: app.data.language
  59. });
  60. },
  61. // 显示提示 1-访客提示 | 2-常客提示
  62. showTip(e) {
  63. const type = e.currentTarget.dataset.type;
  64. let msg = this.data.international[type][this.data.language];
  65. wx.showModal({
  66. title: "提示",
  67. content: msg,
  68. showCancel: false,
  69. success: res => {}
  70. });
  71. },
  72. // 访客
  73. visitors() {
  74. wx.navigateTo({
  75. url: "/pages/visitor_make/visitor_make?formMain=true"
  76. });
  77. },
  78. // 常客
  79. regular() {
  80. wx.requestSubscribeMessage({
  81. entityIds: ["e3dd8fb9e84e49b4a96a1a466054ccad", "9d4ddcd78f66444482ad66c5a262ffed"],
  82. success(res) {
  83. // if(res.behavior === 'subscribe') {}
  84. },
  85. complete: res => {
  86. wx.navigateTo({
  87. url: "/pages/regular_register/regular_register"
  88. })
  89. }
  90. })
  91. },
  92. // 企业信息录入
  93. // informationInput() {
  94. // if (app.data.userInfo) {
  95. // wx.navigateTo({
  96. // url: '/pages/company_register/company_register'
  97. // })
  98. // } else {
  99. // wx.showToast({
  100. // title: '请先到右下角"我的"里面进行实名认证',
  101. // icon: 'none'
  102. // })
  103. // }
  104. // },
  105. // 根据扫码获取的企业id查询企业信息和楼宇信息
  106. getBuildingAndCompanyInfo(adminId) {
  107. getBuildingAndCompanyInfo(adminId).then(res => {
  108. app.data.temporary_adminInfo = res.data;
  109. });
  110. },
  111. goto(e) {
  112. let id = e.currentTarget.dataset.id;
  113. if (this.data.userInfo) {
  114. let url = "";
  115. if (id == 1) {
  116. wx.requestSubscribeMessage({
  117. entityIds: ["486ef1e5652a4629b6e95245f7cb44a9", "e3dd8fb9e84e49b4a96a1a466054ccad"],
  118. success(res) {
  119. // if(res.behavior === 'subscribe') {}
  120. },
  121. complete: res => {
  122. url = "/pages/regular_invite/regular_invite";
  123. wx.navigateTo({
  124. url
  125. })
  126. return
  127. }
  128. })
  129. } else if (id == 2) {
  130. url = "/pages/regular_visit_records/regular_visit_records";
  131. } else if (id == 3) {
  132. url = "/pages/changeUserInfo/index";
  133. } else if (id == 4) {
  134. url = "/pages/regular_company_manage/regular_company_manage";
  135. } else if (id == 6) {
  136. url = "/pages/visit_records/visit_records";
  137. }
  138. if(url) {
  139. wx.navigateTo({
  140. url
  141. });
  142. }
  143. } else {
  144. wx.showToast({
  145. icon: "none",
  146. title: this.data.language == "ch" ? "请先认证!" : "Please first certification!"
  147. });
  148. }
  149. },
  150. /**
  151. * 生命周期函数--监听页面加载
  152. */
  153. onLoad: function () {
  154. // options = {
  155. // adminId: 109,
  156. // type: 1
  157. // }
  158. let launchOptions = my.getLaunchOptionsSync()
  159. if(!launchOptions.query) {
  160. launchOptions = my.getEnterOptionsSync()
  161. }
  162. if (launchOptions.query && launchOptions.query.adminId) {
  163. this.getBuildingAndCompanyInfo(parseInt(launchOptions.query.adminId));
  164. app.data.type = parseInt(launchOptions.query.type) || 0;
  165. }
  166. this.setData({
  167. statusBarHeight: app.globalData.statusBarHeight,
  168. titleBarHeight: app.globalData.titleBarHeight
  169. })
  170. },
  171. /**
  172. * 生命周期函数--监听页面初次渲染完成
  173. */
  174. onReady: function () {
  175. // 页面加载完成
  176. },
  177. /**
  178. * 生命周期函数--监听页面显示
  179. */
  180. onShow: function () {
  181. this.setData({
  182. adminInfo: wx.getStorageSync("adminInfo"),
  183. userInfo: wx.getStorageSync("userInfo")
  184. });
  185. },
  186. /**
  187. * 生命周期函数--监听页面隐藏
  188. */
  189. onHide: function () {},
  190. /**
  191. * 生命周期函数--监听页面卸载
  192. */
  193. onUnload: function () {},
  194. /**
  195. * 页面相关事件处理函数--监听用户下拉动作
  196. */
  197. onPullDownRefresh: function () {},
  198. /**
  199. * 页面上拉触底事件的处理函数
  200. */
  201. onReachBottom: function () {},
  202. /**
  203. * 用户点击右上角分享
  204. */
  205. onShareAppMessage: function () {},
  206. antmoveAction: function () {
  207. //执行时动态赋值,请勿删除
  208. }
  209. });