...
|
...
|
@@ -158,18 +158,27 @@ export function getProductList(content_code,categoryNavigationItem) { |
|
|
let {app, outlet} = getState();
|
|
|
let {categoryList} = outlet;
|
|
|
//limit,page,uid,firstProductSkn=''
|
|
|
// if (productList.isFetching || productList.endReached || productList.error) {
|
|
|
// return;
|
|
|
// }
|
|
|
|
|
|
if (!categoryNavigationItem || categoryNavigationItem.isFetching || categoryNavigationItem.endReached || categoryNavigationItem.error) {
|
|
|
return;
|
|
|
}
|
|
|
let page = categoryNavigationItem.currentPage?categoryNavigationItem.currentPage + 1:1;
|
|
|
let pageSize = categoryNavigationItem.pageSize?categoryNavigationItem.pageSize:60;
|
|
|
|
|
|
let param = parseUrlForparam(categoryNavigationItem.url);
|
|
|
let page = 1;//productList.currentPage + 1;
|
|
|
let pageSize = 60;//productList.pageSize;
|
|
|
|
|
|
dispatch(getProductListRequest({'content_code':content_code,'categoryNavigationItem':categoryNavigationItem}));
|
|
|
return new OutletService(app.host).getProductList(pageSize,page,param)
|
|
|
.then(json => {
|
|
|
dispatch(getProductListSuccess({'json':json,'content_code':content_code,'categoryNavigationItem':categoryNavigationItem}));
|
|
|
let payload = parseProductList(json)
|
|
|
payload.endReached = payload.currentPage == payload.pageCount || payload.list.length < pageSize;
|
|
|
|
|
|
if (payload.currentPage > 1) {
|
|
|
let oldList = categoryNavigationItem.list;
|
|
|
let list = [...oldList, ...payload.list];
|
|
|
payload.list = list;
|
|
|
}
|
|
|
dispatch(getProductListSuccess({'json':payload,'content_code':content_code,'categoryNavigationItem':categoryNavigationItem}));
|
|
|
})
|
|
|
.catch(error => {
|
|
|
dispatch(getProductListFailure(content_code,error,categoryNavigationItem));
|
...
|
...
|
@@ -183,6 +192,21 @@ function parseUrlForparam(url) { |
|
|
return param;
|
|
|
}
|
|
|
|
|
|
function parseProductList(json) {
|
|
|
let currentPage = json && json.page ? json.page : 1;
|
|
|
let pageCount = json && json.page_total ? json.page_total : 0;
|
|
|
let total = json && json.total ? json.total : 0;
|
|
|
let list = json && json.product_list ? json.product_list : [];
|
|
|
return {
|
|
|
list,
|
|
|
currentPage,
|
|
|
pageCount,
|
|
|
total,
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
export function getOutletActivityListRequest(content_code) {
|
|
|
return {
|
|
|
type: GET_OUTLET_ACTIVITY_LIST_REQUEST,
|
...
|
...
|
|