mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-17 23:06:48 +08:00
考试5秒内只能提交一次
This commit is contained in:
@@ -92,8 +92,8 @@
|
|||||||
if(this.examId){
|
if(this.examId){
|
||||||
this.loadExamInfo();
|
this.loadExamInfo();
|
||||||
}
|
}
|
||||||
this.debouncedPresent = this.debounce(this.present, 500);
|
this.debouncedPresent = this.throttle(this.present, 5000);
|
||||||
this.confirmStop = this.debounce(this.submitTest,500)
|
this.confirmStop = this.throttle(this.submitTest,5000)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
changeTimer(){
|
changeTimer(){
|
||||||
@@ -352,16 +352,16 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
debounce(func, delay) {
|
throttle(func, delay) {
|
||||||
let timerId;
|
let lastExecTime = 0;
|
||||||
return function (...args) {
|
return function (...args) {
|
||||||
if (timerId) clearTimeout(timerId);
|
const now = Date.now();
|
||||||
timerId = setTimeout(() => {
|
if (now - lastExecTime >= delay) {
|
||||||
func.apply(this, args);
|
func.apply(this, args);
|
||||||
timerId = null;
|
lastExecTime = now;
|
||||||
}, delay);
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
present(){
|
present(){
|
||||||
let $this=this;
|
let $this=this;
|
||||||
let score=this.countTest();
|
let score=this.countTest();
|
||||||
|
|||||||
Reference in New Issue
Block a user