...
|
...
|
@@ -34,6 +34,7 @@ const ACTION_BAR_STATUS = { |
|
|
};
|
|
|
|
|
|
let app = getApp();
|
|
|
let timeoutId = null; // 定时器ID
|
|
|
|
|
|
/**
|
|
|
* YOHOOD 原价购 抽奖
|
...
|
...
|
@@ -72,7 +73,6 @@ Page( |
|
|
notice: {},
|
|
|
lottery: {},
|
|
|
formatTimeList: [],
|
|
|
timeId: null,
|
|
|
isCountdownEnd: false,
|
|
|
activityId: ''
|
|
|
},
|
...
|
...
|
@@ -326,35 +326,27 @@ Page( |
|
|
},
|
|
|
|
|
|
_formatCountdownTime(remaining) {
|
|
|
console.log('----------this.data.timeId-----',`${this.data.timeId}:${remaining}`)
|
|
|
if (this.data.timeId) {
|
|
|
return;
|
|
|
}
|
|
|
// 初始化倒计时时间
|
|
|
const formatTimeList = fomartCountdownTime(remaining);
|
|
|
this.setData({
|
|
|
formatTimeList,
|
|
|
});
|
|
|
const timeId = setInterval(() => {
|
|
|
// 清除定时器
|
|
|
clearInterval(timeoutId)
|
|
|
if(!remaining) {
|
|
|
return
|
|
|
}
|
|
|
timeoutId = setInterval(() => {
|
|
|
remaining--;
|
|
|
const formatTimeList = fomartCountdownTime(remaining);
|
|
|
const isCountdownEnd = formatTimeList.join('') === '000000';
|
|
|
const data = {
|
|
|
formatTimeList,
|
|
|
timeId,
|
|
|
isCountdownEnd
|
|
|
}
|
|
|
if (this.data.isCountdownEnd) {
|
|
|
console.log('-------isCountdownEnd----------')
|
|
|
data.timeId = null;
|
|
|
data.isCountdownEnd = false
|
|
|
this.setData(data);
|
|
|
if (isCountdownEnd) {
|
|
|
this.changeActionStatus();
|
|
|
clearInterval(timeId);
|
|
|
}else {
|
|
|
this.setData(data);
|
|
|
clearInterval(timeoutId);
|
|
|
}
|
|
|
|
|
|
this.setData({
|
|
|
formatTimeList
|
|
|
});
|
|
|
}, 1000);
|
|
|
},
|
|
|
|
...
|
...
|
|