app.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. console.log(res)
  22. that.globalData.bannerDataList = res.data;
  23. })
  24. wx.getSystemInfo({
  25. success(res) {
  26. //计算底部安全距离高度
  27. // safeAreaBottom += res.screenHeight - res.safeArea.height;
  28. //计算自定义导航的高度
  29. height = capsule.height + res.statusBarHeight + (capsule.top - res.statusBarHeight) + 8;
  30. that.globalData.safeAreaBottom = safeAreaBottom;
  31. //判断是否为平板
  32. if (res.model.slice(0, 4) == "iPad") return that.globalData.myNavBorHeight = height;
  33. that.globalData.myNavBorHeight = height * 2;
  34. }
  35. })
  36. },
  37. globalData: {
  38. myNavBorHeight: null, //自定义头部导航高度
  39. account_list: [], //用户列表
  40. bannerDataList: [],
  41. }
  42. })