Authored by ccbikai

Merge branch 'develop' of git.yoho.cn:fe/yohoblk-wap into develop

... ... @@ -30,6 +30,6 @@ module.exports = {
uid: params.uid || '0',
page: params.page,
limit: '10'
});
}, {code: 200, cache: true});
}
};
... ...
... ... @@ -7,7 +7,6 @@
'use strict';
const logger = global.yoho.logger;
const api = global.yoho.API;
const editorialListApi = require('./list-api');
const camelCase = global.yoho.camelCase;
... ... @@ -19,19 +18,17 @@ const camelCase = global.yoho.camelCase;
const editorialList = params => {
let finalResult = {};
return api.all([
editorialListApi.getEditorialListData(params)
]).then(result => {
if (result[0].code === 200 && result[0].data.list) {
return editorialListApi.getEditorialListData(params).then(result => {
if (result.data.list) {
Object.assign(finalResult, {
data: {
list: result[0].data.list.artList,
totalPage: result[0].data.totalPage
list: result.data.list.artList,
totalPage: result.data.totalPage
},
code: 200
});
} else {
logger.error('getEitorialListData api code no 200');
logger.error('getEitorialListData api no result.data');
}
return camelCase(finalResult);
... ...
... ... @@ -164,7 +164,7 @@ const enDict = {
color: 'Color',
gender: 'Gender',
size: 'Size',
brand: 'Brand品牌',
brand: 'Brand',
priceRange: 'Price',
groupSort: 'Category',
discount: 'Sale',
... ...
... ... @@ -8,9 +8,12 @@ const _ = require('lodash');
/**
* 处理 以风格的数据
* 风格1:
* [
* {filter_attribute: value}
* ]
* 风格2:
* {filter_attribute: value}
*
* 处理结果
* [
... ... @@ -22,18 +25,32 @@ let verboseAttrHandler = (filterField, dataArr) => {
let result = [];
let re = new RegExp(`^${filterField}_`);
dataArr.forEach(obj => {
// 处理 {filter_attribute: value}
function handlerAttrObj(obj) {
let item = {};
let keys = Object.keys(obj);
keys.forEach(key=>{
keys.forEach(key => {
let newKey = key.replace(re, '');
item[newKey] = obj[key];
});
return item;
}
result.push(item);
});
if (_.isPlainObject(dataArr)) {
// 风格2
let attr = handlerAttrObj(dataArr);
result.push(attr);
} else {
// 风格1
dataArr.forEach(obj => {
let attr = handlerAttrObj(obj);
result.push(attr);
});
}
return result;
};
... ... @@ -60,7 +77,7 @@ let keyIdHandler = (filterField, obj) => {
const keys = Object.keys(obj);
keys.sort();
keys.forEach(key=> {
keys.forEach(key => {
let item = {};
item.id = key;
... ...