Authored by 孙凯

调整数据结构 review by hongmo

... ... @@ -44,7 +44,8 @@ export function getGlobalHomeResource(reload=false) {
dispatch(getGlobalHomeResourceRequest(reload));
return new HomeService(app.serviceHost).getGlobalHomeResource()
.then(json => {
dispatch(getGlobalHomeResourceSuccess(json));
let data = parseProductList(json)
dispatch(getGlobalHomeResourceSuccess(data));
})
.catch(error => {
dispatch(getGlobalHomeResourceFailure(error));
... ... @@ -52,6 +53,32 @@ export function getGlobalHomeResource(reload=false) {
};
}
function parseProductList(json) {
let groupInfo = {};
let list = [];
let page = json.page;
let content_code = json.content_code;
let total = json.total;
let total_page = json.total_page;
let list_0 = json.list;
for (var i = 0; i < list_0.length; i++) {
list.push(list_0[i]);
if (list_0[i].template_name == 'paramsGroup') {
groupInfo = list_0[i];
}
}
return {
list,
page,
total,
total_page,
content_code,
groupInfo,
};
}
export function getGlobalProductListRequest() {
return {
... ...
... ... @@ -12,7 +12,13 @@ let InitialState = Record({
ptr: false, // 是否下拉刷新
isFetching: false,
error: null,
groupInfo: new (Record({
list: List(),
page: 0,
isFetching: false,
error: null,
fliter: 0,
})),
});
export default InitialState;
... ...