Forráskód Böngészése

Merge branch 'master' of http://221.216.211.14:3000/GCLS/GCLS_Page_Book_Component_NPC

# Conflicts:
#	src/components/Adult/inputModules/ArticleTemChs/index.vue
guanchunjie 3 éve
szülő
commit
f77d644af4

+ 17 - 0
src/api/ajax.js

@@ -297,4 +297,21 @@ export function textCreadMp3(data) {
         method: 'post',
         data
     })
+}
+export function compareSenTenceTime(data) {
+    let userInfor = getToken();
+    let UserCode = '',
+        UserType = '',
+        SessionID = ''
+    if (userInfor) {
+        let user = JSON.parse(getToken());
+        UserCode = user.user_code;
+        UserType = user.user_type;
+        SessionID = user.session_id;
+    }
+    return request({
+        url: `/GCLSHMToolsServer/api/xunfei/speech/adjustResult?UserCode=${UserCode}&UserType=${UserType}&SessionID=${SessionID}`,
+        method: 'post',
+        data
+    })
 }

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

@@ -15,7 +15,9 @@
       <el-button type="primary" size="small" @click="createPara"
         >生成段落</el-button
       >
-      <el-button size="medium" @click="CreadMp3">生成音频</el-button>
+      <el-button :loading="CreadMp3loading" size="small" @click="CreadMp3"
+        >生成音频</el-button
+      >
     </div>
   </div>
 </template>
@@ -37,21 +39,25 @@ export default {
         timeList: [],
         isTitle: false,
       },
+      CreadMp3loading: false,
     };
   },
   computed: {},
   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);
