...
|
...
|
@@ -238,27 +238,31 @@ seckillObj = { |
|
|
time = $(elem).find('input.date').val() / 1000;
|
|
|
}
|
|
|
offsetTime = time - nowTime;
|
|
|
that.startTick(elem, offsetTime);
|
|
|
that.startTick(elem, offsetTime, nowTime);
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* [开始倒计时]
|
|
|
*/
|
|
|
startTick: function(elem, offsetTime) {
|
|
|
startTick: function(elem, offsetTime, nowTime) {
|
|
|
var that = this,
|
|
|
$el = this.el,
|
|
|
hour = parseInt(offsetTime / (60 * 60), 10),
|
|
|
minute = parseInt(offsetTime % (60 * 60) / 60, 10),
|
|
|
second = offsetTime % 60;
|
|
|
|
|
|
$(elem).find('.tick.hour').text(hour < 0 ? '00' : (hour < 10 ? ('0' + hour) : hour));
|
|
|
$(elem).find('.tick.minute').text(minute < 0 ? '00' : (minute < 10 ? ('0' + minute) : minute));
|
|
|
$(elem).find('.tick.second').text(second < 0 ? '00' : (second < 10 ? ('0' + second) : second));
|
|
|
if (offsetTime <= 0) { // 结束倒计时刷新状态
|
|
|
that.refreshList(elem);
|
|
|
} else {
|
|
|
$(elem).find('.tick.hour').text(hour < 0 ? '00' : (hour < 10 ? ('0' + hour) : hour));
|
|
|
$(elem).find('.tick.minute').text(minute < 0 ? '00' : (minute < 10 ? ('0' + minute) : minute));
|
|
|
$(elem).find('.tick.second').text(second < 0 ? '00' : (second < 10 ? ('0' + second) : second));
|
|
|
|
|
|
$el.currentTick = setTimeout(function() {
|
|
|
that.startTick(elem, --offsetTime);
|
|
|
var curSec = Math.floor(Date.now() / 1000);
|
|
|
|
|
|
offsetTime = offsetTime - (curSec - nowTime);
|
|
|
that.startTick(elem, offsetTime, curSec);
|
|
|
}, 1000);
|
|
|
}
|
|
|
},
|
...
|
...
|
|