natasha 3 年之前
父節點
當前提交
f1bf7f2e44
共有 2 個文件被更改,包括 23 次插入11 次删除
  1. 1 1
      src/components/Adult/inputModules/Table.vue
  2. 22 10
      src/components/Adult/preview/TableView.vue

+ 1 - 1
src/components/Adult/inputModules/Table.vue

@@ -276,7 +276,7 @@
 <script>
 import Upload from "../common/Upload.vue";
 export default {
-  name: "table",
+  name: "tableView",
   props: ["curQue", "fn_data", "changeCurQue"],
   components: { Upload },
   data() {

+ 22 - 10
src/components/Adult/preview/TableView.vue

@@ -20,11 +20,11 @@
             :key="'col' + colIndex"
             :style="{ width: curQue.colWidthList[colIndex].width + '%',textAlign:(curQue.align?curQue.align:'center') }"
           >
-            <template v-if="!col.isNumll">
+            <template v-if="!col.isNull">
               {{ col.con }}
             </template>
             <template v-else>
-                <div v-html="col.con" contenteditable="true" placeholder="输入" class="input"></div>
+                <div v-html="curQue.Bookanswer[rowIndex][colIndex]" contenteditable="true" placeholder="输入" class="input"></div>
               <!-- <input type="text" v-model="col.con" /> -->
             </template>
           </td>
@@ -58,7 +58,7 @@ export default {
   components: {
     Soundrecord,
   },
-  props: ["curQue"],
+  props: ["curQue","Bookanswer"],
   data() {
     //这里存放数据
     return {};
@@ -73,13 +73,25 @@ export default {
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
-    this.curQue.option.forEach((item) => {
-      item.forEach((it) => {
-        if (it.con == "") {
-          it.isNumll = true;
-        }
-      });
-    });
+      if (!this.curQue.Bookanswer) {
+        let curCorrect = [];
+        this.curQue.option.forEach((item) => {
+            let curCorrectItem = []
+            item.forEach((it)=>{
+                if (it.con == "") {
+                    curCorrectItem.push('')
+                    it.isNull = true
+                }else{
+                    curCorrectItem.push(null)
+                }
+            })
+            curCorrect.push(curCorrectItem)
+        });
+        this.$set(this.curQue, "Bookanswer", curCorrect);
+      } else {
+        let curCorrect = JSON.parse(JSON.stringify(this.Bookanswer));
+        this.$set(this.curQue, "Bookanswer", curCorrect);
+      }
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {},