...
|
...
|
@@ -14,6 +14,13 @@ import { |
|
|
|
|
|
import {Map} from 'immutable';
|
|
|
import LoadingIndicator from '../../../common/components/LoadingIndicator';
|
|
|
import OutletSwiper from './OutletSwiper';
|
|
|
import OutletSingleImage from './OutletSingleImage';
|
|
|
import OutletDoubleImage from './OutletDoubleImage';
|
|
|
import OutletThreeImage from './OutletThreeImage';
|
|
|
import OutletRecommendFive from './OutletRecommendFive';
|
|
|
import ProductFliter from './ProductFliter';
|
|
|
|
|
|
|
|
|
export default class OutletPageListView extends Component {
|
|
|
constructor(props) {
|
...
|
...
|
@@ -32,15 +39,43 @@ export default class OutletPageListView extends Component { |
|
|
resource,
|
|
|
} = this.props;
|
|
|
|
|
|
this.props.getOutletHomeResource && this.props.getOutletHomeResource(resource.content_code);
|
|
|
this.props.getOutletHomeResource && this.props.getOutletHomeResource(resource.get('content_code'));
|
|
|
}
|
|
|
|
|
|
|
|
|
renderSectionHeader(sectionData, sectionID) {
|
|
|
if (sectionID == 'categoryNavigationList') {
|
|
|
return (
|
|
|
<ProductFliter
|
|
|
resource={categoryNavigationList}
|
|
|
onPressFilter={this.props.onPressFilter}
|
|
|
/>
|
|
|
);
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
renderRow(rowData, sectionID, rowID, highlightRow) {
|
|
|
console.log(rowData.toJS());
|
|
|
if (sectionID == 'outletHomeReource') {
|
|
|
if (rowData.get('template_name') == 'NL2R') {
|
|
|
return(<OutletThreeImage resource={rowData} onPressProduct={this.props.onPressProduct}/>);
|
|
|
}else if (rowData.get('template_name') == 'focus') {
|
|
|
return(<OutletSwiper resource={rowData} onPressProduct={this.props.onPressProduct}/>);
|
|
|
}else if (rowData.get('template_name') == 'single_image') {
|
|
|
return(<OutletSingleImage resource={rowData} onPressProduct={this.props.onPressProduct}/>);
|
|
|
}else if (rowData.get('template_name') == 'double_image') {
|
|
|
return(<OutletDoubleImage resource={rowData} onPressProduct={this.props.onPressProduct}/>);
|
|
|
}else if (rowData.get('template_name') == 'recommend_content_five') {
|
|
|
return(<OutletRecommendFive resource={rowData} onPressProduct={this.props.onPressProduct}/>);
|
|
|
}else if (rowData.get('template_name') == 'app_hot_brands') {
|
|
|
return(<OutletRecommendFive resource={rowData} onPressProduct={this.props.onPressProduct}/>);
|
|
|
}else if (rowData.get('template_name') == '文字广告') {
|
|
|
// return(<TripleImage resource={rowData} onPressProduct={this.props.onPressProduct}/>);
|
|
|
}
|
|
|
}else if (sectionID == 'categoryNavigationList') {
|
|
|
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -50,35 +85,63 @@ export default class OutletPageListView extends Component { |
|
|
resource,
|
|
|
} = this.props;
|
|
|
|
|
|
let isFetching = false;
|
|
|
|
|
|
if (!resource) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
let isFetching = resource.get('isFetching')?resource.get('isFetching'):false;
|
|
|
let honeResource = resource.get('honeResource');
|
|
|
let error = resource.get('error');
|
|
|
let list;
|
|
|
|
|
|
if (honeResource) {
|
|
|
list = honeResource.get('list');
|
|
|
}
|
|
|
|
|
|
if (list) {
|
|
|
list.map((item, i) => {
|
|
|
let template_name = item.get('template_name');
|
|
|
if (template_name == 'categoryNavigation') {
|
|
|
categoryNavigationList = item.get('data');
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
let dataSource = {
|
|
|
outletHomeReource: honeResource?list.toArray():[],
|
|
|
categoryNavigationList: categoryNavigationList?categoryNavigationList.toArray():[],
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
<View style={styles.container}>
|
|
|
<ListView
|
|
|
ref='OutletPageListView'
|
|
|
contentContainerStyle={styles.contentContainerStyle}
|
|
|
enableEmptySections={true}
|
|
|
dataSource={this.dataSource.cloneWithRowsAndSections([])}
|
|
|
dataSource={this.dataSource.cloneWithRowsAndSections(dataSource)}
|
|
|
renderRow={this.renderRow}
|
|
|
renderSectionHeader={this.renderSectionHeader}
|
|
|
/>
|
|
|
<LoadingIndicator
|
|
|
isVisible={isFetching}
|
|
|
/>
|
|
|
</View>
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
let {width, height} = Dimensions.get('window');
|
|
|
|
|
|
let categoryNavigationList;
|
|
|
let styles = StyleSheet.create({
|
|
|
container: {
|
|
|
flex: 1,
|
|
|
backgroundColor: 'red',
|
|
|
backgroundColor: 'white',
|
|
|
},
|
|
|
contentContainerStyle:{
|
|
|
contentContainerStyle: {
|
|
|
flexDirection: 'row',
|
|
|
flexWrap: 'wrap',
|
|
|
},
|
...
|
...
|
|