Browse Source

Merge branch 'master' into xbnl_20260904(应知应会区分学生/教职工)

dedsudiyu 1 week ago
parent
commit
f9c4c9bb32

+ 11 - 19
src/views/safetyEducationExaminationNew/featurePage/learningCourse/index.vue

@@ -266,26 +266,24 @@
       /*=================================== 学习定时器 ===================================*/
       // 初始化定时器
       initTimer() {
-        let self = this;
-        if(this.newData.coursewares[this.checkLearningIndex].learnedDuration == this.newData.coursewares[this.checkLearningIndex].minLearningDuration){
+        // 先清除旧计时器,防止孤儿计时器在切换窗口时复活写入错误数据
+        this.clearTimer();
+        const idx = this.checkLearningIndex;
+        const courseware = this.newData.coursewares[idx];
+        if(courseware.learnedDuration >= courseware.minLearningDuration){
           return
         }
         this.studyTimer = new StudyTimer({
-          initialSeconds: self.newData.coursewares[self.checkLearningIndex].learnedDuration,
-          maxSeconds: self.newData.coursewares[self.checkLearningIndex].minLearningDuration,
+          initialSeconds: courseware.learnedDuration,
+          maxSeconds: courseware.minLearningDuration,
           onTick: (elapsedSeconds) => {
-            //每次计时
-            this.$set(self.newData.coursewares[self.checkLearningIndex],'learnedDuration',elapsedSeconds);
-            //心跳判断
+            this.$set(this.newData.coursewares[idx],'learnedDuration',elapsedSeconds);
             if (elapsedSeconds % this.heartbeatValue === 0) {
-              //调用心跳方法
               this.examUserCoursewareLearningReportProgress();
             }
           },
           onMaxTimeReached: (elapsedSeconds) => {
-            //达到最大值
-            this.$set(self.newData.coursewares[self.checkLearningIndex],'learnedDuration',elapsedSeconds);
-            //调用心跳方法
+            this.$set(this.newData.coursewares[idx],'learnedDuration',elapsedSeconds);
             this.examUserCoursewareLearningReportProgress();
           }
         });
@@ -352,14 +350,8 @@
       },
     },
     beforeDestroy() {
-      if (this.studyTimer) {
-        this.studyTimer.destroy();
-        this.studyTimer = null;
-      }
-      if (this.countdownTimer) {
-        this.countdownTimer.destroy();
-        this.countdownTimer = null;
-      }
+      this.clearTimer();
+      this.clearCountdown();
     },
   }
 </script>

+ 15 - 1
src/views/safetyEducationExaminationNew/safetyTest/onlineExam/index.vue

@@ -56,7 +56,10 @@
             <div class="bottom-box">
               <p class="text-big-p">{{item.examTypeName}}</p>
               <p class="text-p">{{parseTime(item.startTime,"{y}-{m}-{d} {h}:{i}")}} 至 {{parseTime(item.endTime,"{y}-{m}-{d} {h}:{i}")}}</p>
-              <p class="time-p">时长:{{item.answerDuration}}分钟 丨 总分:{{item.totalScore}}分 丨 及格分:{{item.passScore}}分 丨 可考试次数:{{item.attemptLimit===0?'无限':item.attemptCount+'/'+item.attemptLimit}}次</p>
+              <p class="time-p">时长:{{item.answerDuration}}分钟 丨 总分:{{item.totalScore}}分 丨 及格分:{{item.passScore}}分 丨 可考试次数:{{item.attemptLimit===0?'无限':item.attemptCount+'/'+item.attemptLimit}}次
+                <span v-if="item.studyHoursRequirement>0"> 丨 学时要求:{{item.completedStudyHours>=item.studyHoursRequirement?'已满足':item.completedStudyHours + '/' + item.studyHoursRequirement + ' 学时'}}</span>
+              </p>
+              <p class="position-passed-p" v-if="item.isPassed">已通过</p>
             </div>
             <p class="position-p-1" v-if="item.conditionType == 1" @click="tableButton(1,item)">完成学时要求后解锁</p>
             <p class="position-p-1" v-if="item.conditionType == 2" @click="tableButton(2,item)">完成考前课程学习后解锁</p>
@@ -522,6 +525,17 @@
             padding:10px 20px 20px;
             border-radius:10px;
             margin-top:10px;
+            position: relative;
+            .position-passed-p{
+              position: absolute;
+              top:10px;
+              right:10px;
+              border-radius:4px;
+              color:#fff;
+              background-color: #01B85B;
+              padding:5px 10px;
+              font-size:14px;
+            }
           }
           .title-p{
             color:#0183fa;

+ 1 - 1
src/views/safetyEducationExaminationNew/safetyTest/practiceQuestions/index.vue

@@ -20,7 +20,7 @@
                   <p :class="practiceStatus === ''?'check-table-button':''" @click="tableTypeButton('')">全部</p>
                   <p :class="practiceStatus === 0?'check-table-button':''" @click="tableTypeButton(0)">未开始</p>
                   <p :class="practiceStatus === 1?'check-table-button':''" @click="tableTypeButton(1)">练习中</p>
-                  <p :class="practiceStatus === 2?'check-table-button':''" @click="tableTypeButton(2)">已学完</p>
+                  <p :class="practiceStatus === 2?'check-table-button':''" @click="tableTypeButton(2)">已练习</p>
                 </div>
               </div>
               <el-form-item label="" prop="knowledgePointId">