+        this.CreadMp3loading = false;
       });
     },
     onBlur(item, field) {

+ 154 - 0
src/components/Adult/inputModules/ArticleTemChs/components/CompareTime.vue

@@ -0,0 +1,154 @@
+<template>
+  <div class="CompareTime">
+    <div
+      :class="['sentence']"
+      v-for="(item, index) in data"
+      :key="index + 'sen'"
+    >
+      <div>{{ item.onebest }}</div>
+      <div class="time" v-if="type == '句子'">
+        <span>开始时间:</span>
+        <el-input
+          style="width: 100px"
+          v-model="item.bg"
+          placeholder="开始时间"
+          @change="changeTime(item)"
+        ></el-input
+        >~
+        <span>结束时间:</span>
+        <el-input
+          style="width: 100px"
+          v-model="item.ed"
+          placeholder="结束时间"
+          @change="changeTime(item)"
+        ></el-input>
+      </div>
+      <div class="time" v-else>
+        <el-button
+          style="margin-top: 15px"
+          type="primary"
+          @click="compareOneHZ(index)"
+          size="medium"
+          >校对文字字幕时间</el-button
+        >
+      </div>
+    </div>
+    <template v-if="wordData">
+      <el-dialog
+        title="校对字母时间"
+        :visible.sync="oneHZshow"
+        width="50%"
+        :before-close="handleClose"
+        :modal="false"
+        top="0"
+      >
+        <div
+          :class="['sentence']"
+          v-for="(item, index) in wordData"
+          :key="index + 'wordsResul'"
+        >
+          <div class="time">
+            <div>{{ item.wordsName?item.wordsName:item.onebest }}</div>
+            <span>开始时间:</span>
+            <el-input
+              style="width: 100px"
+              v-model="item.wordBg"
+              placeholder="开始时间"
+            ></el-input
+            >~
+            <span>结束时间:</span>
+            <el-input
+              style="width: 100px"
+              v-model="item.wordEd"
+              placeholder="结束时间"
+            ></el-input>
+          </div>
+        </div>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="handleClose">取 消</el-button>
+          <el-button :loading="compareloading" type="primary" @click="savehz"
+            >确 定</el-button
+          >
+        </span>
+      </el-dialog>
+    </template>
+  </div>
+</template>
+
+<script>
+//这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
+//例如:import 《组件名称》from ‘《组件路径》';
+export default {
+  //import引入的组件需要注入到对象中才能使用
+  components: {},
+  props: ["data", "type", "changewordsResultList"],
+  data() {
+    //这里存放数据
+    return {
+      oneHZshow: false,
+      compareloading: false,
+      wordData: null,
+      index: null,
+    };
+  },
+  //计算属性 类似于data概念
+  computed: {},
+  //监控data中数据变化
+  watch: {},
+  //方法集合
+  methods: {
+    changeTime(item) {
+      item.adjust = "1";
+      console.log(item);
+    },
+    compareOneHZ(index) {
+      this.index = index;
+      this.wordData =JSON.parse(JSON.stringify(this.data[index].wordsResultList));
+      this.oneHZshow = true;
+    },
+    savehz() {
+      this.data[this.index].wordsResultList = JSON.parse(
+        JSON.stringify(this.wordData)
+      );
+      this.changewordsResultList(this.index, this.wordData);
+      this.$message.success("保存成功")
+    },
+    handleClose() {
+      this.index = null;
+      this.wordData = null;
+      this.oneHZshow = false;
+    },
+  },
+  //生命周期 - 创建完成(可以访问当前this实例)
+  created() {},
+  //生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {},
+  //生命周期-创建之前
+  beforeCreated() {},
+  //生命周期-挂载之前
+  beforeMount() {},
+  //生命周期-更新之前
+  beforUpdate() {},
+  //生命周期-更新之后
+  updated() {},
+  //生命周期-销毁之前
+  beforeDestory() {},
+  //生命周期-销毁完成
+  destoryed() {},
+  //如果页面有keep-alive缓存功能,这个函数会触发
+  activated() {},
+};
+</script>
+<style lang="scss" scoped>
+/* @import url(); 引入css类 */
+.CompareTime {
+  .sentence {
+    // display: flex;
+    // align-items: center;
+    margin-top: 15px;
+    .time {
+      margin-top: 15px;
+    }
+  }
+}
+</style>

+ 60 - 1
src/components/Adult/inputModules/ArticleTemChs/index.vue

@@ -103,6 +103,12 @@
       >
         <span>已有字幕时间节点</span>
         <el-button type="text" @click="againWordTime">重新生成</el-button>
+        <el-button @click="compareTime('句子')" size="medium"
+          >校对句子字幕时间</el-button
+        >
+        <el-button @click="compareTime('文字')" size="medium"
+          >校对文字字幕时间</el-button
+        >
       </div>
       <template v-else>
         <el-button v-if="!isWordTime" size="medium" @click="createWordTime"
@@ -122,6 +128,24 @@
         <el-button type="primary" @click="saveTimeList">保 存</el-button>
       </span>
     </el-dialog>
+    <el-dialog
+      title="校对字母时间"
+      :visible.sync="compareShow"
+      width="50%"
+      :before-close="handleClose"
+    >
+      <CompareTime
+        :data="compareData"
+        :type="compareType"
+        :changewordsResultList="changewordsResultList"
+      />
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="handleClose">取 消</el-button>
+        <el-button :loading="compareloading" type="primary" @click="saveCompare"
+          >确 定</el-button
+        >
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -132,6 +156,7 @@ import {
   createPinyin,
   prepareTranscribe,
   getWordTime,
+  compareSenTenceTime,
 } from "@/api/ajax";
 const Base64 = require("js-base64").Base64;
 import Upload from "../../common/Upload.vue";
@@ -141,6 +166,7 @@ import Paragraph from "./components/ParagraphChs.vue";
 import Clauseresult from "./components/ClauseresultChs.vue";
 import Segbyword from "./components/SegbywordChs.vue";
 import Createtimelist from "./components/CreatetimelistChs.vue";
+import CompareTime from "./components/CompareTime.vue";
 
 export default {
   name: "ArticleTemChs",
@@ -152,6 +178,7 @@ export default {
     Clauseresult,
     Segbyword,
     Createtimelist,
+    CompareTime,
   },
   props: ["curQue", "changeCurQue", "tmIndex"],
   data() {
@@ -180,15 +207,47 @@ export default {
         detail: [],
         wordTime: [],
         taskId: "",
+        checkList: [1, 2, 3],
       },
       isWordTime: false,
-      checkList: [1, 2, 3],
+      compareType: "", //校对类型
+      compareShow: false,
+      compareData: null,
+      compareloading: false,
     };
   },
   computed: {},
   watch: {},
   //方法集合
   methods: {
+    // 保存校对
+    saveCompare() {
+      this.compareloading = true;
+      compareSenTenceTime({ matchList: JSON.stringify(this.compareData) }).then(
+        (res) => {
+          console.log(res);
+          this.compareloading = false;
+          this.curQue.wordTime = res.data.result;
+        }
+      );
+    },
+    // 校对时间
+    compareTime(type) {
+      this.compareType = type;
+      this.compareData = JSON.parse(JSON.stringify(this.curQue.wordTime));
+      this.compareShow = true;
+    },
+    handleClose() {
+      this.compareShow = false;
+      this.compareData = null;
+      this.compareType = "";
+    },
+    // 校对每个字的时间
+    changewordsResultList(index, item) {
+      this.curQue.wordTime[index].wordsResultList = JSON.parse(
+        JSON.stringify(item)
+      );
+    },
     changeMp3(fileList) {
       const articleImgList = JSON.parse(JSON.stringify(fileList));
       const articleImgRes = [];

+ 1 - 1
src/components/Adult/preview/NewWordShow.vue

@@ -3,7 +3,7 @@
   <div class="Big-Book-prev-Textdes NewWordShow" v-if="curQue">
     <h2 v-if="curQue.title">{{ curQue.title }}</h2>
     <div class="item-box">
-      <div class="item" v-for="(item, index) in curQue.option" :key="index" :style="{width:(curQue.numberList?100/curQue.numberList.con+'%' : auto)}">
+      <div class="item" v-for="(item, index) in curQue.option" :key="index" :style="{width:(curQue.numberList?100/curQue.numberList.con+'%' : 'auto')}">
         <p v-if="item.pinyin||item.en ">
           <span>{{ item.pinyin }}</span>
           <span>{{ item.en }}</span>

+ 1 - 0
src/components/Adult/preview/SelectTone.vue

@@ -96,6 +96,7 @@ export default {
             }
             a{
                 margin-left: 8px;
+                font-size: 0;
                 &.active{
                     background: #98D1EB;
                     border-radius: 4px;

+ 5 - 0
src/components/Adult/preview/TextInputRecord.vue

@@ -21,6 +21,7 @@
           @input="handleInput"
           :class="['item-input']"
           v-model="curQue.Bookanswer[indexs]"
+          @keyup.enter="handleReplaceTone"
           placeholder="输入"
         />
         <template v-if="items.IsRecord">
@@ -59,6 +60,10 @@ export default {
       // }
     },
     handleWav(data) {},
+    handleReplaceTone(e){
+        let value = e.target.value
+        
+    }
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {