du
2025-04-15 af53664944a59c0e5e7c76fca6e48c58ffbcf21d
修改BUG
已修改1个文件
25 ■■■■ 文件已修改
easegen-front/src/views/myCourse/index.vue 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
easegen-front/src/views/myCourse/index.vue
@@ -454,16 +454,15 @@
    subtitleDialogVisible.value = true
    subtitleForm.videoId = videoId
    const videoDetail = await pptTemplateApi.myCourseDetail(videoId)
    // 立即获取视频详情检查字幕状态
    subtitleForm.subtitlesAddStatus=videoDetail.subtitlesAddStatus
    console.log('视频详情:', videoDetail)
    if (videoDetail.subtitlesAddStatus === 2) {
      subtitleForm.videoUrl = videoDetail.videoUrl || ''
      generating.value=false
      polling.value=false
    }else if (videoDetail.subtitlesAddStatus === 1) {
      subtitleForm.videoUrl = ''
      generating.value=true
      polling.value=true
    }
@@ -497,6 +496,7 @@
    }else if (videoDetail.subtitlesStatus === 1) {
      generating.value=true
      polling.value=true
      subtitleForm.content = ''
    }
  } catch (error) {
    console.error('获取视频详情失败:', error)
@@ -555,7 +555,7 @@
const generateSubtitles = async () => {
  try {
    await subtitleFormRef.value.validateField(['timeThreshold', 'language'])
    console.log(subtitleForm)
    if (!subtitleForm.videoId) {
      message.warning('视频ID不能为空')
      return
@@ -569,8 +569,7 @@
      lang: subtitleForm.language
    }
    await pptTemplateApi.generateSubtitles(params)
    message.success('字幕生成任务已开始')
    message.success(subtitleForm.courseName+' '+'字幕生成任务已开始')
    const maxAttempts = 20000
    const interval = 3000
    let attempts = 0
@@ -596,13 +595,13 @@
          } else if (videoDetail.subtitlesContent) {
            subtitleForm.content = videoDetail.subtitlesContent
          }
          message.success('字幕生成成功')
          message.success(subtitleForm.courseName+' '+'字幕生成成功')
          stopPolling()
        } else if (videoDetail.subtitlesStatus === 3) {
          // message.error(`字幕生成失败: ${videoDetail.errorReason || '未知原因'}`)
          stopPolling()
        } else if (attempts >= maxAttempts) {
          message.warning('字幕生成超时,请稍后手动检查')
          message.warning(subtitleForm.courseName+' '+'字幕生成超时,请稍后手动检查')
          stopPolling()
        } else {
          pollingTimer = window.setTimeout(poll, interval)
@@ -620,7 +619,7 @@
    poll()
  } catch (error) {
    console.error('生成字幕出错:', error)
    console.error(subtitleForm.courseName+' '+'生成字幕出错:', error)
    // message.error(`生成字幕失败: ${error.message || '未知错误'}`)
    stopPolling()
  } finally {
@@ -714,7 +713,7 @@
      id: subtitleForm.videoId
    }
    await pptTemplateApi.videoMeger(obj)
    message.success('字幕视频合成任务已开始')
    message.success(subtitleForm.courseName+' '+'字幕视频合成任务已开始')
    const maxAttempts = 200000
    const interval = 3000
@@ -729,7 +728,7 @@
        console.log('轮询字幕视频合成结果:', videoDetail)
        if (videoDetail.subtitlesAddStatus === 2) {
          message.success('字幕视频合成成功')
          message.success(subtitleForm.courseName+' '+'字幕视频合成成功')
          if (videoDetail.previewUrl) {
            subtitleForm.content = '' // 清空当前字幕内容
            stopPolling()
@@ -737,10 +736,10 @@
            getList() // 刷新列表
          }
        } else if (videoDetail.subtitlesAddStatus === 3) {
          message.error(`字幕视频合成失败: ${videoDetail.errorReason || '未知原因'}`)
          message.error(subtitleForm.courseName+' '+`字幕视频合成失败: ${videoDetail.errorReason || '未知原因'}`)
          stopPolling()
        } else if (attempts >= maxAttempts) {
          message.warning('字幕视频合成超时,请稍后手动检查')
          message.warning(subtitleForm.courseName+' '+'字幕视频合成超时,请稍后手动检查')
          stopPolling()
        } else {
          pollingTimer = window.setTimeout(poll, interval)