gcj 3 vuotta sitten
vanhempi
commit
ae3b92bb03
2 muutettua tiedostoa jossa 20 lisäystä ja 18 poistoa
  1. 2 1
      src/components/Adult/Preview.vue
  2. 18 17
      src/views/courseView.vue

+ 2 - 1
src/components/Adult/Preview.vue

@@ -767,7 +767,8 @@ export default {
       }
       }
     },
     },
     saveAnswer() {
     saveAnswer() {
-      console.log(JSON.parse(JSON.stringify(this.contextData)));
+      // console.log(JSON.parse(JSON.stringify(this.contextData)));
+      return JSON.parse(JSON.stringify(this.contextData));
     },
     },
   }, // 如果页面有keep-alive缓存功能,这个函数会触发
   }, // 如果页面有keep-alive缓存功能,这个函数会触发
 };
 };

+ 18 - 17
src/views/courseView.vue

@@ -22,7 +22,7 @@
         <!-- 显示答案按钮 -->
         <!-- 显示答案按钮 -->
         <!-- <a v-if="chapterId" :class="['answerShow',isAnswerShow?'answerShowTrue':'']" @click="handleAnswerShow">显示答案</a> -->
         <!-- <a v-if="chapterId" :class="['answerShow',isAnswerShow?'answerShowTrue':'']" @click="handleAnswerShow">显示答案</a> -->
         <!-- <a class="edit-btn" @click="handleEdit">编辑</a> -->
         <!-- <a class="edit-btn" @click="handleEdit">编辑</a> -->
-        <a v-if="chapterId" :class="['answerShow']" @click="handleAnswerShow"
+        <a v-if="chapterId" :class="['answerShow']" @click="saveAnswer"
           >保存答案</a
           >保存答案</a
         >
         >
         <div v-if="chapterId" class="title-box">
         <div v-if="chapterId" class="title-box">
@@ -91,21 +91,21 @@ export default {
       treeFlag: true, // tree是否显示
       treeFlag: true, // tree是否显示
       switchvalue: true, // 生词模式
       switchvalue: true, // 生词模式
       isAnswerShow: false, // 是否显示答案
       isAnswerShow: false, // 是否显示答案
-      answer: [
-        //假数据
-        {
-          table_list: [
-            [
-              {
-                data: {
-                  Bookanswer: [],
-                },
-              },
-            ],
-          ],
-        },
-      ],
-      bookAnswerContent: JSON.stringify(this.answer),
+      // answer: [
+      //   //假数据
+      //   {
+      //     table_list: [
+      //       [
+      //         {
+      //           data: {
+      //             Bookanswer: [],
+      //           },
+      //         },
+      //       ],
+      //     ],
+      //   },
+      // ],
+      bookAnswerContent: "",
       TaskModel: "Task",
       TaskModel: "Task",
       category: "",
       category: "",
       FatherTreeData: null,
       FatherTreeData: null,
@@ -213,7 +213,8 @@ export default {
       }
       }
     },
     },
     saveAnswer() {
     saveAnswer() {
-      console.log(this.$refs.preview.saveAnswer());
+      let answer = this.$refs.preview.saveAnswer();
+      console.log(answer);
     },
     },
   },
   },
 };
 };