From 3e0eb6bc6f8816427b093666626d2fd862a4eb8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Sun, 27 Apr 2025 10:26:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A7=92=E6=9D=80?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/diy/components/diy/seckill.vue | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pages/diy/components/diy/seckill.vue b/pages/diy/components/diy/seckill.vue index 035bc1d9..f9e7f115 100644 --- a/pages/diy/components/diy/seckill.vue +++ b/pages/diy/components/diy/seckill.vue @@ -299,7 +299,7 @@ if (!isEmpty(data.current.goods)) { new_list = data.current.goods; } - const { status, time_first_text } = data.current.time; + const { status = '1', time_first_text = '已结束' } = data?.current?.time || {}; this.setData({ seckill_time: { time_end_number: Number(data.current.time_end_number + '000'), @@ -308,13 +308,15 @@ time_first_text: time_first_text, }, }); - // 先执行一次倒计时,后续的等待倒计时执行 - setTimeout(() => { - this.updateCountdown(); - }, 0); - this.setData({ - intervalId: setInterval(this.updateCountdown, 1000), - }); + if (time_first_text !== '已结束') { + // 先执行一次倒计时,后续的等待倒计时执行 + setTimeout(() => { + this.updateCountdown(); + }, 0); + this.setData({ + intervalId: setInterval(this.updateCountdown, 1000), + }); + } } // 默认数据 const product_style_list = [ From ea5320f2fb01ff3ec5d0c3551e55aa84b6639dfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Sun, 27 Apr 2025 11:03:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A7=92=E6=9D=80?= =?UTF-8?q?=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/diy/components/diy/seckill.vue | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/pages/diy/components/diy/seckill.vue b/pages/diy/components/diy/seckill.vue index f9e7f115..51b5583a 100644 --- a/pages/diy/components/diy/seckill.vue +++ b/pages/diy/components/diy/seckill.vue @@ -295,7 +295,7 @@ const new_style = this.propValue.style; const data = new_form.data; let new_list = []; - if (data && !isEmpty(data.current)) { + if (data && !isEmpty(data.current) && !isEmpty(data.current.time)) { if (!isEmpty(data.current.goods)) { new_list = data.current.goods; } @@ -308,15 +308,13 @@ time_first_text: time_first_text, }, }); - if (time_first_text !== '已结束') { - // 先执行一次倒计时,后续的等待倒计时执行 - setTimeout(() => { - this.updateCountdown(); - }, 0); - this.setData({ - intervalId: setInterval(this.updateCountdown, 1000), - }); - } + // 先执行一次倒计时,后续的等待倒计时执行 + setTimeout(() => { + this.updateCountdown(); + }, 0); + this.setData({ + intervalId: setInterval(this.updateCountdown, 1000), + }); } // 默认数据 const product_style_list = [