...
|
...
|
@@ -4,6 +4,7 @@ import ReactNative from 'react-native'; |
|
|
import BrandService from '../../services/BrandService';
|
|
|
import {Record, List, Map} from 'immutable';
|
|
|
import Pinyin from '../../../common/utils/pinyin';
|
|
|
import {isEmptyObject} from '../../utils/Utils';
|
|
|
|
|
|
const {
|
|
|
SET_TYPE,
|
...
|
...
|
@@ -169,14 +170,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 => {
|
...
|
...
|
@@ -193,6 +197,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,
|
...
|
...
|
@@ -359,7 +393,7 @@ export function searchHistory() { |
|
|
});
|
|
|
})
|
|
|
.catch(error => {
|
|
|
|
|
|
|
|
|
});
|
|
|
};
|
|
|
}
|
...
|
...
|
@@ -374,7 +408,7 @@ export function insertSearchHistory(keyword) { |
|
|
});
|
|
|
})
|
|
|
.catch(error => {
|
|
|
|
|
|
|
|
|
});
|
|
|
};
|
|
|
}
|
...
|
...
|
@@ -389,7 +423,7 @@ export function clearSearchHistory() { |
|
|
});
|
|
|
})
|
|
|
.catch(error => {
|
|
|
|
|
|
|
|
|
});
|
|
|
};
|
|
|
}
|
...
|
...
|
@@ -527,11 +561,6 @@ export function filteBrandForKeyword(text) { |
|
|
return false;
|
|
|
});
|
|
|
|
|
|
|
|
|
// let result =
|
|
|
// brandList.forEach((value, key) => {
|
|
|
// console.log(key);
|
|
|
// });
|
|
|
|
|
|
};
|
|
|
} |
|
|
\ No newline at end of file |
|
|
} |
...
|
...
|
|