guanchunjie 3 years ago
parent
commit
52c3ea9d48

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

@@ -141,6 +141,7 @@
                     :cur-que="itemss.data"
                     :child-type="itemss.type"
                     :theme-color="themeColor"
+                    v-if="refresh"
                   />
                 </template>
                 <template v-if="itemss.type == 'record_chs'">
@@ -150,6 +151,7 @@
                   <WordPhrase
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    v-if="refresh"
                   />
                 </template>
                 <template v-if="itemss.type == 'NewWord_chs'">
@@ -157,16 +159,22 @@
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
                     :currentTreeID="currentTreeID"
+                    v-if="refresh"
                   />
                 </template>
                 <template v-if="itemss.type == 'annotation_chs'">
                   <WordPhrase
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    v-if="refresh"
                   />
                 </template>
                 <template v-if="itemss.type == 'notes_chs'">
-                  <Notes :cur-que="itemss.data" :theme-color="themeColor" />
+                  <Notes
+                    :cur-que="itemss.data"
+                    :theme-color="themeColor"
+                    v-if="refresh"
+                  />
                 </template>
                 <template v-if="itemss.type == 'article_chs'">
                   <ArticleTemChs
@@ -176,12 +184,14 @@
                     :n-n-p-e-annotation-list="NNPEAnnotationList"
                     :theme-color="themeColor"
                     :currentTreeID="currentTreeID"
+                    v-if="refresh"
                   />
                 </template>
                 <template v-if="itemss.type == 'sentence_segword_chs'">
                   <SentenceSegWordViewChs
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    v-if="refresh"
                   />
                 </template>
                 <template v-if="itemss.type == 'dialogue_article_chs'">
@@ -192,6 +202,7 @@
                     :n-n-p-e-annotation-list="NNPEAnnotationList"
                     :color-box="colorBox"
                     :theme-color="themeColor"
+                    v-if="refresh"
                   />
                 </template>
                 <template v-if="itemss.type == 'dialogue_answer_chs'">
@@ -199,18 +210,21 @@
                     :cur-que="itemss.data"
                     :color-box="colorBox"
                     :theme-color="themeColor"
+                    v-if="refresh"
                   />
                 </template>
                 <template v-if="itemss.type == 'input_record_chs'">
                   <InputHasRecord
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    v-if="refresh"
                   />
                 </template>
                 <template v-if="itemss.type == 'recordHZ_inputPY_chs'">
                   <TextInputRecord
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    v-if="refresh"
                   />
                 </template>
                 <template
@@ -225,42 +239,56 @@
                   <SentenceInput
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    v-if="refresh"
                   />
                 </template>
                 <template v-if="itemss.type == 'NumberCombination_chs'">
                   <NumberSelectHasRecord
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    v-if="refresh"
                   />
                 </template>
                 <template v-if="itemss.type === 'voice_matrix'">
                   <voice-matrix
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    v-if="refresh"
                   />
                 </template>
                 <template v-if="itemss.type == 'toneSelect_chs'">
                   <SelectTone
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    v-if="refresh"
                   />
                 </template>
                 <template v-if="itemss.type == 'sudoku_chs'">
-                  <Soduko :cur-que="itemss.data" :theme-color="themeColor" />
+                  <Soduko
+                    :cur-que="itemss.data"
+                    :theme-color="themeColor"
+                    v-if="refresh"
+                  />
                 </template>
                 <template v-if="itemss.type == 'single_chs'">
-                  <Single :cur-que="itemss.data" :theme-color="themeColor" />
+                  <Single
+                    :cur-que="itemss.data"
+                    :theme-color="themeColor"
+                    v-if="refresh"
+                  />
                 </template>
                 <template v-if="itemss.type == 'text_problem_chs'">
                   <TextProblem
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    v-if="refresh"
                   />
                 </template>
                 <template v-if="itemss.type == 'newWord_preview_chs'">
                   <NewWordShow
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    v-if="refresh"
                   />
                 </template>
                 <template
@@ -269,22 +297,29 @@
                   <SelectYinjie
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    v-if="refresh"
                   />
                 </template>
                 <template v-if="itemss.type == 'sentence_listen_read_chs'">
                   <SentenceListenRead
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    v-if="refresh"
                   />
                 </template>
                 <template v-if="itemss.type == 'sort_chs'">
                   <SentenceSortQP
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    v-if="refresh"
                   />
                 </template>
                 <template v-if="itemss.type == 'checkbox_self_assessment_chs'">
-                  <Checkbox :cur-que="itemss.data" :theme-color="themeColor" />
+                  <Checkbox
+                    :cur-que="itemss.data"
+                    :theme-color="themeColor"
+                    v-if="refresh"
+                  />
                 </template>
                 <template
                   v-if="
@@ -297,6 +332,7 @@
                   <RecordModule
                     :cur-que="itemss.data"
                     :theme-color="themeColor"
+                    v-if="refresh"
                   />
                 </template>
                 <template
@@ -309,6 +345,7 @@
                     :cur-que="itemss.data"
                     :type="itemss.type"
                     :theme-color="themeColor"
