app.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import "./__antmove/component/componentClass.js";
  2. my.global = {};
  3. const _my = require("./__antmove/api/index.js")(my);
  4. const wx = _my;
  5. // app.js
  6. const { checkUserWhiteListId } = require("./utils/api/api");
  7. App({
  8. data: {
  9. phone: null,
  10. adminInfo: wx.getStorageSync("adminInfo") || null,
  11. language: wx.getStorageSync("language") || "ch",
  12. userInfo: wx.getStorageSync("userInfo") || null,
  13. extraMessage: wx.getStorageSync("extraMessage") || null,
  14. temporary_userInfo: null,
  15. temporary_adminInfo: null,
  16. type: 0,
  17. //0->普通码 1->常客码
  18. //(过审专用,禁止删除)- start
  19. fake: true,
  20. myAppointment: null
  21. //(过审专用,禁止删除)- end
  22. },
  23. onLaunch(options) {
  24. // 展示本地存储能力
  25. const logs = wx.getStorageSync("logs") || [];
  26. logs.unshift(Date.now());
  27. wx.setStorageSync("logs", logs);
  28. // 获取状态栏和导航栏的高度
  29. const {
  30. titleBarHeight,
  31. statusBarHeight,
  32. } = my.getSystemInfoSync()
  33. this.globalData.statusBarHeight = statusBarHeight
  34. this.globalData.titleBarHeight = titleBarHeight
  35. //检测缓存中的常客是否有效(存在)、
  36. if (this.data.adminInfo) {
  37. checkUserWhiteListId(this.data.adminInfo.userWhitelistId).then(
  38. res => {
  39. if (!res.data) {
  40. wx.removeStorageSync("adminInfo");
  41. this.data.adminInfo = null;
  42. }
  43. }
  44. );
  45. }
  46. },
  47. globalData: {
  48. userInfo: null
  49. }
  50. });