|
@@ -20,10 +20,6 @@ export default class Item extends Component {
|
20
|
20
|
componentWillMount(){
|
21
|
21
|
this.updateLeftTime(this.props.data.startDate, this.props.data.endDate)
|
22
|
22
|
}
|
23
|
|
- // 活动状态
|
24
|
|
- const ActBeforeStart = 0;
|
25
|
|
- const ActInProcess = 1;
|
26
|
|
- const ActFinished = 2;
|
27
|
23
|
|
28
|
24
|
updateLeftTime(startDate, endDate) {
|
29
|
25
|
const st = dayjs(startDate).valueOf()
|
|
@@ -37,20 +33,20 @@ export default class Item extends Component {
|
37
|
33
|
// 活动未开始
|
38
|
34
|
this.setState({
|
39
|
35
|
leftTime: st - nw,
|
40
|
|
- actState: ActBeforeStart,
|
|
36
|
+ actState: 0,
|
41
|
37
|
})
|
42
|
38
|
} else if (ed > nw) {
|
43
|
39
|
// 活动未结束
|
44
|
40
|
this.setState({
|
45
|
41
|
leftTime: ed - nw,
|
46
|
|
- actState: ActInProcess,
|
|
42
|
+ actState: 1,
|
47
|
43
|
})
|
48
|
44
|
} else {
|
49
|
45
|
// 活动已结束
|
50
|
46
|
this.clearTicker()
|
51
|
47
|
this.setState({
|
52
|
48
|
leftTime: 0,
|
53
|
|
- actState: ActFinished,
|
|
49
|
+ actState: 2,
|
54
|
50
|
})
|
55
|
51
|
}
|
56
|
52
|
}, 1000)
|
|
@@ -76,7 +72,7 @@ export default class Item extends Component {
|
76
|
72
|
<Image className="pic" src={data.img} ></Image>
|
77
|
73
|
<View className="title">{data.title} {data.status}</View>
|
78
|
74
|
{!data.verification&&
|
79
|
|
- <View className="time">{this.state.actState === ActInProcess ? '距活动结束:' : '活动已结束'}<Text className="count-time">{this.state.actState != ActFinished ? this.formateLeftTime() : ''}</Text></View>
|
|
75
|
+ <View className="time">{this.state.actState === 1 ? '距活动结束:' : '活动已结束'}<Text className="count-time">{this.state.actState != 2 ? this.formateLeftTime() : ''}</Text></View>
|
80
|
76
|
}
|
81
|
77
|
{data.verification&&
|
82
|
78
|
<View className="hexiaoma">核销码:{data.verification}</View>
|