From 7bf27993b3c6c58ab668d1c7487a6aab99d52dce Mon Sep 17 00:00:00 2001 From: binbin_pan Date: Wed, 4 Sep 2024 19:20:45 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/YNEduApp/exam/examination.vue | 15 ++++++++++- pages/YNEduApp/learn/learn.vue | 14 ++++++++++- pages/YNEduApp/learnProj/learnProjDetail.vue | 26 ++++++++++++++++++++ pages/YNEduApp/prac/exercises.vue | 17 +++++++++++-- 4 files changed, 68 insertions(+), 4 deletions(-) diff --git a/pages/YNEduApp/exam/examination.vue b/pages/YNEduApp/exam/examination.vue index 06280ed..c2abcbb 100644 --- a/pages/YNEduApp/exam/examination.vue +++ b/pages/YNEduApp/exam/examination.vue @@ -139,6 +139,7 @@ import config from '@/config' export default { data() { return { + isLoading: false, // 考试id examId: '', // 考试记录id @@ -369,6 +370,15 @@ export default { }, // 确认提交 handleConfirmSubmit() { + console.log('🚀 ~ 提交-->', this.isLoading) + if (this.isLoading) { + uni.showToast({ + title: '正在提交中, 请稍后', + icon: 'none' + }) + return + } + this.isLoading = true // 停止计时 this.$refs.countDown.pause() const params = { @@ -390,7 +400,6 @@ export default { success: res => { console.log('🚀 ~ handleConfirmSubmit ~ res:', res) res = res.data - this.showConfirmModal = false const params2 = { examId: this.examId, examGrade: res.examGrade, @@ -411,6 +420,10 @@ export default { uni.navigateTo({ url: `/pages/YNEduApp/exam/examinationDetails?params=${JSON.stringify(params2)}` }) + setTimeout(() => { + this.showConfirmModal = false + this.isLoading = false + }, 1000) } }) if (this.studyId) { diff --git a/pages/YNEduApp/learn/learn.vue b/pages/YNEduApp/learn/learn.vue index 02fec65..c0eb9e8 100644 --- a/pages/YNEduApp/learn/learn.vue +++ b/pages/YNEduApp/learn/learn.vue @@ -40,6 +40,7 @@ export default { }, data() { return { + isLoading: false, studyId: '', // 学习id stageId: '', // 阶段id stageContentId: '', // 阶段内容id @@ -103,6 +104,14 @@ export default { }, // 结束学习 handleEnd() { + if (this.isLoading) { + uni.showToast({ + title: '正在提交中, 请稍后', + icon: 'none' + }) + return + } + this.isLoading = true if (this.isEnd) { uni.reLaunch({ url: '/pages/YNEduApp/learnProj/learnProjDetail?id=' + this.studyId @@ -149,10 +158,13 @@ export default { }, success: res => { console.log('🚀 ~ handleEnd ~ res:', res) - this.showModal = false uni.reLaunch({ url: '/pages/YNEduApp/learnProj/learnProjDetail?id=' + this.studyId }) + setTimeout(() => { + this.isLoading = false + this.showModal = false + }, 1000) }, fail: err => { console.log('🚀 ~ handleEnd ~ err:', err) diff --git a/pages/YNEduApp/learnProj/learnProjDetail.vue b/pages/YNEduApp/learnProj/learnProjDetail.vue index d638c59..32144c4 100644 --- a/pages/YNEduApp/learnProj/learnProjDetail.vue +++ b/pages/YNEduApp/learnProj/learnProjDetail.vue @@ -317,6 +317,18 @@ export default { // 跳转考试 toggleTheoryExam(item) { console.log('🚀 ~ toggleTheoryExam ~ item:', item, item.examMsg.examEquipment) + const date = new Date() + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + const today = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}` + if (today < item.examMsg.validityDate.split('~')[0] || today > item.examMsg.validityDate.split('~')[1]) { + uni.showToast({ + title: '当前时间不在考试时间范围内', + icon: 'none' + }) + return + } if (item.examMsg.examEquipment == 2) { uni.showToast({ title: '请在电脑端进行考试', @@ -324,6 +336,20 @@ export default { }) return } + // examCount 1: 不限次 2: 及格终止 3: 自定义 + if (item.examMsg.examCount == 2 && item.examMsg.results == 1) { + uni.showToast({ + title: '此考试及格终止, 考试以及格, 无需再次考试', + icon: 'none' + }) + return + } else if (item.examMsg.examCount == 3 && item.examMsg.examNum >= item.examMsg.examCustom) { + uni.showToast({ + title: '此考试有次数限制, 考试次数已达上限, 无法再考试了', + icon: 'none' + }) + return + } const params = { id: item.examMsg.id, // 考试id cutNum: item.examMsg.isCut, // 切屏次数 diff --git a/pages/YNEduApp/prac/exercises.vue b/pages/YNEduApp/prac/exercises.vue index d09304a..c7946c6 100644 --- a/pages/YNEduApp/prac/exercises.vue +++ b/pages/YNEduApp/prac/exercises.vue @@ -218,6 +218,7 @@ import config from '@/config' export default { data() { return { + isLoading: false, practiceId: '', // 练习id recordId: '', // 记录id isNew: 1, // 是否新练习 @@ -606,7 +607,8 @@ export default { recordId: this.recordId, questionId: this.questionList[0].questionId, selectAnswer: select.join(''), - isTrue: isCorrect ? 1 : 0 + isTrue: isCorrect ? 1 : 0, + isMiss: this.isError ? '1' : '' } console.log('🚀 ~ handleOk ~ params-多选:', params) // insertPracticeAnswerById(params) @@ -662,6 +664,14 @@ export default { }, // 结束答题 handleClose() { + if (this.isLoading) { + uni.showToast({ + title: '正在提交中, 请稍后', + icon: 'none' + }) + return + } + this.isLoading = true this.isEnd = true // 停止计时 clearInterval(this.intervalId) @@ -734,7 +744,10 @@ export default { url: '/pages/YNEduApp/prac/prac' }) } - this.showModal = false + setTimeout(() => { + this.isLoading = false + this.showModal = false + }, 500) }, // 打开题目选择弹框 async openSelect() {