-
Notifications
You must be signed in to change notification settings - Fork 57
/
App.vue
364 lines (333 loc) · 8.54 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
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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
<script>
import dayjs from "dayjs";
const systemInfo = uni.getSystemInfoSync();
const statusBarHeight = systemInfo.statusBarHeight;
const menuButtonBoundingClientRect = uni.getMenuButtonBoundingClientRect();
const navigationBarHeight = menuButtonBoundingClientRect.bottom + (menuButtonBoundingClientRect.top - statusBarHeight);
// const getNames = (name, num) =>
// Array(num)
// .fill(0)
// .map((e, i) => `${name}${(i + 1).toString().padStart(2, "0")}`);
// [
// ...getNames("clones", 20),
// ...getNames("cut", 10),
// ...getNames("dancers", 10),
// ...getNames("hungry", 8),
// ...getNames("time", 10),
// ...getNames("nature", 16),
// ...getNames("colorful", 20),
// ...getNames("continuous", 10),
// ...getNames("flipping", 20),
// ...getNames("wobbling", 20),
// ...getNames("progress", 20),
// ...getNames("shapes", 40),
// ...getNames("spinner", 29),
// ];
export default {
globalData: {
systemInfo,
statusBarHeight,
navigationBarHeight,
menuButtonBoundingClientRect,
loadings: [
"clones08",
"clones10",
"clones16",
"clones18",
"cut01",
"clones20",
"hungry01",
"hungry02",
"hungry03",
"hungry08",
"time05",
"nature08",
"nature07",
"nature16",
"colorful19",
"continuous04",
"wobbling05",
"wobbling12",
"wobbling11",
"progress03",
"shapes16",
"spinner02",
"spinner03",
"spinner12",
"spinner16",
"spinner17",
"spinner15",
"spinner26",
"flipping09",
"dancers02",
],
images: [
"https://image.meiye.art/FhtISupNHMibBgrGZOe15CPQ-d5R",
"https://image.meiye.art/FlqKg5bugFQD5Qzm_QhGM7ET4Mtx",
"https://image.meiye.art/Fha6tqRTIwHtlLW3xuZBJj8ZXSX3",
"https://image.meiye.art/FgaFNs-YNxw_vRtqCbvQru3z6s3P",
"https://image.meiye.art/FiqphSjedkvi1y0hfqeNrYGXqLKo",
"https://image.meiye.art/FqZALKFWQ7vEZtmJyMyB_w776B_H",
"https://image.meiye.art/FhHGe9NyO0uddb6D4203jevC_gzc",
"https://image.meiye.art/FiLUT-wb9DP0-dpxRQH19HJOOJOW",
],
bgClass: ["bg-gradual-red-light", "bg-gradual-orange-light", "bg-gradual-green-light", "bg-gradual-purple-light", "bg-gradual-pink-light", "bg-gradual-blue-light", "bg-gradual-pinknew-light", "bg-gradual-cyan-light"],
colors: ["red", "orange", "yellow", "olive", "green", "cyan", "blue", "purple", "mauve", "pink", "brown", "grey"],
},
onPageNotFound() {
uni.reLaunch({ url: "/pages/首页/首页" });
},
onLaunch(option) {
// 监听消息推送
uni.onPushMessage(({ data: { payload } }) => {
if (payload.type === "collect") {
this.$store.commit("app/UPDATE_FUNCTION", payload.data);
this.$toast(JSON.stringify(payload.data))
if (payload.data.collected) {
this.$toast("收藏成功");
} else {
this.$toast("取消收藏成功");
uni.$emit("COLLECT_CANCEL", payload.data._id);
}
} else {
uni.vibrateLong(); // 震动一下
// 如果是支付消息
if (payload.type === "pay") {
this.$store.commit("user/SET_USER_INFO", {
vip_time: payload.data.vip_end_time, // 更新 VIP 时间
energy: this.$store.state.user.energy + payload.data.energy, // 更新总能量
total_income: this.$store.state.user.total_income + payload.data.energy, // 更新总入账能量
});
}
// 如果是邀请新用户奖励到账
if (payload.type === "share") {
this.$store.commit("user/SET_USER_INFO", {
energy: this.$store.state.user.energy + payload.data.energy, // 更新总能量
total_income: this.$store.state.user.total_income + payload.data.energy, // 更新总入账能量
});
}
this.$store.state.app.notify.push(payload); // 弹出系统消息提示框
this.$store.state.app.notifyRoute = this.$store.state.app.currentRoute; // 标记弹出系统消息提示框的页面
}
});
// 小程序启动即登录
this.$store.dispatch("user/login", { ...option.query, path: option.path }).then(async () => {
// 检查用户是否 VIP
const check = () => {
if (this.$store.state.user.vip_time) {
if (Date.now() > dayjs(this.$store.state.user.vip_time).valueOf()) {
this.$store.state.user.vip = false;
} else {
this.$store.state.user.vip = true;
}
} else {
this.$store.state.user.vip = false;
}
};
setInterval(() => check(), 1000); // 1秒钟检查一次,时间一到立马切换状态
});
},
async onShow() {},
onHide() {},
};
</script>
<style lang="scss">
@import "colorui/main.css";
@import "colorui/icon.css";
@import "colorui/icon-new.css";
.w100 {
width: 100% !important;
}
.h100 {
height: 100% !important;
}
.flex {
align-items: center;
display: flex !important;
justify-content: center;
}
.flexc {
align-items: center;
flex-direction: column;
display: flex !important;
justify-content: center;
}
.flex1 {
flex: 1;
}
.flex_sb {
justify-content: space-between;
}
.my_input {
border-radius: 10rpx;
padding: 0 66rpx 0 20rpx;
border: 1px solid #efefef;
margin: 0 20rpx !important;
min-height: 74rpx !important;
&.no_button {
padding-right: 20rpx;
}
}
.my_input_clear {
top: 28rpx;
right: 190rpx;
font-size: 44rpx;
position: absolute;
&.no_button {
right: 56rpx;
}
}
.my_textarea {
border-radius: 10rpx;
border: 1px solid #efefef;
padding: 10rpx 14rpx !important;
}
.my_textarea_clear {
font-size: 44rpx;
}
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
}
.nav-list {
display: flex;
flex-wrap: wrap;
padding: 0px 30rpx 0px;
justify-content: space-between;
}
.nav-li {
padding: 0 0 16rpx 20rpx;
border-radius: 20rpx;
width: 48%;
margin: 0 0 32rpx;
background-size: cover;
background-position: center;
position: relative;
z-index: 1;
}
// .nav-li::after {
// content: "";
// position: absolute;
// z-index: -1;
// background-color: inherit;
// width: 100%;
// height: 100%;
// left: 0;
// bottom: -10%;
// border-radius: 10rpx;
// opacity: 0.2;
// transform: scale(0.9, 0.9);
// }
.nav-title {
font-size: 30rpx;
font-weight: 480;
}
.nav-title > view::first-letter {
font-size: 40rpx;
margin-right: 4rpx;
}
.nav-title > view {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
width: calc(100% - 60rpx);
}
/* .nav-name {
font-size: 28rpx;
text-transform: Capitalize;
margin-top: 20rpx;
position: relative;
}
.nav-des {
font-size: 24rpx;
text-transform: Capitalize;
margin-top: 30rpx;
position: relative;
} */
/* .nav-name::before {
content: "";
position: absolute;
display: block;
width: 40rpx;
height: 6rpx;
background: #fff;
bottom: 0;
left: 0;
opacity: 0.5;
} */
/* .nav-name::after {
content: "";
position: absolute;
display: block;
width: 90rpx;
height: 1px;
background: #fff;
bottom: 0;
right: 40rpx;
opacity: 0.3;
}
.nav-name::first-letter {
font-weight: bold;
font-size: 36rpx;
margin-right: 1px;
} */
/* .nav-li text {
position: absolute;
right: 24rpx;
top: 16rpx;
font-size: 52rpx;
width: 60rpx;
height: 60rpx;
text-align: center;
line-height: 60rpx;
} */
.text-light {
font-weight: 300;
}
.nodata {
font-size: 30rpx;
line-height: 1.2;
font-weight: normal;
text-align: center;
color: #999;
margin-top: 200rpx;
margin-bottom: 200rpx;
}
.nodata .icon {
height: 240rpx;
background: url("https://img01.yzcdn.cn/vant/empty-image-default.png") no-repeat center/210rpx auto;
}
.nodata .txt {
padding-top: 60rpx;
}
.nav-lie {
border-radius: 28rpx;
width: 46%;
margin: 0 1% 40rpx;
background-size: cover;
background-position: center;
position: relative;
z-index: 1;
}
.nav-lie::after {
content: "";
position: absolute;
z-index: -1;
background-color: inherit;
width: 100%;
height: 100%;
left: 0;
bottom: -10%;
border-radius: 10rpx;
opacity: 0.2;
transform: scale(0.9, 0.9);
}
.image-bg-ui {
min-height: 680rpx;
}
</style>