Authored by lixia.zhang

Tab切删除和全部删除,review by Redding

... ... @@ -58,13 +58,8 @@ class BrowseContainer extends Component {
this.subscription = NativeAppEventEmitter.addListener(
'ClearHistoryEvent',
(reminder) => {
let selectedProducts = this.props.browse.productList;
selectedProducts = selectedProducts&&selectedProducts.toJS();
if (selectedProducts.length) {
this.props.actions.clearHistory(selectedProducts);
}
let curCategoryID = this.props.browse.curCategoryID;
this.props.actions.clearHistory(curCategoryID);
}
);
}
... ...
... ... @@ -207,7 +207,7 @@ export function deleteOneHistory(skn, index) {
let fetchList = (skn, uid, sourcePage) => {
dispatch(historyDeleteRequest());
return new BrowseService(app.host).deleteHistory(skn, uid, sourcePage)
return new BrowseService(app.host).deleteHistory(0, uid, sourcePage,skn)
.then(json => {
let {productList} = browse;
let lists = productList.toArray();
... ... @@ -269,22 +269,16 @@ export function historyClearFailure(error) {
};
}
export function clearHistory(selectedProducts) {
export function clearHistory(categoryID=0) {
return (dispatch, getState) => {
let skns = '';
for (var i = 0; i < selectedProducts.length; i++) {
skns = skns+selectedProducts[i].product_skn;
skns = skns+',';
}
let {app, browse} = getState();
if (browse.productList.size == 0) {
return;
}
let fetchList = (skns, uid, sourcePage) => {
let fetchList = (categoryID, uid, sourcePage) => {
dispatch(historyClearRequest());
return new BrowseService(app.host).deleteHistory(skns, uid, sourcePage)
return new BrowseService(app.host).deleteHistory(categoryID, uid, sourcePage,)
.then(json => {
dispatch(historyClearSuccess());
dispatch(historySortList());
... ... @@ -307,7 +301,7 @@ export function clearHistory(selectedProducts) {
return ReactNative.NativeModules.YH_CommonHelper.uid();
}).then(data => {
uid = data;
fetchList(skns, uid, sourcePage);
fetchList(categoryID, uid, sourcePage);
})
.catch(error => {
... ...
... ... @@ -49,8 +49,8 @@ export default class CategoryService {
}
async deleteHistory(skn=0, uid=0, fromPage='') {
let param = skn ? {uid, skn, fromPage,} : {uid, fromPage,};
async deleteHistory(category_id=0, uid=0, fromPage=',',skn=0) {
let param = skn ? {uid, skn, fromPage,} : {category_id, uid,fromPage,};
return await this.api.get({
url: '',
body: {
... ...