Explorar el Código

题库bug提交

weiwenhai hace 6 años
padre
commit
acd9a3f854

+ 6 - 1
src/modules/questions/views/GenPaper.vue

@@ -418,7 +418,12 @@ export default {
       var courseNo = this.formSearch.courseNo;
       this.getCourseName(courseNo);
       var level = this.formSearch.level;
-      if (!courseNo) {
+      if (!level) {
+        this.$notify({
+          message: "请选择课程层次",
+          type: "error"
+        });
+      } else if (!courseNo) {
         this.$notify({
           message: "请选择课程",
           type: "error"

+ 47 - 24
src/modules/questions/views/InsertPaperStructureInfo.vue

@@ -43,9 +43,12 @@
           </el-col>
           <el-col :span="6">
             <el-form-item label="题目数量" prop="count">
-              <el-button @click="propertyDialog = true">
-                {{ paperUnitForm.count }}
-              </el-button>
+              <el-input 
+                class="search_width"
+                v-model.number="paperUnitForm.count" 
+                :disabled="true">
+              </el-input>
+              <el-button @click="propertyDialog = true" icon="el-icon-plus"></el-button>
             </el-form-item>
           </el-col>
         </el-row>
@@ -883,7 +886,7 @@ export default {
           }
           unitStruct.id = maxId + 1;
           this.unitStructs.push(unitStruct);
-          this.resetForm();
+          this.resetForm(formData);
           this.setUnits();
           sessionStorage.setItem(
             "paperStruct",
@@ -928,26 +931,28 @@ export default {
       });
     },
     //重置
-    resetForm() {
-      this.paperUnitForm = {
-        id: "",
-        questionType: "",
-        count: 0,
-        score: "",
-        totalScore: "",
-        quesNames: [],
-        publicSimple: 0,
-        publicMedium: 0,
-        publicDifficulty: 0,
-        noPublicSimple: 0,
-        noPublicMedium: 0,
-        noPublicDifficulty: 0,
-        publicSum: 0,
-        noPublicSum: 0,
-        simpleSum: 0,
-        mediumSum: 0,
-        difficultySum: 0
-      };
+    resetForm(formData) {
+      this.$refs[formData].resetFields();
+      //this.$refs[formData].clearValidate();
+      // this.paperUnitForm = {
+      //   id: "",
+      //   questionType: "",
+      //   count: 0,
+      //   score: "",
+      //   totalScore: "",
+      //   quesNames: [],
+      //   publicSimple: 0,
+      //   publicMedium: 0,
+      //   publicDifficulty: 0,
+      //   noPublicSimple: 0,
+      //   noPublicMedium: 0,
+      //   noPublicDifficulty: 0,
+      //   publicSum: 0,
+      //   noPublicSum: 0,
+      //   simpleSum: 0,
+      //   mediumSum: 0,
+      //   difficultySum: 0
+      // };
     },
     //返回
     back() {
@@ -1119,6 +1124,24 @@ export default {
         paperUnitForm.totalScore =
           (paperUnitForm.score * 1000 * paperUnitForm.count) / 1000;
       }, 5);
+      if(this.clearCheck(paperUnitForm.count)){
+        this.$refs['paperUnitForm'].clearValidate('count');
+      }
+    },
+    clearCheck(value){
+      var reg = /^\d+(?=\.{0,1}\d+$|$)/;
+      if (!value) {
+        return true;
+      }
+      if (!reg.test(value)) {
+        return true;
+      } else {
+        if (value < 0) {
+          return true;
+        } else {
+          return false;
+        }
+      }
     }
   },
   computed: {

+ 9 - 1
src/modules/questions/views/InsertPaperTitle.vue

@@ -199,6 +199,8 @@ export default {
         .get(QUESTION_API + "/paperDetail/paper/" + this.paperTitleForm.paperId)
         .then(response => {
           this.detailsData = response.data;
+          console.log("response.data:", response.data);
+          console.log("this.detailsData:", this.detailsData);
           for (var i = 0; i < this.detailsData.length; i++) {
             if (!this.detailsData[i].name) {
               this.detailsData[i].name = "默认大题";
@@ -234,7 +236,6 @@ export default {
                 this.paperForm.name
             )
             .then(response => {
-              console.log("需要查到的课程id:", response);
               var paperId = response.data.paper.id;
               this.$http
                 .get(
@@ -246,6 +247,7 @@ export default {
                   this.tableData = response.data.content;
                   this.paperTitleForm.paperDetailId = "";
                   this.paperTitleForm.paperId = paperId;
+                  this.searchPaperDetail();
                 });
               this.paperDialog = false;
             })
@@ -303,6 +305,12 @@ export default {
       }
     },
     paperDetailDisable() {
+      console.log(
+        "this.paperTitleForm.courseNo:",
+        this.paperTitleForm.courseNo
+      );
+      console.log("this.paperTitleForm.paperId:", this.paperTitleForm.paperId);
+      console.log("this.detailsData.length:", this.detailsData.length);
       if (
         this.paperTitleForm.courseNo &&
         this.paperTitleForm.paperId &&