Commit d3dfc84f authored by yaya's avatar yaya

feat: 倒计时优化

parent 20b42351
......@@ -53,7 +53,7 @@ export default {
if (!this.timer) {
this.timer = setInterval(() => {
const deltaTime = this.last - (Date.now())
if (deltaTime > 60 * 60 * 1000) {
if (deltaTime > 0) {
this.formatTime = this.formatDuring(deltaTime)
// const newTime = formatTime.split(':')
// if (newTime.length >= 3) {
......@@ -63,9 +63,12 @@ export default {
// this.zzz = null
// // this.showMS = false;
// }
} else if (deltaTime > 0) {
this.ticker.clearInterval(this.timer)
this.timer = null
} else {
this.formatTime = '已超时'
this.$emit('finishCountDown')
if (this.timer) {
clearTimeout(this.timer)
}
}
}, 1000)
}
......@@ -94,8 +97,10 @@ export default {
// 得到秒数
const seconds = parseInt((mss % (1000 * 60)) / 1000)
const str2 = seconds < 10 ? ('0' + seconds) : seconds
console.log('======mss=', '剩余' + str + ':' + str1 + ':' + str2)
return '剩余' + str + ':' + str1 + ':' + str2
} else {
this.$emit('finishCountDown')
return '已超时'
}
}
......
......@@ -8,7 +8,7 @@
style="margin-left: 10px;">{{ systemStateName }}
</el-button>
<div v-if="isHasPrice && (systemState === 1 || systemState === 8) && timeStr" style="margin-left: 10px">
<NormalCountdown :last="timeStr"/>
<NormalCountdown :last="timeStr" @finishCountDown="handleGetDetail"/>
</div>
<div style="margin-right: auto"/>
<div v-if="systemState === 1" style="margin-right: 12px">
......
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