Authored by hongweigao

品牌拍讯

... ... @@ -160,7 +160,7 @@ const getBrandViewList = (channel, start, length) => {
let res = yield brandApi.getBrandListData(switchParams.channelType);
let result = [],
navigation = [];
numResult = {};
if (!res || res.code !== 200) {
return result;
... ... @@ -195,12 +195,18 @@ const getBrandViewList = (channel, start, length) => {
listTmp.push(brandItem);
});
navigation.push(key);
if (key.match(/\d+/g)) {
numResult = {// 把0-9提出来
key: key,
val: _.sortBy(listTmp, 'name')// 对name排序
};
} else {
result.push({
key: key,
val: _.sortBy(listTmp, 'name')// 对name排序
});
}
});
}
... ... @@ -208,15 +214,15 @@ const getBrandViewList = (channel, start, length) => {
// 只取部分数据
let begin;
if (start) {
begin = (start - 1) ? (start - 1) : 0;
begin = (begin > 0) ? begin : 0;
result = length ? result.slice(begin, length + begin) : result.slice(begin);
}
result.navigation = navigation;
result = _.sortBy(result, 'key');// A-Z排序
result.push(numResult); // 0-9放到最后
result.navigation = _.map(result, 'key');
return result;
})();
};
... ...