Jelajahi Sumber

课文里生词读音

natasha 1 bulan lalu
induk
melakukan
ed20138f11

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

@@ -1336,9 +1336,9 @@
           :current-tree-i-d="currentTreeID"
           :TaskModel="TaskModel"
           :write-list="curQue.Bookanswer.writeModel"
-          :mp3-url="activeWord ? activeWord.newWordMp3 : ''"
-          :bg="activeWord ? activeWord.bg : null"
-          :ed="activeWord ? activeWord.ed : null"
+          :mp3-url="activeWord ? activeWord.newWordMp3 || activeWord.audio_file_url : ''"
+          :bg="activeWord ? activeWord.audio_begin_time || activeWord.bg : null"
+          :ed="activeWord ? activeWord.audio_end_time || activeWord.ed : null"
           :attrib="attrib"
           :is-mobile="isMobile"
           @changeCurQue="changeCurQue"

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

@@ -1220,9 +1220,9 @@ export default {
         this.NNPENewWordList.forEach((itemn) => {
           // items.forEach((itemn) => {
           if (itemn.new_word === new_word) {
-            this.wordbg = itemn.bg;
-            this.worded = itemn.ed;
-            this.wordPlayMp3 = itemn.newWordMp3;
+            this.wordbg = itemn.audio_begin_time || itemn.bg;
+            this.worded = itemn.audio_end_time || itemn.ed;
+            this.wordPlayMp3 = itemn.newWordMp3 || itemn.audio_file_url;
           }
           // });
         });
@@ -1280,9 +1280,9 @@ export default {
         this.NNPENewWordList.forEach((itemn) => {
           // items.forEach((itemn) => {
           if (itemn.new_word === new_word) {
-            this.wordbgs = itemn.bg;
-            this.wordeds = itemn.ed;
-            this.wordPlayMp3 = itemn.newWordMp3;
+            this.wordbgs = itemn.audio_begin_time || itemn.bg;
+            this.wordeds = itemn.audio_end_time || itemn.ed;
+            this.wordPlayMp3 = itemn.newWordMp3 || itemn.audio_file_url;
           }
           // });
         });
@@ -1317,9 +1317,9 @@ export default {
         this.NNPENewWordList.forEach((itemn) => {
           // items.forEach((itemn) => {
           if (itemn.new_word === new_word) {
-            this.wordbgs = itemn.bg;
-            this.wordeds = itemn.ed;
-            this.wordPlayMp3 = itemn.newWordMp3;
+            this.wordbgs = itemn.audio_begin_time || itemn.bg;
+            this.wordeds = itemn.audio_end_time || itemn.ed;
+            this.wordPlayMp3 = itemn.newWordMp3 || itemn.audio_file_url;
           }
           // });
         });

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

@@ -5,7 +5,7 @@
       <div
         class="icon-mask icon-compare-play"
         :style="{
-          backgroundColor: attrib?.topic_color,
+          backgroundColor: attrib ? attrib.topic_color : '#e35454',
         }"
         :class="type == 'full' ? 'icon-big' : ''"
         v-if="isPlaying"
@@ -13,7 +13,7 @@
       <div
         class="icon-mask icon-compare-pause"
         :style="{
-          backgroundColor: attrib?.topic_color,
+          backgroundColor: attrib ? attrib.topic_color : '#e35454',
         }"
         :class="type == 'full' ? 'icon-big' : ''"
         v-else
@@ -23,7 +23,7 @@
       <div
         class="icon-mask icon-normal-play"
         :style="{
-          backgroundColor: attrib?.topic_color,
+          backgroundColor: attrib ? attrib.topic_color : '#e35454',
         }"
         :class="type == 'full' ? 'icon-big' : ''"
         v-if="isPlaying"
@@ -31,7 +31,7 @@
       <div
         class="icon-mask icon-normal-pause"
         :style="{
-          backgroundColor: attrib?.topic_color,
+          backgroundColor: attrib ? attrib.topic_color : '#e35454',
         }"
         :class="type == 'full' ? 'icon-big' : ''"
         v-else
