data () {
return {
examinationOpeningTime: '',
examinationClosingTime: '',
timeRemain: 0,
day: 0,
hour: 0,
minute: 0,
timer: null
};
watch: {
timeRemain (newVal) {
if (newVal) {
let day = parseInt(newVal / (60 * 60 * 24 * 1000));
let hour = parseInt((newVal - day * 60 * 60 * 24 * 1000) / (60 * 60 * 1000));
let minute = parseInt((newVal - day * 60 * 60 * 24 * 1000 - hour * 60 * 60 * 1000) / (60 * 1000));
this.day = day;
this.hour = hour;
this.minute = minute;
}
}
},
beforeDestroy() {
clearInterval(this.timer);
},
methods:{
setCountDown () {
this.timer = setInterval(() => {
this.timeRemain -= 60 * 1000;
if (this.timeRemain <= 0) {
clearInterval(this.timer);
this.timeRemain = 0;
this.personCondition = 2;
this.statusUrl = require('../../assets/images/examination/image4.png');
}
}, 60 * 1000);
},
}