Authored by 于良

首页优化 review by days

... ... @@ -163,6 +163,7 @@ class HomeContainer extends Component {
}
onRefresh() {
InteractionManager.runAfterInteractions(() => {
this.props.actions.resetStateWhenRefresh();
this.props.actions.fetchFloor();
});
}
... ...
... ... @@ -133,8 +133,6 @@ export function fetchFloor() {
return;
}
dispatch(resetStateWhenRefresh(channelStr));
dispatch(fetchFloorRequest(channelStr));
let cached = currentChannelData.cached;
... ... @@ -214,10 +212,9 @@ export function fetchBoyGirlFavoriteList() {
let channelStr = channelTransfer.number2String(channel);
let currentChannelData = home[channelStr];
if (currentChannelData.favorite.isFetching
if (currentChannelData.favorite.get('isFetching')
|| currentChannelData.endReached
|| (currentChannelData.list.size == 0 && currentChannelData.cached.get('list').size == 0)) {
return;
}
... ... @@ -281,7 +278,7 @@ export function fetchKidsFavoriteList() {
let channelStr = channelTransfer.number2String(channel);
let {kid} = home;
if (kid.favorite.isFetching
if (kid.favorite.get('isFetching')
|| kid.endReached
|| (kid.list.size == 0 && kid.cached.get('list').size == 0)) {
... ... @@ -392,6 +389,10 @@ export function fetchBottomBanner() {
let channelStr = channelTransfer.number2String(channel);
let currentChannelData = home[channelStr];
if (currentChannelData.bottomBanner.get('list').size > 0) {
return;
}
dispatch(fetchBottomBannerRequest(channelStr));
let fetchBanner = (fromPage, contentCode) => {
... ... @@ -718,11 +719,15 @@ export function fetchFloorFailure(error, channelStr) {
}
//下拉刷新时重置商品列表数据状态
export function resetStateWhenRefresh(channelStr) {
return {
type: HOME_RESET_STATE_WHEN_REFRESH,
payload: channelStr,
};
export function resetStateWhenRefresh() {
return (dispatch, getState) => {
let {app, home} = getState();
let channelStr = channelTransfer.number2String(app.channel);
dispatch({
type: HOME_RESET_STATE_WHEN_REFRESH,
payload: channelStr,
});
};
}
//下拉刷新时接口返回数据没有变动,无需刷新
... ...