Quellcode durchsuchen

视频做题限制

En route vor 1 Jahr
Ursprung
Commit
3060149f4a
1 geänderte Dateien mit 32 neuen und 14 gelöschten Zeilen
  1. 32 14
      src/pages/course-exam/index.vue

+ 32 - 14
src/pages/course-exam/index.vue

@@ -1148,15 +1148,29 @@ export default {
     };
   },
   async mounted() {
-    this.goodsId = this.$route.params.goodsId;
-    this.examId = this.$route.query.examId;
-    this.type = this.$route.query.type;
-    this.courseId = this.$route.query.courseId;
-    this.gradeId = this.$route.query.gradeId;
-    this.moduleId = this.$route.query.moduleId;
-    this.sectionId = this.$route.query.sectionId;
-    this.chapterId = this.$route.query.chapterId;
-    this.orderGoodsId = this.$route.query.orderGoodsId;
+    this.goodsId = Number(this.$route.params.goodsId);
+    this.examId = Number(this.$route.query.examId);
+    this.type = Number(this.$route.query.type);
+    this.courseId = Number(this.$route.query.courseId);
+    this.gradeId = Number(this.$route.query.gradeId);
+    this.moduleId = Number(this.$route.query.moduleId);
+    this.sectionId = Number(this.$route.query.sectionId);
+    this.chapterId = Number(this.$route.query.chapterId);
+    this.orderGoodsId = Number(this.$route.query.orderGoodsId);
+    if (
+      (this.type == 1 && (!this.chapterId || this.chapterId === 0)) ||
+      (this.type == 3 && (!this.moduleId || this.moduleId === 0))
+    ) {
+      this.$alert("数据出现未知异常,请重进或向教务人员反馈", "提示", {
+        confirmButtonText: "返回上一页",
+        showClose: false,
+        callback: action => {
+          this.mustBack = true;
+          this.$router.go(-1);
+        }
+      });
+      return;
+    }
     await this.getGoodsDetail();
     await this.bankExam();
     this.needPhoto && (await this.getExamLearnStatus());
@@ -1980,9 +1994,9 @@ export default {
       //交卷 /bank/record/edit
       this.$request
         .bankRecordEdit({
-          moduleId: this.moduleId || 0,
-          chapterId: this.chapterId || 0,
-          sectionId: this.sectionId || 0,
+          moduleId: this.moduleId,
+          chapterId: this.chapterId,
+          sectionId: this.sectionId,
           gradeId: this.gradeId,
           courseId: this.courseId,
           orderGoodsId: this.orderGoodsId,
@@ -2098,10 +2112,14 @@ export default {
         .bankRecordEdit({
           examId: this.examId,
           goodsId: this.goodsId,
+          gradeId: this.gradeId,
           recordId: this.recordId,
           orderGoodsId: this.orderGoodsId,
-          moduleExamId: this.moduleId || 0,
-          chapterExamId: this.chapterId || 0,
+          courseId: this.courseId,
+          type: this.type,
+          moduleId: this.moduleId,
+          chapterId: this.chapterId,
+          sectionId: this.sectionId,
           status: 0,
           ...form
         })