Authored by 陈轩

fix YH-5118

... ... @@ -104,28 +104,12 @@ function fetchProductList(activityInfo, uid) {
});
}
let _helpers = {
statusClass: (nav) => {
if (nav.over) {
return 'over';
} else if (nav.now) {
return 'now';
} else if (nav.wait) {
return 'wait';
} else {
return '';
}
},
readaleTime: (unixStamp) => {
return moment.unix(unixStamp).format('MM月DD日 HH:mm');
}
};
/**
* [秒杀列表页面]
*/
const index = (req, res, next) => {
let focusTime = Number.parseInt(req.query.t, 10) || 0;
let headerData = headerModel.setNav({
navTitle: '秒杀活动',
navBtn: true,
... ... @@ -145,6 +129,9 @@ const index = (req, res, next) => {
return seckillModel.queryActivity().then((resultActivity) => {
// console.log(resultActivity)
let focusIndex = false;
let nowTime = Date.parse(new Date());
if (resultActivity.code !== 200) {
return next();
}
... ... @@ -162,7 +149,17 @@ const index = (req, res, next) => {
}
result.activitys = resultActivity.data.secKillProductVoList.sort((a, b) => a.startTime - b.startTime); // orderBy startTime ASC
let nowTime = Date.parse(new Date());
if (focusTime) {
focusTime = moment(focusTime, 'YYYYMMDDHHmmss').unix();
focusIndex = result.activitys.findIndex(activity=> activity.startTime === focusTime);
console.log(focusIndex)
if (focusIndex !== -1) {
result.activitys[focusIndex].focus = true;
focusIndex = true;
}
}
result.activitys.forEach((activity, i) => {
let date,
... ... @@ -181,7 +178,7 @@ const index = (req, res, next) => {
if (nowTime < nextTime) { // 下一个时间段与当前时间来区别是否正在抢购
activity.now = true;
activity.focus = true;
focusIndex || (activity.focus = true);
} else {
activity.over = true;
}
... ...
... ... @@ -28,8 +28,6 @@ const queryProductList = (activityId) => {
return api.get('', {
method: 'app.seckill.queryProductList',
activityId: activityId
}, {
cache: true
});
};
... ...
... ... @@ -380,7 +380,7 @@ seckillObj = {
var $xhr;
loading.show();
$xhr = $.get('/product/seckill')
$xhr = $.get(location.href)
.done(function(result) {
self.$container.html(
self.pageTemplate($.extend(result, {
... ...