Authored by liangxs

热门品类楼层完成

... ... @@ -25,7 +25,7 @@ app.engine('.hbs', hbs({
defaultLayout: 'layout',
layoutsDir: doraemon,
partialsDir: [`${partials}/partials`, `${doraemon}/partial`],
helpers: 'helpers'
helpers: require('../../library/helpers')
}));
// router
... ...
... ... @@ -90,19 +90,20 @@ const getNewReportFloorData = data => {
const getHotGoodsFloorData = data => {
let list = [];
_.forEach(data, (item) => {
_.forEach(data, (item, index) => {
if (item.template_intro === '热门品类') {
let object = {},
keyword = [],
category = [],
brands = [],
types = [];
types = [],
navs = {},
products = [];
// product = [];
// console.log(item.data);
// console.log(item.data);
// console.log(item.data.menuNav);
// console.log(item.data.navs);
// return false;
_.forEach(item.data.menuNav.list, (it) => {
let obj = {};
... ... @@ -121,24 +122,39 @@ const getHotGoodsFloorData = data => {
keyword.push(obj);
});
_.forEach(item.data.imgs, (it, index) => {
_.forEach(item.data.imgs, (it, idx) => {
let obj = {};
obj.name = it.title;
obj.href = it.url;
obj.img = it.img;
if (index < 2) {
if (idx === 0 || idx === 4) {
brands.push(obj);
} else {
types.push(obj);
}
});
_.forEach(data[index + 1].data, (it) => {
let obj = {};
obj.name = it.title;
obj.href = it.url;
obj.img = it.src;
products.push(obj);
});
navs.name = item.data.navs.list[0].name;
navs.href = item.data.navs.list[0].url;
object.name = item.data.name;
object.keyword = keyword;
object.category = category;
object.brands = brands;
object.types = types;
object.navs = navs;
object.products = products;
list.push(object);
}
});
... ... @@ -188,7 +204,8 @@ exports.getContent = (type) => {
data.recommend = {
tplrecommend: getHotGoodsFloorData(contentData.list)
};
console.log(data.newReport);
// console.log(contentData.list);
return data;
});
};
... ...
... ... @@ -5,7 +5,7 @@
<div class="tpl-nav">
<div class="tpl-keywords">
{{#each keyword}}
<a class="keywords{{@index}}" title="{{name}}" href="{{href}}" target= "_blank"><img class="lazy" data-original="{{img}}"/></a>
<a class="keywords{{@index}}" title="{{name}}" href="{{href}}" target= "_blank"><img class="lazy" src="{{image img 185 152}}"/></a>
{{/each}}
</div>
<div class="tpl-category clearfix">
... ... @@ -17,14 +17,14 @@
<div class="tpl-brands imgopacity clearfix">
<ul>
{{#each brands}}
<li><a title="{{name}}" href="{{href}}" target= "_blank"><img class="lazy" data-original="{{img img 100 100}}"/></a></li>
<li><a title="{{name}}" href="{{href}}" target= "_blank"><img class="lazy" src="{{image img 378 248}}"/></a></li>
{{/each}}
</ul>
</div>
<div class="tpl-types imgopacity clearfix">
<ul>
{{#each types}}
<li><a title="{{name}}" href="{{href}}" target= "_blank"><img class="lazy" data-original="{{img}}"/></a></li>
<li><a title="{{name}}" href="{{href}}" target= "_blank"><img class="lazy" src="{{image img 185 248}}"/></a></li>
{{/each}}
</ul>
</div>
... ... @@ -32,7 +32,7 @@
<div class="tpl-products imgopacity clearfix">
<ul>
{{#each products}}
<li><a href="{{href}}" title="{{name}}" target= "_blank"><img class="lazy" data-original="{{img}}"/></a></li>
<li><a href="{{href}}" title="{{name}}" target= "_blank"><img class="lazy" src="{{image img 222 298}}"/></a></li>
{{/each}}
</ul>
</div>
... ...