Authored by lixia.zhang

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

@@ -58,13 +58,8 @@ class BrowseContainer extends Component { @@ -58,13 +58,8 @@ class BrowseContainer extends Component {
58 this.subscription = NativeAppEventEmitter.addListener( 58 this.subscription = NativeAppEventEmitter.addListener(
59 'ClearHistoryEvent', 59 'ClearHistoryEvent',
60 (reminder) => { 60 (reminder) => {
61 - let selectedProducts = this.props.browse.productList;  
62 - selectedProducts = selectedProducts&&selectedProducts.toJS();  
63 -  
64 - if (selectedProducts.length) {  
65 - this.props.actions.clearHistory(selectedProducts);  
66 - }  
67 - 61 + let curCategoryID = this.props.browse.curCategoryID;
  62 + this.props.actions.clearHistory(curCategoryID);
68 } 63 }
69 ); 64 );
70 } 65 }
@@ -207,7 +207,7 @@ export function deleteOneHistory(skn, index) { @@ -207,7 +207,7 @@ export function deleteOneHistory(skn, index) {
207 207
208 let fetchList = (skn, uid, sourcePage) => { 208 let fetchList = (skn, uid, sourcePage) => {
209 dispatch(historyDeleteRequest()); 209 dispatch(historyDeleteRequest());
210 - return new BrowseService(app.host).deleteHistory(skn, uid, sourcePage) 210 + return new BrowseService(app.host).deleteHistory(0, uid, sourcePage,skn)
211 .then(json => { 211 .then(json => {
212 let {productList} = browse; 212 let {productList} = browse;
213 let lists = productList.toArray(); 213 let lists = productList.toArray();
@@ -269,22 +269,16 @@ export function historyClearFailure(error) { @@ -269,22 +269,16 @@ export function historyClearFailure(error) {
269 }; 269 };
270 } 270 }
271 271
272 -export function clearHistory(selectedProducts) { 272 +export function clearHistory(categoryID=0) {
273 return (dispatch, getState) => { 273 return (dispatch, getState) => {
274 - let skns = '';  
275 - for (var i = 0; i < selectedProducts.length; i++) {  
276 - skns = skns+selectedProducts[i].product_skn;  
277 - skns = skns+',';  
278 - }  
279 let {app, browse} = getState(); 274 let {app, browse} = getState();
280 -  
281 if (browse.productList.size == 0) { 275 if (browse.productList.size == 0) {
282 return; 276 return;
283 } 277 }
284 278
285 - let fetchList = (skns, uid, sourcePage) => { 279 + let fetchList = (categoryID, uid, sourcePage) => {
286 dispatch(historyClearRequest()); 280 dispatch(historyClearRequest());
287 - return new BrowseService(app.host).deleteHistory(skns, uid, sourcePage) 281 + return new BrowseService(app.host).deleteHistory(categoryID, uid, sourcePage,)
288 .then(json => { 282 .then(json => {
289 dispatch(historyClearSuccess()); 283 dispatch(historyClearSuccess());
290 dispatch(historySortList()); 284 dispatch(historySortList());
@@ -307,7 +301,7 @@ export function clearHistory(selectedProducts) { @@ -307,7 +301,7 @@ export function clearHistory(selectedProducts) {
307 return ReactNative.NativeModules.YH_CommonHelper.uid(); 301 return ReactNative.NativeModules.YH_CommonHelper.uid();
308 }).then(data => { 302 }).then(data => {
309 uid = data; 303 uid = data;
310 - fetchList(skns, uid, sourcePage); 304 + fetchList(categoryID, uid, sourcePage);
311 }) 305 })
312 .catch(error => { 306 .catch(error => {
313 307
@@ -49,8 +49,8 @@ export default class CategoryService { @@ -49,8 +49,8 @@ export default class CategoryService {
49 } 49 }
50 50
51 51
52 - async deleteHistory(skn=0, uid=0, fromPage='') {  
53 - let param = skn ? {uid, skn, fromPage,} : {uid, fromPage,}; 52 + async deleteHistory(category_id=0, uid=0, fromPage=',',skn=0) {
  53 + let param = skn ? {uid, skn, fromPage,} : {category_id, uid,fromPage,};
54 return await this.api.get({ 54 return await this.api.get({
55 url: '', 55 url: '',
56 body: { 56 body: {