fix: bug
This commit is contained in:
@@ -180,7 +180,7 @@
|
||||
return encodeURIComponent(t) + '=' + encodeURIComponent(_params[t]);
|
||||
})
|
||||
.join('&');
|
||||
storageStore.getStorageById('audio', _url + _params.teachNo, (url) => {
|
||||
storageStore.getStorageById('audio', _url + _params.execLogId, (url) => {
|
||||
if (url) {
|
||||
voiceLoading.value = false;
|
||||
itemVoice.value = url;
|
||||
@@ -201,7 +201,7 @@
|
||||
if (voiceIsPlaying.value) return
|
||||
if(unref(dataInfo)?.id !== props.activeVoiceId) return
|
||||
talkVoiceObj.value.play();
|
||||
storageStore.setStorage('audio', _url + _params.teachNo, itemVoice.value);
|
||||
storageStore.setStorage('audio', _url + _params.execLogId, itemVoice.value);
|
||||
})
|
||||
.catch((err) => {
|
||||
voiceLoading.value = false;
|
||||
|
||||
@@ -46,6 +46,15 @@
|
||||
<script setup>
|
||||
import { computed, unref, ref, toRefs, watch, onMounted } from "vue"
|
||||
import { onUnload } from '@dcloudio/uni-app';
|
||||
import {
|
||||
useStorageStore
|
||||
} from '@/store/storage.js';
|
||||
import {
|
||||
downloadFile,
|
||||
downloadVoiceFile
|
||||
} from '@/api/common.js'
|
||||
|
||||
const storageStore = useStorageStore();
|
||||
const props = defineProps({
|
||||
dataInfo: {
|
||||
default: () => ({}),
|
||||
@@ -84,21 +93,53 @@ import { onUnload } from '@dcloudio/uni-app';
|
||||
}
|
||||
const playVoice = () =>{
|
||||
emit('changePlay', unref(dataInfo)?.id)
|
||||
if(talkVoiceObj.value && talkVoiceObj.value.src) {
|
||||
setTimeout(()=>{
|
||||
talkVoiceObj.value.src = unref(dataInfo).talkingVoice
|
||||
talkVoiceObj.value.play()
|
||||
},300)
|
||||
return
|
||||
}else{
|
||||
talkVoiceObj.value.src = ''
|
||||
if(unref(dataInfo).talkingVoice){
|
||||
setTimeout(()=>{
|
||||
talkVoiceObj.value.src = unref(dataInfo).talkingVoice
|
||||
talkVoiceObj.value.play()
|
||||
isPlaying.value = true
|
||||
},100)
|
||||
}
|
||||
|
||||
if (talkVoiceObj.value.src && talkVoiceObj.value.src === itemVoice.value) {
|
||||
if (voiceIsPlaying.value) return
|
||||
talkVoiceObj.value.play();
|
||||
voiceLoading.value = false;
|
||||
return;
|
||||
}
|
||||
talkVoiceObj.value.src = '';
|
||||
if (itemVoice.value) {
|
||||
setTimeout(() => {
|
||||
talkVoiceObj.value.src = itemVoice.value;
|
||||
if (voiceIsPlaying.value) return
|
||||
if(unref(dataInfo)?.id !== props.activeVoiceId) return
|
||||
talkVoiceObj.value.play();
|
||||
}, 100);
|
||||
} else {
|
||||
voiceLoading.value = true;
|
||||
let _id = unref(dataInfo)?.fileId
|
||||
storageStore.getStorageById('audio', _id, (url) => {
|
||||
if (url) {
|
||||
voiceLoading.value = false;
|
||||
itemVoice.value = url;
|
||||
talkVoiceObj.value.src = url;
|
||||
if (voiceIsPlaying.value) return
|
||||
if(unref(dataInfo)?.id !== props.activeVoiceId) return
|
||||
talkVoiceObj.value.play();
|
||||
} else {
|
||||
downloadFile(_id)
|
||||
.then((res) => {
|
||||
if (res?.data) {
|
||||
common.msg(res.data.message);
|
||||
return;
|
||||
}
|
||||
voiceLoading.value = false;
|
||||
itemVoice.value = res.tempFilePath;
|
||||
talkVoiceObj.value.src = res.tempFilePath;
|
||||
if (voiceIsPlaying.value) return
|
||||
if(unref(dataInfo)?.id !== props.activeVoiceId) return
|
||||
talkVoiceObj.value.play();
|
||||
storageStore.setStorage('audio', _id, itemVoice.value);
|
||||
})
|
||||
.catch((err) => {
|
||||
voiceLoading.value = false;
|
||||
emit('changePlay', '');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
const initVoice = () => {
|
||||
|
||||
@@ -199,7 +199,7 @@
|
||||
execId: execId.value,
|
||||
intrctWay: '02', //01-文本;02-语音;03-图片
|
||||
intrctContent: _res.body.transContent,
|
||||
bucketKey: _res.body.fileId,
|
||||
fileId: _res.body.fileId,
|
||||
ossFileAddr: _res.body.ossFileAddr,
|
||||
talkingVoice: voicePath
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user