From 6d4af3aa2ddffeda90731de37e3d99a26b549fd5 Mon Sep 17 00:00:00 2001 From: 670788339 <670788339@qq.com> Date: Fri, 24 Oct 2025 13:29:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E8=A7=86=E9=A2=91=E7=8A=B6?= =?UTF-8?q?=E6=80=81=20=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/study/coursenew.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/views/study/coursenew.vue b/src/views/study/coursenew.vue index 28d235e5..dbfd70ea 100644 --- a/src/views/study/coursenew.vue +++ b/src/views/study/coursenew.vue @@ -480,6 +480,7 @@ defaultMaxTime:1800, //非音频默认最大时间 warn:"测试内容", warnTitle:"测试标题", + isFinishingStudyItem: false, // 防止重复调用完成状态更新接口 } }, mounted() { @@ -1684,19 +1685,28 @@ //这种可能没有,不过这里也是为了万中那个1 !this.tentative && this.saveStudyInfo(); } else { + // 如果正在处理完成请求,则直接返回,避免重复调用 + if (this.isFinishingStudyItem) { + return; + } let params = { itemId: this.contentData.studyItemId, studyId: this.studyId, courseId: this.courseId, cnum: this.totalContent } - this.contentData.status = 9; + this.isFinishingStudyItem = true; // 设置标志位 apiVideoStudy.finishStudyItem(params).then(res => { if (res.status == 200) { + this.contentData.status = 9; this.contentData.progress = 100; } else { console.log("记录完成学习失败:" + res.message + "," + res.error); } + this.isFinishingStudyItem = false; // 重置标志位 + }).catch(error => { + console.error("记录完成学习出错:", error); + this.isFinishingStudyItem = false; // 出错时也重置标志位 }); } },