diff --git a/src/api/modules/courseAiVideo.js b/src/api/modules/courseAiVideo.js index c8928d5c..8a3bd873 100644 --- a/src/api/modules/courseAiVideo.js +++ b/src/api/modules/courseAiVideo.js @@ -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) { diff --git a/src/views/course/aiSet/aiTranslate.vue b/src/views/course/aiSet/aiTranslate.vue index e26cbcc7..3b1acf52 100644 --- a/src/views/course/aiSet/aiTranslate.vue +++ b/src/views/course/aiSet/aiTranslate.vue @@ -59,7 +59,7 @@

AI 翻译重新生成中,过程可能耗时较长,
无需在此等待哦~

- +
- 重新生成 + + 重新生成 同步更新 编辑 取消 @@ -109,7 +110,7 @@
取 消 - 确 认 + 确 认 @@ -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(() => {}); },