瀏覽代碼

上传组件多语言预览

natasha 3 天之前
父節點
當前提交
d0a783f93a

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

@@ -389,8 +389,8 @@ export default {
         });
       }
       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);
+        .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;
       let resArr = [],
         sentArrTotal = [],

+ 17 - 1
src/views/book/courseware/preview/components/upload_preview/UploadPreviewPreview.vue

@@ -33,7 +33,14 @@
             <div class="file-name">
               <span>
                 <SvgIcon :icon-class="icon_list[active_index]" size="16" />
-                <span>{{ data.file_info[file.file_id].xuhao + data.file_info[file.file_id].file_name }}</span>
+                <span
+                  >{{ data.file_info[file.file_id].xuhao + data.file_info[file.file_id].file_name }}
+                  <!-- {{
+                    multilingualTextList[getLang()] && multilingualTextList[getLang()][i]
+                      ? ' ' + multilingualTextList[getLang()][i]
+                      : ''
+                  }} -->
+                </span>
               </span>
               <SvgIcon v-show="file.file_id" icon-class="uploadPreview" size="16" @click="viewDialog(file)" />
               <img
@@ -87,6 +94,7 @@ export default {
       visible: false,
       newpath: '',
       iframeHeight: `${window.innerHeight - 100}px`,
+      multilingualTextList: {}, // 多语言对应的切割后的翻译
     };
   },
   watch: {
@@ -102,6 +110,7 @@ export default {
   methods: {
     // 处理数据
     handleData() {
+      this.multilingualTextList = {};
       this.source_list = [[], [], [], []];
       this.data.file_list.forEach((item) => {
         const suffix = item.file_name.slice(item.file_name.lastIndexOf('.') + 1, item.file_name.length).toLowerCase();
@@ -115,6 +124,13 @@ export default {
           this.source_list[2].push(item);
         }
       });
+      // if (this.showLang) {
+      this.data.multilingual.forEach((item) => {
+        let trans_arr = item.translation.split('\n');
+        this.$set(this.multilingualTextList, item.code, trans_arr);
+      });
+      console.log(this.multilingualTextList);
+      // }
     },
     //   下载表格
     downLoad(file) {