You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.5 KiB

//app.js
App({
//----------------------------------------------globalData--------------------------------------
release: 1,
httpUrl: 'https://api-test.qniao.cn',
tmplIds: ['kg0T1ve0FpYrEtZ4ExbypHm8mtS7OJaehvqN_T9ypoI'],
globalData: {
userInfo: {},
openId: null,
token: null,
isIPhoneX: false
},
//-----------------------------------------onLaunch---------------------------------------------
onLaunch: function () {
if (this.release) {
this.httpUrl = 'https://api.qniao.cn'
} else {
// this.httpUrl = 'http://192.168.0.24:9000'
this.httpUrl = 'https://api-test.qniao.cn'
}
},
// 获取高度
onShow: function(){
wx.getSystemInfo({
success: e => {
this.globalData.StatusBar = e.statusBarHeight;
let custom = wx.getMenuButtonBoundingClientRect();
this.globalData.Custom = custom;
this.globalData.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
let windowHeight = e.windowHeight * (750 / e.windowWidth);
let statusBarHeight = this.globalData.CustomBar * (750 / e.windowWidth);
this.globalData.fragmentHeight = windowHeight - statusBarHeight
this.globalData.isIPhoneX = this.checkIPhoneX(e)
}
})
},
//-----------------------------------------checkIPhoneX---------------------------------------------
checkIPhoneX: function (e) {
var t = e.model,
o = e.platform;
return (/iPhone 11/.test(t) || /iPhone X/.test(t) || /iPhone 12/.test(t)) && 'ios' === o
}
})