app.js 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. // app.js
  2. App({
  3. onLaunch() {
  4. // 展示本地存储能力
  5. const logs = wx.getStorageSync('logs') || []
  6. logs.unshift(Date.now())
  7. wx.setStorageSync('logs', logs)
  8. //获取顶部navBar的信息
  9. const that = this;
  10. // 获取系统信息
  11. const systemInfo = wx.getSystemInfoSync();
  12. // 胶囊按钮位置信息
  13. const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
  14. // 导航栏高度 = 状态栏高度 + 44
  15. that.globalData.navBarHeight = systemInfo.statusBarHeight + 44;
  16. that.globalData.menuRight = systemInfo.screenWidth - menuButtonInfo.right;
  17. that.globalData.menuTop = menuButtonInfo.top;
  18. that.globalData.menuHeight = menuButtonInfo.height;
  19. that.globalData.menuWidth = menuButtonInfo.width;
  20. },
  21. globalData: {
  22. userInfo: null,
  23. navBarHeight: 0, // 导航栏高度
  24. menuRight: 0, // 胶囊距右方间距(方保持左、右间距一致)
  25. menuTop: 0, // 胶囊距顶部间距
  26. menuHeight: 0, // 胶囊高度(自定义内容可与胶囊高度保证一致)
  27. menuWidth:0,
  28. imghttp:'http://192.168.1.7:8801/'
  29. }
  30. })