-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.vue
99 lines (94 loc) · 2.69 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<script>
import Vue from 'vue';
import { APIs } from '@/staticData/staticData.js';
import { getStorageSync, getCurrentWeek,openSchoolChangeTips,commonFun,getClassAndExam } from '@/commonFun.js';
import { http } from '@/axios-config.js';
export default {
onLaunch() {
//从0开始
//计数
const currentWeek = getCurrentWeek();
Vue.prototype.$currentWeek = currentWeek;
Vue.prototype.$currentDay = (new Date().getDay() || 7) - 1;
//设置bar颜色
//这个iconlist要跟pages.json里面的icon对应!
const barColor = this.$themeColor == 'otherTheme' ? this.$commonFun.hexify(this.$allColor.gray.theme) : this.$commonFun.hexify(this.$colorList.theme);
const iconList = ['task_fill', 'grade', 'people_fill'].map(item => {
return `static/bar/${this.$themeColor}/${item}.png`;
});
uni.setTabBarStyle({
color: '#A1A1A1',
selectedColor: barColor,
backgroundColor: '#ffffff',
borderStyle: 'white'
});
if (this.$themeColor !== 'otherTheme') {
iconList.forEach((item, index) => {
uni.setTabBarItem({
index: index,
selectedIconPath: iconList[index]
});
});
}
//获取高度以设置导航栏
uni.getSystemInfo({
success: function(e) {
// #ifndef MP
Vue.prototype.StatusBar = e.statusBarHeight;
if (e.platform == 'android') {
Vue.prototype.CustomBar = e.statusBarHeight + 50;
} else {
Vue.prototype.CustomBar = e.statusBarHeight + 45;
}
// #endif
// #ifdef MP-WEIXIN
Vue.prototype.StatusBar = e.statusBarHeight;
let custom = uni.getMenuButtonBoundingClientRect();
Vue.prototype.Custom = custom;
Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
// #endif
// #ifdef MP-QQ
Vue.prototype.StatusBar = e.statusBarHeight;
Vue.prototype.CustomBar = e.statusBarHeight + 45;
// #endif
// #ifdef MP-ALIPAY
Vue.prototype.StatusBar = e.statusBarHeight;
Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
// #endif
}
});
},
onShow() {},
onHide: function() {
console.log('App Hide');
},
created() {
this.schoolOpening().catch(e=>console.log(e));
},
methods: {
async schoolOpening() {
const {
data: { schoolOpening }
} = await http.get(APIs.getSchoolOpening);
var oldTime = uni.getStorageSync('schoolOpening')
uni.setStorageSync('schoolOpening', schoolOpening);
if (oldTime !== schoolOpening) {
// TODO 刷新一次课表
openSchoolChangeTips()
}
}
}
};
</script>
<style lang="scss">
@import '/theme-color.css';
@import 'colorui/main.css';
@import 'colorui/icon.css';
@import 'colorui/animation.css';
@import 'components/gaoyia-parse/parse.css';
@import 'colorui/zcm-main.css';
ripple {
width: 100%;
height: 100%;
}
</style>