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,12 +30,11 @@ seckillObj = {
*/
init: function() {
var self = this;
this.$container = $('.seckill-list');
this.pageLoad()
.then(function() {
this.pageLoad(function() {
self.domInit();
})
.then(function() {
var $el = self.el;
var focus = $el.$navUl.find('>li.focus');
... ... @@ -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();
... ...