...
|
...
|
@@ -24,6 +24,7 @@ export default class SeckillTimeListView extends Component { |
|
|
this._renderSeparator = this._renderSeparator.bind(this);
|
|
|
this._scrollToFocusActivity = this._scrollToFocusActivity.bind(this);
|
|
|
this._caculateTimerState = this._caculateTimerState.bind(this);
|
|
|
this._searchRightNowStartActivity = this._searchRightNowStartActivity.bind(this);
|
|
|
|
|
|
this.dataSource = new ListView.DataSource({
|
|
|
rowHasChanged: (r1, r2) => r1.key != r2.key,
|
...
|
...
|
@@ -47,6 +48,21 @@ export default class SeckillTimeListView extends Component { |
|
|
this.listView && this.listView.scrollTo({x: scrollX, y: 0, animated: true});
|
|
|
}
|
|
|
}
|
|
|
_searchRightNowStartActivity() {
|
|
|
this.secKillProductVoList.forEach((activityItem, i) => {
|
|
|
if (activityItem.has('wait')) {
|
|
|
let nowTime = Date.parse(new Date()) / 1000 + diffTime;
|
|
|
let startTime = activityItem.get('startTime')/1000;
|
|
|
let offsetTime = startTime - nowTime;
|
|
|
if (offsetTime < 0) {
|
|
|
activityItem.focus = true;
|
|
|
this.curFocusActivity= activityItem;
|
|
|
this._scrollToFocusActivity();
|
|
|
this.props.onFocusToCurStartedActivity && this.props.onFocusToCurStartedActivity(activityItem);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
_caculateTimerState() {
|
|
|
if (this.curFocusActivity.get('index') == this.secKillProductVoList.length - 1 && this.curFocusActivity.has('now')) {
|
...
|
...
|
@@ -60,6 +76,7 @@ export default class SeckillTimeListView extends Component { |
|
|
this.props.onRefresh && this.props.onRefresh();
|
|
|
}
|
|
|
} else {
|
|
|
|
|
|
let nextActivity = this.secKillProductVoList[this.curFocusActivity.get('index') + 1];
|
|
|
let nowTime = Date.parse(new Date()) / 1000 + diffTime;
|
|
|
let time = this.curFocusActivity.has('now') ? nextActivity.get('startTime')/1000: this.curFocusActivity.get('startTime') / 1000;
|
...
|
...
|
@@ -106,6 +123,7 @@ export default class SeckillTimeListView extends Component { |
|
|
return;
|
|
|
}
|
|
|
this._caculateTimerState();
|
|
|
this._searchRightNowStartActivity();
|
|
|
|
|
|
}.bind(this), 1000);
|
|
|
|
...
|
...
|
|