Forráskód Böngészése

更新Picture模版

gcj 3 éve
szülő
commit
b57ac3bf16

+ 11 - 9
src/components/Adult/Preview.vue

@@ -690,15 +690,17 @@ export default {
               if (Bookanswer) {
                 // let answerData = JSON.parse(_this.bookAnswerContent);
                 let answerData = JSON.parse(Bookanswer);
-                itemss.data.Bookanswer =
-                  answerData.length > 0 &&
-                  answerData[index].table_list &&
-                  answerData[index].table_list.length > 0 &&
-                  answerData[index].table_list[indexs].length > 0 &&
-                  answerData[index].table_list[indexs][indexss].data
-                    ? answerData[index].table_list[indexs][indexss].data
-                        .Bookanswer
-                    : [];
+                if (answerData) {
+                  itemss.data.Bookanswer =
+                    answerData.length > 0 &&
+                    answerData[index].table_list &&
+                    answerData[index].table_list.length > 0 &&
+                    answerData[index].table_list[indexs].length > 0 &&
+                    answerData[index].table_list[indexs][indexss].data
+                      ? answerData[index].table_list[indexs][indexss].data
+                          .Bookanswer
+                      : [];
+                }
               }
             });
           });

+ 6 - 3
src/components/Adult/common/HzModule.vue

@@ -110,7 +110,7 @@
         class="adult-book-input"
         :autosize="{ minRows: 2 }"
         placeholder="请输入答案"
-        v-model="curQue.correct[0].input[index]"
+        v-model="curQue.correct[0].input[0]"
         @blur="onBlurCorrect(curQue.correct[0].input, 0)"
         maxlength="200"
         show-word-limit
@@ -128,7 +128,7 @@
         :autosize="{ minRows: 2 }"
         placeholder="请输入答案"
         v-model="curQue.correct[0].input[1]"
-        @blur="onBlurCorrect(curQue.correct[1].input, 1)"
+        @blur="onBlurCorrect(curQue.correct[0].input, 1)"
         maxlength="200"
         show-word-limit
       ></el-input>
@@ -224,7 +224,10 @@ export default {
       this.$set(this.curQueItem[field], index, res);
     },
     onBlurCorrect(item, index) {
-      item[index] = item[index].trim();
+      if (item[index]) {
+        item[index] = item[index].trim();
+        this.$forceUpdate();
+      }
     },
     //   删除当前选项
     deleteOption() {

+ 10 - 4
src/components/Adult/inputModules/Picture.vue

@@ -51,7 +51,7 @@
 import HzModule from "../common/HzModule.vue";
 export default {
   components: { HzModule },
-  props: ["curQue", "fn_data", "changeCurQue","type"],
+  props: ["curQue", "fn_data", "changeCurQue", "type"],
   data() {
     return {
       checkList: [],
@@ -69,9 +69,9 @@ export default {
             isChecked: "",
             isJudge: "",
             correctInput: "",
-            pinyinSite:"",
-            hanziSite:"",
-            RecordControl:"", //选择 音频控件
+            pinyinSite: "",
+            hanziSite: "",
+            RecordControl: "", //选择 音频控件
           },
         ],
         correct: [
@@ -126,6 +126,12 @@ export default {
             isFn: false,
             isDisable: false,
           },
+          {
+            type: "image_gdcy",
+            name: "固定词语",
+            isFn: false,
+            isDisable: false,
+          },
         ],
         numberList: {
           type: "number",

+ 13 - 14
src/components/Adult/preview/Picture.vue

@@ -64,9 +64,9 @@
       >
         <input
           class="singleInput"
-          v-model="curQue.Bookanswer[0].input"
+          v-model="curQue.Bookanswer[0].input[0]"
           placeholder="输入"
-          @blur="handleInput('input')"
+          @blur="handleInput('input', 0)"
         />
       </template>
       <!-- <input class="singleInput" placeholder="输入" @blur="handleInput(index,indexs)" v-if="fn_list_obj[index]&&fn_list_obj[index].indexOf('input')>-1"> -->
@@ -75,9 +75,9 @@
         <div class="fill-box">
           <b v-if="items.hanzi">{{ items.hanzi }}</b>
           <input
-            v-model="curQue.Bookanswer[0].input"
+            v-model="curQue.Bookanswer[0].input[0]"
             placeholder="输入"
-            @blur="handleInput('input')"
+            @blur="handleInput('input', 0)"
           />
         </div>
       </template>
@@ -86,13 +86,13 @@
         <div class="DoubleInput-box">
           <input
             placeholder="输入"
-            @blur="handleInput('dInput', 0)"
-            v-model="curQue.Bookanswer[0].dInput[0]"
+            @blur="handleInput('input', 0)"
+            v-model="curQue.Bookanswer[0].input[0]"
           />
           <input
             placeholder="输入"
-            @blur="handleInput('dInput', 1)"
-            v-model="curQue.Bookanswer[0].dInput[1]"
+            @blur="handleInput('input', 1)"
+            v-model="curQue.Bookanswer[0].input[1]"
           />
         </div>
       </template>
@@ -169,8 +169,8 @@ export default {
       fn_list_obj: "",
       answer: [],
       userAnswer: {
-        input: "", // 输入
-        dInput: ["", ""], //双输入
+        input: [], // 输入
+        // dInput: ["", ""], //双输入
         judge: "", // 判断
         singleRadio: "",
         singlechecked: false,
@@ -199,7 +199,6 @@ export default {
         this.curQue.Bookanswer.push(
           JSON.parse(JSON.stringify(this.userAnswer))
         );
-        console.log(this.curQue);
       }
       let obj = "";
       this.curQue.fn_list.forEach((node) => {
@@ -229,8 +228,8 @@ export default {
     // 去掉前后空格
     handleInput(key, indexs) {
       if (indexs || indexs == 0) {
-        let res = this.userAnswer[index][indexs].trim();
-        this.$set(this.userAnswer[index], indexs, res);
+        let res = this.curQue.Bookanswer[0][key][indexs].trim();
+        this.$set(this.curQue.Bookanswer[0][key], indexs, res);
       } else {
         this.curQue.Bookanswer[0][key] = this.curQue.Bookanswer[0][key].trim();
       }
@@ -262,7 +261,7 @@ export default {
     },
     // 判断题选择
     handleSelectJudge(obj) {
-      this.userAnswer.judge = obj;
+      this.curQue.Bookanswer[0].judge = obj;
     },
     handleWav(list, tmIndex) {
       tmIndex = tmIndex ? tmIndex : 0;