Procházet zdrojové kódy

Merge branch 'master' into NPC-lhd

natasha před 3 roky
rodič
revize
b930208f38

+ 16 - 0
src/components/Adult/preview/ArticleViewChs/PhraseModelChs.vue

@@ -175,6 +175,9 @@
           :changeWordCard="changeWordCard"
           :themeColor="themeColor"
           :currentTreeID="currentTreeID"
+          :TaskModel="TaskModel"
+          :writeList="curQue.Bookanswer.writeModel"
+          @changeCurQue="changeCurQue"
         />
       </div>
     </template>
@@ -195,6 +198,7 @@ export default {
     "noFont",
     "currentTreeID",
     "config",
+    "TaskModel",
   ],
   components: {
     AudioLine,
@@ -439,6 +443,18 @@ export default {
     getScreenHeight() {
       this.screenHeight = window.innerHeight;
     },
+    changeCurQue(answer) {
+      if (answer) {
+        let writeModel = this.curQue.Bookanswer.writeModel;
+        let hz = answer.hz;
+        if (writeModel.hasOwnProperty(hz)) {
+          writeModel[hz].push(answer);
+        } else {
+          writeModel[hz] = [answer];
+        }
+        console.log(this.curQue.Bookanswer);
+      }
+    },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {},

+ 35 - 2
src/components/Adult/preview/ArticleViewChs/Practicechs.vue

@@ -246,12 +246,19 @@
           >
             <div class="Soundrecord-content-inner">
               <Soundrecord
-                @handleWav="handleWav"
                 type="promax"
                 class="luyin-box"
                 @getWavblob="getWavblob"
                 @handleParentPlay="handleParentPlay"
                 @sentPause="sentPause"
+                :TaskModel="TaskModel"
+                :answerRecordList="
+                  curQue.Bookanswer.practiceModel[index] &&
+                  curQue.Bookanswer.practiceModel[index].recordList
+                "
+                :tmIndex="index"
+                @handleWav="handleWav"
+                v-if="refresh"
               />
               <div
                 class="compare-box"
@@ -289,6 +296,8 @@
         :NNPENewWordList="NNPENewWordList"
         :currentTreeID="currentTreeID"
         :config="config"
+        :TaskModel="TaskModel"
+        @handleWav="handleWav"
         @changePinyin="changePinyin"
         @changeEN="changeEN"
         @exitFullscreen="exitFullscreen"
@@ -335,6 +344,7 @@ export default {
       isFull: false,
       mathNum: Math.random().toString(36).substr(2),
       ed: undefined,
+      refresh: true,
     };
   },
   computed: {
@@ -355,6 +365,19 @@ export default {
       },
       deep: true,
     },
+    isFull: {
+      handler: function (newVal, oldVal) {
+        let _this = this;
+        _this.refresh = false;
+        if (!newVal) {
+          _this.$nextTick(() => {
+            // 重新渲染组件
+            _this.refresh = true;
+          });
+        }
+      },
+      deep: true,
+    },
   },
   //方法集合
   methods: {
@@ -580,7 +603,17 @@ export default {
     emptyEd() {
       this.ed = undefined;
     },
-    handleWav(data) {},
+    handleWav(list, tmIndex) {
+      tmIndex = tmIndex ? tmIndex : 0;
+      this.curQue.Bookanswer.practiceModel[tmIndex] = {
+        recordList: [],
+      };
+      this.$set(
+        this.curQue.Bookanswer.practiceModel[tmIndex],
+        "recordList",
+        list
+      );
+    },
     // 录音时暂停音频播放
     handleParentPlay() {
       this.stopAudio = true;

+ 16 - 0
src/components/Adult/preview/ArticleViewChs/WordModelChs.vue

@@ -180,6 +180,9 @@
           :changeWordCard="changeWordCard"
           :themeColor="themeColor"
           :currentTreeID="currentTreeID"
+          :TaskModel="TaskModel"
+          :writeList="curQue.Bookanswer.writeModel"
+          @changeCurQue="changeCurQue"
         />
       </div>
     </template>
@@ -199,6 +202,7 @@ export default {
     "themeColor",
     "currentTreeID",
     "config",
+    "TaskModel",
   ],
   components: {
     AudioLine,
@@ -432,6 +436,18 @@ export default {
     getScreenHeight() {
       this.screenHeight = window.innerHeight;
     },
+    changeCurQue(answer) {
+      if (answer) {
+        let writeModel = this.curQue.Bookanswer.writeModel;
+        let hz = answer.hz;
+        if (writeModel.hasOwnProperty(hz)) {
+          writeModel[hz].push(answer);
+        } else {
+          writeModel[hz] = [answer];
+        }
+        console.log(this.curQue.Bookanswer);
+      }
+    },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {},

+ 12 - 2
src/components/Adult/preview/DialogueArticleViewChs/NormalModelChs.vue

@@ -281,7 +281,13 @@
           <div class="empty-right"></div>
         </div>
         <div class="dia-article-record">
-          <Soundrecord @handleWav="handleWav" type="promax" class="luyin-box" />
+          <Soundrecord
+            type="promax"
+            class="luyin-box"
+            :TaskModel="TaskModel"
+            :answerRecordList="curQue.Bookanswer.normalModel.recordList"
+            @handleWav="handleWav"
+          />
         </div>
       </div>
     </template>
@@ -314,6 +320,7 @@ export default {
     "bodyWidth",
     "noFont",
     "config",
+    "TaskModel",
   ],
   components: {
     AudioLine,
@@ -443,7 +450,10 @@ export default {
         this.$emit("changeConfig", "isShowEN");
       }
     },
-    handleWav() {},
+    handleWav(list, tmIndex) {
+      tmIndex = tmIndex ? tmIndex : 0;
+      this.$set(this.curQue.Bookanswer.normalModel, "recordList", list);
+    },
     getCurTime(curTime) {
       this.curTime = curTime * 1000;
     },

+ 17 - 1
src/components/Adult/preview/DialogueArticleViewChs/PhraseModelChs.vue

@@ -214,7 +214,7 @@
           <div :class="['empty-left', isHasRemark ? 'hasRemark' : '']"></div>
           <div class="empty-right"></div>
         </div>
-        <div class="dia-article-record">
+        <div class="dia-article-record" v-if="1 == 2">
           <Soundrecord @handleWav="handleWav" type="promax" class="luyin-box" />
         </div>
       </div>
@@ -230,6 +230,9 @@
           :changeWordCard="changeWordCard"
           :themeColor="themeColor"
           :currentTreeID="currentTreeID"
+          :TaskModel="TaskModel"
+          :writeList="curQue.Bookanswer.writeModel"
+          @changeCurQue="changeCurQue"
         />
       </div>
     </template>
@@ -265,6 +268,7 @@ export default {
     "noFont",
     "currentTreeID",
     "config",
+    "TaskModel",
   ],
   components: {
     AudioLine,
@@ -647,6 +651,18 @@ export default {
     getScreenHeight() {
       this.screenHeight = window.innerHeight;
     },
+    changeCurQue(answer) {
+      if (answer) {
+        let writeModel = this.curQue.Bookanswer.writeModel;
+        let hz = answer.hz;
+        if (writeModel.hasOwnProperty(hz)) {
+          writeModel[hz].push(answer);
+        } else {
+          writeModel[hz] = [answer];
+        }
+        console.log(this.curQue.Bookanswer);
+      }
+    },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {},

+ 36 - 2
src/components/Adult/preview/DialogueArticleViewChs/Practicechs.vue

@@ -338,12 +338,19 @@
           <div v-show="sentIndex == index" class="Soundrecord-content">
             <div class="Soundrecord-content-inner">
               <Soundrecord
-                @handleWav="handleWav"
                 type="promax"
                 class="luyin-box"
                 @getWavblob="getWavblob"
                 @handleParentPlay="handleParentPlay"
                 @sentPause="sentPause"
+                :TaskModel="TaskModel"
+                :answerRecordList="
+                  curQue.Bookanswer.practiceModel[index] &&
+                  curQue.Bookanswer.practiceModel[index].recordList
+                "
+                :tmIndex="index"
+                @handleWav="handleWav"
+                v-if="refresh"
               />
               <div
                 class="compare-box"
@@ -383,6 +390,8 @@
         :currentTreeID="currentTreeID"
         :isFull="isFull"
         :config="config"
+        :TaskModel="TaskModel"
+        @handleWav="handleWav"
         @changePinyin="changePinyin"
         @changeEN="changeEN"
         @exitFullscreen="exitFullscreen"
@@ -409,6 +418,7 @@ export default {
     "config",
     "NNPENewWordList",
     "currentTreeID",
+    "TaskModel",
   ],
   components: {
     AudioLine,
@@ -478,6 +488,7 @@ export default {
       isFull: false,
       mathNum: Math.random().toString(36).substr(2),
       ed: undefined,
+      refresh: true,
     };
   },
   computed: {
@@ -498,6 +509,19 @@ export default {
       },
       deep: true,
     },
+    isFull: {
+      handler: function (newVal, oldVal) {
+        let _this = this;
+        _this.refresh = false;
+        if (!newVal) {
+          _this.$nextTick(() => {
+            // 重新渲染组件
+            _this.refresh = true;
+          });
+        }
+      },
+      deep: true,
+    },
   },
   //方法集合
   methods: {
@@ -727,7 +751,17 @@ export default {
     emptyEd() {
       this.ed = undefined;
     },
-    handleWav(data) {},
+    handleWav(list, tmIndex) {
+      tmIndex = tmIndex ? tmIndex : 0;
+      this.curQue.Bookanswer.practiceModel[tmIndex] = {
+        recordList: [],
+      };
+      this.$set(
+        this.curQue.Bookanswer.practiceModel[tmIndex],
+        "recordList",
+        list
+      );
+    },
     // 录音时暂停音频播放
     handleParentPlay() {
       this.stopAudio = true;

+ 16 - 0
src/components/Adult/preview/DialogueArticleViewChs/WordModelChs.vue

@@ -227,6 +227,9 @@
           :changeWordCard="changeWordCard"
           :themeColor="themeColor"
           :currentTreeID="currentTreeID"
+          :TaskModel="TaskModel"
+          :writeList="curQue.Bookanswer.writeModel"
+          @changeCurQue="changeCurQue"
         />
       </div>
     </template>
@@ -261,6 +264,7 @@ export default {
     "noFont",
     "currentTreeID",
     "config",
+    "TaskModel",
   ],
   components: {
     AudioLine,
@@ -667,6 +671,18 @@ export default {
       _this.oldNoteNum = "";
       _this.noteNum = "";
     },
+    changeCurQue(answer) {
+      if (answer) {
+        let writeModel = this.curQue.Bookanswer.writeModel;
+        let hz = answer.hz;
+        if (writeModel.hasOwnProperty(hz)) {
+          writeModel[hz].push(answer);
+        } else {
+          writeModel[hz] = [answer];
+        }
+        console.log(this.curQue.Bookanswer);
+      }
+    },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {},

+ 24 - 6
src/components/Adult/preview/DialogueArticleViewChs/index.vue

@@ -3,7 +3,7 @@
   <div
     class="NPC-ArticleView NPC-ArticleView-container"
     id="articleBoby"
-    v-if="curQue"
+    v-if="curQue && curQue.Bookanswer"
   >
     <div class="ArticleView-header">
       <!-- <a :class="['ArticleView-full']" v-if="showPractice" @click="goFullscreen"
@@ -67,6 +67,7 @@
         :themeColor="themeColor"
         :noFont="noFont"
         :config="config"
+        :TaskModel="TaskModel"
         @changeConfig="changeConfig"
         v-if="!showPhrases && !showPractice && !showWord"
       />
@@ -82,6 +83,7 @@
         :currentTreeID="currentTreeID"
         :bodyLeft="bodyLeft"
         :config="config"
+        :TaskModel="TaskModel"
         @changeConfig="changeConfig"
         v-if="showPhrases"
       />
@@ -95,6 +97,7 @@
         :currentTreeID="currentTreeID"
         :NNPENewWordList="NNPENewWordList"
         :config="config"
+        :TaskModel="TaskModel"
         @changeConfig="changeConfig"
         v-if="showPractice"
       />
@@ -110,6 +113,7 @@
         :noFont="noFont"
         :currentTreeID="currentTreeID"
         :config="config"
+        :TaskModel="TaskModel"
         @changeConfig="changeConfig"
         v-if="showWord"
       />
@@ -132,6 +136,7 @@ export default {
     "colorBox",
     "themeColor",
     "currentTreeID",
+    "TaskModel",
   ],
   components: { NormalModelChs, Practice, WordModel, PhraseModel },
   data() {
@@ -153,6 +158,13 @@ export default {
         isShowPY: false,
         isHasPY: false,
       },
+      userAnswer: {
+        normalModel: {
+          recordList: [],
+        },
+        writeModel: {}, //生词/取词模式
+        practiceModel: {}, //练习模式
+      },
     };
   },
   computed: {
@@ -223,13 +235,20 @@ export default {
   created() {},
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
+    let _this = this;
+    console.log(_this.TaskModel);
+    if (!_this.curQue.Bookanswer) {
+      let userAnswer = JSON.parse(JSON.stringify(_this.userAnswer));
+      _this.$set(this.curQue, "Bookanswer", userAnswer);
+    }
     console.log("我是文章预览");
     console.log(this.curQue);
-    if (this.curQue) {
-      this.$nextTick(() => {
-        this.bodyLeft = this.$refs.ArticleViewbody.getBoundingClientRect().left;
+    if (_this.curQue) {
+      _this.$nextTick(() => {
+        _this.bodyLeft =
+          _this.$refs.ArticleViewbody.getBoundingClientRect().left;
       });
-      for (let i = 0; i < this.curQue.detail.length; i++) {
+      for (let i = 0; i < _this.curQue.detail.length; i++) {
         let enStr = this.curQue.detail[i].sentencesEn.join("");
         if (enStr) {
           this.config.isShowEN = true;
@@ -245,7 +264,6 @@ export default {
         }
       }
     }
-    console.log(this.NNPENewWordList);
   },
   beforeCreate() {}, //生命周期 - 创建之前
   beforeMount() {}, //生命周期 - 挂载之前

+ 35 - 3
src/components/Adult/preview/NewWordShow.vue

@@ -61,7 +61,7 @@
           >
             <div
               class="strockplay-newWord"
-              @click="freeWrite(items, index, indexs + 1)"
+              @click="freeWrite(items, index, indexs)"
             >
               <!-- <div
                 @click.stop="playHanzi(index, indexs, items)"
@@ -110,6 +110,10 @@
         :rowIndex="activeIndex"
         :colIndex="activeColIndex"
         :closeifFreeShow="closeifFreeShow"
+        :TaskModel="TaskModel"
+        :writeList="curQue.Bookanswer.writeModel"
+        @changeCurQue="changeCurQue"
+        @deleteWriteRecord="deleteWriteRecord"
       />
     </div>
   </div>
@@ -123,7 +127,7 @@ import { getContentFile, LearnWebSI } from "../../../api/ajax";
 import FreeWriteQP from "./components/FreeWriteQP.vue";
 export default {
   components: { Strockplayredline, Practice, FreewriteLettle, FreeWriteQP },
-  props: ["curQue", "themeColor", "indexStr", "currentTreeID"],
+  props: ["curQue", "themeColor", "indexStr", "currentTreeID", "TaskModel"],
   data() {
     return {
       isPraShow: false,
@@ -135,6 +139,9 @@ export default {
       currentHz: "", //当前汉字
       currenHzData: null, //当前汉字数据
       playStatus: false, //播放状态
+      userAnswer: {
+        writeModel: {}, //生词/取词模式
+      },
     };
   },
   computed: {},
@@ -205,6 +212,7 @@ export default {
           }
         });
       });
+      console.log(this.curQue.option);
     },
     changePraShow() {
       this.isPraShow = false;
@@ -245,11 +253,35 @@ export default {
       this.activeColIndex = indexs;
       this.currentHz = this.curQue.option[index].con;
       this.currenHzData = imgUrl;
-      console.log(this.currenHzData);
+      //console.log(this.currenHzData);
+    },
+    //删除记录
+    deleteWriteRecord(rowIndex, colIndex) {
+      this.$set(this.curQue.option[rowIndex].imgarr, colIndex, {});
+    },
+    changeCurQue(answer, rowIndex) {
+      if (answer) {
+        let writeModel = this.curQue.Bookanswer.writeModel;
+        let hz = answer.hz;
+        if (writeModel.hasOwnProperty(hz)) {
+          writeModel[hz][rowIndex] = answer;
+        } else {
+          writeModel[hz] = [];
+          for (let i = 0; i < 6; i++) {
+            writeModel[hz].push(null);
+          }
+          writeModel[hz][0] = answer;
+        }
+        console.log(this.curQue.Bookanswer);
+      }
     },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
+    let _this = this;
+    if (!_this.curQue.Bookanswer) {
+      _this.curQue.Bookanswer = JSON.parse(JSON.stringify(_this.userAnswer));
+    }
     this.handleData();
   },
   //生命周期 - 挂载完成(可以访问DOM元素)

+ 1 - 0
src/components/Adult/preview/Picture.vue

@@ -160,6 +160,7 @@
         <Soundrecord
           @handleWav="handleWav"
           :answerRecordList="curQue.Bookanswer[0].recordList"
+          :TaskModel="TaskModel"
           :type="items.RecordControl ? items.RecordControl : 'normal'"
           class="luyin-box"
           :class="[items.RecordControl]"

+ 101 - 74
src/components/Adult/preview/Soundrecord.vue

@@ -3,7 +3,11 @@
   <div class="NNPE-Book-record">
     <template v-if="(type && type == 'normal') || (type && type == 'mini')">
       <div
-        :class="['record', microphoneStatus ? 'active' : '', !TaskModel||TaskModel!='ANSWER'?'':'notAllow']"
+        :class="[
+          'record',
+          microphoneStatus ? 'active' : '',
+          !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow',
+        ]"
         @click="microphone"
       />
       <span
@@ -30,7 +34,11 @@
     </template>
     <template v-else-if="type && type == 'pro'">
       <div
-        :class="['record', microphoneStatus ? 'active' : '', !TaskModel||TaskModel!='ANSWER'?'':'notAllow']"
+        :class="[
+          'record',
+          microphoneStatus ? 'active' : '',
+          !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow',
+        ]"
         @click="microphone"
       />
       <el-select
@@ -41,7 +49,7 @@
       >
         <el-option
           v-for="(item, index) in recordList"
-          :key="'select'+item.id"
+          :key="'select' + item.id"
           :label="item.name"
           :value="index"
         />
@@ -57,13 +65,23 @@
         "
       />
       <a
-        :class="['record-delete', hasMicro&&(!TaskModel||TaskModel!='ANSWER') ? 'record-delete-has' : '', !TaskModel||TaskModel!='ANSWER'?'':'notAllow']"
+        :class="[
+          'record-delete',
+          hasMicro && (!TaskModel || TaskModel != 'ANSWER')
+            ? 'record-delete-has'
+            : '',
+          !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow',
+        ]"
         @click="handleDelete"
       />
     </template>
     <template v-else>
       <div
-        :class="['record', microphoneStatus ? 'active' : '', !TaskModel||TaskModel!='ANSWER'?'':'notAllow']"
+        :class="[
+          'record',
+          microphoneStatus ? 'active' : '',
+          !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow',
+        ]"
         @click="microphone"
       />
       <span
@@ -81,7 +99,7 @@
       >
         <el-option
           v-for="(item, index) in recordList"
-          :key="'selectbig' + item.id + index "
+          :key="'selectbig' + item.id + index"
           :label="item.name"
           :value="index"
         />
@@ -97,7 +115,13 @@
         "
       />
       <a
-        :class="['record-delete', hasMicro&&(!TaskModel||TaskModel!='ANSWER') ? 'record-delete-has' : '', !TaskModel||TaskModel!='ANSWER'?'':'notAllow']"
+        :class="[
+          'record-delete',
+          hasMicro && (!TaskModel || TaskModel != 'ANSWER')
+            ? 'record-delete-has'
+            : '',
+          !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow',
+        ]"
         @click="handleDelete"
       />
     </template>
@@ -115,7 +139,7 @@ export default {
     "selectData",
     "tmIndex",
     "answerRecordList",
-    "TaskModel"
+    "TaskModel",
   ],
   data() {
     return {
@@ -154,9 +178,12 @@ export default {
   // 生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
     let _this = this;
-    _this.recordList = _this.answerRecordList ? JSON.parse(JSON.stringify(_this.answerRecordList)) : [];
+    _this.recordList = _this.answerRecordList
+      ? JSON.parse(JSON.stringify(_this.answerRecordList))
+      : [];
     if (_this.recordList.length > 0) {
       _this.selectIndex = 0;
+      _this.recordFile = _this.recordList.length + 1;
       _this.handleChangeRecord(0);
     }
     _this.audio.addEventListener("play", function () {
@@ -183,65 +210,65 @@ export default {
     // 开始录音
     microphone() {
       let _this = this;
-      if(!this.TaskModel||this.TaskModel!='ANSWER'){
-          if (!_this.microphoneStatus) {
-            _this.hasMicro = "";
-            _this.$root.isRecording = true;
-            _this.$emit("getWavblob", null);
-            this.$emit("getSelectData", { type: "" });
-            // 开始录音
-            this.recorder.start();
-            this.microphoneStatus = true;
-            this.recordtime = 0;
-            this.isPlaying = false;
-            clearInterval(_this.timer);
-                _this.timer = setInterval(() => {
-                _this.recordtime++;
-            }, 1000);
-            this.$emit("handleParentPlay");
-            let obj = {
-                name: _this.fileName
-                    ? _this.fileName + _this.recordFile
-                    : "新录音" + _this.recordFile,
-                id: _this.recordFile + Math.round(Math.random() * 10),
-            };
-            if (this.selectData) obj.selectData = this.selectData;
-                _this.recordList.push(obj);
+      if (!this.TaskModel || this.TaskModel != "ANSWER") {
+        if (!_this.microphoneStatus) {
+          _this.hasMicro = "";
+          _this.$root.isRecording = true;
+          _this.$emit("getWavblob", null);
+          this.$emit("getSelectData", { type: "" });
+          // 开始录音
+          this.recorder.start();
+          this.microphoneStatus = true;
+          this.recordtime = 0;
+          this.isPlaying = false;
+          clearInterval(_this.timer);
+          _this.timer = setInterval(() => {
+            _this.recordtime++;
+          }, 1000);
+          this.$emit("handleParentPlay");
+          let obj = {
+            name: _this.fileName
+              ? _this.fileName + _this.recordFile
+              : "新录音" + _this.recordFile,
+            id: _this.recordFile + Math.round(Math.random() * 10),
+          };
+          if (this.selectData) obj.selectData = this.selectData;
+          _this.recordList.push(obj);
 
-                _this.recordFile++;
-                _this.selectIndex = _this.recordList.length - 1;
-            } else {
-                this.hasMicro = "normal";
-                this.recorder.stop();
-                _this.$root.isRecording = false;
-                clearInterval(_this.timer);
-                let toltime = this.recorder.duration; // 录音总时长
-                let fileSize = this.recorder.fileSize; // 录音总大小
-                // 录音结束,获取取录音数据
-                let PCMBlob = this.recorder.getPCMBlob(); // 获取 PCM 数据
-                let wav = this.recorder.getWAVBlob(); // 获取 WAV 数据
-                // this.wavblob = wav;
-                this.microphoneStatus = false;
-                let reader = new window.FileReader();
-                reader.readAsDataURL(wav);
-                reader.onloadend = () => {
-                _this.recordList[_this.selectIndex].wavData = reader.result;
-                _this.recordList[_this.selectIndex].toltime = Math.floor(toltime);
-                _this.recordList[_this.selectIndex].fileSize = fileSize;
-                _this.wavblob = _this.recordList[_this.selectIndex].wavData;
-                _this.$emit("getWavblob", _this.wavblob);
-                _this.$emit(
-                    "handleWav",
-                    JSON.parse(JSON.stringify(_this.recordList)),
-                    _this.tmIndex
-                );
+          _this.recordFile++;
+          _this.selectIndex = _this.recordList.length - 1;
+        } else {
+          this.hasMicro = "normal";
+          this.recorder.stop();
+          _this.$root.isRecording = false;
+          clearInterval(_this.timer);
+          let toltime = this.recorder.duration; // 录音总时长
+          let fileSize = this.recorder.fileSize; // 录音总大小
+          // 录音结束,获取取录音数据
+          let PCMBlob = this.recorder.getPCMBlob(); // 获取 PCM 数据
+          let wav = this.recorder.getWAVBlob(); // 获取 WAV 数据
+          // this.wavblob = wav;
+          this.microphoneStatus = false;
+          let reader = new window.FileReader();
+          reader.readAsDataURL(wav);
+          reader.onloadend = () => {
+            _this.recordList[_this.selectIndex].wavData = reader.result;
+            _this.recordList[_this.selectIndex].toltime = Math.floor(toltime);
+            _this.recordList[_this.selectIndex].fileSize = fileSize;
+            _this.wavblob = _this.recordList[_this.selectIndex].wavData;
+            _this.$emit("getWavblob", _this.wavblob);
+            _this.$emit(
+              "handleWav",
+              JSON.parse(JSON.stringify(_this.recordList)),
+              _this.tmIndex
+            );
             if (this.recordList[this.selectIndex].selectData)
-                this.$emit(
+              this.$emit(
                 "getSelectData",
                 this.recordList[this.selectIndex].selectData
-                );
+              );
             //   }
-            };
+          };
         }
       }
     },
@@ -253,11 +280,11 @@ export default {
           let _this = this;
           if (!this.audio.paused) {
             this.audio.pause();
-            this.hasMicro = 'normal'
+            this.hasMicro = "normal";
             clearInterval(_this.timer);
           } else if (this.audio.paused && _this.oldIndex == _this.selectIndex) {
             _this.audio.play();
-            this.hasMicro = 'active'
+            this.hasMicro = "active";
             if (_this.recordtime == 0) {
               _this.recordtime = totalTimes;
               _this.playtime = 0;
@@ -271,7 +298,7 @@ export default {
               }
             }, 1000);
           } else {
-            _this.hasMicro = 'active'
+            _this.hasMicro = "active";
             _this.audio.pause();
             _this.audio.load();
             _this.audio.src = _this.wavblob;
@@ -334,7 +361,7 @@ export default {
     },
     handleDelete() {
       let _this = this;
-      if (_this.hasMicro&&(!this.TaskModel||this.TaskModel!='ANSWER')) {
+      if (_this.hasMicro && (!this.TaskModel || this.TaskModel != "ANSWER")) {
         if (_this.selectIndex || _this.selectIndex == 0) {
           _this.recordList.splice(_this.selectIndex, 1);
           _this.$emit(
@@ -421,11 +448,11 @@ export default {
         no-repeat;
       background-size: 100%;
     }
-    &.notAllow{
-        cursor: not-allowed;
-        background: url("../../../assets/newImage/common/luyin-notAllow.png") center
-            no-repeat;
-        background-size: 100%;
+    &.notAllow {
+      cursor: not-allowed;
+      background: url("../../../assets/newImage/common/luyin-notAllow.png")
+        center no-repeat;
+      background-size: 100%;
     }
   }
   .record-time {
@@ -462,8 +489,8 @@ export default {
         background-size: 100%;
       }
     }
-    &.notAllow{
-        cursor: not-allowed;
+    &.notAllow {
+      cursor: not-allowed;
     }
   }
 }

+ 88 - 36
src/components/Adult/preview/Soundrecorddiff.vue

@@ -1,7 +1,10 @@
 <!--  -->
 <template>
   <div class="NNPE-Book-record">
-    <div :class="['record-main', microphoneStatus ? 'active' : '']">
+    <div
+      :class="['record-main', microphoneStatus ? 'active' : '']"
+      v-if="!TaskModel || TaskModel != 'ANSWER'"
+    >
       <div class="record-main-inner" @click="microphone">
         <div class="record" />
         <span v-if="microphoneStatus" class="record-time">{{
@@ -11,7 +14,11 @@
     </div>
     <div
       v-if="!microphoneStatus && recordList.length > 0"
-      :class="['hasRecord', bgIndex == 1 ? 'hasRecord-white' : '']"
+      :class="[
+        'hasRecord',
+        bgIndex == 1 ? 'hasRecord-white' : '',
+        TaskModel == 'ANSWER' ? 'hasRecord-answer' : '',
+      ]"
     >
       <div
         :class="[bgIndex == 1 ? 'playBack-white' : 'playBack', hasMicro]"
@@ -23,13 +30,14 @@
           )
         "
       />
-      <span
-        class="record-time"
-      >{{ isPlaying ? "-" : "" }}{{ handleDateTime(recordtime) }}</span>
+      <span class="record-time"
+        >{{ isPlaying ? "-" : "" }}{{ handleDateTime(recordtime) }}</span
+      >
       <el-select
         v-model="selectIndex"
         placeholder="无录音"
         @change="handleChangeRecord"
+        :popper-append-to-body="false"
       >
         <el-option
           v-for="(item, index) in recordList"
@@ -38,7 +46,11 @@
           :value="index"
         />
       </el-select>
-      <a class="record-delete" @click="handleDelete" />
+      <a
+        class="record-delete"
+        @click="handleDelete"
+        v-if="TaskModel != 'ANSWER'"
+      />
     </div>
   </div>
 </template>
@@ -47,7 +59,16 @@
 import Recorder from "js-audio-recorder"; // 录音插件
 export default {
   components: {},
-  props: ["wavData", "type", "fileName", "selectData", "bgIndex"],
+  props: [
+    "wavData",
+    "type",
+    "fileName",
+    "selectData",
+    "bgIndex",
+    "tmIndex",
+    "answerRecordList",
+    "TaskModel",
+  ],
   data() {
     return {
       recorder: new Recorder({
@@ -84,6 +105,21 @@ export default {
   // 生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
     let _this = this;
+    _this.recordList = _this.answerRecordList
+      ? JSON.parse(JSON.stringify(_this.answerRecordList))
+      : [];
+    if (_this.recordList.length > 0) {
+      _this.selectIndex = 0;
+      _this.recordFile = _this.recordList.length + 1;
+      _this.handleChangeRecord(0);
+      if (_this.TaskModel != "ANSWER") {
+        _this.$emit(
+          "getRerordStatus",
+          !_this.microphoneStatus && _this.recordList.length > 0
+        );
+      }
+      _this.$forceUpdate();
+    }
     _this.audio.addEventListener("play", function () {
       _this.changeStatus("active");
       _this.isPlaying = true;
@@ -112,7 +148,7 @@ export default {
     microphone() {
       let _this = this;
       if (!this.microphoneStatus) {
-        _this.hasMicro=""
+        _this.hasMicro = "";
         _this.$emit("getWavblob", null);
         this.$emit("getSelectData", { type: "" });
         // 开始录音
@@ -152,19 +188,20 @@ export default {
           _this.recordList[_this.selectIndex].wavData = reader.result;
           _this.recordList[_this.selectIndex].toltime = Math.floor(toltime);
           _this.recordList[_this.selectIndex].fileSize = fileSize;
-          //   if (
-          //     (_this.type && _this.type == "normal") ||
-          //     (_this.type && _this.type == "mini")
-          //   ) {
+
           _this.wavblob = _this.recordList[_this.selectIndex].wavData;
           _this.$emit("getWavblob", _this.wavblob);
+          _this.$emit(
+            "handleWav",
+            JSON.parse(JSON.stringify(_this.recordList)),
+            _this.tmIndex
+          );
           if (this.recordList[this.selectIndex].selectData) {
             this.$emit(
               "getSelectData",
               this.recordList[this.selectIndex].selectData
             );
           }
-          //   }
         };
       }
       _this.$emit(
@@ -174,7 +211,7 @@ export default {
       _this.$emit("getMicrophoneStatus", _this.microphoneStatus);
     },
     playmicrophone(totalTimes) {
-      if(this.hasMicro){
+      if (this.hasMicro) {
         this.isPlaying = true;
         if (this.selectIndex || this.selectIndex == 0) {
           let totalTime = totalTimes;
@@ -253,31 +290,38 @@ export default {
       this.audio.pause();
       this.oldIndex = null;
       this.$emit("getWavblob", this.wavblob);
-      if (this.recordList[index].selectData) { this.$emit("getSelectData", this.recordList[index].selectData); }
+      if (this.recordList[index].selectData) {
+        this.$emit("getSelectData", this.recordList[index].selectData);
+      }
       this.$emit("sentPause", false);
     },
     handleDelete() {
-      if(this.hasMicro){
-      if (this.selectIndex || this.selectIndex == 0) {
-        this.recordList.splice(this.selectIndex, 1);
-        this.selectIndex =
-          this.recordList.length > 0 ? this.recordList.length - 1 : null;
-        this.hasMicro = this.recordList.length > 0 ? "normal" : "";
-        this.recordtime =
-          this.recordList.length > 0
-            ? this.recordList[this.selectIndex].toltime
-            : 0;
-        this.audio.pause();
-        this.audio = new window.Audio();
-        this.wavblob =
-          this.recordList.length > 0
-            ? this.recordList[this.selectIndex].wavData
-            : null;
-        this.oldIndex = null;
-        this.isPlaying = false;
-        clearInterval(this.timer);
-      }
-      this.$emit("getRerordStatus", this.recordList.length > 0);
+      if (this.hasMicro) {
+        if (this.selectIndex || this.selectIndex == 0) {
+          this.recordList.splice(this.selectIndex, 1);
+          _this.$emit(
+            "handleWav",
+            JSON.parse(JSON.stringify(_this.recordList)),
+            _this.tmIndex
+          );
+          this.selectIndex =
+            this.recordList.length > 0 ? this.recordList.length - 1 : null;
+          this.hasMicro = this.recordList.length > 0 ? "normal" : "";
+          this.recordtime =
+            this.recordList.length > 0
+              ? this.recordList[this.selectIndex].toltime
+              : 0;
+          this.audio.pause();
+          this.audio = new window.Audio();
+          this.wavblob =
+            this.recordList.length > 0
+              ? this.recordList[this.selectIndex].wavData
+              : null;
+          this.oldIndex = null;
+          this.isPlaying = false;
+          clearInterval(this.timer);
+        }
+        this.$emit("getRerordStatus", this.recordList.length > 0);
       }
     },
   }, // 如果页面有keep-alive缓存功能,这个函数会触发
@@ -410,6 +454,10 @@ export default {
       background: url("../../../assets/NPC/del-24.png") center no-repeat;
       background-size: 100%;
       display: block;
+      &-disabled {
+        background: url("../../../assets/NPC/del-24.png") center no-repeat;
+        background-size: 100%;
+      }
     }
     &-white {
       background: rgba(255, 255, 255, 0.1);
@@ -419,6 +467,10 @@ export default {
         color: #fff;
       }
     }
+    &-answer {
+      padding: 16px;
+      border-radius: 40px;
+    }
   }
 }
 </style>

+ 17 - 1
src/components/Adult/preview/Voicefullscreen.vue

@@ -451,6 +451,12 @@
             @getMicrophoneStatus="getMicrophoneStatus"
             @getPlayStatus="getPlayStatus"
             :bgIndex="bgIndex"
+            :TaskModel="TaskModel"
+            :answerRecordList="
+              curQue.Bookanswer.practiceModel[sentIndex] &&
+              curQue.Bookanswer.practiceModel[sentIndex].recordList
+            "
+            :tmIndex="sentIndex"
           />
           <div
             :class="['compare-box', bgIndex == 1 ? 'compare-box-white' : '']"
@@ -544,6 +550,7 @@ export default {
     "NNPENewWordList",
     "currentTreeID",
     "config",
+    "TaskModel",
   ],
   data() {
     return {
@@ -950,7 +957,10 @@ export default {
       this.pauseAudio();
       this.$emit("changeIsFull");
     },
-    handleWav(data) {},
+    handleWav(list, tmIndex) {
+      tmIndex = tmIndex ? tmIndex : 0;
+      this.$emit("handleWav", list, tmIndex);
+    },
     // 录音时暂停音频播放
     handleParentPlay() {
       this.stopAudio = true;
@@ -984,6 +994,9 @@ export default {
     },
     showWordDetail(e, item) {
       let _this = this;
+      if (_this.TaskModel == "ANSWER") {
+        return;
+      }
       if (_this.chsFhList.indexOf(item.chs) > -1) {
         return;
       }
@@ -1717,6 +1730,9 @@ export default {
           border: 1px solid rgba(0, 0, 0, 0.1);
           border-left: 0;
         }
+        &-answer {
+          border-radius: 40px;
+        }
       }
     }
     .page-count {

+ 29 - 2
src/components/Adult/preview/components/Freewrite.vue

@@ -34,7 +34,7 @@
         </div>
       </div>
 
-      <div style="display: flex">
+      <div style="display: flex" v-if="TaskModel != 'ANSWER'">
         <div
           class="xj"
           style="margin-right: 8px"
@@ -70,7 +70,15 @@ export default {
   components: {
     FreeWriteQP,
   },
-  props: ["lineColor", "lineWidth", "cur", "wordNum", "currentTreeID"],
+  props: [
+    "lineColor",
+    "lineWidth",
+    "cur",
+    "wordNum",
+    "currentTreeID",
+    "TaskModel",
+    "writeList",
+  ],
   data() {
     return {
       width: this.wordNum != "2" ? 256 : 256,
@@ -113,6 +121,17 @@ export default {
         });
       });
     },
+    getStuImgList(tabIndex) {
+      this.tabIndex = tabIndex;
+      this.imgarr = [];
+      let hz =
+        this.tabIndex == 0 ? this.cur.stem[0].con : this.cur.stem[0].TChinese;
+      let imgarr = JSON.parse(JSON.stringify(this.writeList));
+      this.imgarr = imgarr[hz].map((item) => {
+        item.history = JSON.parse(item.strokes_content);
+        return item;
+      });
+    },
     removeImage() {
       if (this.hasPlay) {
         this.$message.warning("正在播放,不能删除");
@@ -168,6 +187,13 @@ export default {
         .then((res) => {
           let Book_img = res.replace("data:image/png;base64,", "");
           let write_img = "data:image/png;base64," + Book_img;
+          let answer = {};
+          answer = {
+            hz: hz,
+            strokes_content: JSON.stringify(this.$refs.esign.history),
+            strokes_image_url: write_img,
+          };
+          this.$emit("saveWriteAnswer", answer);
           let data = {
             courseware_id: this.currentTreeID,
             hz: hz,
@@ -178,6 +204,7 @@ export default {
             "teaching-practice_manager-SaveMyHZHandwrittenRecord";
           LearnWebSI(MethodName, data).then((res) => {
             this.$message.success("保存成功!");
+            // this.getImgList(this.tabIndex);
             let obj = {
               hz_handwritten_record_id: res.hz_handwritten_record_id,
               history: this.$refs.esign.history,

+ 30 - 0
src/components/Adult/preview/components/FreewriteLettle.vue

@@ -68,6 +68,8 @@ export default {
     "closeifFreeShow",
     "rowIndex",
     "colIndex",
+    "TaskModel",
+    "writeList",
   ],
   data() {
     return {
@@ -154,6 +156,27 @@ export default {
       this.imgOrCans = false;
       this.$refs.esign.reset();
       this.data.strokes_image_url = "";
+      //this.removeImage();
+    },
+    removeImage() {
+      let _this = this;
+      if (_this.data) {
+        // if (_this.hasPlay) {
+        //   _this.$message.warning("正在播放,不能删除");
+        //   return;
+        // }
+        let MethodName =
+          "teaching-practice_manager-DeleteMyHZHandwrittenRecord";
+        let data = {
+          hz_handwritten_record_id: this.data.hz_handwritten_record_id,
+        };
+        LearnWebSI(MethodName, data).then((res) => {
+          _this.$message.success("删除成功");
+          _this.data = {};
+          _this.$emit("deleteWriteRecord", _this.rowIndex, _this.colIndex);
+          //this.resetHuahua();
+        });
+      }
     },
     handleWriteImg() {
       this.$refs.esign
@@ -161,6 +184,13 @@ export default {
         .then((res) => {
           let Book_img = res.replace("data:image/png;base64,", "");
           let write_img = "data:image/png;base64," + Book_img;
+          let answer = {};
+          answer = {
+            hz: this.currentHz,
+            strokes_content: JSON.stringify(this.$refs.esign.history),
+            strokes_image_url: write_img,
+          };
+          this.$emit("changeCurQue", answer, this.rowIndex);
           let data = {
             courseware_id: this.currentTreeID,
             hz: this.currentHz,

+ 66 - 16
src/components/Adult/preview/components/Practice.vue

@@ -42,7 +42,7 @@
                 </div>
               </div>
             </div>
-            <div class="footer">
+            <div class="footer" v-if="TaskModel != 'ANSWER'">
               <div @click="handleColl" class="bg-box">
                 <template v-if="collFlag">
                   <img
@@ -94,7 +94,10 @@
                     :lineWidth="hanziweight"
                     :currentTreeID="currentTreeID"
                     :tabIndex="0"
+                    :TaskModel="TaskModel"
+                    :writeList="writeList"
                     ref="freewrite"
+                    @saveWriteAnswer="saveWriteAnswer"
                   />
                   <div class="footer">
                     <div class="pen-colors">
@@ -104,7 +107,7 @@
                 </template>
               </div>
 
-              <ul class="nav-list">
+              <ul class="nav-list" v-if="TaskModel != 'ANSWER'">
                 <li
                   :class="navIndex == 0 ? 'active' : ''"
                   @click="changeNav(0)"
@@ -132,7 +135,7 @@
               />
             </div>
             <div class="left-content-pra"></div>
-            <div class="footer">
+            <div class="footer" v-if="TaskModel != 'ANSWER'">
               <div class="bg-box" @click="handleColl">
                 <template v-if="collFlag">
                   <img
@@ -184,7 +187,10 @@
                     :lineWidth="hanziweight"
                     :currentTreeID="currentTreeID"
                     :tabIndex="1"
+                    :TaskModel="TaskModel"
+                    :writeList="writeList"
                     ref="freewrite"
+                    @saveWriteAnswer="saveWriteAnswer"
                   />
                   <div class="footer">
                     <div class="pen-colors">
@@ -194,7 +200,7 @@
                 </template>
               </div>
 
-              <ul class="nav-list">
+              <ul class="nav-list" v-if="TaskModel != 'ANSWER'">
                 <li
                   :class="navIndex == 0 ? 'active' : ''"
                   @click="changeNav(0)"
@@ -231,7 +237,15 @@ export default {
     Freewrite,
     Audio,
   },
-  props: ["cur", "changePraShow", "themeColor", "currentTreeID", "mp3Url"],
+  props: [
+    "cur",
+    "changePraShow",
+    "themeColor",
+    "currentTreeID",
+    "mp3Url",
+    "TaskModel",
+    "writeList",
+  ],
   data() {
     return {
       //   learn_mode: "",
@@ -285,7 +299,7 @@ export default {
           this.collFlag = true;
           this.$message.success("收藏成功!");
         });
-      }else{
+      } else {
         this.$message.warning("权限不足!");
       }
     },
@@ -320,11 +334,13 @@ export default {
     },
     changeNav(index) {
       let _this = this;
-      _this.navIndex = index;
-      if (index == 1) {
-        setTimeout(() => {
-          _this.$refs.freewrite[_this.isShow].getImgList(_this.isShow);
-        }, 100);
+      if (_this.TaskModel != "AMSWER") {
+        _this.navIndex = index;
+        if (index == 1) {
+          setTimeout(() => {
+            _this.$refs.freewrite[_this.isShow].getImgList(_this.isShow);
+          }, 100);
+        }
       }
     },
     changeColor(index) {
@@ -351,12 +367,36 @@ export default {
     handleClick(tab, event) {
       let _this = this;
       _this.isShow = tab.index;
-      if (_this.navIndex == 1) {
-        setTimeout(() => {
-          _this.$refs.freewrite[_this.isShow].getImgList(_this.isShow);
-        }, 100);
+      console.log(_this.isShow);
+      console.log(_this.$refs.freewrite[_this.isShow]);
+      if (_this.TaskModel == "ANSWER") {
+        _this.$refs.freewrite[_this.isShow].getStuImgList(_this.isShow);
+      } else {
+        if (_this.navIndex == 1) {
+          setTimeout(() => {
+            _this.$refs.freewrite[_this.isShow].getImgList(_this.isShow);
+          }, 100);
+        }
+      }
+    },
+    handleClick2(index) {
+      let _this = this;
+      _this.isShow = index;
+      console.log(_this.$refs.freewrite);
+      if (_this.TaskModel == "ANSWER") {
+        _this.$refs.freewrite[_this.isShow].getStuImgList(_this.isShow);
+      } else {
+        if (_this.navIndex == 1) {
+          setTimeout(() => {
+            _this.$refs.freewrite[_this.isShow].getImgList(_this.isShow);
+          }, 100);
+        }
       }
     },
+    saveWriteAnswer(data) {
+      let answer = JSON.parse(JSON.stringify(data));
+      this.$emit("changeCurQue", answer);
+    },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
@@ -368,7 +408,17 @@ export default {
     _this.checkCollStatus();
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
-  mounted() {},
+  mounted() {
+    let _this = this;
+    _this.$nextTick(() => {
+      if (_this.TaskModel == "ANSWER") {
+        _this.navIndex = 1;
+        setTimeout(() => {
+          _this.handleClick({ index: "0" });
+        }, 0);
+      }
+    });
+  },
   beforeCreate() {}, //生命周期 - 创建之前
   beforeMount() {}, //生命周期 - 挂载之前
   beforeUpdate() {}, //生命周期 - 更新之前

+ 24 - 8
src/components/Adult/preview/components/Wordcard.vue

@@ -167,6 +167,9 @@
         :themeColor="themeColor"
         :currentTreeID="currentTreeID"
         :mp3Url="mp3Url"
+        :TaskModel="TaskModel"
+        :writeList="writeList"
+        @changeCurQue="changeCurQue"
       />
     </div>
     <div class="practiceBox" v-if="isIntpShow">
@@ -185,7 +188,11 @@ import Audio from "./AudioRed.vue";
 import Strockplayredline from "./Strockplayredline.vue";
 import Practice from "./Practice.vue";
 import WordPhraseDetail from "./WordPhraseDetail.vue";
-import { getContentFile, LearnWebSI, getHZChineseInfo } from "../../../../api/ajax";
+import {
+  getContentFile,
+  LearnWebSI,
+  getHZChineseInfo,
+} from "../../../../api/ajax";
 import { isChn } from "../../../../utils/index";
 
 export default {
@@ -196,7 +203,15 @@ export default {
     Practice,
     WordPhraseDetail,
   },
-  props: ["word", "changeWordCard", "themeColor", "currentTreeID"],
+  props: [
+    "word",
+    "changeWordCard",
+    "themeColor",
+    "currentTreeID",
+    "curQue",
+    "TaskModel",
+    "writeList"
+  ],
   data() {
     return {
       isPraShow: false,
@@ -224,6 +239,9 @@ export default {
   },
   //方法集合
   methods: {
+    changeCurQue(answer) {
+      this.$emit("changeCurQue", answer);
+    },
     handleColl() {
       let _this = this;
       if (_this.collFlag) {
@@ -254,7 +272,7 @@ export default {
           this.collFlag = true;
           this.$message.success("收藏成功!");
         });
-      }else{
+      } else {
         this.$message.warning("权限不足!");
       }
     },
@@ -307,8 +325,9 @@ export default {
       };
       this.isPraShow = true;
     },
-    changePraShow() {
+    changePraShow(answer) {
       this.isPraShow = false;
+      this.changeCurQue(answer);
     },
     viewIntp() {
       this.isIntpShow = true;
@@ -318,7 +337,6 @@ export default {
     },
     getChineseInfo() {
       let _this = this;
-      console.log(this.word.detail.new_word);
       let data = {
         query: this.word.detail.new_word,
       };
@@ -392,9 +410,7 @@ export default {
     },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
-  created() {
-    console.log(this.word);
-  },
+  created() {},
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
     let _this = this;

+ 3 - 3
src/views/adultInput.vue

@@ -998,7 +998,7 @@ export default {
         "⑲",
         "⑳",
       ],
-      TaskModel:''
+      TaskModel: "",
     };
   },
   computed: {
@@ -1022,8 +1022,8 @@ export default {
   // 生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
     console.log(this.question_list);
-    if(localStorage.getItem("Bookanswer")){
-      this.TaskModel = 'ANSWER';
+    if (localStorage.getItem("Bookanswer")) {
+      this.TaskModel = "ANSWER";
     }
     // let question_list_str = localStorage.getItem("question_list");
     // if (question_list_str) {

+ 7 - 1
src/views/courseView.vue

@@ -108,7 +108,7 @@ export default {
         },
       ],
       bookAnswerContent: "",
-      TaskModel: "ANSWER", //TEST 考试模式; PRACTICE 练习模式; ANSWER 查看答案模式; 空 预览模式 
+      TaskModel: "", //TEST 考试模式; PRACTICE 练习模式; ANSWER 查看答案模式; 空 预览模式
       category: "",
       FatherTreeData: null,
       themeColor: "",
@@ -119,6 +119,9 @@ export default {
   created() {
     const _this = this;
     _this.bookId = this.$route.query.bookId;
+    if (localStorage.getItem("Bookanswer")) {
+      this.TaskModel = "ANSWER";
+    }
   },
   methods: {
     changeTreeData(val) {
@@ -219,7 +222,10 @@ export default {
     },
     saveAnswer() {
       let answer = this.$refs.preview.saveAnswer();
+      console.log("保存答案:");
       console.log(answer);
+      let answerStr = JSON.stringify(answer);
+      localStorage.setItem("Bookanswer", answerStr);
     },
   },
 };