...
|
...
|
@@ -41,18 +41,10 @@ export default class SeckillTimeListView extends Component { |
|
|
//focus
|
|
|
if (this.secKillProductVoList.length >= 1) {
|
|
|
let listLength = this.secKillProductVoList.length;
|
|
|
let curFocusIndex = 0;
|
|
|
let scrollX = 0;
|
|
|
this.secKillProductVoList.forEach((activityItem, i) => {
|
|
|
if (activityItem.get('activityId') === this.curFocusActivity.get('activityId')) {
|
|
|
curFocusIndex = i;
|
|
|
}
|
|
|
});
|
|
|
// if (curFocusIndex > 1 && curFocusIndex < listLength-2) {
|
|
|
scrollX = (curFocusIndex - 1) * rowContainerWidth;
|
|
|
this.listView && this.listView.scrollTo({x: scrollX, y: 0, animated: true});
|
|
|
scrollX = (this.curFocusIndex - 1) * (rowContainerWidth + separatorWidth);
|
|
|
this.listView && this.listView.scrollTo({x: scrollX, y: 0, animated: true});
|
|
|
|
|
|
// }
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -88,6 +80,7 @@ export default class SeckillTimeListView extends Component { |
|
|
nextActivity = nextActivity.toJS();
|
|
|
nextActivity.focus = true;
|
|
|
this.curFocusActivity= Immutable.fromJS(nextActivity);
|
|
|
this.curFocusIndex = this.curFocusIndex + 1;
|
|
|
this._scrollToFocusActivity();
|
|
|
this.props.onFocusToCurStartedActivity && this.props.onFocusToCurStartedActivity(nextActivity);
|
|
|
|
...
|
...
|
@@ -118,19 +111,6 @@ export default class SeckillTimeListView extends Component { |
|
|
});
|
|
|
}
|
|
|
|
|
|
let jumpToTimeoutActivity = () => {
|
|
|
this.secKillProductVoList.forEach((activityItem, i) => {
|
|
|
let nowTime = Date.parse(new Date()) / 1000 + diffTime;
|
|
|
let startTime = activityItem.get('startTime') / 1000;
|
|
|
let offsetTime = nowTime - startTime;
|
|
|
if (activityItem.get('focus') == false && Math.abs(offsetTime) <= 2) {
|
|
|
this.curFocusActivity= activityItem;
|
|
|
this.curFocusIndex = i;
|
|
|
this._scrollToFocusActivity();
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
this.timer = setInterval(function () {
|
|
|
if (!this.curFocusActivity && this.curFocusActivity.size > 0 && !this.curFocusActivity.has('over')) {
|
|
|
return;
|
...
|
...
|
@@ -170,6 +150,7 @@ export default class SeckillTimeListView extends Component { |
|
|
|
|
|
rowData.focus = true;
|
|
|
this.curFocusActivity = Immutable.fromJS(rowData);//rowData;
|
|
|
this.curFocusIndex = rowID;
|
|
|
this._scrollToFocusActivity();
|
|
|
this.props.onPressTimeItem && this.props.onPressTimeItem(rowData);
|
|
|
}}>
|
...
|
...
|
@@ -244,7 +225,7 @@ export default class SeckillTimeListView extends Component { |
|
|
} = this.props;
|
|
|
diffTime = diff;
|
|
|
this.secKillProductVoList = resource;
|
|
|
backgroundWidth = Math.max(rowContainerWidth * (resource.length - 1) + rowContainerFocusWidth, width);
|
|
|
backgroundWidth = Math.max((rowContainerWidth + separatorWidth) * (resource.length - 1) + rowContainerFocusWidth, width);
|
|
|
|
|
|
return (
|
|
|
<View style={[styles.container]}>
|
...
|
...
|
@@ -271,6 +252,7 @@ let backgroundHeight = 61; |
|
|
let diffTime;
|
|
|
let rowContainerWidth = Math.ceil((223 * width) / 750);
|
|
|
let rowContainerFocusWidth = Math.ceil((294 * width) / 750);
|
|
|
let separatorWidth = 1.5;
|
|
|
|
|
|
let styles = StyleSheet.create({
|
|
|
container: {
|
...
|
...
|
@@ -331,7 +313,7 @@ let styles = StyleSheet.create({ |
|
|
top: 10,
|
|
|
},
|
|
|
separator: {
|
|
|
width: 1.5,
|
|
|
width: separatorWidth,
|
|
|
top: 11,
|
|
|
height: backgroundHeight - 22,
|
|
|
backgroundColor: '#dfe3e2',
|
...
|
...
|
|