app.js 1.8 KB

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