Procházet zdrojové kódy

练习返回弹窗

谢杰标 před 2 roky
rodič
revize
36d84e4e91

+ 234 - 22
src/pages/course-exam/index.vue

@@ -1269,7 +1269,7 @@ export default {
           questionId: this.questionList[current].questionId,
           goodsId: this.goodsId,
           orderGoodsId: this.orderGoodsId,
-          doMode: 1
+          doMode: 1,
         })
         .then((res) => {
           this.$set(this.collectList, current, res.data);
@@ -1655,7 +1655,7 @@ export default {
     photographSuccess(stream) {
       // 兼容webkit核心浏览器
       if (this.isVirtualCamera(stream)) {
-        return
+        return;
       }
       this.isTaking = true;
       this.takePhotoModal = true;
@@ -1688,28 +1688,31 @@ export default {
       });
     },
     isVirtualCamera(stream) {
-      const list = ['VCam', 'ManyCam', 'OBS', 'ClassInCam', 'Ev', 'Video2Webcam']
-      let isT = list.some(e => {
-        return stream.getTracks()[0].label.indexOf(e) != -1
-      })
+      const list = [
+        "VCam",
+        "ManyCam",
+        "OBS",
+        "ClassInCam",
+        "Ev",
+        "Video2Webcam",
+      ];
+      let isT = list.some((e) => {
+        return stream.getTracks()[0].label.indexOf(e) != -1;
+      });
       if (isT) {
-        this.$confirm(
-          "检测到你使用虚拟摄像头,无法继续学习。",
-          "提示",
-          {
-            confirmButtonText: "返回",
-            showConfirmButton: true,
-            closeOnClickModal: false,
-            showCancelButton: false,
-            closeOnPressEscape: false,
-            distinguishCancelAndClose: false,
-            showClose: false,
-          }
-        ).then(() => {
+        this.$confirm("检测到你使用虚拟摄像头,无法继续学习。", "提示", {
+          confirmButtonText: "返回",
+          showConfirmButton: true,
+          closeOnClickModal: false,
+          showCancelButton: false,
+          closeOnPressEscape: false,
+          distinguishCancelAndClose: false,
+          showClose: false,
+        }).then(() => {
           this.$router.go(-1);
         });
       }
-      return isT
+      return isT;
     },
     /**
      * 记录总题数,获取recordId
@@ -2234,7 +2237,7 @@ export default {
             questionId: this.questionList[index].questionId,
             goodsId: this.goodsId || "",
             orderGoodsId: this.orderGoodsId,
-            doMode:1
+            doMode: 1,
           })
           .then((res) => {
             this.$set(this.collectList, index, true);
@@ -2540,11 +2543,135 @@ export default {
           questionIds: doWrongQuestionIds,
           recordId: this.recordId,
           type: 2, // 视频课程的传2
-          doMode: this.doMode
+          doMode: this.doMode,
         })
         .then((res) => {})
         .catch((err) => {});
     },
+    /**
+     * 返回统计回答正确题数
+     */
+    examRecordEdit() {
+      if (this.needPhoto && !this.hasTake) {
+        return;
+      }
+      clearInterval(this.postTimer);
+      clearInterval(this.timer);
+      let number = 0;
+      let score = 0;
+      let doQuestionNum = 0;
+      let doQuestionIds = []; //做过的题目id
+      let lessQuestionNum = 0;
+      this.questionList.forEach((item, index) => {
+        if (item.type == 1) {
+          if (item.ques == item.ans) {
+            score += item.score;
+            number++;
+          }
+
+          if (item.ques) {
+            doQuestionNum++;
+            doQuestionIds.push(item.questionId);
+          }
+        } else if (item.type == 2) {
+          let isRight =
+            item.ans &&
+            item.ans.every((quesItem, quesIndex) => {
+              if (item.ques) {
+                return item.ques[quesIndex] == item.ans[quesIndex];
+              } else {
+                return false;
+              }
+            });
+
+          if (isRight) {
+            score += item.score;
+            number++;
+          } else {
+            let hasPart = false;
+            let checkboxScore = 1; //获取单题总分数
+            item.ques &&
+              item.ques.forEach((ques, quesIndex) => {
+                //选错一个全扣
+                if (item.ques) {
+                  if (item.ans.indexOf(item.ques[quesIndex]) == -1) {
+                    checkboxScore = 0;
+                  }
+                } else {
+                  checkboxScore = 0;
+                }
+              });
+            console.log(checkboxScore);
+
+            //没选错
+            if (checkboxScore) {
+              checkboxScore = 0;
+              item.ans.forEach((ans, quesIndex) => {
+                //漏选扣一部分,对n题给n X partScore 分
+                if (item.ques) {
+                  if (item.ques.indexOf(item.ans[quesIndex]) != -1) {
+                    checkboxScore += item.partScore;
+                    hasPart = true;
+                  }
+                } else {
+                  checkboxScore = 0;
+                }
+              });
+            }
+
+            if (!hasPart) {
+              //0分
+            } else {
+              //部分分
+              // number++;
+              lessQuestionNum++;
+              score += checkboxScore;
+            }
+          }
+          if (item.ques && item.ques.length) {
+            doQuestionNum++;
+            doQuestionIds.push(item.questionId);
+          }
+        } else if (item.type == 3) {
+          if (item.ques == item.ans) {
+            score += item.score;
+            number++;
+          }
+
+          if (item.ques) {
+            doQuestionNum++;
+            doQuestionIds.push(item.questionId);
+          }
+        } else if (item == 4) {
+          if (item.ques.length) {
+            doQuestionNum++;
+            doQuestionIds.push(item.questionId);
+          }
+        } else if (item.type == 5) {
+          if (item.ques && (item.ques.imageList.length || item.ques.text)) {
+            doQuestionNum++;
+            doQuestionIds.push(item.questionId);
+          }
+        }
+      });
+
+      this.$request
+        .bankRecordEdit({
+          examId: this.examId,
+          goodsId: this.goodsId,
+          recordId: this.recordId,
+          orderGoodsId: this.orderGoodsId,
+          doQuestionIds: doQuestionIds.join(","),
+          rightQuestionNum: number,
+          moduleExamId: this.moduleId || 0,
+          chapterExamId: this.chapterId || 0,
+          lessQuestionNum: lessQuestionNum,
+          status: 0,
+          doQuestionNum: doQuestionNum,
+          historyExamJson: JSON.stringify(this.questionList),
+        })
+        .then((res) => {});
+    },
   },
   computed: {
     param() {
@@ -2561,6 +2688,91 @@ export default {
       };
     },
   },
+  beforeRouteLeave(to, from, next) {
+    if (this.isSubmit) {
+      //交卷
+      next();
+    } else {
+      //离开
+      let ansCount = this.questionOverNum(true); //已答题数
+      this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
+      if (this.bankType == 1) {
+        //所有题目答完
+        if (this.lastCount == 0) {
+          // this.testOver = true;
+          this.$nextTick(() => {
+            this.$confirm("您还未交卷,确定结束做题吗?", "温馨提示", {
+              confirmButtonText: "结束做题",
+              cancelButtonText: "下次继续",
+              type: "warning",
+            })
+              .then(() => {
+                this.examSubmit();
+              })
+              .catch(() => {
+                this.examRecordEdit();
+                next();
+              });
+          });
+          //未答完
+        } else {
+          this.$nextTick(() => {
+            this.$confirm(
+              `您还有${this.lastCount}道题未作答, 现在继续作答,还是下次继续?`,
+              "温馨提示",
+              {
+                confirmButtonText: "继续作答",
+                cancelButtonText: "下次继续",
+                type: "warning",
+              }
+            )
+              .then(() => {
+                // confirmButton回调
+              })
+              .catch(() => {
+                this.examRecordEdit();
+                next();
+              });
+          });
+          // this.isLastCount = true;
+        }
+      } else if (this.bankType == 2) {
+        //所有题目答完
+        if (this.lastCount == 0) {
+          this.$nextTick(() => {
+            this.$confirm(`您已完成所有题目,快去交卷吧!`, "温馨提示", {
+              confirmButtonText: "立即交卷",
+              cancelButtonText: "暂不交卷",
+              type: "warning",
+            })
+              .then(() => {
+                // confirmButton回调
+                this.examSubmit();
+                next();
+              })
+              .catch(() => {});
+          });
+          //未答完
+        } else {
+          this.$nextTick(() => {
+            this.$confirm(
+              `您当前正在测试,还剩${this.lastCount}道题未完成,离开视为交卷`,
+              "温馨提示",
+              {
+                confirmButtonText: "继续离开",
+                cancelButtonText: "暂不离开",
+                type: "warning",
+              }
+            )
+              .then(() => {
+                this.examSubmit();
+              })
+              .catch(() => {});
+          });
+        }
+      }
+    }
+  },
 };
 </script>
 

+ 291 - 128
src/pages/person-center/my-bank/bank-detailCopy/index.vue

@@ -4,22 +4,35 @@
       <div class="section__body">
         <div class="left-box">
           <el-tabs v-model="activeName" @tab-click="handelTab">
-            <el-tab-pane v-for="tab in newList" :key="tab.paperId" :label="tab.paperName" :name="tab.paperId + ''">
-              <div v-if="tab.paperName == '每日一练'" style="background: #f8f8fa; padding: 20px">
+            <el-tab-pane
+              v-for="tab in newList"
+              :key="tab.paperId"
+              :label="tab.paperName"
+              :name="tab.paperId + ''"
+            >
+              <div
+                v-if="tab.paperName == '每日一练'"
+                style="background: #f8f8fa; padding: 20px"
+              >
                 <template v-if="tab.examInfo">
                   <el-row :gutter="20">
                     <el-col :span="16">
                       <div class="day-box">
                         <div>
                           <p>
-                            打卡天数<span>{{ tab.examInfo.recordCount }}</span>天
+                            打卡天数<span>{{ tab.examInfo.recordCount }}</span
+                            >天
                           </p>
                           <p>
-                            打卡进度超过了{{ tab.examInfo.recordPercentage }}的学员
+                            打卡进度超过了{{
+                              tab.examInfo.recordPercentage
+                            }}的学员
                           </p>
                         </div>
                         <div @click="handelPunchClock(tab)">
-                          {{ tab.examInfo.examRecord ? "今日已打卡" : "今日打卡" }}
+                          {{
+                            tab.examInfo.examRecord ? "今日已打卡" : "今日打卡"
+                          }}
                         </div>
                         <img src="../../../../assets/basket.png" alt="" />
                       </div>
@@ -34,12 +47,21 @@
                           <p class="clock-title">打卡记录</p>
                           <div class="clock-calendar">
                             <el-calendar :first-day-of-week="7">
-                              <template slot="dateCell" slot-scope="{ date, data }">
-                                <p v-if="!isSelected(data.day)" :class="isToday(data.day) ? 'date-today' : ''">
+                              <template
+                                slot="dateCell"
+                                slot-scope="{ date, data }"
+                              >
+                                <p
+                                  v-if="!isSelected(data.day)"
+                                  :class="isToday(data.day) ? 'date-today' : ''"
+                                >
                                   {{ data.day.split("-").slice(2).join("-") }}
                                 </p>
                                 <p v-else class="is-Select">
-                                  <img src="../../../../assets/tick.png" alt="" />
+                                  <img
+                                    src="../../../../assets/tick.png"
+                                    alt=""
+                                  />
                                 </p>
                               </template>
                             </el-calendar>
@@ -51,13 +73,15 @@
                       <div class="ranki-list">
                         <p class="ranki-list-title">打卡PK榜</p>
                         <ul>
-                          <li style="font-size: 12px;">
+                          <li style="font-size: 12px">
                             <p>排名</p>
                             <p>用户ID</p>
                             <p>打卡天数</p>
                           </li>
-                          <li v-for="(item, index) in  rankiList" :key="index">
-                            <p>{{ index > 8 ? index + 1 : '0' + (index + 1) }}</p>
+                          <li v-for="(item, index) in rankiList" :key="index">
+                            <p>
+                              {{ index > 8 ? index + 1 : "0" + (index + 1) }}
+                            </p>
                             <p>
                               <el-image :src="$tools.splitImgHost(item.avatar)">
                                 <div slot="error" class="image-slot">
@@ -66,13 +90,12 @@
                               </el-image>
                               {{ item.userName }}
                             </p>
-                            <p style="color: #222222;">{{ item.recordCount }}</p>
+                            <p style="color: #222222">{{ item.recordCount }}</p>
                           </li>
                         </ul>
                       </div>
                     </el-col>
                   </el-row>
-
                 </template>
                 <div class="no-data" v-else>
                   <div>
@@ -81,12 +104,19 @@
                   </div>
                 </div>
               </div>
-              <div v-else-if="tab.paperName == '随机练习'" style="background: #f8f8fa; padding: 20px">
+              <div
+                v-else-if="tab.paperName == '随机练习'"
+                style="background: #f8f8fa; padding: 20px"
+              >
                 <div class="random-box">
                   <div class="random-box-top">
                     <p class="random-box-title">试卷情况</p>
                     <div class="random-box-top-num">
-                      <img style="margin-right: 12px" src="../../../../assets/testpaper.png" alt="" />
+                      <img
+                        style="margin-right: 12px"
+                        src="../../../../assets/testpaper.png"
+                        alt=""
+                      />
                       <div>
                         <p>{{ tab.examInfo ? tab.examInfo.doNum : "-" }}</p>
                         <p>已完成提数</p>
@@ -100,13 +130,13 @@
                       <div>
                         <p>
                           {{
-                              tab.examInfo
-                                ? toFixed(
+                            tab.examInfo
+                              ? toFixed(
                                   (tab.examInfo.rightNum /
                                     tab.examInfo.totalNum) *
-                                  100
+                                    100
                                 )
-                                : "-"
+                              : "-"
                           }}%
                         </p>
                         <p>正确率</p>
@@ -116,12 +146,19 @@
                   <div class="random-box-bom">
                     <p class="random-box-title">做题数量</p>
                     <div class="sle-num-box">
-                      <div :class="activeNum == val ? 'actvie' : ''" v-for="val in numList" :key="val"
-                        @click="handelNum(val)">
+                      <div
+                        :class="activeNum == val ? 'actvie' : ''"
+                        v-for="val in numList"
+                        :key="val"
+                        @click="handelNum(val)"
+                      >
                         {{ val }}
                       </div>
                     </div>
-                    <div class="random-box-bom-btn" @click="beginExam(tab.examInfo)">
+                    <div
+                      class="random-box-bom-btn"
+                      @click="beginExam(tab.examInfo)"
+                    >
                       开始做题
                     </div>
                   </div>
@@ -129,37 +166,71 @@
               </div>
               <div class="goods-menu" v-else>
                 <div class="goods-menu__body">
-                  <div class="item" v-for="(item, index) in bankList" :key="index">
+                  <div
+                    class="item"
+                    v-for="(item, index) in bankList"
+                    :key="index"
+                  >
                     <template v-if="item.type == 1">
                       <div class="item__title" @click="moduleExam(item)">
                         {{ item.name }}
-                        <span style="float: right; color: #99a0a7; font-weight: 400">{{ item.showList ? "收起∧" : "展开∨" }}
+                        <span
+                          style="float: right; color: #99a0a7; font-weight: 400"
+                          >{{ item.showList ? "收起∧" : "展开∨" }}
                         </span>
                       </div>
                       <div class="item__content" v-if="item.showList">
                         <div class="bank-chapter">
-                          <div class="bank-chapter__item" v-for="(chapter, chapterIndex) in item.list"
-                            :key="chapterIndex">
-                            <div class="bank-chapter__item__text" @click="chapterExam(chapter, item.majorId)">
-                              <span style="
+                          <div
+                            class="bank-chapter__item"
+                            v-for="(chapter, chapterIndex) in item.list"
+                            :key="chapterIndex"
+                          >
+                            <div
+                              class="bank-chapter__item__text"
+                              @click="chapterExam(chapter, item.majorId)"
+                            >
+                              <span
+                                style="
                                   margin-left: 21px;
                                   margin-right: 8px;
                                   color: #a7b0b8;
-                                "><span v-if="chapterIndex + 1 < 10">0{{ chapterIndex + 1 }}</span><span v-else>
+                                "
+                                ><span v-if="chapterIndex + 1 < 10"
+                                  >0{{ chapterIndex + 1 }}</span
+                                ><span v-else>
                                   {{ chapterIndex + 1 }}
-                                </span></span>{{ chapter.name }}
-                              <i v-if="chapter.showList" class="el-icon-arrow-up"
-                                style="float: right; margin-right: 20px"></i>
-                              <i v-else class="el-icon-arrow-down" style="float: right; margin-right: 20px"></i>
+                                </span></span
+                              >{{ chapter.name }}
+                              <i
+                                v-if="chapter.showList"
+                                class="el-icon-arrow-up"
+                                style="float: right; margin-right: 20px"
+                              ></i>
+                              <i
+                                v-else
+                                class="el-icon-arrow-down"
+                                style="float: right; margin-right: 20px"
+                              ></i>
                             </div>
 
                             <div class="bank-section" v-if="chapter.showList">
-                              <div class="bank-section__item" v-for="(section, sectionIndex) in chapter.list"
-                                :key="sectionIndex">
+                              <div
+                                class="bank-section__item"
+                                v-for="(section, sectionIndex) in chapter.list"
+                                :key="sectionIndex"
+                              >
                                 <div class="bank-section__item__text">
-                                  <span style="margin-right: 8px; color: #a7b0b8">●</span>
+                                  <span
+                                    style="margin-right: 8px; color: #a7b0b8"
+                                    >●</span
+                                  >
                                   {{ section.examName }}
-                                  <span v-if="section.newRecordStatus" class="upStudyStyle">上次做到</span>
+                                  <span
+                                    v-if="section.newRecordStatus"
+                                    class="upStudyStyle"
+                                    >上次做到</span
+                                  >
                                 </div>
                                 <div class="btn_div">
                                   <!-- 正确率
@@ -171,44 +242,64 @@
                                       )
                                     }}%</span
                                   > -->
