Authored by hongweigao

没数据,不显示页面,箭头隐藏

... ... @@ -41,7 +41,7 @@ const recBrand = (params) => {
const recList = (params) => {
let finalParams = {
method: 'app.newproduct.reclist',
limit: 50
limit: 60
};
Object.assign(finalParams, params);
... ...
... ... @@ -105,6 +105,7 @@ const index = (req) => {
}
//精彩想先看,左轮播右2图
if (ads.template_name === 'NL2R') {
Object.assign(respData.firstLook.lookBanner.list, ads.data.left);
Object.assign(respData.firstLook.lookTwoImg, ads.data.right);
}
});
... ... @@ -148,6 +149,23 @@ const index = (req) => {
// 列表数据
Object.assign(respData.newProduct, _proListHandler(result[3].data, Object.assign({}, params, {channel: channel}) ));
}
//数据为空,不显示页面模块
if(_.isEmpty(respData.slide.list)) {
delete respData.slide;
}
if(_.isEmpty(respData.recommond.dataList)) {
delete respData.recommond;
}
if(_.isEmpty(respData.newBrand.brandList)) {
delete respData.newBrand;
}
if(_.isEmpty(respData.newProduct.newProList) && _.isEmpty(respData.newProduct.ctyList)) {
delete respData.newProduct;
}
if(_.isEmpty(respData.firstLook.lookBanner.list) && _.isEmpty(respData.firstLook.lookTwoImg)) {
delete respData.firstLook;
}
return respData;
});
};
... ...
... ... @@ -7,15 +7,15 @@
{{#recommond}}
<div class="recommond-floor">
{{> common/floor-header}}
<div class="swiper-container new-arrival-swiper rec-swiper">
<div id="rec-swiper" class="swiper-container new-arrival-swiper rec-swiper">
<div class="swiper-wrapper">
{{#dataList}}
<div class="swiper-slide">
<span class="swiper-slide">
<a class="rec-pro" href="{{url}}" target="_blank">
<img class="lazy" data-original="{{image src 185 86}}" style="display: block; opacity: 1;">
<img src="{{image src 185 86}}">
<p class="new-num">上新<span>{{num}}</span></p>
</a>
</div>
</span>
{{/dataList}}
</div>
... ... @@ -31,14 +31,14 @@
{{#newBrand}}
<div class="newBrand-floor">
{{> common/floor-header}}
<div class="swiper-container new-arrival-swiper brand-swiper">
<div id="brand-swiper" class="swiper-container new-arrival-swiper brand-swiper">
<div class="swiper-wrapper">
{{#brandList}}
<div class="swiper-slide">
<span class="swiper-slide">
<a class="" href="{{url}}" target="_blank">
<img class="lazy" data-original="{{image src 185 86}}" style="display: block; opacity: 1;">
<img src="{{image src 185 86}}">
</a>
</div>
</span>
{{/brandList}}
</div>
... ...
... ... @@ -18,8 +18,8 @@ module.exports = {
domains: {
favApi: 'http://192.168.102.31:8092/brower',
api: 'http://api-test3.yohops.com:9999/',
service: 'http://service-test3.yohops.com:9999/',
api: 'http://api-test2.yohops.com:9999/',
service: 'http://service-test2.yohops.com:9999/',
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/',
... ...
... ... @@ -59,3 +59,23 @@ $('#new-product-floor').on('click', '.catagory-navs li', function() {
}
});
/*
* 页面加载完
*/
$(function() {
//轮播数量不够隐藏左右箭头
var $recSwiper = $('#rec-swiper');
var recNum = $recSwiper.find('.swiper-wrapper > .swiper-slide').length;
if (recNum <= 12) {
$recSwiper.find('.prev,.next').addClass('hide');
}
var $brandSwiper = $('#brand-swiper');
var brandNum = $brandSwiper.find('.swiper-wrapper > .swiper-slide').length;
if (brandNum <= 6) {
$brandSwiper.find('.prev,.next').addClass('hide');
}
});
... ...
... ... @@ -88,11 +88,11 @@
}
.slide-switch a.prev {
margin-left: -392px;
margin-left: -393px;
}
.slide-switch a.next {
margin-right: -392px;
margin-right: -393px;
}
}
... ... @@ -361,6 +361,10 @@
}
}
.new-arrive-latest {
margin-top: 30px;
}
.min-screen {
.firstLook-floor {
.left-one {
... ... @@ -372,11 +376,11 @@
}
.slide-switch a.prev {
margin-left: -328px;
margin-left: -338px;
}
.slide-switch a.next {
margin-right: -328px;
margin-right: -338px;
}
}
... ...