Authored by 郭成尧

品牌一览OK

... ... @@ -52,7 +52,10 @@ module.exports = {
},
getBrandList: (req, res) => {
brandModel.getBrandListData().then(result => {
brandModel.getBrandListData({
channel: req.query.channel || req.cookies._Channel || 'boys'
}).then(result => {
res.json(result);
});
},
... ...
... ... @@ -7,6 +7,21 @@
'use strict';
const api = global.yoho.API;
const yhChannel = {
boys: {
channel: '1'
},
girls: {
channel: '2'
},
kids: {
channel: '3'
},
lifestyle: {
channel: '4'
}
};
module.exports = {
/**
... ... @@ -35,7 +50,8 @@ module.exports = {
*/
getBrandListOriginData(params) {
return api.get('', {
method: ''
method: 'app.brand.newBrandList',
yh_channel: yhChannel[params.channel].channel
});
},
... ...
... ... @@ -6,7 +6,38 @@
*/
'use strict';
const api = global.yoho.API;
const helpers = global.yoho.helpers;
const brandApi = require('./brand-api');
const logger = global.yoho.logger;
const _ = require('lodash');
/**
* 处理品牌一览品牌列表数据
* @param origin
* @returns {Array}
*/
const handleBrandList = origin => {
let dest = [];
_.forEach(origin, (value, key) => {
let brands = [];
_.forEach(value, (subValue) => {
brands.push({
name: subValue.brand_name,
link: helpers.urlFormat('', null, subValue.brand_domain),
logo: subValue.brand_ico
});
});
dest.push({
index: key,
brands: brands
});
});
return dest;
};
/**
* 获取品牌店铺数据
... ... @@ -53,70 +84,13 @@ const getBrandListData = params => {
let finalResult = {};
return api.all([brandApi.getBrandListOriginData(params)]).then(result => {
Object.assign(finalResult, {
brandList: [
{
index: 'A',
brands: [
{
name: 'Yohji Yamamoto(eyes wear)',
link: '#',
logo: 'https://img11.static.yhbimg.com/brandLogo/2016/04/13/15/010eb8606c1072fd2e769c62567d3bbe93.png?imageView2/2/w/140/h/140'
},
{
name: 'TEEN TEAM',
link: '#',
logo: 'https://img12.static.yhbimg.com/brandLogo/2015/12/03/14/02d4dba71951e8e971dc85d2eab5fe7a7f.jpg?imageView2/2/w/140/h/140'
},
{
name: 'MYGESMART',
link: '#',
logo: 'https://img11.static.yhbimg.com/brandLogo/2014/01/27/11/01d9dbee4c83e9122bd1fc363ceb85e484.jpg?imageView2/2/w/140/h/140'
},
{
name: 'MYGESMART',
link: '#',
logo: 'https://img11.static.yhbimg.com/brandLogo/2014/01/27/11/01d9dbee4c83e9122bd1fc363ceb85e484.jpg?imageView2/2/w/140/h/140'
},
{
name: 'MYGESMART',
link: '#',
logo: 'https://img11.static.yhbimg.com/brandLogo/2014/01/27/11/01d9dbee4c83e9122bd1fc363ceb85e484.jpg?imageView2/2/w/140/h/140'
}
]
},
{
index: 'B',
brands: [
{
name: 'Yohji Yamamoto(eyes wear)',
link: '#',
logo: 'https://img11.static.yhbimg.com/brandLogo/2016/04/13/15/010eb8606c1072fd2e769c62567d3bbe93.png?imageView2/2/w/140/h/140'
},
{
name: 'TEEN TEAM',
link: '#',
logo: 'https://img12.static.yhbimg.com/brandLogo/2015/12/03/14/02d4dba71951e8e971dc85d2eab5fe7a7f.jpg?imageView2/2/w/140/h/140'
},
{
name: 'MYGESMART',
link: '#',
logo: 'https://img11.static.yhbimg.com/brandLogo/2014/01/27/11/01d9dbee4c83e9122bd1fc363ceb85e484.jpg?imageView2/2/w/140/h/140'
},
{
name: 'MYGESMART',
link: '#',
logo: 'https://img11.static.yhbimg.com/brandLogo/2014/01/27/11/01d9dbee4c83e9122bd1fc363ceb85e484.jpg?imageView2/2/w/140/h/140'
},
{
name: 'MYGESMART',
link: '#',
logo: 'https://img11.static.yhbimg.com/brandLogo/2014/01/27/11/01d9dbee4c83e9122bd1fc363ceb85e484.jpg?imageView2/2/w/140/h/140'
}
]
}
]
});
if (result[0].code === 200 && result[0].data.all_list) {
Object.assign(finalResult, {
brandList: handleBrandList(result[0].data.all_list)
});
} else {
logger.error('getBrandListOriginData api code no 200 or allList is null');
}
return finalResult;
});
... ...
... ... @@ -6,9 +6,8 @@
<div class="brand-box" v-for="brand in item.brands">
<a href="{{brand.link}}">
<div class="brand-logo">
<img v-lazy="brand.logo" alt="{{brand.name}}">
<img v-lazy="brand.logo | resize 150 150" alt="{{brand.name}}">
</div>
<span class="brand-name">{{brand.name}}</span>
</a>
</div>
... ... @@ -21,6 +20,12 @@
width: 100%;
height: 600px;
.per-brand-box {
.index {
padding: 20px;
}
}
.brand-big-box {
width: 100%;
}
... ... @@ -30,6 +35,7 @@
height: 175px;
float: left;
overflow: hidden;
text-align: center;
.brand-logo {
height: 150px;
... ...