zhangjie 2 năm trước cách đây
mục cha
commit
5ca23e18ff

+ 0 - 1
src/modules/question/components/QuestionEditDialog.vue

@@ -155,7 +155,6 @@ export default {
       this.loading = true;
 
       this.questionModel = this.$refs.QuestionEditDetail.getData();
-      console.log(this.questionModel);
       const res = await updateQuestionApi(this.questionModel).catch(() => {});
       this.loading = false;
       if (!res) return;

+ 14 - 10
src/modules/question/components/QuestionInfoEdit.vue

@@ -50,15 +50,23 @@
       </el-form-item>
       <el-form-item label="属性列表">
         <el-tag
-          v-for="item in modalForm.quesProperties"
-          :key="item.key"
-          style="margin-right: 5px"
+          v-for="content in modalForm.quesProperties"
+          :key="content.key"
           closable
           effect="dark"
           type="primary"
-          @close="removeProperty(item)"
+          style="margin-right: 5px; margin-bottom: 5px"
+          @close="removeProperty(content)"
         >
-          {{ item.name }}
+          {{ content.courseProperty && content.courseProperty.name }}
+          <span style="margin: 0 3px">/</span>
+          {{ content.firstProperty && content.firstProperty.name }}
+          <span
+            v-if="content.secondProperty && content.secondProperty.name"
+            style="margin: 0 3px"
+            >/</span
+          >
+          {{ content.secondProperty && content.secondProperty.name }}
         </el-tag>
       </el-form-item>
     </el-form>
@@ -105,9 +113,7 @@ export default {
   computed: {
     propSelected() {
       return (
-        this.properties.coursePropertyId &&
-        this.properties.firstPropertyId &&
-        this.properties.secondPropertyId
+        this.properties.coursePropertyId && this.properties.firstPropertyId
       );
     },
   },
@@ -119,7 +125,6 @@ export default {
       let modalForm = this.$objAssign(initModalForm, this.question);
       modalForm.quesProperties.forEach((item) => {
         item.key = `${item.courseProperty.id}_${item.firstProperty.id}_${item.secondProperty.id}`;
-        item.name = `${item.courseProperty.name},${item.firstProperty.name},${item.secondProperty.name}`;
       });
       this.modalForm = modalForm;
     },
@@ -142,7 +147,6 @@ export default {
       if (!this.propSelected) return;
       const newProperty = {
         key: `${this.properties.coursePropertyId}_${this.properties.firstPropertyId}_${this.properties.secondPropertyId}`,
-        name: `${this.selection.courseProperty.name},${this.selection.firstProperty.name},${this.selection.secondProperty.name}`,
         ...this.selection,
       };
       const propertyExist = this.modalForm.quesProperties.find(

+ 1 - 1
src/modules/question/components/QuestionPreviewDialog.vue

@@ -63,7 +63,7 @@
           >
             <div class="edit-cont">
               <div class="edit-cont-title">
-                <span>{{ subQuestion.subNumber }}. </span>
+                <span>{{ subIndex + 1 }}. </span>
                 <rich-text :text-json="subQuestion.quesBody"></rich-text>
               </div>
               <div class="edit-cont-body">

+ 11 - 2
src/modules/question/views/QuestionManage.vue

@@ -315,12 +315,21 @@ export default {
       this.$refs.QuestionPreviewDialog.open();
     },
     toEditQuestion(row) {
-      this.curQuestion = {
-        ...row,
+      const courseInfo = {
         courseId: row.course.id,
         courseCode: row.course.code,
         courseName: row.course.name,
       };
+      let curQuestion = {
+        ...row,
+        ...courseInfo,
+      };
+      if (curQuestion.subQuestions && curQuestion.subQuestions.length) {
+        curQuestion.subQuestions = curQuestion.subQuestions.map((q) => {
+          return { ...q, ...courseInfo };
+        });
+      }
+      this.curQuestion = curQuestion;
 
       this.$refs.QuestionEditDialog.open();
     },