Commit bab0b025 by FE

Merge branch '00-formal' into dev

parents 5fe5271a 07774ad3
......@@ -11,11 +11,23 @@ class CourseItem extends Component {
componentDidMount() {
const { time } = this.props;
this.startCountDown(time);
}
componentWillReceiveProps(nextProps) {
const { time: newTime } = nextProps
const { time: oldTime } = this.props;
if(oldTime != newTime) {
this.startCountDown(newTime);
}
}
startCountDown = (time) => {
if(time) {
let date = time * 1000,
hours = 0,
minutes = 0,
seconds = 0;
let date = time * 1000,
hours = 0,
minutes = 0,
seconds = 0;
setInterval(() => {
date -= 1000
hours = `${parseInt(date / (60 * 60 * 1000))}`.padStart(2, 0);
......
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