resitor_scence.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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. startComponent() {
  54. wx.navigateTo({
  55. // url: "/pages/k8_ampe/k8_ampe"
  56. url: "/pages/web/web"
  57. });
  58. },
  59. // 内外宾
  60. changeRadio(e) {
  61. e.detail == 1 ? app.data.language = "ch" : app.data.language = "en";
  62. this.setData({
  63. type: e.detail + "",
  64. language: app.data.language
  65. });
  66. },
  67. // 显示提示 1-访客提示 | 2-常客提示
  68. showTip(e) {
  69. const type = e.currentTarget.dataset.type;
  70. let msg = this.data.international[type][this.data.language];
  71. wx.showModal({
  72. title: "提示",
  73. content: msg,
  74. showCancel: false,
  75. success: res => {}
  76. });
  77. },
  78. // 访客
  79. visitors() {
  80. wx.navigateTo({
  81. url: "/pages/visitor_make/visitor_make?formMain=true"
  82. });
  83. },
  84. // 常客
  85. regular() {
  86. wx.requestSubscribeMessage({
  87. entityIds: ["e3dd8fb9e84e49b4a96a1a466054ccad", "9d4ddcd78f66444482ad66c5a262ffed"],
  88. success(res) {
  89. // if(res.behavior === 'subscribe') {}
  90. },
  91. complete: res => {
  92. wx.navigateTo({
  93. url: "/pages/regular_register/regular_register"
  94. })
  95. }
  96. })
  97. },
  98. // 企业信息录入
  99. // informationInput() {
  100. // if (app.data.userInfo) {
  101. // wx.navigateTo({
  102. // url: '/pages/company_register/company_register'
  103. // })
  104. // } else {
  105. // wx.showToast({
  106. // title: '请先到右下角"我的"里面进行实名认证',
  107. // icon: 'none'
  108. // })
  109. // }
  110. // },
  111. // 根据扫码获取的企业id查询企业信息和楼宇信息
  112. getBuildingAndCompanyInfo(adminId) {
  113. getBuildingAndCompanyInfo(adminId).then(res => {
  114. app.data.temporary_adminInfo = res.data;
  115. });
  116. },
  117. goto(e) {
  118. let id = e.currentTarget.dataset.id;
  119. if (this.data.userInfo) {
  120. let url = "";
  121. if (id == 1) {
  122. wx.requestSubscribeMessage({
  123. entityIds: ["486ef1e5652a4629b6e95245f7cb44a9", "e3dd8fb9e84e49b4a96a1a466054ccad"],
  124. success(res) {
  125. // if(res.behavior === 'subscribe') {}
  126. },
  127. complete: res => {
  128. url = "/pages/regular_invite/regular_invite";
  129. wx.navigateTo({
  130. url
  131. })
  132. return
  133. }
  134. })
  135. } else if (id == 2) {
  136. url = "/pages/regular_visit_records/regular_visit_records";
  137. } else if (id == 3) {
  138. url = "/pages/changeUserInfo/index";
  139. } else if (id == 4) {
  140. url = "/pages/regular_company_manage/regular_company_manage";
  141. } else if (id == 6) {
  142. url = "/pages/visit_records/visit_records";
  143. }
  144. if(url) {
  145. wx.navigateTo({
  146. url
  147. });
  148. }
  149. } else {
  150. wx.showToast({
  151. icon: "none",
  152. title: this.data.language == "ch" ? "请先认证!" : "Please first certification!"
  153. });
  154. }
  155. },
  156. /**
  157. * 生命周期函数--监听页面加载
  158. */
  159. onLoad: function () {
  160. // options = {
  161. // adminId: 109,
  162. // type: 1
  163. // }
  164. let launchOptions = my.getLaunchOptionsSync()
  165. if(!launchOptions.query) {
  166. launchOptions = my.getEnterOptionsSync()
  167. }
  168. if (launchOptions.query && launchOptions.query.adminId) {
  169. this.getBuildingAndCompanyInfo(parseInt(launchOptions.query.adminId));
  170. app.data.type = parseInt(launchOptions.query.type) || 0;
  171. }
  172. this.setData({
  173. statusBarHeight: app.globalData.statusBarHeight,
  174. titleBarHeight: app.globalData.titleBarHeight
  175. })
  176. },
  177. /**
  178. * 生命周期函数--监听页面初次渲染完成
  179. */
  180. onReady: function () {
  181. // 页面加载完成
  182. },
  183. /**
  184. * 生命周期函数--监听页面显示
  185. */
  186. onShow: function () {
  187. this.setData({
  188. adminInfo: wx.getStorageSync("adminInfo"),
  189. userInfo: wx.getStorageSync("userInfo")
  190. });
  191. },
  192. /**
  193. * 生命周期函数--监听页面隐藏
  194. */
  195. onHide: function () {},
  196. /**
  197. * 生命周期函数--监听页面卸载
  198. */
  199. onUnload: function () {},
  200. /**
  201. * 页面相关事件处理函数--监听用户下拉动作
  202. */
  203. onPullDownRefresh: function () {},
  204. /**
  205. * 页面上拉触底事件的处理函数
  206. */
  207. onReachBottom: function () {},
  208. /**
  209. * 用户点击右上角分享
  210. */
  211. onShareAppMessage: function () {},
  212. antmoveAction: function () {
  213. //执行时动态赋值,请勿删除
  214. }
  215. });