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.
67 lines
2.3 KiB
67 lines
2.3 KiB
//app.js
|
|
App({
|
|
//----------------------------------------------globalData--------------------------------------
|
|
release: 1,
|
|
httpUrl: 'https://api.qniao.cn',
|
|
tmplIds: ['SUjEgwDopCv9xkkSZ4KbS0L7XbAiVQor6GmPg14K760'],
|
|
agentMsgIds: ['kG8DErWDpyzBHCFaLlSKYMF7xVy8UpgogCwV_WSNt10', 'oLbv-IyJOia2tenh64_Lc8xeAzwgzu3gh1vFJ1Se-ME'],
|
|
version: 152,
|
|
xAppId: '470236309865238528',
|
|
globalData: {
|
|
userInfo: {},
|
|
openId: null,
|
|
token: null,
|
|
isIPhoneX: false,
|
|
isIos: false,
|
|
kg: 0
|
|
},
|
|
inited: false,
|
|
//-----------------------------------------onLaunch---------------------------------------------
|
|
onLaunch: function () {
|
|
if (this.release) {
|
|
this.httpUrl = 'https://api.qniao.cn'
|
|
} else {
|
|
// this.httpUrl = 'http://47.113.118.47:9000'
|
|
this.httpUrl = 'https://api-test.qniao.cn'
|
|
}
|
|
},
|
|
|
|
// 获取高度
|
|
onShow: function(){
|
|
wx.getSystemInfo({
|
|
success: e => {
|
|
this.globalData.isIPhoneX = this.checkIPhoneX(e)
|
|
this.globalData.isIos = this.checkIos(e)
|
|
this.globalData.dev = e.platform == 'devtools'
|
|
let custom = wx.getMenuButtonBoundingClientRect()
|
|
this.globalData.Custom = custom
|
|
// 顶部操作栏高度
|
|
this.globalData.CustomBar = custom.bottom + custom.top - e.statusBarHeight + (this.globalData.isIos ? 4 : 0)
|
|
let windowHeight = e.windowHeight * (750 / e.windowWidth)
|
|
let statusBarHeight = this.globalData.CustomBar * (750 / e.windowWidth)
|
|
// 状态栏高度
|
|
this.globalData.StatusBar = e.statusBarHeight * (750 / e.windowWidth)
|
|
this.globalData.statusBarHeight = statusBarHeight
|
|
// fragmentHeight:指的是整个页面statusBarHeight以下的高度
|
|
this.globalData.fragmentHeight = windowHeight - statusBarHeight
|
|
this.globalData.windowWidth = e.windowWidth
|
|
}
|
|
})
|
|
},
|
|
//-----------------------------------------checkIPhoneX---------------------------------------------
|
|
checkIos: function (e) {
|
|
if ('ios' === e.platform) {
|
|
return true
|
|
}
|
|
if (e.system.startsWith('iOS')) {
|
|
return true
|
|
}
|
|
return false
|
|
},
|
|
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
|
|
}
|
|
|
|
})
|