Authored by 陈轩

秒杀前端 模板 完成

... ... @@ -250,9 +250,7 @@ const getProductList = (req, res, next) => {
console.log(activityInfo)
return fetchProductList(activityInfo, uid).then(resultProducts => {
res.render('seckill/product-list', Object.assign({products: resultProducts}, {
layout: false
}));
res.json({products: resultProducts});
}).catch(error => {
logger.error(error);
});
... ...
<div class="seckill-list yoho-page">loading.....</div>
<div class="seckill-list yoho-page">
<div style="height: 100vh"></div>
</div>
... ...
... ... @@ -30,31 +30,30 @@ seckillObj = {
*/
init: function() {
var self = this;
this.$container = $('.seckill-list');
this.pageLoad()
.then(function() {
self.domInit();
})
.then(function() {
var $el = self.el;
var focus = $el.$navUl.find('>li.focus');
this.pageLoad(function() {
self.domInit();
self.$productList = $('.product-list');
$el.$navUl.find('>li').click(function(event) {
self.selectTime(event.currentTarget);
});
var $el = self.el;
var focus = $el.$navUl.find('>li.focus');
$(window).resize(function() {
self.initNav();
});
self.$productList = $('.product-list');
$el.$navUl.find('>li').click(function(event) {
self.selectTime(event.currentTarget);
});
$(window).resize(function() {
self.initNav();
if (focus.length && (focus.hasClass('now') || focus.hasClass('wait'))) {
self.initTick($el.$navUl.find('>li.focus'));
}
self.bindEvents();
});
self.initNav();
if (focus.length && (focus.hasClass('now') || focus.hasClass('wait'))) {
self.initTick($el.$navUl.find('>li.focus'));
}
self.bindEvents();
});
},
domInit: function() {
... ... @@ -221,6 +220,7 @@ seckillObj = {
* [异步加载商品列表]
*/
refreshProductList: function(activityId, startTime) {
var self = this;
var url = yoho.isApp ?
'/product/seckill/get-product-list?app_version=1' :
'/product/seckill/get-product-list';
... ... @@ -234,7 +234,7 @@ seckillObj = {
startTime: startTime
},
success: function(data) {
$('.product-list').html(data);
$('.product-list').html(self.listTemplate(data));
lazyload('img.lazy');
window.rePosFooter();
},
... ... @@ -374,7 +374,7 @@ seckillObj = {
});
},
pageLoad: function() {
pageLoad: function(callback) {
var self = this;
loading.show();
... ... @@ -385,9 +385,8 @@ seckillObj = {
isApp: yoho.isApp
}))
);
})
.error(function() {
console.log('TODO');
window.rePosFooter();
callback();
})
.always(function() {
loading.hide();
... ...