...
|
...
|
@@ -26,6 +26,7 @@ export default class Seckill extends Component { |
|
|
|
|
|
this.renderRow = this.renderRow.bind(this);
|
|
|
this.renderSectionHeader = this.renderSectionHeader.bind(this);
|
|
|
this._renderSeparator = this._renderSeparator.bind(this);
|
|
|
this.dataSource = new ListView.DataSource({
|
|
|
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
|
|
|
sectionHeaderHasChanged: (s1, s2) => !Immutable.is(s1, s2),
|
...
|
...
|
@@ -53,10 +54,9 @@ export default class Seckill extends Component { |
|
|
componentWillReceiveProps(nextProps) {
|
|
|
if (nextProps.tipMessage && nextProps.tipMessage !== '') {
|
|
|
this._showToast && this._showToast(nextProps.tipMessage);
|
|
|
console.log(nextProps.tipMessage);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
_showToast = (message) => {
|
|
|
if (this.toast) {
|
|
|
return;
|
...
|
...
|
@@ -93,24 +93,25 @@ export default class Seckill extends Component { |
|
|
}
|
|
|
}
|
|
|
|
|
|
renderRow(rowData, sectionID, rowID, highlightRow) {
|
|
|
if (Array.isArray(rowData) && rowData.length == 0 && !this.isFetching) {
|
|
|
switch (rowID) {
|
|
|
case 'ActivityProductList':
|
|
|
return (
|
|
|
<View style={styles.seckillEndView}>
|
|
|
<Text style={{fontSize:16}}>来晚啦~秒杀已结束</Text>
|
|
|
</View>
|
|
|
);
|
|
|
default:
|
|
|
|
|
|
}
|
|
|
_renderSeparator(sectionID, rowID, adjacentRowHighlighted) {
|
|
|
return (
|
|
|
<View key={'sep' + rowID} style={styles.separator}>
|
|
|
</View>
|
|
|
);
|
|
|
}
|
|
|
|
|
|
renderRow(rowData, sectionID, rowID, highlightRow) {
|
|
|
if (this.queryActivityInfo.secKillProductVoList.size == 0 && !this.isFetching) {
|
|
|
return (
|
|
|
<View style={styles.seckillEndView}>
|
|
|
<Text style={{fontSize:16}}>来晚啦~秒杀已结束</Text>
|
|
|
</View>
|
|
|
);
|
|
|
}
|
|
|
if (sectionID == 'ActivityProductList') {
|
|
|
return(
|
|
|
<ProductListView
|
|
|
resource={rowData}
|
|
|
rowData={rowData}
|
|
|
onPressProductItem={this.props.onPressProductItem}
|
|
|
onPressRemindBtn={this.props.onPressRemindBtn}
|
|
|
tipMessage={this.tipMessage}
|
...
|
...
|
@@ -138,7 +139,7 @@ export default class Seckill extends Component { |
|
|
this.tipMessage = tipMessage;
|
|
|
diff = localServerTimeDiff;
|
|
|
let dataSource = {
|
|
|
ActivityProductList: [queryProductList ? queryProductList : []],
|
|
|
ActivityProductList: queryProductList ? queryProductList : [],
|
|
|
};
|
|
|
let isPullToRefresh = ptr && isFetching;
|
|
|
return (
|
...
|
...
|
@@ -159,6 +160,7 @@ export default class Seckill extends Component { |
|
|
this.props.onRefresh && this.props.onRefresh();
|
|
|
}}
|
|
|
renderSectionHeader={this.renderSectionHeader}
|
|
|
renderSeparator={this._renderSeparator}
|
|
|
renderFooter={()=>{
|
|
|
return <View style={styles.descriptionContainer}>
|
|
|
<Text style={styles.descriptionText}>秒杀活动说明</Text>
|
...
|
...
|
@@ -188,6 +190,7 @@ export default class Seckill extends Component { |
|
|
dataSource={this.dataSource.cloneWithRowsAndSections(dataSource)}
|
|
|
renderRow={this.renderRow}
|
|
|
enablePullToRefresh={true}
|
|
|
renderSeparator={this._renderSeparator}
|
|
|
isOnPullToRefresh={isPullToRefresh}
|
|
|
onRefreshData={() => {
|
|
|
//强制刷新数据
|
...
|
...
|
@@ -230,7 +233,7 @@ let styles = StyleSheet.create({ |
|
|
|
|
|
},
|
|
|
contentContainer:{
|
|
|
flexDirection: 'row',
|
|
|
flexDirection: 'column',
|
|
|
flexWrap: 'wrap',
|
|
|
},
|
|
|
seckillEndView: {
|
...
|
...
|
@@ -251,7 +254,7 @@ let styles = StyleSheet.create({ |
|
|
borderWidth: 0.5,
|
|
|
},
|
|
|
descriptionContainer: {
|
|
|
marginTop: -40,
|
|
|
marginTop: 10,
|
|
|
marginBottom: 50,
|
|
|
marginLeft: 15,
|
|
|
},
|
...
|
...
|
@@ -261,4 +264,9 @@ let styles = StyleSheet.create({ |
|
|
width: width - 20,
|
|
|
|
|
|
},
|
|
|
separator: {
|
|
|
width: width,
|
|
|
height: 1.5,
|
|
|
backgroundColor: '#e5e5e5',
|
|
|
},
|
|
|
}); |
...
|
...
|
|