|
|
@@ -218,9 +218,10 @@ function loadList(action: 'page' | 'reload', callback?: (items) => void) {
|
|
218
|
218
|
function getCountdown() {
|
|
219
|
219
|
const now = new Date();
|
|
220
|
220
|
const startDate = new Date(now.getFullYear(), now.getMonth(), now.getDate(), parseHours(msSeckillDate.value), 0, 0);
|
|
|
221
|
+ // const startDate = new Date('2023-12-26 10:55:00');
|
|
221
|
222
|
const endDate = new Date(startDate.getTime() + 60 * 60 * 1000); // 结束时间为开始时间的一小时后
|
|
222
|
223
|
|
|
223
|
|
- if (now < endDate) {
|
|
|
224
|
+ if (now > startDate && now < endDate) {
|
|
224
|
225
|
let milliseconds = endDate - now;
|
|
225
|
226
|
|
|
226
|
227
|
const hours = Math.floor(milliseconds / (1000 * 60 * 60));
|
|
|
@@ -233,12 +234,24 @@ function getCountdown() {
|
|
233
|
234
|
minutes: minutes < 10 ? '0' + minutes : minutes,
|
|
234
|
235
|
seconds: seconds < 10 ? '0' + seconds : seconds
|
|
235
|
236
|
}
|
|
236
|
|
- } else {
|
|
|
237
|
+ } else if (now >= endDate) {
|
|
|
238
|
+ clearInterval(timer);
|
|
|
239
|
+ //加载秒杀数据
|
|
|
240
|
+ console.log('时间到,自动关闭');
|
|
|
241
|
+ // loadList('reload')
|
|
|
242
|
+ uni.reLaunch({
|
|
|
243
|
+ url: '/pages/home/index'
|
|
|
244
|
+ })
|
|
|
245
|
+ } else if (now < startDate) {
|
|
|
246
|
+ console.log(111);
|
|
|
247
|
+
|
|
|
248
|
+ } else if (now == startDate) {
|
|
237
|
249
|
clearInterval(timer);
|
|
238
|
250
|
//加载秒杀数据
|
|
239
|
|
- console.log('自动关闭');
|
|
240
|
|
- uni.switchTab({
|
|
241
|
|
- url:'pages/home/index'
|
|
|
251
|
+ console.log('时间到,自动关闭');
|
|
|
252
|
+ // loadList('reload')
|
|
|
253
|
+ uni.reLaunch({
|
|
|
254
|
+ url: '/pages/home/index'
|
|
242
|
255
|
})
|
|
243
|
256
|
}
|
|
244
|
257
|
}
|
|
|
@@ -260,7 +273,6 @@ onUnload(() => {
|
|
260
|
273
|
|
|
261
|
274
|
|
|
262
|
275
|
|
|
263
|
|
-
|
|
264
|
276
|
watch(() => state.isShowSignIn, (val) => {
|
|
265
|
277
|
val ? uni.hideTabBar() : uni.showTabBar()
|
|
266
|
278
|
})
|