Authored by 于良

首页优化 review by days

@@ -163,6 +163,7 @@ class HomeContainer extends Component { @@ -163,6 +163,7 @@ class HomeContainer extends Component {
163 } 163 }
164 onRefresh() { 164 onRefresh() {
165 InteractionManager.runAfterInteractions(() => { 165 InteractionManager.runAfterInteractions(() => {
  166 + this.props.actions.resetStateWhenRefresh();
166 this.props.actions.fetchFloor(); 167 this.props.actions.fetchFloor();
167 }); 168 });
168 } 169 }
@@ -133,8 +133,6 @@ export function fetchFloor() { @@ -133,8 +133,6 @@ export function fetchFloor() {
133 return; 133 return;
134 } 134 }
135 135
136 - dispatch(resetStateWhenRefresh(channelStr));  
137 -  
138 dispatch(fetchFloorRequest(channelStr)); 136 dispatch(fetchFloorRequest(channelStr));
139 let cached = currentChannelData.cached; 137 let cached = currentChannelData.cached;
140 138
@@ -214,10 +212,9 @@ export function fetchBoyGirlFavoriteList() { @@ -214,10 +212,9 @@ export function fetchBoyGirlFavoriteList() {
214 let channelStr = channelTransfer.number2String(channel); 212 let channelStr = channelTransfer.number2String(channel);
215 let currentChannelData = home[channelStr]; 213 let currentChannelData = home[channelStr];
216 214
217 - if (currentChannelData.favorite.isFetching 215 + if (currentChannelData.favorite.get('isFetching')
218 || currentChannelData.endReached 216 || currentChannelData.endReached
219 || (currentChannelData.list.size == 0 && currentChannelData.cached.get('list').size == 0)) { 217 || (currentChannelData.list.size == 0 && currentChannelData.cached.get('list').size == 0)) {
220 -  
221 return; 218 return;
222 } 219 }
223 220
@@ -281,7 +278,7 @@ export function fetchKidsFavoriteList() { @@ -281,7 +278,7 @@ export function fetchKidsFavoriteList() {
281 let channelStr = channelTransfer.number2String(channel); 278 let channelStr = channelTransfer.number2String(channel);
282 279
283 let {kid} = home; 280 let {kid} = home;
284 - if (kid.favorite.isFetching 281 + if (kid.favorite.get('isFetching')
285 || kid.endReached 282 || kid.endReached
286 || (kid.list.size == 0 && kid.cached.get('list').size == 0)) { 283 || (kid.list.size == 0 && kid.cached.get('list').size == 0)) {
287 284
@@ -392,6 +389,10 @@ export function fetchBottomBanner() { @@ -392,6 +389,10 @@ export function fetchBottomBanner() {
392 let channelStr = channelTransfer.number2String(channel); 389 let channelStr = channelTransfer.number2String(channel);
393 let currentChannelData = home[channelStr]; 390 let currentChannelData = home[channelStr];
394 391
  392 + if (currentChannelData.bottomBanner.get('list').size > 0) {
  393 + return;
  394 + }
  395 +
395 dispatch(fetchBottomBannerRequest(channelStr)); 396 dispatch(fetchBottomBannerRequest(channelStr));
396 397
397 let fetchBanner = (fromPage, contentCode) => { 398 let fetchBanner = (fromPage, contentCode) => {
@@ -718,10 +719,14 @@ export function fetchFloorFailure(error, channelStr) { @@ -718,10 +719,14 @@ export function fetchFloorFailure(error, channelStr) {
718 } 719 }
719 720
720 //下拉刷新时重置商品列表数据状态 721 //下拉刷新时重置商品列表数据状态
721 -export function resetStateWhenRefresh(channelStr) {  
722 - return { 722 +export function resetStateWhenRefresh() {
  723 + return (dispatch, getState) => {
  724 + let {app, home} = getState();
  725 + let channelStr = channelTransfer.number2String(app.channel);
  726 + dispatch({
723 type: HOME_RESET_STATE_WHEN_REFRESH, 727 type: HOME_RESET_STATE_WHEN_REFRESH,
724 payload: channelStr, 728 payload: channelStr,
  729 + });
725 }; 730 };
726 } 731 }
727 732