forked from zzjoey/Leava
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
176 lines (174 loc) · 5.47 KB
/
app.js
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
var coolsite360 = require('./coolsite/index.js');
wx.cloud.init({
traceUser: true
});
const db = wx.cloud.database();
App({
coolsite360: coolsite360,
//第一种状态的底部
editTabBar: function () {
var _curPageArr = getCurrentPages();
var _curPage = _curPageArr[_curPageArr.length - 1];
var _pagePath = _curPage.__route__;
if (_pagePath.indexOf('/') != 0) {
_pagePath = '/' + _pagePath;
}
var tabBar = this.globalData.tabBar;
for (var i = 0; i < tabBar.list.length; i++) {
tabBar.list[i].active = false;
if (tabBar.list[i].pagePath == _pagePath) {
tabBar.list[i].active = true;//根据页面地址设置当前页面状态
}
}
_curPage.setData({
tabBar: tabBar
});
},
exit:function(){
wx.clearStorageSync();//同步清空本地缓存
wx.redirectTo({
url: '/page/index/index',
})
},
//第二种状态的底部
editTabBarTeacher1: function () {
var _curPageArr = getCurrentPages();
var _curPage = _curPageArr[_curPageArr.length - 1];
var _pagePath = _curPage.__route__;
if (_pagePath.indexOf('/') != 0) {
_pagePath = '/' + _pagePath;
}
var tabBar = this.globalData.tabBarTeacher1;
for (var i = 0; i < tabBar.list.length; i++) {
tabBar.list[i].active = false;
if (tabBar.list[i].pagePath == _pagePath) {
tabBar.list[i].active = true;//根据页面地址设置当前页面状态
}
}
_curPage.setData({
tabBar: tabBar
});
},
editTabBarTeacher2: function () {
var _curPageArr = getCurrentPages();
var _curPage = _curPageArr[_curPageArr.length - 1];
var _pagePath = _curPage.__route__;
if (_pagePath.indexOf('/') != 0) {
_pagePath = '/' + _pagePath;
}
var tabBar = this.globalData.tabBarTeacher2;
for (var i = 0; i < tabBar.list.length; i++) {
tabBar.list[i].active = false;
if (tabBar.list[i].pagePath == _pagePath) {
tabBar.list[i].active = true;//根据页面地址设置当前页面状态
}
}
_curPage.setData({
tabBar: tabBar
});
},
globalData: {
userInfo: null,
pop: 2,
num: 0,
tabBar: {
"color": "#7F8389",
"selectedColor": "#0caccf",
"borderStyle": "white",
"backgroundColor": "#F2F2F2",
"list": [
{
"pagePath": "/page/student/page/two/two",
"text": "请假",
"iconPath": "/resources/cf40a95b8f217158f823f9b7ca4d1010.png",
"selectedIconPath": "/resources/6977462f74dff3dd731bad9f9f8d2485.png",
"clas": "menu-item",
"selectedColor": "#1296db",
active: true
},
{
"pagePath": "/page/student/page/three/three",
"text": "消息",
"iconPath": "/resources/d83f27493387b5ce6ed3c55cedf86662.png",
"selectedIconPath": "/resources/5900aea920b3ffd281b7406b0a064406.png",
"selectedColor": "#1296db",
"clas": "menu-item",
active: false
},
{
"pagePath": "/page/student/page/five/five",
"text": "我",
"iconPath": "/resources/847cebd0c6211832c319a1b12f5221f0.png",
"selectedIconPath": "/resources/1cec6c375417abdc2649fcf65766bd16.png",
"selectedColor": "#1296db",
"clas": "menu-item",
active: false
}
],
"position": "bottom"
},
tabBarTeacher1: {
"color": "#7F8389",
"selectedColor": "#0caccf",
"borderStyle": "#ccc",
"backgroundColor": "#F2F2F2",
"list": [
{
"pagePath": "/page/teacher/page/one/one",
"text": "消息",
"iconPath": "/resources/cf40a95b8f217158f823f9b7ca4d1010.png",
"selectedIconPath": "/resources/6977462f74dff3dd731bad9f9f8d2485.png",
"clas": "menu-item2",
"selectedColor": "#1296db",
active: true
},
{
"pagePath": "/page/teacher/page/three/three",
"text": "批假",
"iconPath": "/resources/d83f27493387b5ce6ed3c55cedf86662.png",
"selectedIconPath": "/resources/5900aea920b3ffd281b7406b0a064406.png",
"selectedColor": "#1296db",
"clas": "menu-item2",
active: false
},
{
"pagePath": "/page/teacher/page/five/five",
"text": "我",
"iconPath": "/resources/847cebd0c6211832c319a1b12f5221f0.png",
"selectedIconPath": "/resources/1cec6c375417abdc2649fcf65766bd16.png",
"selectedColor": "#1296db",
"clas": "menu-item2",
active: false
}
],
"position": "bottom"
},
tabBarTeacher2: {
"color": "#7F8389",
"selectedColor": "#0caccf",
"borderStyle": "#ccc",
"backgroundColor": "#F2F2F2",
"list": [
{
"pagePath": "/page/teacher/page/three/three",
"text": "消息",
"iconPath": "/resources/cf40a95b8f217158f823f9b7ca4d1010.png",
"selectedIconPath": "/resources/6977462f74dff3dd731bad9f9f8d2485.png",
"clas": "menu-item2",
"selectedColor": "#1296db",
active: true
},
{
"pagePath": "/page/teacher/page/five/five",
"text": "我",
"iconPath": "/resources/847cebd0c6211832c319a1b12f5221f0.png",
"selectedIconPath": "/resources/1cec6c375417abdc2649fcf65766bd16.png",
"selectedColor": "#1296db",
"clas": "menu-item2",
active: false
}
],
"position": "bottom"
}
}
})