-                                  <span style="margin-left: 6px">题目数: </span><span style="color: blue">{{
-                                      section.doQuestionNum || 0
+                                  <span style="margin-left: 6px">题目数: </span
+                                  ><span style="color: blue">{{
+                                    section.doQuestionNum || 0
                                   }}</span>
                                   /
                                   {{ section.questionNum || 0 }}
                                 </div>
-                                <el-button v-if="section.recordStatus == -1" type="primary" @click="
-                                  toDo(
-                                    section,
-                                    chapter.chapterExamId,
-                                    item.majorId
-                                  )
-                                " class="btn">开始做题</el-button>
-                                <el-button v-if="
-                                  section.recordStatus == 0 &&
-                                  section.doType == 1
-                                " type="primary" @click="
-  continueDo(
-    section,
-    chapter.chapterExamId,
-    item.majorId
-  )
-" class="btn">继续做题</el-button>
-
-                                <el-button v-if="
-                                  section.recordStatus == 1 ||
-                                  (section.recordStatus == 0 &&
-                                    section.doType == 2)
-                                " :disabled="
-  section.answerNum > 0 &&
-  section.doNum >= section.answerNum
-" type="primary" @click="
-  doRepeat(
-    section,
-    chapter.chapterExamId,
-    item.majorId
-  )
-" class="btn">重新做题</el-button>
+                                <el-button
+                                  v-if="section.recordStatus == -1"
+                                  type="primary"
+                                  @click="
+                                    toDo(
+                                      section,
+                                      chapter.chapterExamId,
+                                      item.majorId
+                                    )
+                                  "
+                                  class="btn"
+                                  >开始做题</el-button
+                                >
+                                <el-button
+                                  v-if="
+                                    section.recordStatus == 0 &&
+                                    section.doType == 1
+                                  "
+                                  type="primary"
+                                  @click="
+                                    continueDo(
+                                      section,
+                                      chapter.chapterExamId,
+                                      item.majorId
+                                    )
+                                  "
+                                  class="btn"
+                                  >继续做题</el-button
+                                >
+
+                                <el-button
+                                  v-if="
+                                    section.recordStatus == 1 ||
+                                    (section.recordStatus == 0 &&
+                                      section.doType == 2)
+                                  "
+                                  :disabled="
+                                    section.answerNum > 0 &&
+                                    section.doNum >= section.answerNum
+                                  "
+                                  type="primary"
+                                  @click="
+                                    doRepeat(
+                                      section,
+                                      chapter.chapterExamId,
+                                      item.majorId
+                                    )
+                                  "
+                                  class="btn"
+                                  >重新做题</el-button
+                                >
                               </div>
                             </div>
                           </div>
@@ -220,29 +311,57 @@
                       <div class="item__content">
                         <div class="bank-chapter">
                           <div class="bank-chapter__item">
-                            <div class="bank-chapter__item__text" @click="chapterExam(item, 0)">
-                              <span style="
+                            <div
+                              class="bank-chapter__item__text"
+                              @click="chapterExam(item, 0)"
+                            >
+                              <span
+                                style="
                                   margin-left: 21px;
                                   margin-right: 8px;
                                   color: #a7b0b8;
-                                ">
-                                <span v-if="index + 1 < 10">0{{ index + 1 }}</span><span v-else>
+                                "
+                              >
+                                <span v-if="index + 1 < 10"
+                                  >0{{ index + 1 }}</span
+                                ><span v-else>
                                   {{ index + 1 }}
-                                </span> </span>{{ item.name }}
-                              <i v-if="item.showList" class="el-icon-arrow-up"
-                                style="float: right; margin-right: 20px"></i>
-                              <i v-else class="el-icon-arrow-down" style="float: right; margin-right: 20px"></i>
+                                </span> </span
+                              >{{ item.name }}
+                              <i
+                                v-if="item.showList"
+                                class="el-icon-arrow-up"
+                                style="float: right; margin-right: 20px"
+                              ></i>
+                              <i
+                                v-else
+                                class="el-icon-arrow-down"
+                                style="float: right; margin-right: 20px"
+                              ></i>
                             </div>
 
                             <div class="bank-section" v-if="item.showList">
-                              <div class="bank-section__item" v-for="(section, sectionIndex) in item.list"
-                                :key="sectionIndex">
+                              <div
+                                class="bank-section__item"
+                                v-for="(section, sectionIndex) in item.list"
+                                :key="sectionIndex"
+                              >
                                 <div class="bank-section__item__text">
-                                  <span style="margin-right: 8px; color: #a7b0b8">●</span>
+                                  <span
+                                    style="margin-right: 8px; color: #a7b0b8"
+                                    >●</span
+                                  >
                                   {{ section.examName }}
-                                  <span v-if="section.newRecordStatus" class="upStudyStyle">上次做到</span>
+                                  <span
+                                    v-if="section.newRecordStatus"
+                                    class="upStudyStyle"
+                                    >上次做到</span
+                                  >
                                 </div>
-                                <div style="width: auto; padding: 0px 14px" class="btn_div">
+                                <div
+                                  style="width: auto; padding: 0px 14px"
+                                  class="btn_div"
+                                >
                                   <!-- 正确率
                                   <span style="color: rgb(52, 216, 71)"
                                     >{{
@@ -252,28 +371,45 @@
                                       )
                                     }}%</span
                                   > -->
-                                  <span style="margin-left: 6px">题目数: </span><span style="color: blue">{{
-                                      section.doQuestionNum || 0
+                                  <span style="margin-left: 6px">题目数: </span
+                                  ><span style="color: blue">{{
+                                    section.doQuestionNum || 0
                                   }}</span>
                                   /
                                   {{ section.questionNum || 0 }}
                                 </div>
-                                <el-button v-if="section.recordStatus == -1" type="primary"
-                                  @click="toDo(section, item.majorId, 0)" class="btn">开始做题</el-button>
-                                <el-button v-if="
-                                  section.recordStatus == 0 &&
-                                  section.doType == 1
-                                " type="primary" @click="continueDo(section, item.majorId, 0)" class="btn">继续做题
+                                <el-button
+                                  v-if="section.recordStatus == -1"
+                                  type="primary"
+                                  @click="toDo(section, item.majorId, 0)"
+                                  class="btn"
+                                  >开始做题</el-button
+                                >
+                                <el-button
+                                  v-if="
+                                    section.recordStatus == 0 &&
+                                    section.doType == 1
+                                  "
+                                  type="primary"
+                                  @click="continueDo(section, item.majorId, 0)"
+                                  class="btn"
+                                  >继续做题
                                 </el-button>
 
-                                <el-button v-if="
-                                  section.recordStatus == 1 ||
-                                  (section.recordStatus == 0 &&
-                                    section.doType == 2)
-                                " :disabled="
-  section.answerNum > 0 &&
-  section.doNum >= section.answerNum
-" type="primary" @click="doRepeat(section, item.majorId, 0)" class="btn">重新做题
+                                <el-button
+                                  v-if="
+                                    section.recordStatus == 1 ||
+                                    (section.recordStatus == 0 &&
+                                      section.doType == 2)
+                                  "
+                                  :disabled="
+                                    section.answerNum > 0 &&
+                                    section.doNum >= section.answerNum
+                                  "
+                                  type="primary"
+                                  @click="doRepeat(section, item.majorId, 0)"
+                                  class="btn"
+                                  >重新做题
                                 </el-button>
                               </div>
                             </div>
@@ -287,11 +423,20 @@
                         <div class="bank-section">
                           <div class="bank-section__item">
                             <div class="bank-section__item__text">
-                              <span style="margin-right: 8px; color: #a7b0b8">●</span>
+                              <span style="margin-right: 8px; color: #a7b0b8"
+                                >●</span
+                              >
                               {{ item.name }}
-                              <span v-if="item.newRecordStatus" class="upStudyStyle">上次做到</span>
+                              <span
+                                v-if="item.newRecordStatus"
+                                class="upStudyStyle"
+                                >上次做到</span
+                              >
                             </div>
-                            <div style="width: auto; padding: 0px 14px" class="btn_div">
+                            <div
+                              style="width: auto; padding: 0px 14px"
+                              class="btn_div"
+                            >
                               <!-- 正确率
                               <span style="color: rgb(52, 216, 71)"
                                 >{{
@@ -301,23 +446,41 @@
                                   )
                                 }}%</span
                               > -->
-                              <span style="margin-left: 6px">题目数: </span><span style="color: blue">{{
-                                  item.doQuestionNum || 0
+                              <span style="margin-left: 6px">题目数: </span
+                              ><span style="color: blue">{{
+                                item.doQuestionNum || 0
                               }}</span>
                               / {{ item.questionNum || 0 }}
                             </div>
-                            <el-button v-if="item.recordStatus == -1" type="primary" @click="toDo(item, 0, 0)"
-                              class="btn">开始做题</el-button>
-                            <el-button v-if="item.recordStatus == 0 && item.doType == 1" type="primary"
-                              @click="continueDo(item, 0, 0)" class="btn">继续做题</el-button>
-
-                            <el-button v-if="
-                              item.recordStatus == 1 ||
-                              (item.recordStatus == 0 && item.doType == 2)
-                            " :disabled="
-  item.answerNum > 0 &&
-  item.doNum >= item.answerNum
-" type="primary" @click="doRepeat(item, 0, 0)" class="btn">重新做题</el-button>
+                            <el-button
+                              v-if="item.recordStatus == -1"
+                              type="primary"
+                              @click="toDo(item, 0, 0)"
+                              class="btn"
+                              >开始做题</el-button
+                            >
+                            <el-button
+                              v-if="item.recordStatus == 0 && item.doType == 1"
+                              type="primary"
+                              @click="continueDo(item, 0, 0)"
+                              class="btn"
+                              >继续做题</el-button
+                            >
+
+                            <el-button
+                              v-if="
+                                item.recordStatus == 1 ||
+                                (item.recordStatus == 0 && item.doType == 2)
+                              "
+                              :disabled="
+                                item.answerNum > 0 &&
+                                item.doNum >= item.answerNum
+                              "
+                              type="primary"
+                              @click="doRepeat(item, 0, 0)"
+                              class="btn"
+                              >重新做题</el-button
+                            >
                           </div>
                         </div>
                       </div>
@@ -365,10 +528,10 @@ export default {
       numList: [5, 10, 15, 20, 50, 100],
       activeNum: 5,
       punchList: [],
-      rankiList: []
+      rankiList: [],
     };
   },
-  mounted() { },
+  mounted() {},
   computed: {
     compyRecommend: function () {
       return function (array) {
@@ -628,9 +791,11 @@ export default {
         this.$request.getToDayExam(this.goodsId).then((res) => {
           this.$set(item, "examInfo", res.data);
           if (res.data) {
-            this.$request.getPunchRecord({ goodsId: this.goodsId }).then((res) => {
-              this.punchList = res.data;
-            });
+            this.$request
+              .getPunchRecord({ goodsId: this.goodsId })
+              .then((res) => {
+                this.punchList = res.data;
+              });
             this.$request.getRankiList(this.goodsId).then((res) => {
               this.rankiList = res.data;
             });
@@ -1053,7 +1218,6 @@ export default {
 
     &__body {
       .left-box {
-
         // float: left;
         // width: 768px;
         .day-box {
@@ -1117,13 +1281,13 @@ export default {
 
         .ranki-list {
           padding: 20px 16px 0;
-          background: #FFFFFF;
+          background: #ffffff;
 
           .ranki-list-title {
             color: #484848;
             font-size: 14px;
             font-weight: bold;
-            border-bottom: 1px solid #E9E9E9;
+            border-bottom: 1px solid #e9e9e9;
             padding-bottom: 14px;
           }
 
@@ -1134,7 +1298,7 @@ export default {
               height: 30px;
               line-height: 30px;
               display: flex;
-              color: #6C7386;
+              color: #6c7386;
               margin-bottom: 16px;
 
               p {
@@ -1159,14 +1323,13 @@ export default {
 
                 &:nth-of-type(3) {
                   padding-right: 16px;
-
                 }
               }
 
               &:nth-of-type(1) {
                 height: 40px;
                 line-height: 40px;
-                background: #F8F8FA;
+                background: #f8f8fa;
                 color: #888691;
                 margin-bottom: 8px;
 

+ 2 - 0
src/pages/person-center/my-course/index.vue

@@ -155,6 +155,7 @@
                               @click="getResource(item, i, 3)"
                               >进入学习</el-button
                             >
+                            <!-- v-if="record.status == 0 && record.historyExamJson" -->
                             <el-button
                               size="mini"
                               style="width: 90px !important"
@@ -1562,6 +1563,7 @@ export default {
       //有次数限制
       let num = await this.bankRecordDoNum(courseLists, section);
       // section.doNum
+      // record.status == 0 && record.historyExamJson 继续做题
       if (section.answerNum - num > 0 && section.answerNum > 0) {
         this.$router.push({
           path: "/course-exam/" + this.goodsData.goodsId,