Authored by lijing

秒杀详情样式修改

... ... @@ -14,8 +14,10 @@ const shopList = (uid, tabName) => {
method: 'app.shops.promote',
uid: uid,
tab_name: tabName
}, {
code: 200,
cache: true
}).then((result) => {
if (result && result.code === 200) {
_.forEach(result.data, function(data) {
data.isFavorite = data.isFavorite === 'Y';
... ... @@ -31,8 +33,11 @@ const shopList = (uid, tabName) => {
const shopNav = () => {
return api.get('', {
method: 'app.shops.promoteTabNameList'
}, {
cache: true,
code: 200
}).then((result) => {
if (result && result.code === 200) {
if (result.data) {
return result.data;
}
});
... ... @@ -40,11 +45,13 @@ const shopNav = () => {
const banner = () => {
return service.get('operations/api/v5/resource/get', {
content_code: 'c0acf0296a3c329678fb45da958d9951'
content_code: 'ec9eb72eae121fcd6c1b7d1de75caff1'
}, {
cache: true
cache: true,
code: 200
}).then((result) => {
if (result && result.code === 200) {
console.log(result)
if (result && result.data) {
return result.data[0];
}
});
... ...
... ... @@ -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
});
};
... ...
... ... @@ -3,7 +3,7 @@
<img class="lazy" data-original="{{image defaultImages 235 314}}" alt="">
</div>
<div class="item-info">
<div class="item-title">
<div class="item-title line-clamp-2">
{{productName}}
</div>
{{#if wait}}
... ...
... ... @@ -133,7 +133,7 @@ function shopNavData() {
// 加载第一页数据
if (navType.id) {
$('.shop-nav').find('li').each(function() {
if (navType.id === $(this).data('type')) {
if (decodeURI(navType.id) === $(this).data('type')) {
$(this).addClass('active');
shopListData($(this).data('type'));
}
... ... @@ -183,6 +183,4 @@ $(function() {
pagination: '.banner-top .pagination-inner'
});
}
});
... ...
... ... @@ -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, {
... ...