|
|
@@ -39,8 +39,8 @@
|
|
|
</template>
|
|
|
</div>
|
|
|
</template>
|
|
|
+ <div>智能批改</div>
|
|
|
<div class="edit-box-header">
|
|
|
- 智能批改
|
|
|
<el-button @click="handleCorrect" :disabled="!showCorrectBtn" @mouseover="handleCorrectTip">开始批改</el-button>
|
|
|
<el-button @click="handleCorrectToPage" :disabled="!showCorrectToPageBtn" @mouseover="handleCorrectToPageTip">查看完整批改报告</el-button>
|
|
|
</div>
|
|
|
@@ -236,10 +236,24 @@ import * as path from "node:path";
|
|
|
|
|
|
}
|
|
|
|
|
|
- const handleCorrectTip = () => {
|
|
|
- if(!showCorrectBtn.value)
|
|
|
- ElMessage.error("请更新作文内容并暂存后批改")
|
|
|
- }
|
|
|
+ // 添加节流函数
|
|
|
+ const throttle = (fn: Function, delay: number) => {
|
|
|
+ let lastTime = 0;
|
|
|
+ return function (...args: any[]) {
|
|
|
+ const now = Date.now();
|
|
|
+ if (now - lastTime >= delay) {
|
|
|
+ fn.apply(this, args);
|
|
|
+ lastTime = now;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ };
|
|
|
+
|
|
|
+ // 使用节流包装 handleCorrectTip
|
|
|
+ const handleCorrectTip = throttle(() => {
|
|
|
+ if(!showCorrectBtn.value) {
|
|
|
+ ElMessage.error("请更新作文内容并暂存后批改");
|
|
|
+ }
|
|
|
+ }, 2000); // 2秒的节流时间
|
|
|
|
|
|
const handleCorrectToPageTip = () => {
|
|
|
if(!showCorrectToPageBtn.value)
|