@@ -169,6 +169,7 @@ export default {
 
   img,
   .icon-mask {
+    flex-shrink: 0;
     float: left;
     width: 20px;
     height: 20px;

+ 7 - 3
src/views/book/courseware/preview/components/article/components/WordPhraseDetail.vue

@@ -68,13 +68,16 @@
             <div class="yinpin">
               <span class="pinyintext"> {{ data.pinyin.toLowerCase() }}</span>
               <template v-if="data.newWordMp3">
-                <Audio :mp3="data.newWordMp3" :theme-color="themeColor" :bg="bg" :ed="ed" />
+                <Audio :mp3="data.newWordMp3" :attrib="attrib" :theme-color="themeColor" :bg="bg" :ed="ed" />
               </template>
               <template v-else-if="data.mp3_list && data.mp3_list[0] && data.mp3_list[0].id">
-                <Audio :mp3="data.mp3_list[0].id" :theme-color="themeColor" />
+                <Audio :mp3="data.mp3_list[0].id" :attrib="attrib" :theme-color="themeColor" />
               </template>
               <template v-else-if="data.mp3Url">
-                <Audio :mp3="data.mp3Url" :theme-color="themeColor" :bg="bg" :ed="ed" />
+                <Audio :mp3="data.mp3Url" :attrib="attrib" :theme-color="themeColor" :bg="bg" :ed="ed" />
+              </template>
+              <template v-else-if="data.audio_file_url">
+                <AudioRed :mp3="data.audio_file_url" :attrib="attrib" :theme-color="themeColor" :bg="bg" :ed="ed" />
               </template>
             </div>
             <p
@@ -1066,6 +1069,7 @@ export default {
             line-height: 30px;
             color: #2c2c2c;
             word-break: normal;
+            white-space: nowrap;
           }
 
           .content-voices {

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

@@ -8,7 +8,7 @@
       <div v-if="word.detail" class="bwc-top">
         <span v-if="word.detail.pinyin">{{ word.detail.pinyin.toLowerCase() }}</span>
         <div style="margin-left: 4px">
-          <Audio :mp3="mp3Url ? mp3Url : ''" :theme-color="attrib ? attrib.topic_color : '#e35454'" :bg="bg" :ed="ed" />
+          <Audio :mp3="mp3Url ? mp3Url : ''" :attrib="attrib" :bg="bg" :ed="ed" />
         </div>
 
         <!-- <img

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

@@ -542,6 +542,77 @@ export default {
         //   this.data.mp3_list[0].url = url_map[this.data.mp3_list[0].file_id];
         // });
       }
+      // 处理课文里生词表的音频和时间
+      if (this.data.new_word_list && this.data.new_word_list.new_word_list) {
+        if (this.data.new_word_list.audio_data && this.data.new_word_list.audio_data.temporary_url) {
+          // 如果大音频存在
+          this.data.new_word_list.new_word_list.forEach((item, index) => {
+            this.$set(item, 'audio_file_url', this.data.new_word_list.audio_data.temporary_url);
+            this.$set(
+              item,
+              'audio_begin_time',
+              this.data.new_word_list.lrc_arr[index] ? this.data.new_word_list.lrc_arr[index].bg : null,
+            );
+            this.$set(
+              item,
+              'audio_end_time',
+              this.data.new_word_list.lrc_arr[index] ? this.data.new_word_list.lrc_arr[index].ed : null,
+            );
+          });
+        } else {
+          let mp3_list = [];
+          this.data.new_word_list.new_word_list.forEach((item, index) => {
+            mp3_list.push(item.mp3_list);
+          });
+          GetFileURLMap({ file_id_list: mp3_list }).then(({ url_map }) => {
+            this.data.new_word_list.new_word_list.forEach((item, index) => {
+              this.$set(item, 'audio_file_url', url_map[item.mp3_list]);
+              this.$set(item, 'audio_begin_time', null);
+              this.$set(item, 'audio_end_time', null);
+            });
+          });
+        }
+      }
+      // 处理课文里其他词汇表的音频和时间
+      if (this.data.other_word_list && this.data.other_word_list.new_word_list) {
+        if (this.data.other_word_list.audio_data && this.data.other_word_list.audio_data.temporary_url) {
+          // 如果大音频存在
+          this.data.other_word_list.new_word_list.forEach((item, index) => {
+            this.$set(item, 'audio_file_url', this.data.other_word_list.audio_data.temporary_url);
+            this.$set(
+              item,
+              'audio_begin_time',
+              this.data.other_word_list.lrc_arr[index] ? this.data.other_word_list.lrc_arr[index].bg : null,
+            );
+            this.$set(
+              item,
+              'audio_end_time',
+              this.data.other_word_list.lrc_arr[index] ? this.data.other_word_list.lrc_arr[index].ed : null,
+            );
+          });
+        } else {
+          let mp3_list = [];
+          this.data.other_word_list.new_word_list.forEach((item, index) => {
+            mp3_list.push(item.mp3_list);
+          });
+          GetFileURLMap({ file_id_list: mp3_list }).then(({ url_map }) => {
+            this.data.other_word_list.new_word_list.forEach((item, index) => {
+              this.$set(item, 'audio_file_url', url_map[item.mp3_list]);
+              this.$set(item, 'audio_begin_time', null);
+              this.$set(item, 'audio_end_time', null);
+            });
+          });
+        }
+      }
+      if (this.data.new_word_list_other_component_input) {
+        this.data.new_word_list_other_component_input.forEach((item) => {
+          if (item.audio_begin_time === -1) {
+            item.audio_begin_time = null;
+            item.audio_end_time = null;
+          }
+        });
+      }
+
       this.NNPENewWordList = (
         this.data.new_word_list_other_component_input ? this.data.new_word_list_other_component_input : []
       )

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

@@ -1436,9 +1436,9 @@ export default {
       _this.NNPENewWordList.forEach((itemn) => {
         // items.forEach((itemn) => {
         if (itemn.new_word === noteNum) {
-          _this.wordbgs = itemn.bg;
-          _this.wordeds = itemn.ed;
-          _this.wordPlayMp3 = itemn.newWordMp3;
+          _this.wordbgs = itemn.audio_begin_time || itemn.bg;
+          _this.wordeds = itemn.audio_end_time || itemn.ed;
+          _this.wordPlayMp3 = itemn.newWordMp3 || itemn.audio_file_url;
         }
         // });
       });

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

@@ -252,6 +252,7 @@ import Practice from './Practicechs.vue'; // 语音练习模式
 import WordModel from './WordModelChs.vue'; // 语音练习模式
 import Voicefullscreen from '../article/Voicefullscreen.vue';
 import { getToken } from '@/utils/auth';
+import { GetFileURLMap } from '@/api/app';
 import { analysSubmit, getSysConfig } from '@/api/article';
 import NewWordPreview from '../new_word/NewWordPreview.vue';
 import NotesPreview from '../notes/NotesPreview.vue';
@@ -540,6 +541,77 @@ export default {
         //   this.data.mp3_list[0].url = url_map[this.data.mp3_list[0].file_id];
         // });
       }
+      // 处理课文里生词表的音频和时间
+      if (this.data.new_word_list && this.data.new_word_list.new_word_list) {
+        if (this.data.new_word_list.audio_data && this.data.new_word_list.audio_data.temporary_url) {
+          // 如果大音频存在
+          this.data.new_word_list.new_word_list.forEach((item, index) => {
+            this.$set(item, 'audio_file_url', this.data.new_word_list.audio_data.temporary_url);
+            this.$set(
+              item,
+              'audio_begin_time',
+              this.data.new_word_list.lrc_arr[index] ? this.data.new_word_list.lrc_arr[index].bg : null,
+            );
+            this.$set(
+              item,
+              'audio_end_time',
+              this.data.new_word_list.lrc_arr[index] ? this.data.new_word_list.lrc_arr[index].ed : null,
+            );
+          });
+        } else {
+          let mp3_list = [];
+          this.data.new_word_list.new_word_list.forEach((item, index) => {
+            mp3_list.push(item.mp3_list);
+          });
+          GetFileURLMap({ file_id_list: mp3_list }).then(({ url_map }) => {
+            this.data.new_word_list.new_word_list.forEach((item, index) => {
+              this.$set(item, 'audio_file_url', url_map[item.mp3_list]);
+              this.$set(item, 'audio_begin_time', null);
+              this.$set(item, 'audio_end_time', null);
+            });
+          });
+        }
+      }
+      // 处理课文里其他词汇表的音频和时间
+      if (this.data.other_word_list && this.data.other_word_list.new_word_list) {
+        if (this.data.other_word_list.audio_data && this.data.other_word_list.audio_data.temporary_url) {
+          // 如果大音频存在
+          this.data.other_word_list.new_word_list.forEach((item, index) => {
+            this.$set(item, 'audio_file_url', this.data.other_word_list.audio_data.temporary_url);
+            this.$set(
+              item,
+              'audio_begin_time',
+              this.data.other_word_list.lrc_arr[index] ? this.data.other_word_list.lrc_arr[index].bg : -1,
+            );
+            this.$set(
+              item,
+              'audio_end_time',
+              this.data.other_word_list.lrc_arr[index] ? this.data.other_word_list.lrc_arr[index].ed : -1,
+            );
+          });
+        } else {
+          let mp3_list = [];
+          this.data.other_word_list.new_word_list.forEach((item, index) => {
+            mp3_list.push(item.mp3_list);
+          });
+          GetFileURLMap({ file_id_list: mp3_list }).then(({ url_map }) => {
+            this.data.other_word_list.new_word_list.forEach((item, index) => {
+              this.$set(item, 'audio_file_url', url_map[item.mp3_list]);
+              this.$set(item, 'audio_begin_time', null);
+              this.$set(item, 'audio_end_time', null);
+            });
+          });
+        }
+      }
+      if (this.data.new_word_list_other_component_input) {
+        this.data.new_word_list_other_component_input.forEach((item) => {
+          if (item.audio_begin_time === -1) {
+            item.audio_begin_time = null;
+            item.audio_end_time = null;
+          }
+        });
+      }
+
       this.NNPENewWordList = (
         this.data.new_word_list_other_component_input ? this.data.new_word_list_other_component_input : []
       )

+ 2 - 2
src/views/book/courseware/preview/components/new_word/NewWordPreview.vue

@@ -1466,8 +1466,8 @@
             :option-res="optionRes"
             :theme-color="'red'"
             :current-tree-i-d="courseware_id"
-            :bg="dataWord && dataWord.bg ? dataWord.bg : null"
-            :ed="dataWord && dataWord.ed ? dataWord.ed : null"
+            :bg="dataWord ? dataWord.audio_begin_time || dataWord.bg : null"
+            :ed="dataWord ? dataWord.audio_end_time || dataWord.ed : null"
             type="newWordDetail"
             :attrib="data.unified_attrib"
             :is-mobile="isMobile"

+ 12 - 6
src/views/book/courseware/preview/components/new_word/components/WordPhraseDetail.vue

@@ -77,13 +77,19 @@
             <div class="yinpin">
               <span class="pinyintext" v-html="data.pinyin.toLowerCase()"></span>
               <template v-if="data.newWordMp3">
-                <AudioRed :mp3="data.newWordMp3" :theme-color="themeColor" :bg="bg" :ed="ed" />
+                <AudioRed :mp3="data.newWordMp3" :attrib="attrib" :theme-color="themeColor" :bg="bg" :ed="ed" />
               </template>
               <template v-else-if="data.mp3_list && data.mp3_list[0] && data.mp3_list[0].id">
-                <AudioRed :mp3="data.mp3_list[0].id" :theme-color="themeColor" />
+                <AudioRed :mp3="data.mp3_list[0].id" :attrib="attrib" :theme-color="themeColor" />
               </template>
               <template v-else-if="data.mp3Url">
-                <AudioRed :mp3="data.mp3Url" :theme-color="themeColor" :bg="bg" :ed="ed" />
+                <AudioRed :mp3="data.mp3Url" :attrib="attrib" :theme-color="themeColor" :bg="bg" :ed="ed" />
+              </template>
+              <template v-else-if="data.mp3_list_url">
+                <AudioRed :mp3="data.mp3_list_url" :attrib="attrib" :theme-color="themeColor" :bg="bg" :ed="ed" />
+              </template>
+              <template v-else-if="data.audio_file_url">
+                <AudioRed :mp3="data.audio_file_url" :attrib="attrib" :theme-color="themeColor" :bg="bg" :ed="ed" />
               </template>
             </div>
             <p class="jieshu" v-html="convertText(sanitizeHTML(data.definition_list))"></p>
@@ -220,7 +226,6 @@
         <div class="from">来自百度汉语</div>
         <div class="wordDetail">
           <p class="word">
-            {{ data.new_word }}
             <span v-for="(fy, i) in data.endata.mean_list" :key="i"> [{{ fy.pinyin }}] </span>
             <img v-if="data.endata.src_tts" @click="playAudio('audiosrc')" src="@/assets/play-red.png" alt="" />
             <audio ref="audiosrc" :src="data.endata.src_tts"></audio>
@@ -257,7 +262,7 @@
 
 <script>
 import Strockplayredline from './Strockplayredline.vue';
-import AudioRed from '../../voice_matrix/components/AudioRed.vue';
+import AudioRed from '../../article/components/AudioRed.vue';
 import { getCoursewareWordExampleSentenceList, toolDictionary } from '@/api/article';
 import { sanitizeHTML } from '@/utils/common';
 
@@ -974,10 +979,11 @@ export default {
             line-height: 30px;
             color: #2c2c2c;
             word-break: normal;
+            white-space: nowrap;
           }
 
           .content-voices {
-            width: 16px;
+            // width: 16px;
           }
         }
       }