Quellcode durchsuchen

新增组卷接口参数

Tang vor 2 Jahren
Ursprung
Commit
cd02a8123f
3 geänderte Dateien mit 336 neuen und 331 gelöschten Zeilen
  1. 165 162
      src/pages/bank-exam/index.vue
  2. 2 1
      src/pages/course-exam/index.vue
  3. 169 168
      src/pages/mock-exam/index.vue

+ 165 - 162
src/pages/bank-exam/index.vue

@@ -1163,8 +1163,8 @@ export default {
     this.examId = this.$route.query.examId;
     this.moduleId = this.$route.query.moduleId;
     this.chapterId = this.$route.query.chapterId;
-    this.simulateStatus = parseInt(this.$route.query.simulateStatus),
-    await this.bankExam();
+    (this.simulateStatus = parseInt(this.$route.query.simulateStatus)),
+      await this.bankExam();
     if (!this.number) {
       this.goodsQuestionList();
     } else {
@@ -1337,157 +1337,86 @@ export default {
       this.$request[
         this.doMode == 3 ? "goodsRandomQuestionList" : "goodsQuestionList"
       ]({
-          examId: this.examId,
+        examId: this.examId,
         goodsId: this.goodsId,
         orderGoodsId: this.orderGoodsId,
-        })
-        .then(async (res) => {
-          if(this.doMode==3){
-            this.simulateExamId = res.data.simulateExamId
-            res.data = res.data.questionList
-          }
-          if (!res.data.length) {
-            this.$message({
-              type: "warning",
-              message: "该试卷暂无题目",
-            });
-            return;
-          }
-          this.allTimes = res.data[0].answerTime * 60;
-          this.lastTime = res.data[0].answerTime && res.data[0].answerTime * 60;
-
-          //考试时间到了自动交卷
-          if (this.lastTime) {
-            this.timer = setInterval(() => {
-              if (this.lastTime <= 0) {
-                clearInterval(this.timer);
-                this.$confirm(`考试时间已到,系统将自动交卷`, "提示", {
-                  confirmButtonText: "立即交卷",
-                  closeOnClickModal: false,
-                  showCancelButton: false,
-                  closeOnPressEscape: false,
-                  distinguishCancelAndClose: false,
-                  showClose: false,
-                });
-
-                setTimeout(() => {
-                  try {
-                    this.$msgbox.close();
-                  } catch (err) {}
-                  this.examSubmit();
-                }, 3000);
-                return;
-              }
-              this.lastTime--;
-            }, 1000);
-          } else {
-          }
-
-          res.data.forEach((item, index) => {
-            item.jsonStr = JSON.parse(item.jsonStr);
-            if (item.type == 2) {
-              //多选
-              item.jsonStr.forEach((str) => {
-                str.optionsId = "" + str.optionsId;
-              });
-              let arr = item.answerQuestion.split(",");
-              arr.forEach((a, i) => {
-                arr[i] = "" + a;
-              });
-              item.ans = arr;
-              item.quesSelect = [];
-              item.analysisContent &&
-                (item.analysisContent = item.analysisContent.replace(
-                  /<img/gi,
-                  '<img style="max-width:100%;"'
-                ));
-              item.content &&
-                (item.content = item.content.replace(
-                  /<img/gi,
-                  '<img style="max-width:100%;"'
-                ));
-              return;
-            } else if (item.type == 5) {
-              //简答题
-              item.ansText = {
-                text: "",
-                imageList: [],
-              };
-              item.ques = {
-                text: "",
-                imageList: [],
-              };
-              item.analysisContent &&
-                (item.analysisContent = item.analysisContent.replace(
-                  /<img/gi,
-                  '<img style="max-width:100%;"'
-                ));
-              item.content &&
-                (item.content = item.content.replace(
-                  /<img/gi,
-                  '<img style="max-width:100%;"'
-                ));
-
-              return;
-            } else if (item.type == 4) {
-              //案例题
-              console.log(item.jsonStr);
-              item.ques = [];
-              item.tabIndex = "0";
-              let ansArr = [];
-              item.jsonStr.forEach((json, index) => {
-                if (json.type == 1) {
-                  ansArr[index] = json.answerQuestion;
-                  json.content &&
-                    (json.content = json.content.replace(
-                      /<img/gi,
-                      '<img style="max-width:100%;"'
-                    ));
-                } else if (json.type == 2) {
-                  json.optionsList.forEach((str) => {
-                    str.optionsId = "" + str.optionsId;
-                  });
-                  let arr = json.answerQuestion.split(",");
-                  arr.forEach((a, i) => {
-                    arr[i] = "" + a;
-                  });
-                  ansArr[index] = arr;
-                  json.content &&
-                    (json.content = json.content.replace(
-                      /<img/gi,
-                      '<img style="max-width:100%;"'
-                    ));
-                } else if (json.type == 3) {
-                  ansArr[index] = json.answerQuestion;
-                  json.content &&
-                    (json.content = json.content.replace(
-                      /<img/gi,
-                      '<img style="max-width:100%;"'
-                    ));
-                } else if (json.type == 5) {
-                  ansArr[index] = {
-                    text: "",
-                    imageList: [],
-                  };
-                  json.ansText = {
-                    text: "",
-                    imageList: [],
-                  };
-                  json.ques = {
-                    text: "",
-                    imageList: [],
-                  };
-                  json.content &&
-                    (json.content = json.content.replace(
-                      /<img/gi,
-                      '<img style="max-width:100%;"'
-                    ));
-                }
+        from: this.doMode == 3 ? 1 : "",
+      }).then(async (res) => {
+        if (this.doMode == 3) {
+          this.simulateExamId = res.data.simulateExamId;
+          res.data = res.data.questionList;
+        }
+        if (!res.data.length) {
+          this.$message({
+            type: "warning",
+            message: "该试卷暂无题目",
+          });
+          return;
+        }
+        this.allTimes = res.data[0].answerTime * 60;
+        this.lastTime = res.data[0].answerTime && res.data[0].answerTime * 60;
+
+        //考试时间到了自动交卷
+        if (this.lastTime) {
+          this.timer = setInterval(() => {
+            if (this.lastTime <= 0) {
+              clearInterval(this.timer);
+              this.$confirm(`考试时间已到,系统将自动交卷`, "提示", {
+                confirmButtonText: "立即交卷",
+                closeOnClickModal: false,
+                showCancelButton: false,
+                closeOnPressEscape: false,
+                distinguishCancelAndClose: false,
+                showClose: false,
               });
 
-              item.ans = ansArr;
+              setTimeout(() => {
+                try {
+                  this.$msgbox.close();
+                } catch (err) {}
+                this.examSubmit();
+              }, 3000);
               return;
             }
+            this.lastTime--;
+          }, 1000);
+        } else {
+        }
+
+        res.data.forEach((item, index) => {
+          item.jsonStr = JSON.parse(item.jsonStr);
+          if (item.type == 2) {
+            //多选
+            item.jsonStr.forEach((str) => {
+              str.optionsId = "" + str.optionsId;
+            });
+            let arr = item.answerQuestion.split(",");
+            arr.forEach((a, i) => {
+              arr[i] = "" + a;
+            });
+            item.ans = arr;
+            item.quesSelect = [];
+            item.analysisContent &&
+              (item.analysisContent = item.analysisContent.replace(
+                /<img/gi,
+                '<img style="max-width:100%;"'
+              ));
+            item.content &&
+              (item.content = item.content.replace(
+                /<img/gi,
+                '<img style="max-width:100%;"'
+              ));
+            return;
+          } else if (item.type == 5) {
+            //简答题
+            item.ansText = {
+              text: "",
+              imageList: [],
+            };
+            item.ques = {
+              text: "",
+              imageList: [],
+            };
             item.analysisContent &&
               (item.analysisContent = item.analysisContent.replace(
                 /<img/gi,
@@ -1498,15 +1427,86 @@ export default {
                 /<img/gi,
                 '<img style="max-width:100%;"'
               ));
-            item.ques = "";
-            item.ans = item.answerQuestion;
-          });
 
-          this.questionList = res.data;
-          this.lastCount = this.questionList.length;
-          this.getCollectInfo(this.current);
-          await this.examRecord();
+            return;
+          } else if (item.type == 4) {
+            //案例题
+            console.log(item.jsonStr);
+            item.ques = [];
+            item.tabIndex = "0";
+            let ansArr = [];
+            item.jsonStr.forEach((json, index) => {
+              if (json.type == 1) {
+                ansArr[index] = json.answerQuestion;
+                json.content &&
+                  (json.content = json.content.replace(
+                    /<img/gi,
+                    '<img style="max-width:100%;"'
+                  ));
+              } else if (json.type == 2) {
+                json.optionsList.forEach((str) => {
+                  str.optionsId = "" + str.optionsId;
+                });
+                let arr = json.answerQuestion.split(",");
+                arr.forEach((a, i) => {
+                  arr[i] = "" + a;
+                });
+                ansArr[index] = arr;
+                json.content &&
+                  (json.content = json.content.replace(
+                    /<img/gi,
+                    '<img style="max-width:100%;"'
+                  ));
+              } else if (json.type == 3) {
+                ansArr[index] = json.answerQuestion;
+                json.content &&
+                  (json.content = json.content.replace(
+                    /<img/gi,
+                    '<img style="max-width:100%;"'
+                  ));
+              } else if (json.type == 5) {
+                ansArr[index] = {
+                  text: "",
+                  imageList: [],
+                };
+                json.ansText = {
+                  text: "",
+                  imageList: [],
+                };
+                json.ques = {
+                  text: "",
+                  imageList: [],
+                };
+                json.content &&
+                  (json.content = json.content.replace(
+                    /<img/gi,
+                    '<img style="max-width:100%;"'
+                  ));
+              }
+            });
+
+            item.ans = ansArr;
+            return;
+          }
+          item.analysisContent &&
+            (item.analysisContent = item.analysisContent.replace(
+              /<img/gi,
+              '<img style="max-width:100%;"'
+            ));
+          item.content &&
+            (item.content = item.content.replace(
+              /<img/gi,
+              '<img style="max-width:100%;"'
+            ));
+          item.ques = "";
+          item.ans = item.answerQuestion;
         });
+
+        this.questionList = res.data;
+        this.lastCount = this.questionList.length;
+        this.getCollectInfo(this.current);
+        await this.examRecord();
+      });
     },
     // 随机练习题目
     goodsExamRandomList() {
@@ -2183,14 +2183,17 @@ export default {
       }
     },
     isCheck(item, index) {
-      if(item.type === 4){
-        if (this.questionList[index].ques && this.questionList[index].ques.length) {
-        return true;
-      }
-      }else{
-      if (this.questionList[index].ques) {
-        return true;
-      }
+      if (item.type === 4) {
+        if (
+          this.questionList[index].ques &&
+          this.questionList[index].ques.length
+        ) {
+          return true;
+        }
+      } else {
+        if (this.questionList[index].ques) {
+          return true;
+        }
       }
     },
     isRight(item, index) {

+ 2 - 1
src/pages/course-exam/index.vue

@@ -1291,6 +1291,7 @@ export default {
         examId: this.examId,
         goodsId: this.goodsId,
         orderGoodsId: this.orderGoodsId,
+        from: this.doMode == 3 ? 2 : "",
       }).then(async ({ data }) => {
         if (this.doMode == 3) {
           this.simulateExamId = data.simulateExamId;
@@ -2567,7 +2568,7 @@ export default {
           chapterId: this.chapterId,
           courseId: this.courseId,
           moduleId: this.moduleId,
-          type:this.type,
+          type: this.type,
           examId: this.examId,
         })
         .then((res) => {

+ 169 - 168
src/pages/mock-exam/index.vue

@@ -1072,7 +1072,7 @@ export default {
     Footer,
     Header,
     ToolBar,
-    HeaderTabBox
+    HeaderTabBox,
   },
   computed: {
     ...mapGetters(["sysTime"]),
@@ -1122,8 +1122,8 @@ export default {
       needPhoto: false,
       lastTime: 0, //剩余考试时长
       allTimes: 0, //总考试时长
-      goodsId:"",
-      orderGoodsId:"",
+      goodsId: "",
+      orderGoodsId: "",
       lastCount: 0,
       examId: 0,
       current: 0,
@@ -1138,8 +1138,8 @@ export default {
       isAutoSubmit: false,
       examEndTime: 0,
       examStartTime: 0,
-      doMode:1,//3模考组卷1普通考卷
-      simulateExamId:''
+      doMode: 1, //3模考组卷1普通考卷
+      simulateExamId: "",
     };
   },
   async mounted() {
@@ -1290,7 +1290,7 @@ export default {
           questionId: this.questionList[current].questionId,
           goodsId: this.goodsId,
           orderGoodsId: this.orderGoodsId,
-          doMode: this.doMode
+          doMode: this.doMode,
         })
         .then((res) => {
           this.$set(this.collectList, current, res.data);
@@ -1326,161 +1326,92 @@ export default {
      * 请求题目列表
      */
     goodsQuestionList() {
-      console.log(this.doMode,this.examId,this.goodsId)
-      this.$request[this.doMode==3?'goodsRandomQuestionList':'goodsQuestionList']({
-          examId: this.examId,
-          goodsId: this.goodsId,
-          orderGoodsId: this.orderGoodsId,
-        })
-        .then(async (data) => {
-          if(this.doMode==3){
-            this.simulateExamId = data.data.simulateExamId
-            data = data.data.questionList
-          }
-          if (!data.length) {
-            this.$message({
-              type: "warning",
-              message: "该试卷暂无题目",
-            });
-            return;
-          }
+      console.log(this.doMode, this.examId, this.goodsId);
+      this.$request[
+        this.doMode == 3 ? "goodsRandomQuestionList" : "goodsQuestionList"
+      ]({
+        examId: this.examId,
+        goodsId: this.goodsId,
+        orderGoodsId: this.orderGoodsId,
+        from: this.doMode == 3 ? 3 : "",
+      }).then(async (data) => {
+        if (this.doMode == 3) {
+          this.simulateExamId = data.data.simulateExamId;
+          data = data.data.questionList;
+        }
+        if (!data.length) {
+          this.$message({
+            type: "warning",
+            message: "该试卷暂无题目",
+          });
+          return;
+        }
 
-          if (this.subscribeId) {
-            this.lastTime = this.examEndTime - this.sysTime;
-            //考试时间到了自动交卷
-            if (this.lastTime) {
-              this.timer = setInterval(() => {
-                if (this.lastTime <= 0) {
-                  clearInterval(this.timer);
-                  this.$confirm(`考试时间已到,系统将自动交卷`, "提示", {
-                    confirmButtonText: "立即交卷",
-                    closeOnClickModal: false,
-                    showCancelButton: false,
-                    closeOnPressEscape: false,
-                    distinguishCancelAndClose: false,
-                    showClose: false,
-                  });
-                  this.isAutoSubmit = true;
-
-                  setTimeout(() => {
-                    try {
-                      this.$msgbox.close();
-                    } catch (err) {}
-                    this.examSubmit();
-                  }, 3000);
-                  return;
-                }
-                this.lastTime--;
-              }, 1000);
-            } else {
-            }
+        if (this.subscribeId) {
+          this.lastTime = this.examEndTime - this.sysTime;
+          //考试时间到了自动交卷
+          if (this.lastTime) {
+            this.timer = setInterval(() => {
+              if (this.lastTime <= 0) {
+                clearInterval(this.timer);
+                this.$confirm(`考试时间已到,系统将自动交卷`, "提示", {
+                  confirmButtonText: "立即交卷",
+                  closeOnClickModal: false,
+                  showCancelButton: false,
+                  closeOnPressEscape: false,
+                  distinguishCancelAndClose: false,
+                  showClose: false,
+                });
+                this.isAutoSubmit = true;
+
+                setTimeout(() => {
+                  try {
+                    this.$msgbox.close();
+                  } catch (err) {}
+                  this.examSubmit();
+                }, 3000);
+                return;
+              }
+              this.lastTime--;
+            }, 1000);
+          } else {
           }
+        }
 
-          data.forEach((item, index) => {
-            item.jsonStr = JSON.parse(item.jsonStr);
-            if (item.type == 2) {
-              //多选
-              item.jsonStr.forEach((str) => {
-                str.optionsId = "" + str.optionsId;
-              });
-              let arr = item.answerQuestion.split(",");
-              arr.forEach((a, i) => {
-                arr[i] = "" + a;
-              });
-              item.ans = arr;
-              item.quesSelect = [];
-              item.analysisContent &&
-                (item.analysisContent = item.analysisContent.replace(
-                  /<img/gi,
-                  '<img style="max-width:100%;"'
-                ));
-              item.content &&
-                (item.content = item.content.replace(
-                  /<img/gi,
-                  '<img style="max-width:100%;"'
-                ));
-              return;
-            } else if (item.type == 5) {
-              //简答题
-              item.ansText = {
-                text: "",
-                imageList: [],
-              };
-              item.ques = {
-                text: "",
-                imageList: [],
-              };
-              item.analysisContent &&
-                (item.analysisContent = item.analysisContent.replace(
-                  /<img/gi,
-                  '<img style="max-width:100%;"'
-                ));
-              item.content &&
-                (item.content = item.content.replace(
-                  /<img/gi,
-                  '<img style="max-width:100%;"'
-                ));
-
-              return;
-            } else if (item.type == 4) {
-              //案例题
-              console.log(item.jsonStr);
-              item.ques = [];
-              item.tabIndex = "0";
-              let ansArr = [];
-              item.jsonStr.forEach((json, index) => {
-                if (json.type == 1) {
-                  ansArr[index] = json.answerQuestion;
-                  json.content &&
-                    (json.content = json.content.replace(
-                      /<img/gi,
-                      '<img style="max-width:100%;"'
-                    ));
-                } else if (json.type == 2) {
-                  json.optionsList.forEach((str) => {
-                    str.optionsId = "" + str.optionsId;
-                  });
-                  let arr = json.answerQuestion.split(",");
-                  arr.forEach((a, i) => {
-                    arr[i] = "" + a;
-                  });
-                  ansArr[index] = arr;
-                  json.content &&
-                    (json.content = json.content.replace(
-                      /<img/gi,
-                      '<img style="max-width:100%;"'
-                    ));
-                } else if (json.type == 3) {
-                  ansArr[index] = json.answerQuestion;
-                  json.content &&
-                    (json.content = json.content.replace(
-                      /<img/gi,
-                      '<img style="max-width:100%;"'
-                    ));
-                } else if (json.type == 5) {
-                  ansArr[index] = {
-                    text: "",
-                    imageList: [],
-                  };
-                  json.ansText = {
-                    text: "",
-                    imageList: [],
-                  };
-                  json.ques = {
-                    text: "",
-                    imageList: [],
-                  };
-                  json.content &&
-                    (json.content = json.content.replace(
-                      /<img/gi,
-                      '<img style="max-width:100%;"'
-                    ));
-                }
-              });
-
-              item.ans = ansArr;
-              return;
-            }
+        data.forEach((item, index) => {
+          item.jsonStr = JSON.parse(item.jsonStr);
+          if (item.type == 2) {
+            //多选
+            item.jsonStr.forEach((str) => {
+              str.optionsId = "" + str.optionsId;
+            });
+            let arr = item.answerQuestion.split(",");
+            arr.forEach((a, i) => {
+              arr[i] = "" + a;
+            });
+            item.ans = arr;
+            item.quesSelect = [];
+            item.analysisContent &&
+              (item.analysisContent = item.analysisContent.replace(
+                /<img/gi,
+                '<img style="max-width:100%;"'
+              ));
+            item.content &&
+              (item.content = item.content.replace(
+                /<img/gi,
+                '<img style="max-width:100%;"'
+              ));
+            return;
+          } else if (item.type == 5) {
+            //简答题
+            item.ansText = {
+              text: "",
+              imageList: [],
+            };
+            item.ques = {
+              text: "",
+              imageList: [],
+            };
             item.analysisContent &&
               (item.analysisContent = item.analysisContent.replace(
                 /<img/gi,
@@ -1491,15 +1422,86 @@ export default {
                 /<img/gi,
                 '<img style="max-width:100%;"'
               ));
-            item.ques = "";
-            item.ans = item.answerQuestion;
-          });
 
-          this.questionList = data;
-          this.lastCount = this.questionList.length;
-          this.getCollectInfo(this.current)
-          await this.mockRecord();
+            return;
+          } else if (item.type == 4) {
+            //案例题
+            console.log(item.jsonStr);
+            item.ques = [];
+            item.tabIndex = "0";
+            let ansArr = [];
+            item.jsonStr.forEach((json, index) => {
+              if (json.type == 1) {
+                ansArr[index] = json.answerQuestion;
+                json.content &&
+                  (json.content = json.content.replace(
+                    /<img/gi,
+                    '<img style="max-width:100%;"'
+                  ));
+              } else if (json.type == 2) {
+                json.optionsList.forEach((str) => {
+                  str.optionsId = "" + str.optionsId;
+                });
+                let arr = json.answerQuestion.split(",");
+                arr.forEach((a, i) => {
+                  arr[i] = "" + a;
+                });
+                ansArr[index] = arr;
+                json.content &&
+                  (json.content = json.content.replace(
+                    /<img/gi,
+                    '<img style="max-width:100%;"'
+                  ));
+              } else if (json.type == 3) {
+                ansArr[index] = json.answerQuestion;
+                json.content &&
+                  (json.content = json.content.replace(
+                    /<img/gi,
+                    '<img style="max-width:100%;"'
+                  ));
+              } else if (json.type == 5) {
+                ansArr[index] = {
+                  text: "",
+                  imageList: [],
+                };
+                json.ansText = {
+                  text: "",
+                  imageList: [],
+                };
+                json.ques = {
+                  text: "",
+                  imageList: [],
+                };
+                json.content &&
+                  (json.content = json.content.replace(
+                    /<img/gi,
+                    '<img style="max-width:100%;"'
+                  ));
+              }
+            });
+
+            item.ans = ansArr;
+            return;
+          }
+          item.analysisContent &&
+            (item.analysisContent = item.analysisContent.replace(
+              /<img/gi,
+              '<img style="max-width:100%;"'
+            ));
+          item.content &&
+            (item.content = item.content.replace(
+              /<img/gi,
+              '<img style="max-width:100%;"'
+            ));
+          item.ques = "";
+          item.ans = item.answerQuestion;
         });
+
+        this.questionList = data;
+        this.lastCount = this.questionList.length;
+        this.getCollectInfo(this.current);
+        await this.mockRecord();
+      });
     },
     /**
      * 记录总题数,获取recordId
@@ -2137,7 +2139,7 @@ export default {
             questionId: this.questionList[index].questionId,
             goodsId: this.goodsId || "",
             orderGoodsId: this.orderGoodsId,
-            doMode:this.doMode
+            doMode: this.doMode,
           })
           .then((res) => {
             this.$set(this.collectList, index, true);
@@ -2619,7 +2621,7 @@ export default {
           examId: this.examId,
           questionIds: doWrongQuestionIds,
           recordId: this.recordId,
-          doMode: this.doMode
+          doMode: this.doMode,
         })
         .then((res) => {
           this.loading = false;
@@ -2629,7 +2631,6 @@ export default {
         });
     },
   },
-
 };
 </script>