app.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import {
  2. ApiModel
  3. } from "./utils/api";
  4. const _Http = new ApiModel();
  5. App({
  6. onLaunch() {
  7. /* 计算tabbar+iphone安全距离 tabbar页面+100rpx*/
  8. let safeAreaBottom = 0,
  9. capsule = wx.getMenuButtonBoundingClientRect(),
  10. height = 200,
  11. that = this;
  12. //轮播图
  13. _Http.basic({
  14. "classname": "publicmethod.bannermag.bannermag",
  15. "method": "query_bannerlocationlist",
  16. "content": {
  17. "siteid": "BWJ",
  18. "fclienttype": "MOBILE"
  19. }
  20. }).then(res => {
  21. that.globalData.bannerDataList = res.data;
  22. })
  23. wx.getSystemInfo({
  24. success(res) {
  25. //计算底部安全距离高度
  26. // safeAreaBottom += res.screenHeight - res.safeArea.height;
  27. //计算自定义导航的高度
  28. height = capsule.height + res.statusBarHeight + (capsule.top - res.statusBarHeight) + 8;
  29. that.globalData.safeAreaBottom = safeAreaBottom;
  30. //判断是否为平板
  31. if (res.model.slice(0, 4) == "iPad") return that.globalData.myNavBorHeight = height;
  32. that.globalData.myNavBorHeight = height * 2;
  33. }
  34. })
  35. },
  36. globalData: {
  37. myNavBorHeight: null, //自定义头部导航高度
  38. account_list: [], //用户列表
  39. bannerDataList: [],
  40. }
  41. })