Browse Source

每日一练最终

谢杰标 2 years ago
parent
commit
2b1d379831

+ 6 - 1
src/apis/bank.js

@@ -56,7 +56,12 @@ export default {
 			method: 'get',
 		})
 	},
-
+	bankTempExam(data) {
+		return request({
+			url: '/bank/exam/temp/' + data,
+			method: 'get',
+		})
+	},
 	bankRecord(data) {
 		return request({
 			url: '/bank/record',

+ 1 - 0
src/pages/bank-exam-explain/index.vue

@@ -19,6 +19,7 @@
               <div class="left-box">
                 <Header-tab-box
                   :num="questionOverNum(true)"
+                  :allNum="questionList.length"
                   @prevQuestion="prevQuestion"
                   @nextQuestion="nextQuestion"
                 ></Header-tab-box>

+ 16 - 2
src/pages/bank-report/index.vue

@@ -258,7 +258,13 @@ export default {
     this.getcourList();
     this.examWrongRecordWrongNum();
     this.bankExamNextExam();
-    await this.bankExam();
+    if (this.examType == 2) {
+      // 随机
+      await this.bankTempExam();
+    } else {
+      await this.bankExam();
+    }
+
     await this.examReport();
   },
   methods: {
@@ -412,7 +418,15 @@ export default {
         });
       });
     },
