70 lines
1.8 KiB
Vue
70 lines
1.8 KiB
Vue
|
<script>
|
|||
|
import toolAll from '@/jsFile/tools.js';
|
|||
|
export default {
|
|||
|
globalData: {
|
|||
|
statusBarHeight: 0, //状态栏高度
|
|||
|
navigationBarHeight: 44, //这里先默认为44,ios 导航栏高度值,安卓和ios有点差别哦
|
|||
|
},
|
|||
|
onLaunch: function() {
|
|||
|
// console.log('App Launch');
|
|||
|
let that = this;
|
|||
|
uni.getSystemInfo({
|
|||
|
success(res) {
|
|||
|
that.globalData.statusBarHeight = res.statusBarHeight;
|
|||
|
if (res.platform == 'ios') {
|
|||
|
// console.log('ios',that.globalData.statusBarHeight);
|
|||
|
that.globalData.navigationBarHeight == 44;
|
|||
|
} else if (res.platform == 'android') {
|
|||
|
// console.log('android',that.globalData.statusBarHeight);
|
|||
|
that.globalData.navigationBarHeight = 48;
|
|||
|
} else {
|
|||
|
// console.log('其他',that.globalData.statusBarHeight);
|
|||
|
that.globalData.navigationBarHeight = 44;
|
|||
|
}
|
|||
|
}
|
|||
|
})
|
|||
|
// 给底部tab加角标
|
|||
|
// setTimeout(() => {
|
|||
|
// uni.setTabBarBadge({
|
|||
|
// index: 1,
|
|||
|
// text: '31'
|
|||
|
// });
|
|||
|
// uni.showTabBarRedDot({
|
|||
|
// index: 3
|
|||
|
// });
|
|||
|
// }, 1000);
|
|||
|
|
|||
|
},
|
|||
|
onShow: function() {
|
|||
|
// wx.checkSession({ //检测当前用户的session_key是否过期
|
|||
|
// success: function() { //session_key 未过期,并且在本生命周期一直有效
|
|||
|
// if(uni.getStorageSync('token')!=''){
|
|||
|
toolAll.tools.guoq()
|
|||
|
// }
|
|||
|
// },fail() {
|
|||
|
// toolAll.tools.showToast('您目前是游客,请授权登录')
|
|||
|
// setTimeout(()=>{
|
|||
|
// uni.navigateTo({
|
|||
|
// url:'/pages/login/login'
|
|||
|
// })
|
|||
|
// },1000)
|
|||
|
// }
|
|||
|
// })
|
|||
|
console.log('App Show');
|
|||
|
},
|
|||
|
onHide: function() {
|
|||
|
// console.log('App Hide');
|
|||
|
}
|
|||
|
};
|
|||
|
</script>
|
|||
|
|
|||
|
<style>
|
|||
|
/*每个页面公共css */
|
|||
|
@import url("./commons/dengrui.css");
|
|||
|
@import url("./commons/animate.min.css");
|
|||
|
|
|||
|
page {
|
|||
|
background-color: #F5F5F5;
|
|||
|
}
|
|||
|
</style>
|