natasha 3 тижнів тому
батько
коміт
afe6af110f

+ 21 - 0
src/views/book/courseware/preview/components/article/index.vue

@@ -249,6 +249,27 @@ export default {
   },
   computed: {},
   watch: {
+    showLang: {
+      handler(val) {
+        if (val) {
+          this.data.multilingual.forEach((item) => {
+            let trans_arr = item.translation.split('\n');
+            this.data.detail.forEach((items) => {
+              let items_trans_arr = [];
+              if (!items.hasOwnProperty('multilingualTextList')) {
+                this.$set(items, 'multilingualTextList', {});
+              }
+              if (items.para) {
+                items_trans_arr = trans_arr.splice(0, items.sentences.length);
+              }
+              this.$set(items.multilingualTextList, item.type, items_trans_arr);
+            });
+          });
+        }
+      },
+      deep: true,
+      immediate: true,
+    },
     'data.content': {
       handler(val) {
         if (val) {

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

@@ -191,6 +191,27 @@ export default {
   mixins: [PreviewMixin],
   inject: ['bookInfo'],
   watch: {
+    showLang: {
+      handler(val) {
+        if (val) {
+          this.data.multilingual.forEach((item) => {
+            let trans_arr = item.translation.split('\n');
+            this.data.detail.forEach((items) => {
+              let items_trans_arr = [];
+              if (!items.hasOwnProperty('multilingualTextList')) {
+                this.$set(items, 'multilingualTextList', {});
+              }
+              if (items.para) {
+                items_trans_arr = trans_arr.splice(0, items.sentences.length);
+              }
+              this.$set(items.multilingualTextList, item.type, items_trans_arr);
+            });
+          });
+        }
+      },
+      deep: true,
+      immediate: true,
+    },
     'data.detail.length': {
       handler(val) {
         if (val) {