-
+    bankTempExam() {
+      return new Promise((resolve) => {
+        this.$request.bankTempExam(this.examId).then((res) => {
+          res.data.doType = 1;
+          this.examData = res.data;
+          resolve();
+        });
+      });
+    },
     examReport() {
       return new Promise((resolve) => {
         this.$request.examReport(this.recordId).then((res) => {

+ 84 - 74
src/pages/person-center/bank-record/record-list/index.vue

@@ -35,7 +35,11 @@
                           orderGoodsId: record.orderGoodsId,
                         })
                       "
-                      v-if="courseType !=  2 && record.status == 0 && record.historyExamJson"
+                      v-if="
+                        courseType != 2 &&
+                        record.status == 0 &&
+                        record.historyExamJson
+                      "
                       >继续答题</el-button
                     >
 
@@ -43,7 +47,7 @@
                       <div
                         class="btn-line__in"
                         @click="doRepeat(record)"
-                        v-if="record.status == 1"
+                        v-if="record.status == 1 && record.paperName != '随机练习'"
                       >
                         <div>重新做题</div>
                       </div>
@@ -52,8 +56,14 @@
                         @click="
                           go('/bank-exam-explain/' + record.goodsId, {
                             examId: record.examId,
-                            chapterId: courseType == 2 ? record.chapterId : record.chapterExamId,
-                            moduleId: courseType == 2 ? record.moduleId : record.moduleExamId,
+                            chapterId:
+                              courseType == 2
+                                ? record.chapterId
+                                : record.chapterExamId,
+                            moduleId:
+                              courseType == 2
+                                ? record.moduleId
+                                : record.moduleExamId,
                             orderGoodsId: record.orderGoodsId,
                           })
                         "
@@ -64,8 +74,7 @@
                       <div
                         class="btn-line__in"
                         v-if="record.status == 1"
-                        @click="doReport(record)
-                        "
+                        @click="doReport(record)"
                       >
                         <div>做题报告</div>
                       </div>
@@ -109,12 +118,12 @@ export default {
         goodsId: 0,
       },
       record: {
-        examId: '',
-        gradeId: '',
-        chapterId: '',
-        moduleId: '',
-        courseId: '',
-        sectionId: '',
+        examId: "",
+        gradeId: "",
+        chapterId: "",
+        moduleId: "",
+        courseId: "",
+        sectionId: "",
       },
       recordList: [],
       total: 0,
@@ -126,9 +135,10 @@ export default {
     this.param.chapterExamId = this.$route.query.chapterId;
     this.param.examId = this.$route.query.examId;
     this.param.goodsId = this.$route.params.goodsId;
-    this.courseType = this.$route.query.courseType
+    this.courseType = this.$route.query.courseType;
     if (this.courseType == 2) {
-      const { examId, gradeId, chapterId, moduleId, courseId, sectionId} = this.$route.query
+      const { examId, gradeId, chapterId, moduleId, courseId, sectionId } =
+        this.$route.query;
       this.record = {
         examId: +examId,
         gradeId: +gradeId,
@@ -136,12 +146,11 @@ export default {
         moduleId: +moduleId,
         courseId: +courseId,
         sectionId: +sectionId,
-      }
-      this.recordBankList()
+      };
+      this.recordBankList();
     } else {
       this.examRecordList();
     }
-    
   },
   methods: {
     go(path, query) {
@@ -156,7 +165,7 @@ export default {
       this.param.pageNum = e;
       // this.getExamRecordList();
       if (this.courseType == 2) {
-        this.recordBankList()
+        this.recordBankList();
       } else {
         this.examRecordList();
       }
@@ -169,35 +178,35 @@ export default {
     },
     recordBankList() {
       let params = {
-          examId: this.record.examId,
-          goodsId: this.param.goodsId,
-          pageNum: this.param.pageNum,
-          pageSize: this.param.pageSize
-        }
-        this.record.gradeId && (params['gradeId'] = this.record.gradeId)
-        this.record.chapterId && (params['chapterId'] = this.record.chapterId)
-        this.record.courseId && (params['courseId'] = this.record.courseId)
-        this.record.moduleId && (params['moduleId'] = this.record.moduleId)
-        this.record.sectionId && (params['sectionId'] = this.record.sectionId)
-        console.log('参数params', params)
-        this.$axios({
-          url: '/bank/record/bankList',
-          method: 'get',
-          params: params
-        }).then((res) => {
-          this.recordList = res.rows || []
-          this.total = res.total
-        })
+        examId: this.record.examId,
+        goodsId: this.param.goodsId,
+        pageNum: this.param.pageNum,
+        pageSize: this.param.pageSize,
+      };
+      this.record.gradeId && (params["gradeId"] = this.record.gradeId);
+      this.record.chapterId && (params["chapterId"] = this.record.chapterId);
+      this.record.courseId && (params["courseId"] = this.record.courseId);
+      this.record.moduleId && (params["moduleId"] = this.record.moduleId);
+      this.record.sectionId && (params["sectionId"] = this.record.sectionId);
+      console.log("参数params", params);
+      this.$axios({
+        url: "/bank/record/bankList",
+        method: "get",
+        params: params,
+      }).then((res) => {
+        this.recordList = res.rows || [];
+        this.total = res.total;
+      });
     },
     async doRepeat(section) {
       // let count = await this.examRecordCount(section.examId);
-      let count = 0
+      let count = 0;
       if (this.courseType == 2) {
-        count = await this.bankRecordDoNum(section)
+        count = await this.bankRecordDoNum(section);
       } else {
-        count = await this.examRecordCount(section.examId)
+        count = await this.examRecordCount(section.examId);
       }
-      console.log('已做的次数', count)
+      console.log("已做的次数", count);
       let answerNum = await this.getExamDetail(section.examId);
       //超过答题次数
       if (answerNum > 0 && count >= answerNum) {
@@ -217,30 +226,30 @@ export default {
         showClose: false,
       })
         .then((_) => {
-          if (this.courseType == 2){
-              this.$router.push({
-                path: "/course-exam/" + section.goodsId,
-                query: {
-                  courseId: section.courseId,
-                  gradeId: section.gradeId || 0,
-                  moduleId: section.moduleId || 0,
-                  sectionId: section.sectionId || 0,
-                  examId: section.examId,
-                  type: section.type, // 模块卷类型
-                  chapterId: section.chapterId || 0,
-                  orderGoodsId: section.orderGoodsId,
-                },
-            })
+          if (this.courseType == 2) {
+            this.$router.push({
+              path: "/course-exam/" + section.goodsId,
+              query: {
+                courseId: section.courseId,
+                gradeId: section.gradeId || 0,
+                moduleId: section.moduleId || 0,
+                sectionId: section.sectionId || 0,
+                examId: section.examId,
+                type: section.type, // 模块卷类型
+                chapterId: section.chapterId || 0,
+                orderGoodsId: section.orderGoodsId,
+              },
+            });
           } else {
-          this.$router.push({
-            path: "/bank-exam/" + section.goodsId,
-            query: {
-              orderGoodsId: section.orderGoodsId,
-              examId: section.examId,
-              moduleId: section.moduleExamId || 0,
-              chapterId: section.chapterExamId || 0,
-            },
-          });
+            this.$router.push({
+              path: "/bank-exam/" + section.goodsId,
+              query: {
+                orderGoodsId: section.orderGoodsId,
+                examId: section.examId,
+                moduleId: section.moduleExamId || 0,
+                chapterId: section.chapterExamId || 0,
+              },
+            });
           }
         })
         .catch((_) => {
@@ -311,18 +320,19 @@ export default {
             recordId: record.recordId,
             type: record.type, //type:1章卷,2节卷,3模块卷
           },
-        })
+        });
       } else {
         this.$router.push({
-            path: '/bank-report/' + record.goodsId,
-            query: {
-              chapterId: record.chapterExamId,
-              moduleId: record.moduleExamId,
-              examId: record.examId,
-              recordId: record.recordId,
-              orderGoodsId: record.orderGoodsId,
-            },
-          })
+          path: "/bank-report/" + record.goodsId,
+          query: {
+            chapterId: record.chapterExamId,
+            moduleId: record.moduleExamId,
+            examId: record.examId,
+            recordId: record.recordId,
+            orderGoodsId: record.orderGoodsId,
+            examType: record.paperName == "随机练习" ? 2 : undefined,
+          },
+        });
       }
       // go('/bank-report/' + record.goodsId, {
       //   chapterId: record.chapterExamId,