|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <ModuleBase :type="data.type">
|
|
|
+ <ModuleBase :type="data.type" v-loading="loading">
|
|
|
<template #content>
|
|
|
<UploadFile
|
|
|
key="upload_image"
|
|
@@ -37,6 +37,10 @@
|
|
|
</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">{{
|
|
|
+ data.word_time.length === 0 ? '自动生成字幕节点' : '重新生成字幕节点'
|
|
|
+ }}</el-button>
|
|
|
+
|
|
|
<el-radio-group v-model="isText" style="width: 100%; margin: 20px 0; text-align: center">
|
|
|
<el-radio-button :label="true">文字框</el-radio-button>
|
|
|
<el-radio-button :label="false">输入框</el-radio-button>
|
|
@@ -194,6 +198,7 @@ import UploadFile from '../../base/common/UploadFile.vue';
|
|
|
import { getImageTextData } from '@/views/book/courseware/data/imageText';
|
|
|
import SelectUpload from '@/views/book/courseware/create/components/common/SelectUpload.vue';
|
|
|
import { GetFileURLMap } from '@/api/app';
|
|
|
+import { fileToBase64Text, prepareTranscribe, getWordTime } from '@/api/article';
|
|
|
|
|
|
export default {
|
|
|
name: 'ImageTextPage',
|
|
@@ -214,6 +219,7 @@ export default {
|
|
|
genloading: false, // 字幕节点loading
|
|
|
isText: true, // 框选是文本还是输入框
|
|
|
inputActiveIndex: null, // 当前编辑输入框热区索引
|
|
|
+ loading: false,
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -328,6 +334,53 @@ export default {
|
|
|
});
|
|
|
this.data.mind_map.node_list = node_list;
|
|
|
},
|
|
|
+ // 生成字幕
|
|
|
+ handleTime() {
|
|
|
+ let verseList = [];
|
|
|
+ this.data.text_list.forEach((item) => {
|
|
|
+ verseList = verseList.concat(item.text);
|
|
|
+ });
|
|
|
+ if (verseList.length > 0) {
|
|
|
+ } else {
|
|
|
+ this.$message.warning('请先录入文本内容');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.loading = true;
|
|
|
+ fileToBase64Text({
|
|
|
+ file_id: this.data.mp3_list[0].file_id,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ let taskIddata = {
|
|
|
+ fileName: this.data.mp3_list[0].name,
|
|
|
+ speechBase64: res.base64_text,
|
|
|
+ language: 'ch',
|
|
|
+ };
|
|
|
+ prepareTranscribe(taskIddata)
|
|
|
+ .then((res) => {
|
|
|
+ let taskId = res.data.taskId;
|
|
|
+ let data = {
|
|
|
+ taskId: taskId,
|
|
|
+ verseList: JSON.stringify(verseList),
|
|
|
+ matchType: 'chinese',
|
|
|
+ language: 'ch',
|
|
|
+ };
|
|
|
+ getWordTime(data)
|
|
|
+ .then((res) => {
|
|
|
+ this.data.word_time = res.data.result;
|
|
|
+ this.loading = false;
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|