|
|
@ -48,49 +48,13 @@ Page({ |
|
|
this.wxLogin() |
|
|
this.wxLogin() |
|
|
}, |
|
|
}, |
|
|
onReady: function () { |
|
|
onReady: function () { |
|
|
wx.getSystemInfo({ |
|
|
|
|
|
success: e => { |
|
|
|
|
|
app.globalData.isIos = this.checkIos(e) |
|
|
|
|
|
app.globalData.dev = e.platform == 'devtools' |
|
|
|
|
|
|
|
|
|
|
|
let custom = wx.getMenuButtonBoundingClientRect() |
|
|
|
|
|
app.globalData.Custom = custom |
|
|
|
|
|
// 顶部操作栏高度
|
|
|
|
|
|
app.globalData.CustomBar = custom.bottom + custom.top - e.statusBarHeight + (app.globalData.isIos ? 4 : 0) |
|
|
|
|
|
let windowHeight = e.windowHeight * (750 / e.windowWidth) |
|
|
|
|
|
|
|
|
|
|
|
let safeBottom = e.windowHeight - e.safeArea.bottom |
|
|
|
|
|
if(safeBottom > e.windowHeight){ |
|
|
|
|
|
safeBottom = 34 |
|
|
|
|
|
} |
|
|
|
|
|
app.globalData.safeBottom = safeBottom * (750 / e.windowWidth) |
|
|
|
|
|
// 状态栏高度
|
|
|
|
|
|
app.globalData.StatusBar = e.statusBarHeight * (750 / e.windowWidth) |
|
|
|
|
|
let statusBarHeight = app.globalData.CustomBar * (750 / e.windowWidth) |
|
|
|
|
|
app.globalData.statusBarHeight = statusBarHeight |
|
|
|
|
|
// fragmentHeight:指的是整个页面statusBarHeight以下的高度
|
|
|
|
|
|
app.globalData.fragmentHeight = windowHeight - statusBarHeight |
|
|
|
|
|
app.globalData.safeFragmentHeight = windowHeight - statusBarHeight - app.globalData.safeBottom |
|
|
|
|
|
app.globalData.windowWidth = e.windowWidth |
|
|
|
|
|
|
|
|
|
|
|
app.globalData.token = app.globalData.token || storage.get('Authorization') |
|
|
|
|
|
if(this.data.code){ |
|
|
|
|
|
this.fetchQrCode(this.data.code) |
|
|
|
|
|
} else if(!util.isEmpty(app.globalData.token)){ |
|
|
|
|
|
this.setData({ loging: true}) |
|
|
|
|
|
this.fetchUserInfo(app.globalData.token) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
checkIos: function (e) { |
|
|
|
|
|
if ('ios' === e.platform) { |
|
|
|
|
|
return true |
|
|
|
|
|
|
|
|
app.globalData.token = app.globalData.token || storage.get('Authorization') |
|
|
|
|
|
if(this.data.code){ |
|
|
|
|
|
this.fetchQrCode(this.data.code) |
|
|
|
|
|
} else if(!util.isEmpty(app.globalData.token)){ |
|
|
|
|
|
this.setData({ loging: true}) |
|
|
|
|
|
this.fetchUserInfo(app.globalData.token) |
|
|
} |
|
|
} |
|
|
if (e.system.startsWith('iOS')) { |
|
|
|
|
|
return true |
|
|
|
|
|
} |
|
|
|
|
|
return false |
|
|
|
|
|
}, |
|
|
}, |
|
|
/************************************** 获取用户信息,进行登录 ********************************************/ |
|
|
/************************************** 获取用户信息,进行登录 ********************************************/ |
|
|
checkFactoryId: function(storageFactoryId){ |
|
|
checkFactoryId: function(storageFactoryId){ |
|
|
|