提交 e41006d2 authored 作者: lihuihui's avatar lihuihui

倒计时加天

上级 c538692e
差异被折叠。
差异被折叠。
...@@ -78,7 +78,6 @@ export default { ...@@ -78,7 +78,6 @@ export default {
const winWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth || 0 const winWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth || 0
const winHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0 const winHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0
if (winHeight > winWidth) { if (winHeight > winWidth) {
console.log(1)
this.$message({ this.$message({
message: '请横屏预览', message: '请横屏预览',
type: 'warning' type: 'warning'
...@@ -158,10 +157,14 @@ export default { ...@@ -158,10 +157,14 @@ export default {
// 倒计时 // 倒计时
countDown(time) { countDown(time) {
const lefttime = parseInt(time / 1000) const lefttime = parseInt(time / 1000)
const h = this.addZero(parseInt((lefttime / (60 * 60)) % 24)) const datSec = 24 * 60 * 60
const m = this.addZero(parseInt((lefttime / 60) % 60)) const hourSer = 60 * 60
const s = this.addZero(parseInt(lefttime % 60)) const minuteSec = 60
this.loginParam.countTimeText = `距离开考还有: ${h} : ${m} : ${s}` const dd = Math.floor(lefttime / datSec)
const hh = Math.floor((lefttime % datSec) / hourSer)
const mm = Math.floor((lefttime % hourSer) / minuteSec)
const ss = lefttime % minuteSec
this.loginParam.countTimeText = dd > 0 ? `距离开考还有: ${dd}${this.addZero(hh)}${this.addZero(mm)}${this.addZero(ss)}秒` : `距离开考还有: ${this.addZero(hh)}${this.addZero(mm)}${this.addZero(ss)}秒`
}, },
// 开启全屏 // 开启全屏
fullScreen() { fullScreen() {
...@@ -175,7 +178,6 @@ export default { ...@@ -175,7 +178,6 @@ export default {
}, },
// 禁止input输入空格 // 禁止input输入空格
keydown(event) { keydown(event) {
console.log(event.keyCode)
if (event.keyCode === 32 || event.keyCode === 187 || event.keyCode === 107) { if (event.keyCode === 32 || event.keyCode === 187 || event.keyCode === 107) {
event.returnValue = false event.returnValue = false
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论