+                    v-if="refresh"
                   />
                 </template>
                 <template v-if="itemss.type == 'CourseStart_chs'">
@@ -316,16 +353,22 @@
                     :cur-que="itemss.data"
                     :handle-n-n-p-enext="handleNNPEnext"
                     :theme-color="themeColor"
+                    v-if="refresh"
                   />
                 </template>
                 <template v-if="itemss.type == 'tinydemo_chs'">
-                  <Tinydemo :cur-que="itemss.data" :theme-color="themeColor" />
+                  <Tinydemo
+                    :cur-que="itemss.data"
+                    :theme-color="themeColor"
+                    v-if="refresh"
+                  />
                 </template>
                 <template v-if="itemss.type == 'video_chs'">
                   <VideoControl
                     :cur-que="itemss.data"
                     :type="itemss.type"
                     :theme-color="themeColor"
+                    v-if="refresh"
                   />
                 </template>
                 <template v-if="itemss.type == 'table_chs'">
@@ -333,6 +376,7 @@
                     :cur-que="itemss.data"
                     :type="itemss.type"
                     :theme-color="themeColor"
+                    v-if="refresh"
                   />
                 </template>
               </template>
@@ -457,6 +501,7 @@ export default {
       noFont: ["~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")"], // 对应不要拼音字体
       idArr: [], //当前的pid
       oldCurrentTreeID: "",
+      refresh: true,
     };
   },
   computed: {},
@@ -464,9 +509,14 @@ export default {
     context: {
       handler(val, oldVal) {
         const _this = this;
+        _this.refresh = false;
         if (val) {
           _this.initContextData();
           _this.handleTitleData();
+          _this.$nextTick(() => {
+            // 重新渲染组件
+            _this.refresh = true;
+          });
         }
       },
       // 深度观察监听
@@ -555,6 +605,7 @@ export default {
           });
         });
       }
+      this.$forceUpdate();
     },
     // 上一页
     handleNNPEprev() {
@@ -572,7 +623,6 @@ export default {
               });
             } else {
               _this.changeId(this.idArr[i - 1]);
-              _this.$forceUpdate();
             }
           }
         });
@@ -580,7 +630,6 @@ export default {
         _this.queIndex -= 1;
         _this.watchIndex = _this.queIndex + new Date().getTime();
         _this.cur = _this.queList[_this.queIndex];
-        _this.$forceUpdate();
       }
     },
     // 递归寻找相同的目录并保存目录的pid
@@ -615,7 +664,6 @@ export default {
               });
             } else {
               _this.changeId(this.idArr[i + 1]);
-              _this.$forceUpdate();
             }
           }
         });
@@ -623,7 +671,6 @@ export default {
         _this.queIndex += 1;
         _this.watchIndex = _this.queIndex + new Date().getTime();
         _this.cur = _this.queList[_this.queIndex];
-        _this.$forceUpdate();
       }
     },
   }, // 如果页面有keep-alive缓存功能,这个函数会触发

+ 0 - 1
src/components/Adult/inputModules/DialogueArticleChs/components/ClauseresultChs.vue

@@ -86,7 +86,6 @@ export default {
       this.$set(_this.curQue.detail[index], "sentences", sentArr);
     },
     sureClause(index) {
-      debugger;
       let _this = this;
       let para_list = JSON.parse(JSON.stringify(_this.para_list));
       let paraStr = para_list[index].para.replace(/\n/g, "");

+ 0 - 1
src/components/Adult/inputModules/DialogueTem/components/ClauseresultChs.vue

@@ -86,7 +86,6 @@ export default {
       this.$set(_this.curQue.detail[index], "sentences", sentArr);
     },
     sureClause(index) {
-      debugger;
       let _this = this;
       let para_list = JSON.parse(JSON.stringify(_this.para_list));
       let paraStr = para_list[index].para.replace(/\n/g, "");

+ 1 - 0
src/components/Adult/preview/ArticleViewChs/index.vue

@@ -131,6 +131,7 @@ export default {
         this.showPractice = false; // 语音练习
         this.showWord = false; // 取词
       },
+      deep: true,
     },
   },
   //方法集合

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

