<script>
|
import Vue from 'vue'
|
export default {
|
onLaunch: function() {
|
if (!uni.getStorageSync('switchs')) {
|
uni.setStorageSync('switchs', JSON.stringify(true))
|
}
|
//获取头部高度
|
uni.getSystemInfo({
|
success: function(e) {
|
// console.log('手机牌子'+e.brand) //手机牌子
|
// console.log('手机型号'+e.model) //手机型号
|
Vue.prototype.PhoneModel = e.model
|
// #ifndef MP
|
Vue.prototype.StatusBar = e.statusBarHeight;
|
Vue.prototype.CustomBar = e.statusBarHeight + 45;
|
console.log(e.platform)
|
// if (e.platform == 'android') {
|
// Vue.prototype.CustomBar = e.statusBarHeight + 50;
|
// } else {
|
// Vue.prototype.CustomBar = e.statusBarHeight + 45;
|
// };
|
// #endif
|
|
// #ifdef MP-WEIXIN || MP-QQ
|
Vue.prototype.StatusBar = e.statusBarHeight;
|
let capsule = wx.getMenuButtonBoundingClientRect();
|
if (capsule) {
|
Vue.prototype.Custom = capsule;
|
// Vue.prototype.capsuleSafe = uni.upx2px(750) - capsule.left + uni.upx2px(750) - capsule.right;
|
Vue.prototype.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight;
|
} else {
|
Vue.prototype.CustomBar = e.statusBarHeight + 50;
|
}
|
// #endif
|
|
|
// #ifdef MP-ALIPAY
|
Vue.prototype.StatusBar = e.statusBarHeight;
|
Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
|
// #endif
|
|
}
|
})
|
|
|
|
},
|
onShow: function() {
|
console.log('App Show')
|
},
|
onError:function(error,msg){
|
console.log(error.toString())
|
if(error.toString().indexOf('SyntaxError') != -1 ){ //子页面token失效报错
|
if(!uni.getStorageSync('userInfo')){
|
uni.showToast({
|
title: 'token失效,请重新登陆',
|
icon: 'none',
|
duration: 2000
|
});
|
// 跳转到登录
|
uni.redirectTo({
|
url: '/pages/login/login'
|
})
|
}
|
|
}
|
},
|
methods: {
|
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
/* 要写在第一行,同时给style标签加入lang="scss"属性 */
|
@import "uview-ui/index.scss";
|
/*每个页面公共css */
|
@import "styles/iconfont/iconfont.css";
|
@import "styles/main.css";
|
@import "styles/index.css";
|
|
page {
|
width: 100%;
|
min-height: 100vh;
|
background-color: #F2F2F2;
|
box-sizing: border-box;
|
}
|
</style>
|