-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.vue
78 lines (76 loc) · 1.68 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
77
78
<script>
import {
themeStorage
} from '@/storage/index.js'
import {
mapActions
} from 'vuex'
// #ifdef APP-PLUS
import '@/interceptor/chooseImage/index.js'
// #endif
import '@/interceptor/request/index.js'
import {
isLoginServe
} from '@/serves/auth.js'
import {
getUserInfoServe
} from '@/serves/user.js'
import {
getMenuServe
} from '@/serves/menu.js'
// #ifdef APP-PLUS
import wgtUpdate from '@/common/wgtUpdate.js'
// #endif
export default {
onLaunch() {
uni.onPushMessage((res) => {
const pages = getCurrentPages()
const page = pages[pages.length - 1]
if (page && page.route !== 'pages/message/message') {
// 设置tabbar红点
uni.showTabBarRedDot({
index: 1
})
}
})
// #ifdef APP-PLUS
wgtUpdate()
// #endif
// 初始主题色
const theme = themeStorage.get()
if (theme) {
this.setTheme(theme)
}
// 如果已登录 获取用户信息 菜单数据 并更新 store
isLoginServe().then(() => {
const pages = getCurrentPages()
const page = pages[pages.length - 1]
if (page && page.route !== 'pages/home/home')
uni.switchTab({
url: '/pages/home/home'
})
getUserInfoServe().then(res => {
this.setUserInfo(res.data)
})
getMenuServe().then(res => {
this.setMenuData(res.data)
})
}).catch(e => {})
},
onShow() {},
onHide() {},
methods: {
...mapActions(['setTheme', 'setUserInfo', 'setMenuData'])
}
}
</script>
<style lang="scss">
// 自定义字体图标
@import '@/static/iconfont.css';
// uni-ui公共css
@import '@/uni_modules/uni-scss/index.scss';
// 设置整个项目的背景色
page {
background-color: $uni-bg-color;
}
</style>