Authored by 张丽霞

数据为空的处理,review by 孙凯

... ... @@ -34,6 +34,7 @@ export default class Seckill extends Component {
this.isFetching = false;
this.tipMessage = '';
this.queryActivityInfo = Immutable.fromJS({});
this.firstLaunch = true;
}
... ... @@ -52,6 +53,7 @@ export default class Seckill extends Component {
}
componentWillReceiveProps(nextProps) {
this.firstLaunch = false;
if (nextProps.tipMessage && nextProps.tipMessage !== '') {
this._showToast && this._showToast(nextProps.tipMessage);
}
... ... @@ -101,14 +103,15 @@ export default class Seckill extends Component {
}
renderRow(rowData, sectionID, rowID, highlightRow) {
if (this.queryActivityInfo.secKillProductVoList.size == 0 && !this.isFetching) {
return (
if (this.queryActivityInfo.secKillProductVoList.size == 0 && !this.isFetching && !this.firstLaunch)
{
return(
<View style={styles.seckillEndView}>
<Text style={{fontSize:16}}>来晚啦~秒杀已结束</Text>
<Text style={{fontSize:16}}>来晚啦~秒杀已结束</Text>
</View>
);
}
if (sectionID == 'ActivityProductList') {
if (sectionID == 'ActivityProductList' && this.queryActivityInfo.secKillProductVoList.size) {
return(
<ProductListView
rowData={rowData}
... ... @@ -118,7 +121,6 @@ export default class Seckill extends Component {
/>
);
}
return null;
}
... ... @@ -139,7 +141,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 (
... ...