Authored by zhangxiaoru

plustar

... ... @@ -25,14 +25,17 @@ const getListData = (req, res, next) => {
plustarModel.getListData(gender, recom, all).then((result) => {
res.render('plustar/list', {
module: 'plustar',
page: 'list',
module: 'guang',
page: 'plustar-list',
pageHeader: headerModel.setNav({
navTitle: '国际优选'
}),
pageFooter: true,
ps: {
sName: '设计师',
pName: '经典潮牌'
pName: '经典潮牌',
star: result.star,
plus: result.plus
}
});
}).catch(next);
... ...
... ... @@ -4,6 +4,49 @@ const serviceAPI = global.yoho.ServiceAPI;
const _ = require('lodash');
const productProcess = require('../../../utils/product-process');
const formaData = (data, gender) => {
let build = [];
//console.log(data)
_.forEach(data, function(val) {
//多张图
if(val.data[1]) {
let imgs = [];
_.forEach(val.data, function(list) {
let obj = {};
obj = _.assign(obj, {
url: '/plustar/brandinfo?id=' + val.id + '&gender=' + gender,
img: list.src,
deps: val.brand_title
});
imgs.push(obj);
})
build.push({
imgs: imgs
})
}
//单张图
if(val.data[0]) {
_.forEach(val.data, function(list) {
build.push({
url: '/plustar/brandinfo?id=' + val.id + '&gender=' + gender,
img: list.src,
deps: val.brand_title
})
})
}
})
return build;
}
const getContentData = (gender, type) => {
... ... @@ -12,8 +55,8 @@ const getContentData = (gender, type) => {
brand_type: type
}).then((result) => {
if (result && result.code === 200) {
// console.log(result)
return result;
//console.log(result)
return formaData(result.data.data.list[0].data, gender);
} else {
logger.error('列表 list data return code is not 200');
return {};
... ... @@ -21,6 +64,8 @@ const getContentData = (gender, type) => {
});
};
const getListData = (gender, recom, all) => {
return Promise.all([getContentData(gender, recom), getContentData(gender, all)]).then((result) => {
return {
... ...
... ... @@ -12,7 +12,7 @@
</ul>
<ul class="plus-content content hide">
{{# plus}}
{{> guang/ps_item}}
{{> ps_item}}
{{/ plus}}
</ul>
</div>
... ...
... ... @@ -5,7 +5,7 @@
{{# imgs}}
<div class="swiper-slide">
<a href={{url}}>
<img class="swiper-lazy" data-src={{img}}>
<img class="swiper-lazy" data-src={{image img 640 310 2}}>
</a>
</div>
{{/ imgs}}
... ... @@ -17,7 +17,7 @@
</div>
{{^}}
<a href={{url}}>
<img class="lazy" data-original={{img}}>
<img class="lazy" data-original={{image img 640 310 2}}>
</a>
{{/if}}
{{# deps}}
... ...
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload'),
Swiper = require('yoho-swiper');
var $navs = $('#nav-tab > li'),
$contents = $('#ps-content > .content');
var mySwiper;
require('../common');
lazyLoad($('img.lazy'));
$('.star-content li').each(function(key, item) {
$(item).find('.swiper-container').addClass('swiper-' + key);
mySwiper = new Swiper('.swiper-' + key, {
lazyLoading: true,
pagination: '.swiper-' + key + ' .pagination-inner'
});
});
$('#nav-tab').bind('contextmenu', function(e) {
return false;
});
$('#nav-tab').on('touchend touchcancel', function(e) {
var $this = $(e.target).closest('li');
if ($this.hasClass('focus')) {
return;
}
$navs.toggleClass('focus');
$contents.toggleClass('hide');
$(document).trigger('scroll'); //Trigger lazyLoad
});
$('#nav-tab').on('touchstart', function(e) {
var target = e.target || e.srcElement;
target.className = 'bytouch ' + target.className;
}).on('touchend touchcancel', function() {
$navs.removeClass('bytouch');
});
\ No newline at end of file
... ...
... ... @@ -6,7 +6,7 @@
}
.nav-tab {
height: 60px;
/*height: 60px;*/
padding: 10px 0;
background-color: #fff;
}
... ... @@ -49,6 +49,8 @@
}
}
.content.hide {
display: none;
}
... ...