...
|
...
|
@@ -828,53 +828,57 @@ function activityPlan() { |
|
|
let templateId = $('.template-id').val();
|
|
|
|
|
|
if (atlBo) {
|
|
|
let curTime = Math.round(new Date() / 1000);
|
|
|
let showTimes = [];
|
|
|
let planTimes = [];
|
|
|
let localUrl = '';
|
|
|
let query = '';
|
|
|
$.ajax({
|
|
|
url: '//m.yohobuy.com/activity/feature/getServerTimes',
|
|
|
dataType: 'jsonp'
|
|
|
}).then(function(curTime) {
|
|
|
let showTimes = [];
|
|
|
let planTimes = [];
|
|
|
let localUrl = '';
|
|
|
let query = '';
|
|
|
|
|
|
qs.timeStamp = curTime;
|
|
|
qs.timeStamp = curTime || Math.round(new Date() / 1000);
|
|
|
|
|
|
Object.keys(qs).map((key, index) => {
|
|
|
if (index === 0) {
|
|
|
query += `${key}=${qs[key]}`;
|
|
|
} else {
|
|
|
query += `&${key}=${qs[key]}`;
|
|
|
}
|
|
|
return query;
|
|
|
});
|
|
|
|
|
|
localUrl = `${location.origin}${location.pathname}?${query}`;
|
|
|
Object.keys(qs).map((key, index) => {
|
|
|
if (index === 0) {
|
|
|
query += `${key}=${qs[key]}`;
|
|
|
} else {
|
|
|
query += `&${key}=${qs[key]}`;
|
|
|
}
|
|
|
return query;
|
|
|
});
|
|
|
|
|
|
atlBo = JSON.parse(atlBo);
|
|
|
atlBo.forEach(t => {
|
|
|
if (t.showTime <= curTime) {
|
|
|
showTimes.push(t);
|
|
|
} else {
|
|
|
planTimes.push(t);
|
|
|
}
|
|
|
});
|
|
|
localUrl = `${location.origin}${location.pathname}?${query}`;
|
|
|
|
|
|
showTimes = showTimes.sort((a, b) => {
|
|
|
return b.showTime - a.showTime;
|
|
|
});
|
|
|
atlBo = JSON.parse(atlBo);
|
|
|
atlBo.forEach(t => {
|
|
|
if (t.showTime <= curTime) {
|
|
|
showTimes.push(t);
|
|
|
} else {
|
|
|
planTimes.push(t);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
planTimes = planTimes.sort((a, b) => {
|
|
|
return a.showTime - b.showTime;
|
|
|
});
|
|
|
showTimes = showTimes.sort((a, b) => {
|
|
|
return b.showTime - a.showTime;
|
|
|
});
|
|
|
|
|
|
if (showTimes && showTimes[0] && showTimes[0].templateId !== +templateId) {
|
|
|
location.href = localUrl;
|
|
|
}
|
|
|
planTimes = planTimes.sort((a, b) => {
|
|
|
return a.showTime - b.showTime;
|
|
|
});
|
|
|
|
|
|
if (planTimes && planTimes[0] && planTimes[0].showTime) {
|
|
|
let time = (planTimes[0].showTime - curTime) * 1000;
|
|
|
let countDown = setTimeout(function() {
|
|
|
if (showTimes && showTimes[0] && showTimes[0].templateId !== +templateId) {
|
|
|
location.href = localUrl;
|
|
|
clearTimeout(countDown);
|
|
|
}, time);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (planTimes && planTimes[0] && planTimes[0].showTime) {
|
|
|
let time = (planTimes[0].showTime - curTime) * 1000;
|
|
|
let countDown = setTimeout(function() {
|
|
|
location.href = localUrl;
|
|
|
clearTimeout(countDown);
|
|
|
}, time);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|