mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-18 23:36:44 +08:00
ai视频二期功能提交-ai翻译编辑联调
This commit is contained in:
@@ -93,7 +93,7 @@ const getTextDetail = function(data) {
|
||||
"videoId": "VIDEO_001",
|
||||
"language": "zh-CN",
|
||||
"subtitleData": "dddd",
|
||||
"updateStatus": 1, // 0-(重新生成)更新当前语种 1-同步更新
|
||||
"updateStatus": 1, // 0-编辑 1-重新生成 2-同步更新
|
||||
}
|
||||
*/
|
||||
const updateText = function(data) {
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
<p v-show="type == 1" v-html="aiTranslate"></p>
|
||||
<p v-show="type == 2" style="color: rgba(207, 207, 207, 1);text-align: center;margin-top: 48%;">AI 翻译重新生成中,过程可能耗时较长,<br>无需在此等待哦~</p>
|
||||
<img v-show="type == 3" src="@/assets/images/course/generationFailed.png" alt="" width="150" height="159" style="display: flex;margin: 35% auto 0 auto;">
|
||||
<img v-show="type == 5" src="@/assets/images/course/selectLanguage.png" alt="" width="112" height="130" style="display: flex;margin: 35% auto 0 auto;">
|
||||
<img v-show="type == 5" src="@/assets/images/course/selectLanguage.png" alt="" width="82" height="100" style="display: flex;margin: 35% auto 0 auto;">
|
||||
</div>
|
||||
<el-input v-show="type == 4"
|
||||
type="textarea"
|
||||
@@ -68,7 +68,8 @@
|
||||
v-model="aiTranslate">
|
||||
</el-input>
|
||||
<div class="opera-btn">
|
||||
<el-button v-show="type == 1 && currentLang != 'zh-CN'" type="primary" plain round size="mini" @click="handleGenerate()">重新生成</el-button>
|
||||
<!-- // 1: 正常 2: 生成中 3: 错误 4: 编辑中 5: 未选择语种 -->
|
||||
<el-button v-show="(type == 1 || type == 3) && currentLang != 'zh-CN'" type="primary" plain round size="mini" @click="handleGenerate()">重新生成</el-button>
|
||||
<el-button v-show="type == 1 && currentLang == 'zh-CN'" type="primary" plain round size="mini" @click="updateDialogVisible = true">同步更新</el-button>
|
||||
<el-button v-show="type == 1" type="primary" plain round size="mini" @click="type = 4">编辑</el-button>
|
||||
<el-button v-show="type == 4" plain round size="mini" @click="type = 1">取消</el-button>
|
||||
@@ -109,7 +110,7 @@
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="selectDialogVisible = false">取 消</el-button>
|
||||
<el-button style="" type="primary" @click="selectDialogVisible = false">确 认</el-button>
|
||||
<el-button style="" type="primary" @click="handleSelectableLang">确 认</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
@@ -417,6 +418,18 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
// 设置语种
|
||||
handleSelectableLang() {
|
||||
apiCourse.benchAiSet({courseList:[{id: this.courseId, languageCode: this.currentLangList}]}).then(res => {
|
||||
this.selectDialogVisible = false;
|
||||
if(res.status === 200){
|
||||
this.$message.success('语种设置成功!');
|
||||
this.getCourseInfo();
|
||||
}else{
|
||||
this.$message.error(res.message || '语种设置失败!');
|
||||
}
|
||||
})
|
||||
},
|
||||
// 提交编辑后的字幕
|
||||
submitSubtitle() {
|
||||
// 校验文本格式
|
||||
@@ -435,30 +448,36 @@ export default {
|
||||
videoId: this.currentVideo.id,
|
||||
language: this.currentLang,
|
||||
subtitleData: JSON.stringify(jsonData),
|
||||
updateStatus: 0, // 0-(重新生成)更新当前语种 1-同步更新
|
||||
}).then(res => {
|
||||
this.$message.success('字幕提交成功!');
|
||||
this.getCourseInfo();
|
||||
updateStatus: 0, // 0-编辑 1-重新生成 2-同步更新
|
||||
}).then(res => {
|
||||
if(res.rspCode === '0000'){
|
||||
this.$message.success('字幕编辑成功!');
|
||||
this.getCourseInfo();
|
||||
}else{
|
||||
this.$message.error(res.rspDesc || '字幕编辑失败!');
|
||||
}
|
||||
});
|
||||
},
|
||||
// 确认同步更新
|
||||
handleSyncUpdate() {
|
||||
// 转换为JSON格式
|
||||
const jsonData = this.textToJsonFormat(this.aiTranslate);
|
||||
console.log('转换后的JSON数据:', jsonData);
|
||||
apiAiVideo.updateText({
|
||||
videoId: this.currentVideo.id,
|
||||
language: this.currentLang,
|
||||
subtitleData: JSON.stringify(jsonData),
|
||||
updateStatus: 1, // 0-(重新生成)更新当前语种 1-同步更新
|
||||
}).then(res => {
|
||||
this.$message.success('字幕提交成功!');
|
||||
this.getCourseInfo();
|
||||
updateStatus: 2, // 0-编辑 1-重新生成 2-同步更新
|
||||
}).then(res => {
|
||||
this.updateDialogVisible = false;
|
||||
if(res.rspCode === '0000'){
|
||||
this.$message.success('同步更新中!');
|
||||
this.getCourseInfo();
|
||||
}else{
|
||||
this.$message.error(res.rspDesc || '同步更新失败!');
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
// 重新生成
|
||||
handleGenerate() {
|
||||
this.$confirm('此操作将中文重新生成译文, 是否继续?', '提示', {
|
||||
this.$confirm('此操作将重新生成译文, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
@@ -467,10 +486,14 @@ export default {
|
||||
apiAiVideo.updateText({
|
||||
videoId: this.currentVideo.id,
|
||||
language: this.currentLang,
|
||||
updateStatus: 0, // 0-(重新生成)更新当前语种 1-同步更新
|
||||
updateStatus: 1, // 0-编辑 1-重新生成 2-同步更新
|
||||
}).then(res => {
|
||||
this.$message.success('字幕提交成功!');
|
||||
this.getCourseInfo();
|
||||
if(res.rspCode === '0000'){
|
||||
this.$message.success('重新生成中!');
|
||||
this.getCourseInfo();
|
||||
}else{
|
||||
this.$message.error(res.rspDesc || '重新生成失败!');
|
||||
}
|
||||
});
|
||||
}).catch(() => {});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user