...
|
...
|
@@ -2,6 +2,7 @@ |
|
|
|
|
|
import ReactNative from 'react-native';
|
|
|
import BrandService from '../../services/BrandService';
|
|
|
import {isEmptyObject} from '../../utils/Utils';
|
|
|
|
|
|
const {
|
|
|
SET_TYPE,
|
...
|
...
|
@@ -167,14 +168,17 @@ export function getBrandList(channel) { |
|
|
}
|
|
|
return new BrandService(app.host).getBrandList(channel)
|
|
|
.then(json => {
|
|
|
|
|
|
let payload = parseListResources(json);
|
|
|
|
|
|
if (channel == 0) {
|
|
|
dispatch(getBrandListForBoySuccess(json));
|
|
|
dispatch(getBrandListForBoySuccess(payload));
|
|
|
}else if (channel == 1) {
|
|
|
dispatch(getBrandListForGirlSuccess(json));
|
|
|
dispatch(getBrandListForGirlSuccess(payload));
|
|
|
}else if (channel == 2) {
|
|
|
dispatch(getBrandListForKidSuccess(json));
|
|
|
dispatch(getBrandListForKidSuccess(payload));
|
|
|
}else if (channel == 3) {
|
|
|
dispatch(getBrandListForLifeStyleSuccess(json));
|
|
|
dispatch(getBrandListForLifeStyleSuccess(payload));
|
|
|
}
|
|
|
})
|
|
|
.catch(error => {
|
...
|
...
|
@@ -191,6 +195,36 @@ export function getBrandList(channel) { |
|
|
};
|
|
|
}
|
|
|
|
|
|
export function parseListResources(json) {
|
|
|
let all_list_old = json.all_list;
|
|
|
let hot_list = json.hot_list;
|
|
|
let new_list = json.new_list;
|
|
|
|
|
|
if (isEmptyObject(all_list_old)) {
|
|
|
return json;
|
|
|
}
|
|
|
|
|
|
let reg = /^[a-zA-Z]*$/;
|
|
|
let all_list = {};
|
|
|
let otherList = [];
|
|
|
|
|
|
for(let k in all_list_old) {
|
|
|
|
|
|
if (reg.test(k)) {
|
|
|
all_list[k] = all_list_old[k];
|
|
|
} else {
|
|
|
Array.prototype.push.apply(otherList, all_list_old[k]);
|
|
|
}
|
|
|
}
|
|
|
all_list['0-9'] = otherList;
|
|
|
|
|
|
return {
|
|
|
all_list,
|
|
|
hot_list,
|
|
|
new_list,
|
|
|
};
|
|
|
}
|
|
|
|
|
|
export function getBrandResourceForBoyRequest() {
|
|
|
return {
|
|
|
type: GET_BRAND_RESOURCE_FOR_BOY_REQUEST,
|
...
|
...
|
@@ -357,7 +391,7 @@ export function searchHistory() { |
|
|
});
|
|
|
})
|
|
|
.catch(error => {
|
|
|
|
|
|
|
|
|
});
|
|
|
};
|
|
|
}
|
...
|
...
|
@@ -372,7 +406,7 @@ export function insertSearchHistory(keyword) { |
|
|
});
|
|
|
})
|
|
|
.catch(error => {
|
|
|
|
|
|
|
|
|
});
|
|
|
};
|
|
|
}
|
...
|
...
|
@@ -387,7 +421,7 @@ export function clearSearchHistory() { |
|
|
});
|
|
|
})
|
|
|
.catch(error => {
|
|
|
|
|
|
|
|
|
});
|
|
|
};
|
|
|
}
|
...
|
...
|
@@ -478,7 +512,7 @@ export function filteBrandForKeyword(text) { |
|
|
let {app, brand} = getState();
|
|
|
let {search} = brand;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
} |
|
|
\ No newline at end of file |
|
|
} |
...
|
...
|
|