-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.vue
70 lines (69 loc) · 1.59 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
<script>
import { mapGetters } from 'vuex'
export default {
computed: {
...mapGetters(['setting'])
},
onLaunch: function() {
console.log('App Launch')
// 读取设置信息
this.$store.dispatch('app/readSetting')
// #ifdef APP-PLUS
plus.screen.lockOrientation('portrait-primary')
// #endif
// #ifndef H5
// 开启屏幕常亮
uni.setKeepScreenOn({
keepScreenOn: this.setting.keepScreen || false,
success: _ => {
if (!this.setting.keepScreen) return
uni.showToast({
title: this.setting.keepScreen && '屏幕常亮开启中',
icon: 'none',
position: 'bottom'
})
}
})
// #endif
// 获取系统信息
uni.getSystemInfo({
success: res => {
delete res['errMsg']
this.$store.commit('app/SAVE_SYSTEMINFO', res)
}
})
// 获取网络状态
uni.getNetworkType({
success: res => {
const { networkType } = res
this.$store.commit('app/SAVE_NETWORKTYPE', networkType)
}
})
// 监听网络变化
uni.onNetworkStatusChange(res => {
const { networkType } = res
this.$store.commit('app/SAVE_NETWORKTYPE', networkType)
})
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
</script>
<style lang="scss">
/*每个页面公共css */
@import "./static/iconfont/iconfont.css";
body {
background-color: #fff;
}
.group {
padding-top: $uni-spacing-col-lg;
background-color: $uni-bg-color-grey;
}
p{
font-size: $uni-font-size-base;
}
</style>