|
|
@@ -155,7 +155,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, computed, onMounted, onUnmounted, watch } from 'vue'
|
|
|
+import { ref, computed, onMounted, onUnmounted, watch, nextTick } from 'vue'
|
|
|
import { useRouter } from 'vue-router'
|
|
|
import { ArrowLeftBold, CaretLeft, CaretRight, Grid, VideoPlay } from '@element-plus/icons-vue'
|
|
|
import VoiceInput from '@/components/ai/voice/VoiceInput_Api.vue'
|
|
|
@@ -527,6 +527,9 @@ const playSequence = () => {
|
|
|
}
|
|
|
}, 500)
|
|
|
}
|
|
|
+ } else if (currentDialogue.value?.type === 'video') {
|
|
|
+ // 视频类型对话,不自动播放下一条,等待视频结束事件
|
|
|
+ return
|
|
|
} else {
|
|
|
// 播放当前对话语音,传递isAutoPlay参数
|
|
|
playDialogueAudio(true)
|
|
|
@@ -584,15 +587,17 @@ const playPrevious = () => {
|
|
|
}
|
|
|
|
|
|
// 播放背景音
|
|
|
- playBackgroundAudio()
|
|
|
- // 播放当前对话语音(非诗词类型)
|
|
|
- if (currentDialogue.value?.type !== 'poem') {
|
|
|
- if (isPlaying.value) {
|
|
|
- playDialogueAudio(true)
|
|
|
- } else {
|
|
|
- playDialogueAudio()
|
|
|
+ nextTick(() => {
|
|
|
+ playBackgroundAudio()
|
|
|
+ // 播放当前对话语音(非诗词类型)
|
|
|
+ if (currentDialogue.value?.type !== 'poem') {
|
|
|
+ if (isPlaying.value) {
|
|
|
+ playDialogueAudio(true)
|
|
|
+ } else {
|
|
|
+ playDialogueAudio()
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
const playNext = (isAutoPlay = false) => {
|
|
|
@@ -659,39 +664,41 @@ const playNext = (isAutoPlay = false) => {
|
|
|
showPoem.value = false
|
|
|
currentPoemContent.value = ''
|
|
|
// 播放背景音
|
|
|
- playBackgroundAudio()
|
|
|
- // 检查新环节的第一个对话是否为诗词类型
|
|
|
- if (currentDialogue.value?.type === 'poem') {
|
|
|
- // 显示诗词
|
|
|
- showPoem.value = true
|
|
|
- currentPoemContent.value = currentDialogue.value.content
|
|
|
-
|
|
|
- // 检查是否有语音
|
|
|
- if (currentDialogue.value?.voiceoverUrl) {
|
|
|
- // 播放诗词语音
|
|
|
+ nextTick(() => {
|
|
|
+ playBackgroundAudio()
|
|
|
+ // 检查新环节的第一个对话是否为诗词类型
|
|
|
+ if (currentDialogue.value?.type === 'poem') {
|
|
|
+ // 显示诗词
|
|
|
+ showPoem.value = true
|
|
|
+ currentPoemContent.value = currentDialogue.value.content
|
|
|
+
|
|
|
+ // 检查是否有语音
|
|
|
+ if (currentDialogue.value?.voiceoverUrl) {
|
|
|
+ // 播放诗词语音
|
|
|
+ if (isPlaying.value) {
|
|
|
+ playDialogueAudio(true)
|
|
|
+ } else {
|
|
|
+ playDialogueAudio()
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 没有语音,直接切换到下一条对话
|
|
|
+ setTimeout(() => {
|
|
|
+ playNext(isAutoPlay)
|
|
|
+ }, 500)
|
|
|
+ }
|
|
|
+ } else if (currentDialogue.value?.type === 'video') {
|
|
|
+ // 视频类型对话,隐藏诗词
|
|
|
+ showPoem.value = false
|
|
|
+ currentPoemContent.value = ''
|
|
|
+ } else {
|
|
|
+ // 根据是否为自动播放状态决定如何播放语音
|
|
|
if (isPlaying.value) {
|
|
|
playDialogueAudio(true)
|
|
|
} else {
|
|
|
playDialogueAudio()
|
|
|
}
|
|
|
- } else {
|
|
|
- // 没有语音,直接切换到下一条对话
|
|
|
- setTimeout(() => {
|
|
|
- playNext(isAutoPlay)
|
|
|
- }, 500)
|
|
|
}
|
|
|
- } else if (currentDialogue.value?.type === 'video') {
|
|
|
- // 视频类型对话,隐藏诗词
|
|
|
- showPoem.value = false
|
|
|
- currentPoemContent.value = ''
|
|
|
- } else {
|
|
|
- // 根据是否为自动播放状态决定如何播放语音
|
|
|
- if (isPlaying.value) {
|
|
|
- playDialogueAudio(true)
|
|
|
- } else {
|
|
|
- playDialogueAudio()
|
|
|
- }
|
|
|
- }
|
|
|
+ })
|
|
|
return true
|
|
|
}
|
|
|
return false
|