Authored by 郝肖肖

'个性化推荐头部'

'use strict';
const TideModel = require('../models/tide');
const headerModel = require('../../../doraemon/models/header');
/**
* 潮品推介
... ... @@ -11,15 +12,25 @@ exports.category = (req, res, next) => {
isApp: req.yoho.isApp,
scene: req.query.scene || 1
};
let renders = {};
if (!req.yoho.isApp) {
renders = {
pageHeader: headerModel.setNav({
navTitle: '潮流推荐'
}),
pageFooter: true,
};
}
return req.ctx(TideModel).tideCategory(params).then(result => {
res.render('tide/category', {
res.render('tide/category', Object.assign(renders, {
module: 'tide',
page: 'category',
width750: true,
localCss: true,
result: result
});
}));
}).catch(next);
};
... ... @@ -33,14 +44,24 @@ exports.shop = (req, res, next) => {
isApp: req.yoho.isApp,
scene: req.query.scene || 1
};
let renders = {};
if (!req.yoho.isApp) {
renders = {
pageHeader: headerModel.setNav({
navTitle: '潮流推荐'
}),
pageFooter: true,
};
}
return req.ctx(TideModel).tideShop(params).then((result) => {
res.render('tide/shop', {
res.render('tide/shop', Object.assign(renders, {
module: 'tide',
page: 'shop',
width750: true,
localCss: true,
result: result
});
}));
}).catch(next);
};
... ...
... ... @@ -31,7 +31,9 @@ class TideModel extends global.yoho.BaseModel {
});
let tdata = {
sortInfo: Object.assign({}, item.sortInfo, {
url: helpers.urlFormat(`/${item.sortInfo.itemId}`, '', null)
url: helpers.urlFormat(`/list/so${item.sortInfo.itemId}`, {
'openby:yohobuy': `{"action":"go.list","params":{"sort":${item.sortInfo.itemId}}}"`
})
}),
goods: goods
};
... ... @@ -103,7 +105,9 @@ class TideModel extends global.yoho.BaseModel {
let shopInfo = _.get(res[1], 'data.shopInfo', {});
if (shopInfo.shopId) {
shopInfo.url = helpers.urlFormat(`/shop/${shopInfo.shopName}-${shopInfo.shopId}.html`, '', null);
shopInfo.url = helpers.urlFormat(`/shop/${shopInfo.shopDomain}-${shopInfo.shopId}.html`, {
'openby:yohobuy': `{"action":"go.shop","params":{"shop_id":"${shopInfo.shopId}","shop_template_type":"${shopInfo.shopTemplateType}","shop_name":"${shopInfo.shopName}"}}` //eslint-disable-line
});
}
tide.shopInfo.push({
title: '# 为你精选 #',
... ... @@ -116,7 +120,9 @@ class TideModel extends global.yoho.BaseModel {
_.each(_.get(res[2], 'data', []), (item) => {
tide.brands.push(Object.assign({}, item, {
url: helpers.urlFormat(`/shop/${item.name}-${item.shopId}.html`, '', null)
url: helpers.urlFormat(`/shop/${item.shopDomain}-${item.shopId}.html`, {
'openby:yohobuy': `{"action":"go.shop","params":{"shop_id":"${item.shopId}","shop_template_type":"${item.shopTemplateType}","shop_name":"${item.shopName}"}}` //eslint-disable-line
})
}));
});
... ...
... ... @@ -13,12 +13,13 @@
{{/if}}
<div class="tide-goods">
{{#if sortInfo}}
{{#if sortInfo.imageUrl}}
<div class="cate-block">
<img class="lazy" data-original="{{image sortInfo.imageUrl 217 300 1}}">
<a href="{{sortInfo.url}}">
<img class="lazy" data-original="{{image sortInfo.imageUrl 217 300 1}}" />
</a>
</div><!--/cate-block-->
{{/if}}
{{> tide/goods}}
</div><!--/tide-goods-->
{{/result.contents}}
... ...
... ... @@ -105,11 +105,7 @@
.goods-img img {
width: 187px;
height: 216px;
margin: 15px;
}
.goods-img {
overflow: hidden;
margin: 15px 15px 12px;
}
.goods-footer {
... ... @@ -148,7 +144,7 @@
.wonderful-container {
display: flex;
flex-wrap: wrap;
margin: 0 20px 0 40px;
margin: 20px 20px 0 40px;
.wonderful-big {
margin-right: 20px;
... ... @@ -236,7 +232,7 @@
width: 210px;
height: 140px;
overflow: hidden;
margin: 40px auto 0;
margin: 40px auto 20px;
}
.name {
... ...