Sfoglia il codice sorgente

更换火山引擎打点接口

liuhaidi123 3 settimane fa
parent
commit
5eef5deb4c

+ 25 - 3
src/views/book/courseware/create/components/question/article/Article.vue

@@ -25,7 +25,7 @@
             <a size="medium" @click="compareTime('文字')">校对文字字幕时间</a>
           </template>
           <template v-else>
-            <a v-if="!isWordTime" size="medium" @click="createWordTime">自动生成字幕节点</a>
+            <a v-if="!isWordTime" size="medium" @click="createWordTimes">自动生成字幕节点</a>
             <p v-else>字幕节点生成中...请等待</p>
           </template>
           <el-button @click="handleMultilingual">课文多语言</el-button>
@@ -374,12 +374,29 @@ export default {
         this.data.detail[paraIndex].wordsList[sentenceIndex][wordIndex].pinyin = pinyin;
       }
     },
-    saveStyle(paraIndex, sentenceIndex, wordIndex, fontFamily, textDecoration, fontWeight, border, color) {
+    saveStyle(
+      paraIndex,
+      sentenceIndex,
+      wordIndex,
+      fontFamily,
+      textDecoration,
+      fontWeight,
+      border,
+      color,
+      matchWords,
+      matchNotes,
+      img,
+      imgPosition,
+    ) {
       this.data.detail[paraIndex].wordsList[sentenceIndex][wordIndex].fontFamily = fontFamily;
       this.data.detail[paraIndex].wordsList[sentenceIndex][wordIndex].textDecoration = textDecoration;
       this.data.detail[paraIndex].wordsList[sentenceIndex][wordIndex].fontWeight = fontWeight;
       this.data.detail[paraIndex].wordsList[sentenceIndex][wordIndex].border = border;
       this.data.detail[paraIndex].wordsList[sentenceIndex][wordIndex].color = color;
+      this.data.detail[paraIndex].wordsList[sentenceIndex][wordIndex].matchWords = matchWords;
+      this.data.detail[paraIndex].wordsList[sentenceIndex][wordIndex].matchNotes = matchNotes;
+      this.data.detail[paraIndex].wordsList[sentenceIndex][wordIndex].img = img;
+      this.data.detail[paraIndex].wordsList[sentenceIndex][wordIndex].imgPosition = imgPosition;
     },
     // 保存校对
     saveCompare() {
@@ -420,13 +437,18 @@ export default {
     },
     createWordTimes() {
       let _this = this;
-
+      let verseList = [];
       if (_this.data.mp3_list && _this.data.mp3_list.length > 0 && _this.data.mp3_list[0].file_id) {
         if (_this.data.content) {
+          _this.data.detail.forEach((item) => {
+            verseList = verseList.concat(item.sentences);
+          });
           _this.isWordTime = true;
           let data = {
             audio_file_id: _this.data.mp3_list[0].file_id,
             text: _this.data.content,
+            text_type: 'line_text_list',
+            line_text_list: verseList,
           };
           getWordTimes(data).then((res) => {
             _this.data.wordTime = res.data.result;

+ 18 - 1
src/views/book/courseware/create/components/question/article/CheckArticle.vue

@@ -230,7 +230,20 @@ export default {
     savePinyin(paraIndex, sentenceIndex, wordIndex, pinyin) {
       this.$emit('savePinyin', paraIndex, sentenceIndex, wordIndex, pinyin);
     },
-    saveStyle(paraIndex, sentenceIndex, wordIndex, fontFamily, textDecoration, fontWeight, border, color) {
+    saveStyle(
+      paraIndex,
+      sentenceIndex,
+      wordIndex,
+      fontFamily,
+      textDecoration,
+      fontWeight,
+      border,
+      color,
+      matchWords,
+      matchNotes,
+      img,
+      imgPosition,
+    ) {
       this.$emit(
         'saveStyle',
         paraIndex,
@@ -241,6 +254,10 @@ export default {
         fontWeight,
         border,
         color,
+        matchWords,
+        matchNotes,
+        img,
+        imgPosition,
       );
     },
     changeImage(file) {

+ 26 - 0
src/views/book/courseware/create/components/question/article/CheckStyle.vue

@@ -90,6 +90,14 @@
             <SvgIcon icon-class="borderDotted" title="下划虚线" size="16" @click="setActiveTextStyle('border')" />
           </span>
         </div>
+        <div class="match-info">
+          <label>关联生词:</label>
+          <el-input v-model="itemActive.matchWords"></el-input>
+        </div>
+        <div class="match-info">
+          <label>关联注释:</label>
+          <el-input v-model="itemActive.matchNotes"></el-input>
+        </div>
         <div class="btn-box">
           <el-button type="info" size="small" @click="cancleDialog">取消</el-button>
           <el-button type="primary" size="small" @click="surePinyin">保存</el-button>
@@ -173,6 +181,10 @@ export default {
               fontWeight: itemss.fontWeight,
               border: itemss.border,
               color: itemss.color,
+              matchWords: itemss.matchWords,
+              matchNotes: itemss.matchNotes,
+              img: itemss.img,
+              imgPosition: itemss.imgPosition,
             };
             arr[index].push(obj);
             let saveObj = {
@@ -216,6 +228,10 @@ export default {
         this.itemActive.fontWeight,
         this.itemActive.border,
         this.itemActive.color,
+        this.itemActive.matchWords,
+        this.itemActive.matchNotes,
+        this.itemActive.img,
+        this.itemActive.imgPosition,
       );
       this.$message.success('保存成功');
       this.activeIndex = null;
@@ -451,6 +467,16 @@ export default {
     }
   }
 }
+
+.match-info {
+  display: flex;
+  align-items: center;
+  margin: 10px 0;
+
+  label {
+    width: 100px;
+  }
+}
 </style>
 <style lang="scss">
 .check-article {

+ 1 - 0
src/views/book/courseware/create/components/question/article/NewWord.vue

@@ -552,6 +552,7 @@ export default {
         let data = {
           audio_file_id: this.data.audio_data.file_id,
           text: text,
+          text_type: 'text',
         };
         getWordTimes(data)
           .then((res) => {

+ 22 - 3
src/views/book/courseware/create/components/question/dialogue_article/Article.vue

@@ -146,7 +146,7 @@
             <a size="medium" @click="compareTime('文字')">校对文字字幕时间</a>
           </template>
           <template v-else>
-            <a v-if="!isWordTime" size="medium" @click="createWordTime">自动生成字幕节点</a>
+            <a v-if="!isWordTime" size="medium" @click="createWordTimes">自动生成字幕节点</a>
             <p v-else>字幕节点生成中...请等待</p>
           </template>
           <el-button @click="handleMultilingual">课文多语言</el-button>
@@ -710,12 +710,29 @@ export default {
         this.data.detail[paraIndex].wordsList[sentenceIndex][wordIndex].pinyin = pinyin;
       }
     },
-    saveStyle(paraIndex, sentenceIndex, wordIndex, fontFamily, textDecoration, fontWeight, border, color) {
+    saveStyle(
+      paraIndex,
+      sentenceIndex,
+      wordIndex,
+      fontFamily,
+      textDecoration,
+      fontWeight,
+      border,
+      color,
+      matchWords,
+      matchNotes,
+      img,
+      imgPosition,
+    ) {
       this.data.detail[paraIndex].wordsList[sentenceIndex][wordIndex].fontFamily = fontFamily;
       this.data.detail[paraIndex].wordsList[sentenceIndex][wordIndex].textDecoration = textDecoration;
       this.data.detail[paraIndex].wordsList[sentenceIndex][wordIndex].fontWeight = fontWeight;
       this.data.detail[paraIndex].wordsList[sentenceIndex][wordIndex].border = border;
       this.data.detail[paraIndex].wordsList[sentenceIndex][wordIndex].color = color;
+      this.data.detail[paraIndex].wordsList[sentenceIndex][wordIndex].matchWords = matchWords;
+      this.data.detail[paraIndex].wordsList[sentenceIndex][wordIndex].matchNotes = matchNotes;
+      this.data.detail[paraIndex].wordsList[sentenceIndex][wordIndex].img = img;
+      this.data.detail[paraIndex].wordsList[sentenceIndex][wordIndex].imgPosition = imgPosition;
     },
     // 保存校对
     saveCompare() {
@@ -763,7 +780,7 @@ export default {
         _this.data.detail.forEach((item) => {
           if (item.type === 'text') {
             verseList = verseList.concat(item.sentences);
-            text += item.sentences;
+            text += item.sentences.join('');
           }
         });
         if (verseList.length > 0) {
@@ -771,6 +788,8 @@ export default {
           let data = {
             audio_file_id: _this.data.mp3_list[0].file_id,
             text: text,
+            text_type: 'line_text_list',
+            line_text_list: verseList,
           };
           getWordTimes(data).then((res) => {
             _this.data.wordTime = res.data.result;

+ 7 - 4
src/views/book/courseware/create/components/question/image_text/ImageText.vue

@@ -35,7 +35,7 @@
         </div>
         <SvgIcon icon-class="delete-black" size="12" @click="removeFile" />
       </div>
-      <el-button v-if="data.mp3_list.length > 0" type="primary" size="small" @click="handleTime">{{
+      <el-button v-if="data.mp3_list.length > 0" type="primary" size="small" @click="handleTimes">{{
         data.word_time.length === 0 ? '自动生成字幕节点' : '重新生成字幕节点'
       }}</el-button>
 
@@ -358,8 +358,10 @@ export default {
     // 生成字幕
     handleTimes() {
       let text = '';
+      let verseList = [];
       this.data.text_list.forEach((item) => {
-        text += item.text + '\r';
+        text += item.text;
+        verseList = verseList.concat(item.text);
       });
       if (text) {
       } else {
@@ -371,11 +373,13 @@ export default {
       let data = {
         audio_file_id: this.data.mp3_list[0].file_id,
         text: text,
+        line_text_list: verseList,
+        text_type: 'line_text_list',
       };
       getWordTimes(data)
         .then((res) => {
           this.data.word_time = res.data.result;
-          this.handleResult();
+          // this.handleResult();
 
           if (this.data.property.is_first_sentence_first_hz_pinyin_first_char_upper_case === 'true') {
             this.handleUpPinyin();
@@ -388,7 +392,6 @@ export default {
     },
     // 把字幕结果按段组合到一起
     handleResult() {
-      console.log(this.data.word_time);
       let index = 0;
       this.data.text_list.forEach((item) => {
         let sentence = item.text;

+ 1 - 0
src/views/book/courseware/create/components/question/new_word/NewWord.vue

@@ -721,6 +721,7 @@ export default {
         let data = {
           audio_file_id: this.data.audio_data.file_id,
           text: text,
+          text_type: 'text',
         };
         getWordTimes(data)
           .then((res) => {