Browse Source

[edit][时间终止时间]

zhangwei 2 years ago
parent
commit
f6e8eca807
2 changed files with 7 additions and 1 deletions
  1. 6 0
      src/uilts/help.js
  2. 1 1
      src/view/iframe/red-packet/luck-draw.vue

+ 6 - 0
src/uilts/help.js

@@ -155,6 +155,9 @@ export function getOffsetRect(element) {
 }
 
 export function formatSecondsAsTime(secs) {
+  if (secs <= 0) {
+    return '00:00:00'
+  }
   var hr = Math.floor(secs / 3600)
   var min = Math.floor((secs - (hr * 3600)) / 60)
   var sec = Math.floor(secs - (hr * 3600) - (min * 60))
@@ -175,6 +178,9 @@ export function formatSecondsAsTime(secs) {
 
 // 抽奖红包 left
 export function formatSecondsAsDaysOrTime(secs) {
+  if (secs <= 0) {
+    return '00:00:00'
+  }
   var hr = Math.floor(secs / 3600)
   var min = Math.floor((secs - (hr * 3600)) / 60)
   var sec = Math.floor(secs - (hr * 3600) - (min * 60))

+ 1 - 1
src/view/iframe/red-packet/luck-draw.vue

@@ -875,7 +875,7 @@ function openConutDownTime(end_time_ms, callback) {
     let end_time_s = Number((end_time_ms - new Date().getTime()) / 1000)
     let timer = setInterval(() => {
         end_time_s = Number((end_time_ms - new Date().getTime()) / 1000)
-        if (state.open_timer_status == true || end_time_s <= 0) {
+        if (state.open_timer_status == true) {
             clearInterval(timer)
         }
         callback(formatSecondsAsDaysOrTime(end_time_s))