-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.wpy
221 lines (194 loc) · 4.33 KB
/
app.wpy
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<script>
import wepy from 'wepy';
import 'wepy-async-function';
export default class extends wepy.app {
config = {
pages: [
'pages/index/index',
'pages/live_detail/live_detail',
'pages/news_list/news_list',
'pages/news_info/news_info',
'pages/team_rank/team_rank',
'pages/team_info/team_info',
'pages/stats/stats',
'pages/player_detail/player_detail',
'pages/about/about'
],
window: {
backgroundTextStyle: 'light',
navigationBarBackgroundColor: '#00AA98',
navigationBarTitleText: 'NBA球赛',
navigationBarTextStyle: '#fff'
},
tabBar: {
color: '#333',
selectedColor: '#00aa98',
position: 'bottom',
borderStyle: 'block',
list: [
{
pagePath: 'pages/index/index',
text: '赛事直播',
iconPath: 'assets/images/ball.png',
selectedIconPath: 'assets/images/ball-active.png'
},
{
pagePath: 'pages/news_list/news_list',
text: 'NBA资讯',
iconPath: 'assets/images/news.png',
selectedIconPath: 'assets/images/news-active.png'
},
{
pagePath: 'pages/team_rank/team_rank',
text: '球队战绩',
iconPath: 'assets/images/rank.png',
selectedIconPath: 'assets/images/rank-active.png'
},
{
pagePath: 'pages/stats/stats',
text: '数据统计',
iconPath: 'assets/images/stats.png',
selectedIconPath: 'assets/images/stats-active.png'
},
{
pagePath: 'pages/about/about',
text: '关于我',
iconPath: 'assets/images/about.png',
selectedIconPath: 'assets/images/about-active.png'
}
]
}
};
globalData = {
userInfo: null
};
constructor() {
super();
this.use('requestfix');
this.use('promisify');
}
onLaunch() {
this.testAsync();
}
sleep(s) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve('promise resolved');
}, s * 1000);
});
}
async testAsync() {
const data = await this.sleep(3);
console.log(data);
}
getUserInfo(cb) {
const that = this;
if (this.globalData.userInfo) {
return this.globalData.userInfo;
}
wepy.getUserInfo({
success(res) {
that.globalData.userInfo = res.userInfo;
cb && cb(res.userInfo);
}
});
}
}
</script>
<style lang="less">
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
}
.left {
float: left;
}
.right {
float: right;
}
.padding-lrtb-30 {
padding: 30rpx !important;
}
.padding-lr-30 {
padding: 0 30rpx !important;
}
.text-right {
text-align: right;
}
.no-data {
padding: 100rpx 30rpx;
text-align: center;
width: 100%;
box-sizing: border-box;
font-size: 28rpx;
}
.icon-nothing {
background: url(https://coding.it919.cn/static/images/no-data.png) center
no-repeat;
width: 120rpx;
height: 120rpx;
margin: 0 auto;
margin-bottom: 20rpx;
}
.footer {
position: fixed;
width: 100%;
bottom: 0;
background: #f5f5f5;
display: flex;
}
.footer .foot-item {
float: left;
font-size: 24rpx;
text-align: center;
padding: 8rpx 0;
flex: 1;
}
.visibility {
width: 100%;
height: 110rpx;
}
.icon-ball {
background: url(https://coding.it919.cn/static/images/ball.png) center
no-repeat;
}
.active .icon-ball-active {
background: url(https://coding.it919.cn/static/images/ball-active.png) center
no-repeat;
}
.icon-news {
background: url(https://coding.it919.cn/static/images/news.png) center
no-repeat;
}
.active .icon-news-active {
background: url(https://coding.it919.cn/static/images/news-active.png) center
no-repeat;
}
.icon-rank {
background: url(https://coding.it919.cn/static/images/rank.png) center
no-repeat;
}
.active .icon-rank-active {
background: url(https://coding.it919.cn/static/images/rank-active.png) center
no-repeat;
}
.footer .active {
color: #00aa98;
}
.icon-about {
background: url(https://coding.it919.cn/static/images/about.png) center
no-repeat;
}
.footer .icon {
padding: 25rpx;
background-size: 40rpx 40rpx !important;
}
footer navigator:active,
footer navigator:kink {
background: #f5f5f5;
}
</style>