fix: NIT 合并——开场朗读 onEnd 驱动自动进入(防 3s 截断)/continuePlay 空守卫/gotoResult 防双跳/计时器卸载清理

This commit is contained in:
2026-08-13 17:43:35 +08:00
parent d571e8974d
commit 8c19e826b3
3 changed files with 35 additions and 6 deletions
+24 -3
View File
@@ -79,11 +79,32 @@ export default {
},
mounted() {
this.speaking = true
speak(this.content, this.audio)
// v2.1:朗读结束自动进入决策幕(「跳过」仍可手动跳过)
setTimeout(() => { this.speaking = false; this.$emit('done') }, Math.min(3000, this.content.length * 300))
// v2.1:朗读结束自动进入决策幕——最短展示 1.2s,之后 speak onEnd 即进入;
// 无 TTS/onEnd 缺失最迟 15s 兜底(「跳过」仍可手动跳过)
this.speechDone = false
this.ready = false
let done = false
const finishAuto = () => {
if (done) return
done = true
this.speaking = false
this.$emit('done')
}
this.minTimer = setTimeout(() => { this.ready = true; if (this.speechDone) finishAuto() }, 1200)
this.autoTimer = setTimeout(finishAuto, 15000)
const onSpeechEnd = () => {
this.speechDone = true
if (this.ready) finishAuto()
}
if (!this.content) {
finishAuto()
return
}
speak(this.content, this.audio, onSpeechEnd)
},
beforeUnmount() {
clearTimeout(this.minTimer)
clearTimeout(this.autoTimer)
stopSpeak()
},
methods: {