Procházet zdrojové kódy

对接随机组题接口

谢杰标 před 2 roky
rodič
revize
3c488aca82
1 změnil soubory, kde provedl 12 přidání a 6 odebrání
  1. 12 6
      src/pages/course-exam/index.vue

+ 12 - 6
src/pages/course-exam/index.vue

@@ -1202,6 +1202,7 @@ export default {
       bankType: 0,
       compareFaceData: 0, // 拍照匹配相似度
       collectList: [],
+      doMode: 1,
     };
   },
   async mounted() {
@@ -1216,8 +1217,8 @@ export default {
     this.chapterId = this.$route.query.chapterId;
     this.orderGoodsId = this.$route.query.orderGoodsId;
     await this.getGoodsDetail();
-    this.goodsQuestionList();
-    this.bankExam();
+    await this.bankExam();
+    this.doMode == 1 ? this.goodsQuestionList() : this.simulationQuestionList();
   },
   beforeDestroy() {
     clearInterval(this.timer);
@@ -1244,6 +1245,7 @@ export default {
       return new Promise((resolve) => {
         let self = this;
         this.$request.goodsDetail(this.goodsId).then((res) => {
+          console.log(res.data);
           self.goodsDetail = res.data;
           if (self.goodsDetail.goodsPhotoExamConfig) {
             let goodsPhotoExamConfig = JSON.parse(
@@ -1269,7 +1271,7 @@ export default {
           questionId: this.questionList[current].questionId,
           goodsId: this.goodsId,
           orderGoodsId: this.orderGoodsId,
-          doMode: 1,
+          doMode: this.doMode,
         })
         .then((res) => {
           this.$set(this.collectList, current, res.data);
@@ -1424,7 +1426,9 @@ export default {
           await this.examRecord();
         });
     },
-
+    simulationQuestionList() {
+      console.log(98898989123213);
+    },
     //拍照
     openPhoto() {
       this.$nextTick(() => {
@@ -1784,11 +1788,13 @@ export default {
      * 获取试卷类型2考试,1练习
      */
     bankExam() {
-      this.$request.bankExam(this.examId).then((res) => {
+      return this.$request.bankExam(this.examId).then((res) => {
         this.bankType = res.data.doType;
         if (this.bankType == 2) {
           this.needBack = true;
         }
+        this.doMode = res.data.simulateStatus ? 3 : 1;
+        return Promise.resolve();
       });
     },
     /**
@@ -2237,7 +2243,7 @@ export default {
             questionId: this.questionList[index].questionId,
             goodsId: this.goodsId || "",
             orderGoodsId: this.orderGoodsId,
-            doMode: 1,
+            doMode: this.doMode,
           })
           .then((res) => {
             this.$set(this.collectList, index, true);