Authored by lea guo

YOHOOD抽奖倒计时

@@ -72,7 +72,6 @@ Page( @@ -72,7 +72,6 @@ Page(
72 notice: {}, 72 notice: {},
73 lottery: {}, 73 lottery: {},
74 formatTimeList: [], 74 formatTimeList: [],
75 - isCountdownEnd: false,  
76 timeId: null, 75 timeId: null,
77 }, 76 },
78 77
@@ -334,18 +333,22 @@ Page( @@ -334,18 +333,22 @@ Page(
334 formatTimeList, 333 formatTimeList,
335 }); 334 });
336 const timeId = setInterval(() => { 335 const timeId = setInterval(() => {
337 - if (this.data.isCountdownEnd) {  
338 - this.changeActionStatus();  
339 - clearInterval(timeId);  
340 - }  
341 remaining--; 336 remaining--;
342 const formatTimeList = fomartCountdownTime(remaining); 337 const formatTimeList = fomartCountdownTime(remaining);
343 const isCountdownEnd = formatTimeList.join('') === '000000'; 338 const isCountdownEnd = formatTimeList.join('') === '000000';
344 - this.setData({ 339 + const data = {
345 formatTimeList, 340 formatTimeList,
346 - timeId: isCountdownEnd ? null: timeId,  
347 - isCountdownEnd,  
348 - }); 341 + timeId,
  342 + }
  343 + if (isCountdownEnd) {
  344 + data.timeId = null;
  345 + this.setData(data);
  346 + this.changeActionStatus();
  347 + clearInterval(timeId);
  348 + }else {
  349 + this.setData(data);
  350 + }
  351 +
349 }, 1000); 352 }, 1000);
350 }, 353 },
351 354