Authored by 孙凯

更新 bug review by hongmo

... ... @@ -107,7 +107,7 @@ export default class Browse extends Component {
let {isFetching, productList, categoryList, selectedCategoryIndex, isDeleting, showEmpty, currentPage, page_total} = this.props.data;
let isLoading = (productList.size == 0 && isFetching) || isDeleting;
let isLoading = (productList.size == 0 && isFetching);
let showList = !isFetching && productList.size > 0;
let isLoadingMore = isFetching && currentPage > 0;
return (
... ...
... ... @@ -133,7 +133,7 @@ export default class Browse extends Component {
let {isFetching, productList, categoryList, selectedCategoryIndex, isDeleting, showEmpty, currentPage, page_total} = this.props.data;
let isLoading = (productList.size == 0 && isFetching) || isDeleting;
let isLoading = (productList.size == 0 && isFetching);
let isLoadingMore = isFetching && currentPage > 0;
let showList = !isFetching && productList.size > 0;
return (
... ...
... ... @@ -144,7 +144,7 @@ export function historyList(category_id) {
} else if (newproductList.length){
productList = newproductList;
}
dispatch(historyListSuccess({currentPage, page_total, productList}));
let show = productList.length > 0;
ReactNative.NativeModules.YH_RecorderHelper.setRightClearButtonVisiblity(show);
... ... @@ -217,11 +217,11 @@ export function deleteOneHistory(skn, index) {
if (indexInAll != -1) {
productList = productList.delete(indexInAll);
}
if (productList.size == 0 || productList.length == 0) {
dispatch(historySortList());
}else {
// if (productList.size == 0 || productList.length == 0) {
// dispatch(historySortList());
// }else {
dispatch(historyDeleteSuccess({productList}));
}
// }
let show = productList.size > 0;
ReactNative.NativeModules.YH_RecorderHelper.setRightClearButtonVisiblity(show);
... ... @@ -256,10 +256,9 @@ export function historyClearRequest() {
};
}
export function historyClearSuccess(json) {
export function historyClearSuccess() {
return {
type: HISTORY_CLEAR_SUCCESS,
payload:json
};
}
... ... @@ -287,9 +286,9 @@ export function clearHistory(selectedProducts) {
dispatch(historyClearRequest());
return new BrowseService(app.host).deleteHistory(skns, uid, sourcePage)
.then(json => {
dispatch(historySortList());
dispatch(historyList(0));
dispatch({type: HISTORY_CLEAR_SUCCESS});
// dispatch(historySortList());
// dispatch(historyList(0));
dispatch(historyClearSuccess());
})
.catch(error => {
dispatch(historyClearFailure(error));
... ... @@ -314,4 +313,3 @@ export function clearHistory(selectedProducts) {
});
};
}
... ...
... ... @@ -54,7 +54,7 @@ export default function browseReducer(state=initialState, action) {
return newState;
}
case HISTORY_LIST_FAILURE:
case HISTORY_LIST_FAILURE:
case HISTORY_SORT_LIST_FAILURE:{
return state.set('isFetching', false)
.set('error', action.payload);
... ... @@ -78,9 +78,14 @@ export default function browseReducer(state=initialState, action) {
}
case HISTORY_DELETE_SUCCESS: {
let {productList, selectedProductList} = action.payload;
let {productList} = action.payload;
let showEmpty = productList.size == 0;
return state.set('isDeleting', false);
console.log(showEmpty);
return state.set('isDeleting', false)
.set('productList', productList)
.set('showEmpty', showEmpty);
}
case HISTORY_DELETE_FAILURE:
... ... @@ -90,12 +95,12 @@ export default function browseReducer(state=initialState, action) {
case HISTORY_CLEAR_SUCCESS: {
let {productList,categoryList,index} = action.payload;
let show = productList.length==0;
return state.set('isDeleting', false);
return state.set('isDeleting', false)
.set('productList', Immutable.fromJS([]))
.set('categoryList', Immutable.fromJS([]))
.set('showEmpty', true);
}
}
return state;
}
... ...