app.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  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. that.globalData.windowWidth = systemInfo.windowWidth
  15. that.globalData.windowHeight = systemInfo.windowHeight
  16. // 导航栏高度 = 状态栏高度 + 44
  17. that.globalData.navBarHeight = systemInfo.statusBarHeight + 44;
  18. that.globalData.menuRight = systemInfo.screenWidth - menuButtonInfo.right;
  19. that.globalData.menuTop = menuButtonInfo.top;
  20. that.globalData.menuHeight = menuButtonInfo.height;
  21. that.globalData.menuWidth = menuButtonInfo.width;
  22. },
  23. globalData: {
  24. userInfo: null,
  25. navBarHeight: 0, // 导航栏高度
  26. menuRight: 0, // 胶囊距右方间距(方保持左、右间距一致)
  27. menuTop: 0, // 胶囊距顶部间距
  28. menuHeight: 0, // 胶囊高度(自定义内容可与胶囊高度保证一致)
  29. menuWidth:0,
  30. windowHeight:0,
  31. windowWidth:0,
  32. imghttp:'http://192.168.1.7:8801/'
  33. }
  34. })