Authored by 陈轩

fix YH-5027

... ... @@ -128,8 +128,9 @@ const index = (req, res, next) => {
return seckillModel.queryActivity().then((resultActivity) => {
// console.log(resultActivity)
let focusIndex = false;
let nowTime = Date.parse(new Date());
let nowTime = Date.now();
result.currentTime = nowTime;
if (resultActivity.code !== 200) {
return next();
}
... ...
... ... @@ -188,7 +188,7 @@ seckillObj = {
$el.$navUl.find('>li').each(function() {
$(this).removeClass('now over wait');
time = new Date(parseInt($(this).find('input.date').val(), 10));
nowTime = new Date();
nowTime = new Date(Date.now() + that.diff * 1000);
if (nowTime > time) { // 当前时间大于这个时间段,已经开始和即将开始两种情况
if ($(this).next('.time-item').length) {
... ... @@ -258,7 +258,7 @@ seckillObj = {
initTick: function(elem) {
var $el = this.el, that = this,
time,
nowTime = Date.parse(new Date()) / 1000,
nowTime = Date.parse(new Date()) / 1000 + that.diff,
offsetTime;
if ($(elem).hasClass('now')) {
... ... @@ -288,7 +288,7 @@ seckillObj = {
$(elem).find('.tick.second').text(second < 0 ? '00' : (second < 10 ? ('0' + second) : second));
$el.currentTick = setTimeout(function() {
var curSec = Math.floor(Date.now() / 1000);
var curSec = Math.floor(Date.now() / 1000) + that.diff;
offsetTime = offsetTime - (curSec - nowTime);
that.startTick(elem, offsetTime, curSec);
... ... @@ -392,16 +392,14 @@ seckillObj = {
}))
);
// if (result && result.currentTime) {
// self.diff = Math.round((Date.now() - result.currentTime) / 1000);
// }
if (result && result.activitys && result.activitys.length) {
window.diff = self.diff = Math.round((result.currentTime - Date.now()) / 1000);
callback();
}
lazyload('img.lazy');
window.rePosFooter();
if (result && result.activitys && result.activitys.length) {
callback();
}
})
.error(function() {
})
... ...