ai视频二期功能提交-编辑ai翻译

This commit is contained in:
sunli_tydic
2025-12-17 18:04:08 +08:00
parent 04e163b63e
commit 423275ed08
3 changed files with 379 additions and 38 deletions

View File

@@ -4,7 +4,7 @@
<div class="left-title">{{courseInfo.name}}</div>
<ul class="ai-list" >
<template v-for="c in chapterList">
<li class="ai-item" v-for="(item, index) in c.children" @click="handleSelectVideo(item, index+1)" :class="{'active': currentVideo.id === item.id}" :key="index">
<li class="ai-item" v-for="(item, index) in c.children" @click="handleSelectVideo(item, index+1)" :class="{'active': currentVideo.id === item.id}" :key="item.id">
<div class="ai-item-title">{{item.chapterName}}-{{'视频' + (index + 1)}}</div>
</li>
</template>
@@ -34,7 +34,7 @@
<div class="opera-title">
<h4>课程摘要</h4>
<div class="opera-btn">
<el-button v-if="type == 1" type="primary" plain round size="mini" @click="retrySummaryTxt">重新生成</el-button>
<el-button v-if="type == 1 || type == 3" type="primary" plain round size="mini" @click="retrySummaryTxt">重新生成</el-button>
<el-button v-if="type == 1" type="primary" plain round size="mini" @click="type = 4">编辑</el-button>
<el-button v-if="type == 4" plain round size="mini" @click="type = 1">取消</el-button>
<el-button v-if="type == 4" type="primary" plain round size="mini" @click="updateSummary">确认</el-button>
@@ -84,6 +84,14 @@ export default {
blobId: '',
blobUrl: '',
videoSummary: '',
summaryTimer: null
}
},
beforeDestroy() {
// 组件销毁前清除定时器
if (this.summaryTimer) {
clearInterval(this.summaryTimer);
this.summaryTimer = null;
}
},
created() {
@@ -181,7 +189,36 @@ export default {
courseId: this.courseId,
})
.then((rs) => {
// 任务状态 courseSummaryTaskStatus 0-未开始 1-执行中 2-执行完成 3-执行失败 4-重试中
// 页面状态 type 1: 正常 2: 生成中 3: 错误 4: 编辑中
let taskStatus = rs.data.courseSummaryTaskStatus;
// 统一清除可能存在的旧定时器
if (this.summaryTimer) {
clearInterval(this.summaryTimer);
this.summaryTimer = null;
}
if (taskStatus == 1 || taskStatus == 4) {
this.type = 2;
// 设置新定时器每隔1秒调用一次
this.summaryTimer = setInterval(() => {
this.getCourseSummary();
}, 5000);
} else if (taskStatus == 3) {
this.type = 3;
} else {
this.type = 1;
}
this.aiAbstract = rs.data.summaryContent || '';
})
.catch(() => {
// 请求失败时也清除定时器
if (this.summaryTimer) {
clearInterval(this.summaryTimer);
this.summaryTimer = null;
}
})
},
createPlayUrl(fid, u) {