Authored by hongweigao

品牌列表

... ... @@ -143,17 +143,18 @@ const getBrandViewList = (channel, start, length) => {
let res = yield brandApi.getBrandListData(switchParams.brandCode);
let result = {},
let result = [],
navigation = [];
// 品牌list A-Z 0-9
if (res.data.brands) {
let listTmp = {};
_.forEach(res.data.brands, subValue => {
_.forEach(res.data.brands, (subValue, key) => {
// if(_.isEmpty(subValue)){
// continue;
// }
let listTmp = [];
_.forEach(subValue, ssubValue => {
// 为品牌名称
let brandName = ssubValue.brand_name,
... ... @@ -167,30 +168,30 @@ const getBrandViewList = (channel, start, length) => {
href = helpers.urlFormat(ssubValue.brand_domain);
}
listTmp[brandName] = {
listTmp.push({
name: ssubValue.brand_name,
key: ssubValue.id,
href: href
};
if (ssubValue.is_hot === 'Y') {
listTmp[brandName].hot = 'hot';
}
href: href,
hot: ssubValue.is_hot === 'Y' ? 'hot' : ''
});
});
navigation.push(key);
// 按键值排序
result.push({
key: key,
val: listTmp
});
});
}
// 只取部分数据
let begin,
end;
let begin;
begin = (start - 1) ? (start - 1) : 0;
begin = (begin > 0) ? begin : 0;
end = length - begin;
result = length ? result.slice(begin, end) : result.slice(begin, end);
result = length ? result.slice(begin, length + begin) : result.slice(begin);
result.navigation = navigation;
return result;
... ...
... ... @@ -32,7 +32,8 @@ exports.getBrandViewList = (channel) => {
// 品牌一览列表
responseData.brands = result[1];
responseData.brands.navigation = result[2].navigation;
responseData.brands.category = result[2];
return responseData;
});
};
... ...
{{> brand/brand-list}}
\ No newline at end of file
... ... @@ -49,6 +49,7 @@
</div>
</div>
<div class="brands-list" >
{{> brand-list}}
</div>
{{/ brands}}
</div>
... ...
{{#each category}}
<dl class="clearfix" name="{{key}}">
<dt>{{key}}</dt>
<dd>
<ul class="clearfix">
{{#each val}}
<li>
<a class="{{hot}}" data-key="{{key}}" href="{{href}}" target="_blank">
<span>{{name}}</span>
</a>
{{# hot}}
<i class="iconfont">&#xe632;</i>
{{/ hot}}
</li>
{{/each}}
</ul>
</dd>
</dl>
{{/each}}
... ...