diff --git a/pages/study/exam.vue b/pages/study/exam.vue index 1ff3b74..ccc0eaa 100644 --- a/pages/study/exam.vue +++ b/pages/study/exam.vue @@ -31,7 +31,7 @@ - + @@ -230,9 +230,9 @@ } } }, - confirmStop(){ - this.submitTest(); - }, + // confirmStop(){ + // this.submitTest() + // }, cancelStop(){ //应该返回课程面页 this.confirmFinish(); @@ -350,6 +350,16 @@ } }) }, + debounce(func, delay) { + let timerId; + return function (...args) { + if (timerId) clearTimeout(timerId); + timerId = setTimeout(() => { + func.apply(this, args); + timerId = null; + }, delay); + }; + }, present(){ let $this=this; let score=this.countTest(); @@ -386,7 +396,11 @@ } - } + }, + created() { + this.debouncedPresent = this.debounce(this.present, 500); + this.confirmStop = this.debounce(this.submitTest,500) + }, }