diff --git a/src/pages/index/components/question.vue b/src/pages/index/components/question.vue index 1d59196a..e95e15bb 100644 --- a/src/pages/index/components/question.vue +++ b/src/pages/index/components/question.vue @@ -126,18 +126,27 @@ import { onUnload } from '@dcloudio/uni-app'; } } const setVoiceTime = (sum) => { - sum += 1 - if(Math.ceil(talkVoiceObj.value.duration)>0){ - voiceTime.value = (Math.ceil(talkVoiceObj.value.duration) || 1 ) + 's' - }else{ - if(sum === 20) { - voiceTime.value = (unref(dataInfo).voiceTime || 0) + 's'; - return + plus.io.getAudioInfo({ + filePath: unref(dataInfo).talkingVoice, + success:(res)=>{ + voiceTime.value = (Math.floor(res.duration) || 1) + 's' + }, + fail:(res)=>{ + voiceTime.value = (unref(dataInfo).voiceTime || 1) + 's' } - setTimeout(()=>{ - setVoiceTime(sum) - },200) - } + }) + // sum += 1 + // if(Math.ceil(talkVoiceObj.value.duration)>0){ + // voiceTime.value = (Math.ceil(talkVoiceObj.value.duration) || 1 ) + 's' + // }else{ + // if(sum === 20) { + // voiceTime.value = (unref(dataInfo).voiceTime || 0) + 's'; + // return + // } + // setTimeout(()=>{ + // setVoiceTime(sum) + // },200) + // } }