-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.vue
76 lines (74 loc) · 1.9 KB
/
App.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<script>
import {
getLocal
} from "@/utils/local.js";
import {
userStore
} from '@/pinia/userInfo/userInfo.js';
import {
showMsg
} from '@/utils/Toast.js';
import request from "@/utils/request.js"
export default {
onLaunch: function(options) {
// if (getLocal('login')) {
// console.log('防止手机上选择头像的时候触发下面代码直接进入到登录页');
// } else if (getLocal('edits')) {
// console.log('防止更换手机头像的时候触发下面代码直接进入到登录页');
// } else if (getLocal('token')) {
if (getLocal('token')) {
const userPower = new userStore();
// 判断token是否过期
request('/user/userInfo', 'get', {
username: userPower.username
})
.then(response => {
const res = response.data;
// console.log(res);
// 处理返回的数据
if (res.code == '401') {
return showMsg(res.msg)
} else {
uni.switchTab({
url: '/pages/home/home'
})
}
})
} else {
uni.redirectTo({
url: "/pages/login/login",
animationType: 'pop-in',
animationDuration: 200
});
}
console.log('App Launch');
},
onShow: function(options) {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
},
}
</script>
<style>
/*每个页面公共css */
@import '@/static/iconfont/font/iconfont.css';
@import '@/static/css/touch.css';
/* 引入iconfont */
@import url('@/static/iconfont/iconfont.css');
/* 这个高度我们得手动去掉,否则纵向滚动做不了,它会撑开盒子高度导致两个滚动条 */
:deep(.uni-app--showtabbar uni-page-wrapper::after) {
display: none !important;
height: 0 !important;
}
/* 隐藏滚动条 */
::-webkit-scrollbar {
display: none;
width: 0 !important;
height: 0 !important;
-webkit-appearance: none;
background: transparent;
color: transparent;
}
</style>