...
|
...
|
@@ -37,6 +37,7 @@ export default class RedBrand extends Component { |
|
|
this.renderSectionHeader = this.renderSectionHeader.bind(this);
|
|
|
this.renderRow = this.renderRow.bind(this);
|
|
|
this._onPressProductFilter = this._onPressProductFilter.bind(this);
|
|
|
this._onPressFilter = this._onPressFilter.bind(this);
|
|
|
this._onPressLaunchProfile = this._onPressLaunchProfile.bind(this);
|
|
|
|
|
|
this.dataSource = new ListView.DataSource({
|
...
|
...
|
@@ -51,17 +52,22 @@ export default class RedBrand extends Component { |
|
|
}
|
|
|
|
|
|
_onPressProductFilter(value){
|
|
|
|
|
|
this.refs.redBrandList && this.refs.redBrandList.scrollTo({x: 0, y: yPosition, animated: false});
|
|
|
|
|
|
this.props.onPressProductFilter && this.props.onPressProductFilter(value);
|
|
|
}
|
|
|
|
|
|
_onPressFilter(value){
|
|
|
this.refs.redBrandList && this.refs.redBrandList.scrollTo({x: 0, y: 0, animated: false});
|
|
|
this.props.onPressProductFilter && this.props.onPressStoreFilter(value);
|
|
|
}
|
|
|
|
|
|
renderSectionHeader(sectionData, sectionID) {
|
|
|
|
|
|
let {fliter} = this.props;
|
|
|
|
|
|
switch(sectionID) {
|
|
|
case 'RedBrandStoreFilter': {
|
|
|
return(<RedBrandStoreFilter resource={'launchProfile'} onPressStoreFilter={this.props.onPressStoreFilter}/>);
|
|
|
case 'brandReource': {
|
|
|
return(<RedBrandStoreFilter resource={fliter} onPressStoreFilter={this._onPressFilter}/>);
|
|
|
}
|
|
|
case 'productList': {
|
|
|
let noFilterValue = true;
|
...
|
...
|
@@ -76,6 +82,7 @@ export default class RedBrand extends Component { |
|
|
}
|
|
|
return (
|
|
|
<View style={styles.brandFilterContainer} onLayout={(evt) => {yPosition = evt.nativeEvent.layout.y;}}>
|
|
|
<RedBrandStoreFilter resource={fliter} onPressStoreFilter={this._onPressFilter}/>
|
|
|
<BrandProductFilter
|
|
|
onPressFilter={this._onPressProductFilter}
|
|
|
lastSelected={this.props.productList.isFilter}
|
...
|
...
|
@@ -95,10 +102,10 @@ export default class RedBrand extends Component { |
|
|
if (sectionID == 'ShopBanner') {
|
|
|
let {launchProfile} = this.props;
|
|
|
return(<Header resource={rowData} launchProfile={launchProfile} onPressLaunchProfile={this._onPressLaunchProfile} onPressCollection={this.props.onPressCollection} onPressLink={this.props.onPressLink}/>);
|
|
|
} else if (sectionID == 'coupon') {
|
|
|
return(<CouponCell resource={rowData} onPressCoupon={this.props.onPressCoupon}/>);
|
|
|
} else if(sectionID == 'brandReource'){
|
|
|
if (rowData.get('module_type') == 'CarouselImage') {
|
|
|
} else if(sectionID == 'brandReource'){
|
|
|
if (rowData.get('module_type') == 'coupon') {
|
|
|
return(<CouponCell resource={rowData} onPressCoupon={this.props.onPressCoupon}/>);
|
|
|
}else if (rowData.get('module_type') == 'CarouselImage') {
|
|
|
return(<RedBrandSwiper resource={rowData} onPressSlideItem={this.props.onPressProduct}/>);
|
|
|
}else if (rowData.get('module_type') == 'Title') {
|
|
|
return(<Title resource={rowData} onPressProduct={this.props.onPressProduct}/>);
|
...
|
...
|
@@ -144,19 +151,18 @@ export default class RedBrand extends Component { |
|
|
|
|
|
let isFetching = (productList.list.size > 0 && productList.isFetching && productList.currentPage == 0);
|
|
|
videoCounts = shopsdecorator.counts;
|
|
|
let resList = shopsdecorator.modules?shopsdecorator.modules.toArray():[];
|
|
|
coupon?resList.unshift(coupon):null;
|
|
|
|
|
|
let dataSource = null;
|
|
|
if (fliter == 0) {
|
|
|
dataSource = {
|
|
|
ShopBanner: [shopIntro],
|
|
|
RedBrandStoreFilter: [],
|
|
|
coupon: [coupon],
|
|
|
brandReource: shopsdecorator.modules.toArray(),
|
|
|
brandReource: resList,
|
|
|
};
|
|
|
} else if (fliter == 1) {
|
|
|
dataSource = {
|
|
|
ShopBanner: [shopIntro],
|
|
|
RedBrandStoreFilter: [],
|
|
|
productList: productList.list.toArray(),
|
|
|
};
|
|
|
}
|
...
|
...
|
@@ -250,10 +256,7 @@ let styles = StyleSheet.create({ |
|
|
brandFilterContainer: {
|
|
|
marginLeft: -1,
|
|
|
width: width + 2,
|
|
|
height: 40,
|
|
|
borderTopColor: '#e5e5e5',
|
|
|
borderBottomColor: '#e5e5e5',
|
|
|
borderWidth: 0.5,
|
|
|
height: 84,
|
|
|
},
|
|
|
placeholder: {
|
|
|
width,
|
...
|
...
|
|