12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import {
- ApiModel
- } from "./utils/api";
- const _Http = new ApiModel();
- App({
- onLaunch() {
- /* 计算tabbar+iphone安全距离 tabbar页面+100rpx*/
- let safeAreaBottom = 0,
- capsule = wx.getMenuButtonBoundingClientRect(),
- height = 200,
- that = this;
- //获取轮播图
- this.getBanner();
- wx.getSystemInfo({
- success(res) {
- //计算底部安全距离高度
- safeAreaBottom += res.screenHeight - res.safeArea.bottom;
- //计算自定义导航的高度
- height = capsule.height + res.statusBarHeight + (capsule.top - res.statusBarHeight) + 8;
- that.globalData.safeAreaBottom = safeAreaBottom;
- //判断是否为平板
- if (res.model.slice(0, 4) == "iPad") return that.globalData.myNavBorHeight = height;
- that.globalData.myNavBorHeight = height * 2;
- }
- })
- },
- getBanner() {
- //轮播图
- _Http.basic({
- "classname": "publicmethod.bannermag.bannermag",
- "method": "query_bannerlocationlist",
- "content": {
- "siteid": "BWJ",
- "fclienttype": "MOBILE"
- }
- }).then(res => {
- if (res.msg != '成功') {
- this.globalData.count = this.globalData.count + 1;
- if (this.globalData.count > 3) this.getBanner();
- return;
- }
- this.globalData.bannerDataList = res.data;
- })
- },
- globalData: {
- myNavBorHeight: 0, //自定义头部导航高度
- safeAreaBottom: 0, //底部安全距离
- account_list: [], //用户列表
- bannerDataList: [], //轮播图列表
- servicehotline: '', //客服手机号
- msgFcount: "", //徽标数量
- count: 0, //banner 请求次数
- }
- })
|