@@ -348,7 +348,6 @@ export default {
       handler: function (val, oldVal) {
         let _this = this;
         if (val) {
-          debugger;
           setTimeout(() => {
             _this.cardHeight = _this.$refs.notecard.offsetHeight;
             if (_this.screenHeight - _this.clientY > _this.cardHeight) {
@@ -492,7 +491,6 @@ export default {
       }
     },
     viewNotes(e, noteNum) {
-      debugger;
       let _this = this;
       let noteIndex = "";
       if (_this.NumberList.indexOf(noteNum) > -1) {

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

@@ -31,7 +31,7 @@
     </div>
 
     <template v-if="resObj">
-      <p class="notice" v-if="curQue.notice">
+      <p class="notice" v-if="curQue.notice" style="padding-top: 24px">
         {{ curQue.notice }}
       </p>
       <div class="NPC-sentences-list">
@@ -677,7 +677,6 @@ export default {
 //@import url(); 引入公共css类
 .NNPE-ArticleView {
   width: 100%;
-  padding-top: 24px;
   .NPC-sentences-list {
     padding: 0px 0 24px 0;
   }

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

@@ -361,7 +361,6 @@ export default {
       handler: function (val, oldVal) {
         let _this = this;
         if (val) {
-          debugger;
           setTimeout(() => {
             _this.cardHeight = _this.$refs.notecard.offsetHeight;
             if (_this.screenHeight - _this.clientY > _this.cardHeight) {

+ 4 - 1
src/components/Adult/preview/DialogueArticleViewChs/index.vue

@@ -1,6 +1,6 @@
 <!--  -->
 <template>
-  <div class="NPC-ArticleView">
+  <div class="NPC-ArticleView NPC-ArticleView-container">
     <div class="ArticleView-header">
       <el-switch
         style="display: block"
@@ -226,6 +226,9 @@ export default {
 </style>
 <style lang="scss">
 .NPC-ArticleView {
+  &.NPC-ArticleView-container {
+    margin-bottom: 16px;
+  }
   .notice {
     font-weight: normal;
     font-size: 14px;

+ 42 - 27
src/components/Adult/preview/WordPhrase.vue

@@ -67,7 +67,7 @@
                   <span style="width: 24px; height: 24px"></span>
                 </template>
                 <span class="tabNum"
-                  ><template v-if="sIndex == 0"
+                  ><template v-if="sItem.mIndex == 0"
                     >{{ index + 1 }}.</template
                   ></span
                 >
@@ -142,12 +142,24 @@ export default {
   //计算属性 类似于data概念
   computed: {},
   //监控data中数据变化
-  watch: {},
+  watch: {
+    currentTreeID: {
+      handler: function () {
+        this.mp3_index = -1; // 全文预览
+        this.optionRes = []; // 显示单词和短语
+        this.mp3List = []; // 语音练习
+        this.initData();
+      },
+      deep: true,
+    },
+  },
   //方法集合
   methods: {
     handleChange(val) {},
     palyAudio(new_word, sIndex) {
+      console.log(sIndex);
       let _this = this;
+      _this.stopAudio();
       let node = document.getElementById(new_word);
       _this.playWord = node;
       if (node) {
@@ -281,33 +293,36 @@ export default {
         this.audio.pause();
       }
     },
+    initData() {
+      if (this.curQue.type == "NewWord_chs") {
+        let resIndex = 0;
+        let optionRes = [];
+        let mp3List = [];
+        this.curQue.option.forEach((item, index) => {
+          optionRes = optionRes.concat(item);
+          item.forEach((sItem, sIndex) => {
+            sItem.mIndex = sIndex;
+            sItem.sIndex = resIndex;
+            resIndex++;
+            sItem.def_str =
+              sItem.definition_list.length > 0
+                ? sItem.definition_list.join(";")
+                : "";
+            if (sItem.mp3_list[0]) {
+              mp3List.push(sItem);
+            }
+          });
+        });
+        this.optionRes = JSON.parse(JSON.stringify(optionRes));
+        this.mp3List = mp3List;
+        console.log("this.mp3List");
+        console.log(this.curQue.option);
+      }
+    },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
-    if (this.curQue.type == "NewWord_chs") {
-      let resIndex = 0;
-      let optionRes = [];
-      let mp3List = [];
-      this.curQue.option.forEach((item, index) => {
-        optionRes = optionRes.concat(item);
-        item.index = index + 1;
-        item.forEach((sItem, sIndex) => {
-          sItem.sIndex = resIndex;
-          resIndex++;
-          sItem.def_str =
-            sItem.definition_list.length > 0
-              ? sItem.definition_list.join(";")
-              : "";
-          if (sItem.mp3_list[0]) {
-            mp3List.push(sItem);
-          }
-        });
-      });
-      this.optionRes = JSON.parse(JSON.stringify(optionRes));
-      this.mp3List = mp3List;
-      console.log("this.mp3List");
-      console.log(this.curQue.option);
-    }
+    this.initData();
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
@@ -342,7 +357,7 @@ export default {
 /* @import url(); 引入css类 */
 .NPC-zhedie {
   width: 780px;
-  margin-top: 16px;
+  margin-bottom: 16px;
   .NPC-word-table {
     width: 100%;
     > .NPC-word-tr {

+ 1 - 2
src/views/adultInput3.vue

@@ -757,7 +757,7 @@ export default {
       item[field] = item[field] ? item[field].trim() : "";
     },
     // 当前目录id  name    父级name/当前 name
-    changeId(id, name, fatherName,type) {
+    changeId(id, name, fatherName, type) {
       this.TopicIndex = null;
       this.RowIndex = null;
       this.LineIndex = null;
@@ -956,7 +956,6 @@ export default {
       let _this = this;
       let question_data = null;
       if (_this.question_list) {
-        // debugger;
         const question2 = JSON.parse(JSON.stringify(_this.question_list));
         question_data = await _this.getFileUrl_preview(question2);
         _this.previewVisible = true;