Commit dcddddc4 by zhanghaozhe

周年庆

parent 8b1e6bde
......@@ -532,21 +532,21 @@ class Anniversary2020 extends Component {
}
setupCountDown = (totalSeconds) => {
this.countDownTimer = setTimeout(() => {
totalSeconds--
const d = Math.floor(totalSeconds / 60 / 60 / 24)
const h = Math.floor(totalSeconds / 60 / 60) % 24
const m = Math.floor(totalSeconds / 60) % 60
this.setState({
countDown: `${d}${h}${m}分`,
}, () => {
if (totalSeconds > 0) {
totalSeconds -= 60
const d = Math.floor(totalSeconds / 60 / 60 / 24)
const h = Math.floor(totalSeconds / 60 / 60) % 24
const m = Math.floor(totalSeconds / 60) % 60
this.setState({
countDown: `${d}${h}${m}分`,
}, () => {
if (totalSeconds > 0) {
this.countDownTimer = setTimeout(() => {
this.setupCountDown(totalSeconds)
} else {
this.getActivityStage()
}
});
}, 1000 * 60)
}, 1000 * 60)
} else {
this.getActivityStage()
}
});
}
render() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment