Jelajahi Sumber

文章多语言

natasha 1 hari lalu
induk
melakukan
5098409f15

+ 9 - 8
src/views/book/courseware/create/components/question/article/Article.vue

@@ -365,28 +365,29 @@ export default {
       this.data.wordTime = [];
     },
     createWordTime() {
+      let _this = this;
       this.getfillLiu().then(() => {
-        if (this.data.taskId) {
+        if (_this.data.taskId) {
           let verseList = [];
-          this.data.detail.forEach((item) => {
+          _this.data.detail.forEach((item) => {
             verseList = verseList.concat(item.sentences);
           });
           if (verseList.length > 0) {
-            this.isWordTime = true;
+            _this.isWordTime = true;
             let data = {
-              taskId: this.data.taskId,
+              taskId: _this.data.taskId,
               verseList: JSON.stringify(verseList),
               matchType: 'chinese',
               language: 'ch',
             };
             getWordTime(data).then((res) => {
-              this.data.wordTime = res.data.result;
-              this.isWordTime = false;
+              _this.data.wordTime = res.data.result;
+              _this.isWordTime = false;
             });
           }
         } else {
-          this.$message.warning('请先上传音频');
-          this.loading = false;
+          _this.$message.warning('请先上传音频');
+          _this.loading = false;
         }
       });
     },

+ 9 - 8
src/views/book/courseware/create/components/question/dialogue_article/Article.vue

@@ -654,28 +654,29 @@ export default {
       this.data.wordTime = [];
     },
     createWordTime() {
+      let _this = this;
       this.getfillLiu().then(() => {
-        if (this.data.taskId) {
+        if (_this.data.taskId) {
           let verseList = [];
-          this.data.detail.forEach((item) => {
+          _this.data.detail.forEach((item) => {
             verseList = verseList.concat(item.sentences);
           });
           if (verseList.length > 0) {
-            this.isWordTime = true;
+            _this.isWordTime = true;
             let data = {
-              taskId: this.data.taskId,
+              taskId: _this.data.taskId,
               verseList: JSON.stringify(verseList),
               matchType: 'chinese',
               language: 'ch',
             };
             getWordTime(data).then((res) => {
-              this.data.wordTime = res.data.result;
-              this.isWordTime = false;
+              _this.data.wordTime = res.data.result;
+              _this.isWordTime = false;
             });
           }
         } else {
-          this.$message.warning('请先上传音频');
-          this.loading = false;
+          _this.$message.warning('请先上传音频');
+          _this.loading = false;
         }
       });
     },

+ 9 - 1
src/views/book/courseware/preview/components/article/NormalModelChs.vue

@@ -861,6 +861,9 @@
         </div>
       </template>
     </template>
+    <div class="multilingual" v-for="(items, indexs) in multilingualTextList" :key="indexs">
+      {{ items }}
+    </div>
     <template v-if="isNoteShow">
       <div
         ref="notecard"
@@ -885,7 +888,7 @@ export default {
     AudioLine,
     Notecard,
   },
-  props: ['curQue', 'noFont', 'config', 'NNPEAnnotationList', 'colLength', 'themeColor'],
+  props: ['curQue', 'noFont', 'config', 'NNPEAnnotationList', 'colLength', 'themeColor', 'multilingualTextList'],
   data() {
     return {
       resArr: [],
@@ -1640,6 +1643,11 @@ export default {
       color: rgba(0, 0, 0, 100%);
     }
   }
+
+  .multilingual {
+    padding: 6px 24px 12px;
+    word-break: break-word;
+  }
 }
 
 .NPC-Big-Book-preview-green {

+ 1 - 0
src/views/book/courseware/preview/components/article/PhraseModelChs.vue

@@ -617,6 +617,7 @@ export default {
     'TaskModel',
     'NNPEAnnotationList',
     'colLength',
+    'multilingualTextList',
   ],
   data() {
     return {

+ 5 - 4
src/views/book/courseware/preview/components/article/Practicechs.vue

@@ -440,6 +440,7 @@ export default {
     'TaskModel',
     'colLength',
     'isFull',
+    'multilingualTextList',
   ],
   data() {
     return {
@@ -559,7 +560,7 @@ export default {
       this.goFullscreen();
     },
     goFullscreen() {
-      let id = `screen-${  this.mathNum}`;
+      let id = `screen-${this.mathNum}`;
       let element = document.getElementById(id);
       if (element.requestFullscreen) {
         element.requestFullscreen();
@@ -619,8 +620,8 @@ export default {
     },
     handleData() {
       let resArr = [];
-        let sentArrTotal = [];
-        let timeArr = [];
+      let sentArrTotal = [];
+      let timeArr = [];
       let curQue = JSON.parse(JSON.stringify(this.curQue));
       let wordTimeList = curQue.wordTime;
       let dhaspinyin = false; // 每段是否有拼音
@@ -738,7 +739,7 @@ export default {
       }
       let pos = time.indexOf(':');
       let min = 0;
-        var sec = 0;
+      var sec = 0;
       if (pos > 0) {
         min = parseInt(time.substring(0, pos));
         sec = parseFloat(time.substring(pos + 1));

+ 1 - 0
src/views/book/courseware/preview/components/article/WordModelChs.vue

@@ -571,6 +571,7 @@ export default {
     'TaskModel',
     'colLength',
     'noFont',
+    'multilingualTextList',
   ],
   data() {
     return {

+ 15 - 1
src/views/book/courseware/preview/components/article/index.vue

@@ -80,6 +80,7 @@
             :NNPEAnnotationList="NNPEAnnotationList"
             :col-length="colLength"
             @changeConfig="changeConfig"
+            :multilingualTextList="showLang && multilingualTextList[getLang()] ? multilingualTextList[getLang()] : []"
           />
           <PhraseModel
             v-if="showPhrases"
@@ -97,6 +98,7 @@
             :col-length="colLength"
             :NpcNewWordMp3="NpcNewWordMp3"
             @changeConfig="changeConfig"
+            :multilingualTextList="showLang && multilingualTextList[getLang()] ? multilingualTextList[getLang()] : []"
           />
           <Practice
             v-if="showPractice"
@@ -113,6 +115,7 @@
             :NpcNewWordMp3="NpcNewWordMp3"
             :is-full="isFull"
             @changeConfig="changeConfig"
+            :multilingualTextList="showLang && multilingualTextList[getLang()] ? multilingualTextList[getLang()] : []"
           />
           <WordModel
             v-if="showWord"
@@ -129,6 +132,7 @@
             :TaskModel="isJudgingRightWrong ? 'ANSWER' : ''"
             :col-length="colLength"
             @changeConfig="changeConfig"
+            :multilingualTextList="showLang && multilingualTextList[getLang()] ? multilingualTextList[getLang()] : []"
           />
         </div>
         <div :id="'screen-' + mathNum" class="voice-full-screen">
@@ -235,6 +239,7 @@ export default {
       NpcNewWordMp3: [],
       colLength: 1,
       courseware_id: this.$route.params.id,
+      multilingualTextList: {},
     };
   },
   computed: {},
@@ -389,12 +394,21 @@ export default {
       }
     },
     handleData() {
+      if (this.showLang) {
+        this.data.multilingual.forEach((item) => {
+          let trans_arr = item.translation.split('\n');
+          this.$set(this.multilingualTextList, item.type, trans_arr);
+        });
+      }
       if (this.data.mp3_list && this.data.mp3_list.length > 0) {
         GetFileURLMap({ file_id_list: [this.data.mp3_list[0].file_id] }).then(({ url_map }) => {
           this.data.mp3_list[0].url = url_map[this.data.mp3_list[0].file_id];
         });
       }
-      this.NNPENewWordList = this.data.new_word_list_other_component_input
+
+      this.NNPENewWordList = (
+        this.data.new_word_list_other_component_input ? this.data.new_word_list_other_component_input : []
+      )
         .concat(this.data.new_word_list.new_word_list)
         .concat(this.data.other_word_list.new_word_list);
       this.NNPEAnnotationList = this.data.notes_list.option;

+ 10 - 0
src/views/book/courseware/preview/components/dialogue_article/NormalModelChs.vue

@@ -436,6 +436,9 @@
           <div :class="['empty-left', isHasRemark ? 'hasRemark' : '']"></div>
           <div class="empty-right"></div>
         </div>
+        <div class="multilingual" v-for="(items, indexs) in multilingualTextList" :key="indexs">
+          {{ items }}
+        </div>
         <div class="dia-article-record" v-if="curQue.Bookanswer">
           <Soundrecord
             type="promax"
@@ -447,6 +450,7 @@
         </div>
       </div>
     </template>
+
     <template v-if="isNoteShow">
       <div
         ref="notecard"
@@ -482,6 +486,7 @@ export default {
     'TaskModel',
     'colLength',
     'isPhone',
+    'multilingualTextList',
   ],
   components: {
     AudioLine,
@@ -1167,5 +1172,10 @@ export default {
     margin-top: -130px;
     overflow: auto;
   }
+
+  .multilingual {
+    padding: 6px 24px 12px;
+    word-break: break-word;
+  }
 }
 </style>

+ 1 - 0
src/views/book/courseware/preview/components/dialogue_article/PhraseModelChs.vue

@@ -365,6 +365,7 @@ export default {
     'colLength',
     'NpcNewWordMp3',
     'isPhone',
+    'multilingualTextList',
   ],
   components: {
     AudioLine,

+ 1 - 0
src/views/book/courseware/preview/components/dialogue_article/Practicechs.vue

@@ -478,6 +478,7 @@ export default {
     'colLength',
     'NpcNewWordMp3',
     'isPhone',
+    'multilingualTextList',
   ],
   components: {
     AudioLine,

+ 1 - 0
src/views/book/courseware/preview/components/dialogue_article/WordModelChs.vue

@@ -342,6 +342,7 @@ export default {
     'TaskModel',
     'colLength',
     'isPhone',
+    'multilingualTextList',
   ],
   components: {
     AudioLine,

+ 14 - 1
src/views/book/courseware/preview/components/dialogue_article/index.vue

@@ -74,6 +74,7 @@
             @changeConfig="changeConfig"
             :NNPEAnnotationList="NNPEAnnotationList"
             :colLength="colLength"
+            :multilingualTextList="showLang && multilingualTextList[getLang()] ? multilingualTextList[getLang()] : []"
           />
           <PhraseModel
             :curQue="data"
@@ -90,6 +91,7 @@
             :NNPEAnnotationList="NNPEAnnotationList"
             :colLength="colLength"
             :NpcNewWordMp3="NpcNewWordMp3"
+            :multilingualTextList="showLang && multilingualTextList[getLang()] ? multilingualTextList[getLang()] : []"
           />
           <Practice
             :curQue="data"
@@ -105,6 +107,7 @@
             :colLength="colLength"
             :NpcNewWordMp3="NpcNewWordMp3"
             :isFull="isFull"
+            :multilingualTextList="showLang && multilingualTextList[getLang()] ? multilingualTextList[getLang()] : []"
           />
           <WordModel
             :curQue="data"
@@ -120,6 +123,7 @@
             @changeConfig="changeConfig"
             :TaskModel="isJudgingRightWrong ? 'ANSWER' : ''"
             :colLength="colLength"
+            :multilingualTextList="showLang && multilingualTextList[getLang()] ? multilingualTextList[getLang()] : []"
           />
         </div>
         <div class="voice-full-screen" :id="'screen-' + mathNum">
@@ -261,6 +265,7 @@ export default {
       NNPENewWordList: [],
       NpcNewWordMp3: [],
       colLength: 1,
+      multilingualTextList: {},
     };
   },
   computed: {},
@@ -381,6 +386,12 @@ export default {
       }
     },
     handleData() {
+      if (this.showLang) {
+        this.data.multilingual.forEach((item) => {
+          let trans_arr = item.translation.split('\n');
+          this.$set(this.multilingualTextList, item.type, trans_arr);
+        });
+      }
       let userAnswer = JSON.parse(JSON.stringify(this.userAnswer));
       this.$set(this.data, 'Bookanswer', userAnswer);
       if (this.data.mp3_list && this.data.mp3_list.length > 0) {
@@ -388,7 +399,9 @@ export default {
           this.data.mp3_list[0].url = url_map[this.data.mp3_list[0].file_id];
         });
       }
-      this.NNPENewWordList = this.data.new_word_list_other_component_input
+      this.NNPENewWordList = (
+        this.data.new_word_list_other_component_input ? this.data.new_word_list_other_component_input : []
+      )
         .concat(this.data.new_word_list.new_word_list)
         .concat(this.data.other_word_list.new_word_list);
       this.NNPEAnnotationList = this.data.notes_list.option;