-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.vue
58 lines (57 loc) · 1.25 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
<script>
import {
mapGetters,
mapActions
} from 'vuex'
import config from '@/admin.config.js'
import {
version
} from './package.json'
export default {
computed: {
...mapGetters({
isTokenValid: 'user/isTokenValid'
})
},
methods: {
...mapActions({
init: 'app/init'
})
},
onPageNotFound(msg) {
uni.redirectTo({
url: config.error.url
})
},
onLaunch: function() {
// #ifdef H5
console.log(
`%c uni-admin %c v${version} `,
'background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff',
'background:#007aff ;padding: 1px; border-radius: 0 3px 3px 0; color: #fff; font-weight: bold;'
)
// #endif
// 线上示例使用
// console.log('%c uni-app官方团队诚邀优秀前端工程师加盟,一起打造更卓越的uni-app & uniCloud,欢迎投递简历到 hr2013@dcloud.io', 'color: red');
console.log('App Launch')
if (!this.isTokenValid) {
uni.redirectTo({
url: config.login.url
})
} else {
this.init()
}
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
</script>
<style>
@import '@/common/uni.css';
@import '@/common/uni-icons.css';
@import '@/common/admin-icons.css';
</style>