Ver Fonte

修改阅读题问题

dusenyao há 1 ano atrás
pai
commit
92e66ed539

+ 0 - 5
src/views/exercise_questions/create/components/common/QuestionMixin.js

@@ -36,10 +36,6 @@ const mixin = {
       type: Boolean,
       default: false,
     },
-    isChange: {
-      type: Boolean,
-      default: false,
-    },
   },
   components: {
     QuestionBase,
@@ -49,7 +45,6 @@ const mixin = {
   created() {
     // 题目的子题目保存
     if (this.isChild) {
-      if (this.isChange) return;
       GetQuestionInfo({ question_id: this.questionId })
         .then(({ question }) => {
           if (!question.content) return;

+ 0 - 3
src/views/exercise_questions/create/components/exercises/ReadQuestion.vue

@@ -28,7 +28,6 @@
           <component
             :is="exerciseComponents[item.type]"
             ref="exercise"
-            :is-change="change"
             :is-child="true"
             :question-id="item.id"
             @updatePreviewData="updatePreviewData(i, $event)"
@@ -119,7 +118,6 @@ export default {
   inject: ['exercise_id'],
   data() {
     return {
-      change: false, // 是否改变题目类型
       questionTypeOption,
       exerciseTypeList,
       childPreviewData: [],
@@ -177,7 +175,6 @@ export default {
     updateCurQuestionType(i, arr) {
       let type = arr[arr.length - 1];
       this.data.question_list[i].type = type;
-      this.change = true;
       this.data.question_list[i].additional_type = type === 'select' ? 'single' : '';
     },
 

+ 15 - 15
src/views/exercise_questions/create/components/exercises/SelectQuestion.vue

@@ -184,22 +184,22 @@ export default {
         .map((item) => item.trim())
         .filter((item) => item);
 
-      if (arr.length > 0) {
-        let sliceLength = 0;
-        if (arr[0].substring(0, 3) === '题干:') {
-          this.data.stem = arr[0].substring(3);
-          sliceLength += 1;
-        }
-        if (arr.slice(sliceLength)[0] && arr.slice(sliceLength)[0].substring(0, 3) === '提示:') {
-          this.data.description = arr.slice(sliceLength)[0].substring(3);
-          this.data.property.is_enable_description = 'true';
-          sliceLength += 1;
-        } else {
-          this.data.description = '';
-          this.data.property.is_enable_description = 'false';
-        }
-        this.data.option_list = arr.slice(sliceLength).map((content) => getOption(content));
+      if (arr.length <= 0) return;
+
+      let sliceLength = 0;
+      if (arr[0].substring(0, 3) === '题干:') {
+        this.data.stem = arr[0].substring(3);
+        sliceLength += 1;
+      }
+      if (arr.slice(sliceLength)[0] && arr.slice(sliceLength)[0].substring(0, 3) === '提示:') {
+        this.data.description = arr.slice(sliceLength)[0].substring(3);
+        this.data.property.is_enable_description = 'true';
+        sliceLength += 1;
+      } else {
+        this.data.description = '';
+        this.data.property.is_enable_description = 'false';
       }
+      this.data.option_list = arr.slice(sliceLength).map((content) => getOption(content));
     },
     changeSelectType(val) {
       if (val === selectTypeList[0].value && this.data.answer.answer_list.length > 1) {