Authored by lea guo

YOHOOD抽奖倒计时

... ... @@ -72,7 +72,6 @@ Page(
notice: {},
lottery: {},
formatTimeList: [],
isCountdownEnd: false,
timeId: null,
},
... ... @@ -334,18 +333,22 @@ Page(
formatTimeList,
});
const timeId = setInterval(() => {
if (this.data.isCountdownEnd) {
this.changeActionStatus();
clearInterval(timeId);
}
remaining--;
const formatTimeList = fomartCountdownTime(remaining);
const isCountdownEnd = formatTimeList.join('') === '000000';
this.setData({
const data = {
formatTimeList,
timeId: isCountdownEnd ? null: timeId,
isCountdownEnd,
});
timeId,
}
if (isCountdownEnd) {
data.timeId = null;
this.setData(data);
this.changeActionStatus();
clearInterval(timeId);
}else {
this.setData(data);
}
}, 1000);
},
... ...