mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-12 04:16:45 +08:00
考试提交改为5秒内只执行一次
This commit is contained in:
@@ -408,17 +408,18 @@ export default {
|
|||||||
this.curIndex++;
|
this.curIndex++;
|
||||||
this.curItem=this.paper.items[this.curIndex];
|
this.curItem=this.paper.items[this.curIndex];
|
||||||
},
|
},
|
||||||
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(){ //提交前处理
|
||||||
|
console.log('ssss')
|
||||||
let $this=this;
|
let $this=this;
|
||||||
let score=this.countTest();
|
let score=this.countTest();
|
||||||
console.log('score='+score);
|
console.log('score='+score);
|
||||||
@@ -600,7 +601,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.debouncedPresent = this.debounce(this.present, 500);
|
this.debouncedPresent = this.throttle(this.present, 5000);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user