Ver código fonte

视频预览 字幕打点 文章生成音频 获取组词 近反义词 释义接口

秦鹏 3 anos atrás
pai
commit
da924a4de8

+ 1 - 20
src/components/Adult/inputModules/ArticleTemChs/components/ArticleChs.vue

@@ -15,9 +15,6 @@
       <el-button type="primary" size="small" @click="createPara"
         >生成段落</el-button
       >
-      <el-button :loading="CreadMp3loading" size="small" @click="CreadMp3"
-        >生成音频</el-button
-      >
     </div>
   </div>
 </template>
@@ -46,23 +43,7 @@ export default {
   watch: {},
   //方法集合
   methods: {
-    // 根据文章生成MP3
-    CreadMp3() {
-      if (!this.curQue.article) {
-        this.$message.warning("请先输入内容,在生成音频");
-        return;
-      }
-      this.CreadMp3loading = true;
-      textCreadMp3({
-        text: this.curQue.article,
-      }).then((res) => {
-        console.log(res);
-        let fileList = [res.data.fileInfo];
-        //this.$set(this.curQue, "mp3_file_base64", res.data.fileBase64);
-        this.$set(this.curQue, "mp3_list", fileList);
-        this.CreadMp3loading = false;
-      });
-    },
+
     onBlur(item, field) {
       item[field] = item[field] ? item[field].trim() : "";
     },

+ 25 - 7
src/components/Adult/inputModules/ArticleTemChs/components/CompareTime.vue

@@ -10,10 +10,18 @@
         <tr v-for="(item, index) in data" :key="index + 'sen'">
           <td>{{ item.onebest }}</td>
           <td>
-            <input v-model="item.bg" @change="changeTime(item)" type="text" />
+            <input
+              v-model="item.bg"
+              @change="changeTime(item, 'bg')"
+              type="text"
+            />
           </td>
           <td>
-            <input v-model="item.ed" @change="changeTime(item)" type="text" />
+            <input
+              v-model="item.ed"
+              @change="changeTime(item, 'ed')"
+              type="text"
+            />
           </td>
         </tr>
       </table>
@@ -52,10 +60,18 @@
           <tr v-for="(item, index) in wordData" :key="index + 'wordsResul'">
             <td>{{ item.wordsName ? item.wordsName : item.onebest }}</td>
             <td>
-              <input v-model="item.wordBg" type="text" />
+              <input
+                v-model="item.wordBg"
+                type="text"
+                @change="changeTime(item, 'wordBg')"
+              />
             </td>
             <td>
-              <input v-model="item.wordEd" type="text" />
+              <input
+                v-model="item.wordEd"
+                type="text"
+                @change="changeTime(item, 'wordEd')"
+              />
             </td>
           </tr>
         </table>
@@ -92,9 +108,11 @@ export default {
   watch: {},
   //方法集合
   methods: {
-    changeTime(item) {
-      item.adjust = "1";
-      console.log(item);
+    changeTime(item, type) {
+      item[type] = item[type] * 1;
+      if (type == "bg" || type == "en") {
+        item.adjust = "1";
+      }
     },
     compareOneHZ(index) {
       this.index = index;

+ 88 - 20
src/components/Adult/inputModules/ArticleTemChs/index.vue

@@ -48,8 +48,11 @@
         :datafileList="fileCon.mp3_list"
         :filleNumber="mp3Number"
         :uploadType="'mp3'"
-        :handleMp3Base64="handleChange"
       />
+      <!-- 
+        :handleMp3Base64="handleChange"
+
+       -->
     </div>
     <div class="adult-book-input-item">
       <span class="adult-book-lable">功能配置:</span>
@@ -68,6 +71,9 @@
         :changeIsPara="changeIsPara"
       />
     </div>
+    <el-button :loading="CreadMp3loading" size="small" @click="CreadMp3"
+      >生成音频</el-button
+    >
     <div class="NPC-Book-Paragraph" v-if="isPara">
       <Paragraph :curQue="curQue" :isClause="isClause" :sureSeg="sureSeg" />
     </div>
@@ -158,6 +164,8 @@ import {
   prepareTranscribe,
   getWordTime,
   compareSenTenceTime,
+  textCreadMp3,
+  getContentFile,
 } from "@/api/ajax";
 const Base64 = require("js-base64").Base64;
 import Upload from "../../common/Upload.vue";
@@ -215,14 +223,72 @@ export default {
       compareShow: false,
       compareData: null,
       compareloading: false,
+      CreadMp3loading: false,
     };
   },
   computed: {},
   watch: {},
   //方法集合
   methods: {
+    // 得到文件流
+    getfillLiu() {
+      this.loading = true;
+      let _this = this;
+      return new Promise(function (resolve, reject) {
+        let id = "";
+        if (_this.curQue.mp3_list[0].id.indexOf("#") != -1) {
+          id = _this.curQue.mp3_list[0].id.substring(
+            6,
+            _this.curQue.mp3_list[0].id.length - 6
+          );
+        } else {
+          id = _this.curQue.mp3_list[0].id;
+        }
+
+        let Mname = "file_store_manager-GetFileByteBase64Text";
+        let data = {
+          file_id: id,
+        };
+        getContentFile(Mname, data).then((res) => {
+          let taskIddata = {
+            fileName: _this.curQue.mp3_list[0].name,
+            speechBase64: res.base64_text,
+            language: "ch",
+          };
+          prepareTranscribe(taskIddata).then((res) => {
+            _this.$set(_this.curQue, "taskId", res.data.taskId);
+            _this.loading = false;
+            resolve();
+          });
+        });
+      });
+    },
+    // 根据文章生成MP3
+    CreadMp3() {
+      let _this = this;
+      if (!_this.curQue.article) {
+        _this.$message.warning("请先输入内容,在生成音频");
+        return;
+      }
+      _this.CreadMp3loading = true;
+      textCreadMp3({
+        text: _this.curQue.article,
+      }).then((res) => {
+        res.data.fileInfo.id = res.data.fileInfo.file_id;
+        res.data.fileInfo.name = res.data.fileInfo.file_name;
+
+        let fileList = [res.data.fileInfo];
+        //this.$set(this.curQue, "mp3_file_base64", res.data.fileBase64);
+        _this.$set(_this.curQue, "mp3_list", fileList);
+        _this.CreadMp3loading = false;
+      });
+    },
     // 保存校对
     saveCompare() {
+      if (this.compareType == "文字") {
+        this.compareloading = false;
+        return;
+      }
       this.compareloading = true;
       compareSenTenceTime({ matchList: JSON.stringify(this.compareData) }).then(
         (res) => {
@@ -381,27 +447,29 @@ export default {
       });
     },
     createWordTime() {
-      if (this.curQue.taskId) {
-        let verseList = [];
-        this.curQue.detail.forEach((item) => {
-          verseList = verseList.concat(item.sentences);
-        });
-        if (verseList.length > 0) {
-          this.isWordTime = true;
-          let data = {
-            taskId: this.curQue.taskId,
-            verseList: JSON.stringify(verseList),
-            matchType: "chinese",
-            language: "ch",
-          };
-          getWordTime(data).then((res) => {
-            this.curQue.wordTime = res.data.result;
-            this.isWordTime = false;
+      this.getfillLiu().then(() => {
+        if (this.curQue.taskId) {
+          let verseList = [];
+          this.curQue.detail.forEach((item) => {
+            verseList = verseList.concat(item.sentences);
           });
+          if (verseList.length > 0) {
+            this.isWordTime = true;
+            let data = {
+              taskId: this.curQue.taskId,
+              verseList: JSON.stringify(verseList),
+              matchType: "chinese",
+              language: "ch",
+            };
+            getWordTime(data).then((res) => {
+              this.curQue.wordTime = res.data.result;
+              this.isWordTime = false;
+            });
+          }
+        } else {
+          this.$message.warning("请先上传音频");
         }
-      } else {
-        this.$message.warning("请先上传音频");
-      }
+      });
     },
     againWordTime() {
       this.isWordTime = false;

+ 78 - 19
src/components/Adult/inputModules/DialogueArticleChs/index.vue

@@ -116,6 +116,9 @@
         :changeIsPara="changeIsPara"
       />
     </div>
+    <el-button :loading="CreadMp3loading" size="small" @click="CreadMp3"
+      >生成音频</el-button
+    >
     <div class="NPC-Book-Paragraph" v-if="isPara">
       <Paragraph :curQue="curQue" :isClause="isClause" :sureSeg="sureSeg" />
     </div>
@@ -226,6 +229,7 @@ import {
   prepareTranscribe,
   getWordTime,
   compareSenTenceTime,
+  getContentFile,
 } from "@/api/ajax";
 const Base64 = require("js-base64").Base64;
 import Upload from "../../common/Upload.vue";
@@ -321,6 +325,59 @@ export default {
   watch: {},
   //方法集合
   methods: {
+    // 得到文件流
+    getfillLiu() {
+      this.loading = true;
+      let _this = this;
+      return new Promise(function (resolve, reject) {
+        let id = "";
+        if (_this.curQue.mp3_list[0].id.indexOf("#") != -1) {
+          id = _this.curQue.mp3_list[0].id.substring(
+            6,
+            _this.curQue.mp3_list[0].id.length - 6
+          );
+        } else {
+          id = _this.curQue.mp3_list[0].id;
+        }
+
+        let Mname = "file_store_manager-GetFileByteBase64Text";
+        let data = {
+          file_id: id,
+        };
+        getContentFile(Mname, data).then((res) => {
+          let taskIddata = {
+            fileName: _this.curQue.mp3_list[0].name,
+            speechBase64: res.base64_text,
+            language: "ch",
+          };
+          prepareTranscribe(taskIddata).then((res) => {
+            _this.$set(_this.curQue, "taskId", res.data.taskId);
+            _this.loading = false;
+            resolve();
+          });
+        });
+      });
+    },
+    // 根据文章生成MP3
+    CreadMp3() {
+      let _this = this;
+      if (!_this.curQue.article) {
+        _this.$message.warning("请先输入内容,在生成音频");
+        return;
+      }
+      _this.CreadMp3loading = true;
+      textCreadMp3({
+        text: _this.curQue.article,
+      }).then((res) => {
+        res.data.fileInfo.id = res.data.fileInfo.file_id;
+        res.data.fileInfo.name = res.data.fileInfo.file_name;
+
+        let fileList = [res.data.fileInfo];
+        //this.$set(this.curQue, "mp3_file_base64", res.data.fileBase64);
+        _this.$set(_this.curQue, "mp3_list", fileList);
+        _this.CreadMp3loading = false;
+      });
+    },
     // 保存校对
     saveCompare() {
       this.compareloading = true;
@@ -521,27 +578,29 @@ export default {
       });
     },
     createWordTime() {
-      if (this.curQue.taskId) {
-        let verseList = [];
-        this.curQue.detail.forEach((item) => {
-          verseList = verseList.concat(item.sentences);
-        });
-        if (verseList.length > 0) {
-          this.isWordTime = true;
-          let data = {
-            taskId: this.curQue.taskId,
-            verseList: JSON.stringify(verseList),
-            matchType: "chinese",
-            language: "ch",
-          };
-          getWordTime(data).then((res) => {
-            this.curQue.wordTime = res.data.result;
-            this.isWordTime = false;
+      this.getfillLiu().then(() => {
+        if (this.curQue.taskId) {
+          let verseList = [];
+          this.curQue.detail.forEach((item) => {
+            verseList = verseList.concat(item.sentences);
           });
+          if (verseList.length > 0) {
+            this.isWordTime = true;
+            let data = {
+              taskId: this.curQue.taskId,
+              verseList: JSON.stringify(verseList),
+              matchType: "chinese",
+              language: "ch",
+            };
+            getWordTime(data).then((res) => {
+              this.curQue.wordTime = res.data.result;
+              this.isWordTime = false;
+            });
+          }
+        } else {
+          this.$message.warning("请先上传音频");
         }
-      } else {
-        this.$message.warning("请先上传音频");
-      }
+      });
     },
     againWordTime() {
       this.isWordTime = false;

+ 26 - 0
src/components/Adult/inputModules/VideoControl.vue

@@ -24,6 +24,7 @@
 
 <script>
 import Upload from "../common/Upload.vue";
+import { getContentFile } from "@/api/ajax";
 export default {
   components: { Upload },
   props: ["curQue", "fn_data", "changeCurQue"],
@@ -35,6 +36,7 @@ export default {
         name: "视频控件",
         img_list: [],
         video_list: [],
+        loading: null,
       },
     };
   },
@@ -62,6 +64,7 @@ export default {
     changeVideo(fileList) {
       const articleImgList = JSON.parse(JSON.stringify(fileList));
       const articleImgRes = [];
+      let id = "";
       articleImgList.forEach((item) => {
         if (item.response) {
           const obj = {
@@ -70,10 +73,33 @@ export default {
             id: "[FID##" + item.response.file_info_list[0].file_id + "##FID]",
             media_duration: item.response.file_info_list[0].media_duration, //音频时长
           };
+          id = item.response.file_info_list[0].file_id;
           articleImgRes.push(obj);
         }
       });
       this.curQue.video_list = JSON.parse(JSON.stringify(articleImgRes));
+      if (id) {
+        this.getqxd(id);
+      }
+    },
+    // 获取不同视频清晰度 definition
+    getqxd(id) {
+      this.loading = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      let Mname = "tool-VideoConversion_720P_480P";
+      let data = {
+        file_id: id,
+      };
+      getContentFile(Mname, data).then((res) => {
+        this.curQue.definition_list = [];
+        this.curQue.definition_list.push(res["480P"]);
+        this.curQue.definition_list.push(res["720P"]);
+        this.loading.close();
+      });
     },
   },
   //生命周期 - 创建完成(可以访问当前this实例)

+ 3 - 3
src/components/Adult/preview/VideoControl.vue

@@ -83,9 +83,9 @@ export default {
     });
     // 设置清晰度
     _this.player.emit("resourceReady", [
-      { name: "高清", url: "https://v-cdn.zjol.com.cn/276985.mp4" },
-      { name: "标清", url: "https://v-cdn.zjol.com.cn/276984.mp4" },
-      { name: "流畅", url: _this.curQue.video_list[0].url },
+      { name: "高清", url: _this.curQue.video_list[0].url },
+      { name: "标清", url: _this.curQue.definition_list[0].file_url },
+      { name: "流畅", url: _this.curQue.definition_list[1].file_url },
     ]);
     setTimeout(() => {
       let name = document.getElementsByClassName("name")[0];

+ 17 - 1
src/components/Adult/preview/components/Intp.vue

@@ -385,8 +385,24 @@ export default {
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
     let _this = this;
-    _this.getChineseInfo();
+    console.log(_this.word);
+    // _this.getChineseInfo();
     // _this.handleChineseDetail();
+    if (_this.word) {
+      _this.mp3Url = _this.word.mp3Url ? _this.word.mp3Url : "";
+      _this.paraphrase = _this.word.paraphrase
+        ? JSON.parse(JSON.stringify(_this.word.paraphrase))
+        : [];
+      _this.synonymList = _this.word.synonymList
+        ? JSON.parse(JSON.stringify(_this.word.synonymList))
+        : [];
+      _this.antonymList = _this.word.antonymList
+        ? JSON.parse(JSON.stringify(_this.word.antonymList))
+        : [];
+      _this.termsList = _this.word.termsList
+        ? JSON.parse(JSON.stringify(_this.word.termsList))
+        : [];
+    }
   },
   beforeCreate() {}, //生命周期 - 创建之前
   beforeMount() {}, //生命周期 - 挂载之前

+ 52 - 11
src/components/Adult/preview/components/Wordcard.vue

@@ -12,15 +12,8 @@
     </div>
     <div class="bwc-top" v-if="word.detail">
       <span v-if="word.detail.pinyin">{{ word.detail.pinyin }}</span>
-      <Audio
-        :fontSize="20"
-        :mp3="
-          word.detail.mp3_list.length > 0 ? word.detail.mp3_list[0].url : ''
-        "
-        :pinyin="word.detail.pinyin"
-        :themeColor="themeColor"
-      />
-      <img
+      <Audio :mp3="mp3Url ? mp3Url : ''" :themeColor="themeColor" />
+      <!-- <img
         :src="
           themeColor
             ? themeColor == 'green'
@@ -32,7 +25,7 @@
         "
         v-if="word.detail.mp3_list.length == 0"
         style="width: 16px"
-      />
+      /> -->
     </div>
     <div
       class="bwc-Strockplay"
@@ -141,7 +134,7 @@ import Audio from "./AudioRed.vue";
 import Strockplayredline from "./Strockplayredline.vue";
 import Practice from "./Practice.vue";
 import WordPhraseDetail from "./WordPhraseDetail.vue";
-import { getContentFile, getContent } from "@/api/ajax";
+import { getContentFile, getContent, getHZChineseInfo } from "@/api/ajax";
 
 export default {
   name: "Wordcard",
@@ -158,6 +151,8 @@ export default {
       isIntpShow: false,
       curData: null,
       defStr: "",
+      mp3Url: "", // 音频
+      dataDetail: null,
     };
   },
   computed: {},
@@ -235,6 +230,51 @@ export default {
     changeIntpShow() {
       this.isIntpShow = false;
     },
+    getChineseInfo() {
+      let _this = this;
+      let data = {
+        query: this.word.detail.new_word,
+        //  query: "开心",
+      };
+      getHZChineseInfo(data).then((res) => {
+        _this.dataDetail = res.data.result;
+        _this.handleChineseDetail();
+      });
+    },
+    // 处理数据
+    handleChineseDetail() {
+      let _this = this;
+      _this.dataDetail.forEach((item) => {
+        if (item.request.queryType == "entity") {
+          // 读音
+          item.response.entity.forEach((items) => {
+            items.attrs.forEach((itemss) => {
+              if (itemss.key == "pronunciation") {
+                // 音频
+                _this.mp3Url = itemss.objects[0]["@value"]
+                  ? itemss.objects[0]["@value"]
+                  : "";
+                _this.word.detail.mp3Url = itemss.objects[0]["@value"]
+                  ? itemss.objects[0]["@value"]
+                  : "";
+              } else if (itemss.key == "definition") {
+                // 释义
+                _this.word.detail.paraphrase = itemss.objects;
+              } else if (itemss.key == "synonym") {
+                // 近义词
+                _this.word.detail.synonymList = itemss.objects;
+              } else if (itemss.key == "antonym") {
+                // 反义词
+                _this.word.detail.antonymList = itemss.objects;
+              } else if (itemss.key == "terms") {
+                // 反义词
+                _this.word.detail.termsList = itemss.objects;
+              }
+            });
+          });
+        }
+      });
+    },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {
@@ -252,6 +292,7 @@ export default {
           ? _this.word.detail.definition_list.join(";")
           : "";
     }
+    this.getChineseInfo();
   },
   beforeCreate() {}, //生命周期 - 创建之前
   beforeMount() {}, //生命周期 - 挂载之前