app.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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.bottom;
  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: 0, //自定义头部导航高度
  38. safeAreaBottom: 0, //底部安全距离
  39. account_list: [], //用户列表
  40. bannerDataList: [], //轮播图列表
  41. servicehotline: '', //客服手机号
  42. msgFcount: "", //徽标数量
  43. }
  44. })