app.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // app.js
  2. const api = require('./api/index')
  3. App({
  4. onLaunch() {
  5. // 展示本地存储能力
  6. const logs = wx.getStorageSync('logs') || []
  7. logs.unshift(Date.now())
  8. wx.setStorageSync('logs', logs)
  9. //获取顶部navBar的信息
  10. const that = this;
  11. // 获取系统信息
  12. const systemInfo = wx.getSystemInfoSync();
  13. // 胶囊按钮位置信息
  14. const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
  15. that.globalData.windowWidth = systemInfo.windowWidth
  16. that.globalData.windowHeight = systemInfo.windowHeight
  17. // 导航栏高度 = 状态栏高度 + 44
  18. that.globalData.navBarHeight = systemInfo.statusBarHeight + 44;
  19. that.globalData.menuRight = systemInfo.screenWidth - menuButtonInfo.right;
  20. that.globalData.menuTop = menuButtonInfo.top;
  21. that.globalData.menuHeight = menuButtonInfo.height;
  22. that.globalData.menuWidth = menuButtonInfo.width;
  23. wx.setStorageSync('height', that.globalData.navBarHeight)
  24. this.getPersonRights()
  25. },
  26. globalData: {
  27. userInfo: null,
  28. navBarHeight: 0, // 导航栏高度
  29. menuRight: 0, // 胶囊距右方间距(方保持左、右间距一致)
  30. menuTop: 0, // 胶囊距顶部间距
  31. menuHeight: 0, // 胶囊高度(自定义内容可与胶囊高度保证一致)
  32. menuWidth:0,
  33. windowHeight:0,
  34. windowWidth:0,
  35. phone:'0755-82839168',
  36. imghttp:'https://www.xsip.cn/fileManager/downloadFile?fileId='
  37. // imghttp:'http://192.168.1.16:8801/fileManager/downloadFile?fileId='
  38. },
  39. getPersonRights(){
  40. api.getPersonRights({},false).then(res=>{
  41. if(res.code == 200){
  42. var data = JSON.stringify(res.data.data)
  43. wx.setStorageSync('vip', data)
  44. }
  45. })
  46. },
  47. })