Authored by 王水玲

定时计划到点自动刷新页面

... ... @@ -830,11 +830,14 @@ function activityPlan() {
if (atlBo) {
let curTime = Math.round(new Date() / 1000);
let showTimes = [];
let planTimes = [];
atlBo = JSON.parse(atlBo);
atlBo.forEach(t => {
if (t.showTime <= curTime) {
showTimes.push(t);
} else {
planTimes.push(t);
}
});
... ... @@ -842,9 +845,21 @@ function activityPlan() {
return t.showTime;
});
planTimes = planTimes.sort(t => {
return -t.showTime;
});
if (showTimes && showTimes[0] && showTimes[0].templateId !== +templateId) {
location.reload();
}
if (planTimes && planTimes[0] && planTimes[0].showTime) {
let time = (planTimes[0].showTime - curTime) * 1000;
let countDown = setTimeout(function() {
location.reload();
clearTimeout(countDown);
}, time);
}
}
}
... ...