Authored by 盖剑秋

Optimize code for guang list. reviewed by Boss Mei.

@@ -44,9 +44,11 @@ export default class List extends Component { @@ -44,9 +44,11 @@ export default class List extends Component {
44 44
45 renderRow(rowData,sectionID,rowID) { 45 renderRow(rowData,sectionID,rowID) {
46 let type = this.props.data.get('type'); 46 let type = this.props.data.get('type');
  47 + let categoryMap = this.props.data.get('categoryMap').toJS();
47 return( 48 return(
48 <ListCell 49 <ListCell
49 resource={rowData} 50 resource={rowData}
  51 + categoryMap={categoryMap}
50 type={type} 52 type={type}
51 rowID={rowID} 53 rowID={rowID}
52 onPressCell={this.props.onPressCell} 54 onPressCell={this.props.onPressCell}
@@ -63,9 +65,9 @@ export default class List extends Component { @@ -63,9 +65,9 @@ export default class List extends Component {
63 let isFetching = articles.get('isFetching'); 65 let isFetching = articles.get('isFetching');
64 66
65 if (!list || !list.size) { 67 if (!list || !list.size) {
66 - return <LoadingIndicator 68 + return (<LoadingIndicator
67 isVisible={isFetching} 69 isVisible={isFetching}
68 - />; 70 + />);
69 } 71 }
70 72
71 return ( 73 return (
@@ -58,14 +58,7 @@ export default class List extends Component { @@ -58,14 +58,7 @@ export default class List extends Component {
58 } 58 }
59 59
60 render() { 60 render() {
61 - let tagMap = {  
62 - '潮品' :require('../../image/chaopin_icon.png'),  
63 - '话题' :require('../../image/huati_icon.png'),  
64 - '潮人' :require('../../image/chaoren_icon.png'),  
65 - '搭配' :require('../../image/dapei_icon.png'),  
66 - '小贴士' :require('../../image/xiaotieshi_icon.png'),  
67 - '专题' :require('../../image/zuanti_icon.png')  
68 - }; 61 + let tagMap = this.props.categoryMap;
69 let { 62 let {
70 browse, 63 browse,
71 category_name, 64 category_name,
@@ -22,6 +22,14 @@ let InitialState = Record({ @@ -22,6 +22,14 @@ let InitialState = Record({
22 total: 0, 22 total: 0,
23 endReached: false, 23 endReached: false,
24 })), 24 })),
  25 + categoryMap: new (Record({
  26 + '潮品' :require('../../image/chaopin_icon.png'),
  27 + '话题' :require('../../image/huati_icon.png'),
  28 + '潮人' :require('../../image/chaoren_icon.png'),
  29 + '搭配' :require('../../image/dapei_icon.png'),
  30 + '小贴士' :require('../../image/xiaotieshi_icon.png'),
  31 + '专题' :require('../../image/zuanti_icon.png')
  32 + })),
25 }); 33 });
26 34
27 export default InitialState; 35 export default InitialState;