Authored by 郭成尧

no-result

... ... @@ -81,6 +81,9 @@ const shop = {
}).catch(next);
},
/**
* 一个横向商品列表
*/
shopHotList(req, res, next) {
let skns = req.query.skns;
let isApp = req.query.app_version || req.query.appVersion || false;
... ...
... ... @@ -352,10 +352,9 @@ const searchBrandGoods = (req, res, next) => {
let goodsList = productProcess.processProductList(_.get(goodListApi, 'data.product_list', []));
if (goodsList) {
res.render('search/page', {
res.render('search/goods-list-ajax', {
layout: false,
new: goodsList,
total: goodsData.total,
goodsList: goodsList,
_noLazy: req.query.noLazy || false
});
} else {
... ...
{{# goodsList}}
{{> common/goods}}
{{/ goodsList}}
\ No newline at end of file
... ...
... ... @@ -14,7 +14,7 @@ const lazyLoad = require('yoho-jquery-lazyload');
class ProductListWithFilter {
constructor(filterParams, searchUrl) {
this.scrollActived = true;
this.scrollActived = true; // 是否激活滚动加载,默认激活
this.filterParams = filterParams;
this.searchUrl = location.protocol + '//m.yohobuy.com/' + (searchUrl || 'product/search/search');
this.filterUrl = location.protocol + '//m.yohobuy.com/product/search/filter';
... ... @@ -56,6 +56,7 @@ class ProductListWithFilter {
};
this.beforeScroll = document.body.scrollTop; // 滚动前位置记录
this.navType = 'default'; // 目前激活的导航页面
this.nav = this.navInfo[this.navType];
this.defaultOpt = Object.assign({}, this.navInfo.default, this.filterParams); // 默认参数
this.onSearching = false; // 是否正在搜索
this.isScrollLoad = false; // 是否是滚动加载
... ... @@ -79,6 +80,7 @@ class ProductListWithFilter {
});
this.beforeScroll = afterScroll;
} else {
this.beforeScroll = afterScroll;
return false;
}
}, 5);
... ... @@ -138,7 +140,9 @@ class ProductListWithFilter {
if ($('.no-result-new').length > 0) {
$('.no-result-new').remove();
}
this.view.container.append('<div class="search-divide">正在加载...</div>');
this.view.container.after(() => {
return '<div class="search-divide">正在加载...</div>';
});
},
success: (result) => {
// 去掉正在加载
... ... @@ -146,11 +150,12 @@ class ProductListWithFilter {
let noResult = !result || result.length < 1 || (result.list && result.list.length < 1);
// 没有结果输出没有结果页面
if (noResult) {
if (this.isScrollLoad) {
this.view.container.append('<div class="search-divide">没有更多内容了...</div>');
this.view.container.after(() => {
return '<div class="search-divide">没有更多内容了...</div>';
});
} else {
this.view.container.html(noResultHbs());
}
... ...
... ... @@ -594,3 +594,9 @@
border-top: none;
}
}
.reds-shop {
.search-divide {
margin-bottom: 100px;
}
}
... ...