Merge branch 'develop' of http://25.13.9.101:9000/K17_AITS/tra-app into develop
This commit is contained in:
@@ -416,28 +416,36 @@
|
||||
pauseVoice();
|
||||
});
|
||||
let prevTime = -1;
|
||||
let pauseTime = -1;
|
||||
talkVoiceObj.value.onEnded(() => {
|
||||
console.log('onEnded');
|
||||
emit('changePlay', '');
|
||||
if(props.activeVoiceId){
|
||||
emit('changePlay', '');
|
||||
}
|
||||
prevTime = -1;
|
||||
pauseTime = prevTime
|
||||
talkVoiceObj.value.src = '';
|
||||
});
|
||||
talkVoiceObj.value.onStop(() => {
|
||||
console.log('onStop');
|
||||
emit('changePlay', '');
|
||||
if(props.activeVoiceId){
|
||||
emit('changePlay', '');
|
||||
}
|
||||
prevTime = -1;
|
||||
pauseTime = prevTime
|
||||
talkVoiceObj.value.src = '';
|
||||
});
|
||||
talkVoiceObj.value.onPause(() => {
|
||||
console.log('onPause');
|
||||
prevTime = talkVoiceObj.value.currentTime;
|
||||
emit('changePlay', '');
|
||||
pauseTime = prevTime
|
||||
});
|
||||
talkVoiceObj.value.onPlay(() => {
|
||||
console.log('onPlay');
|
||||
prevTime = talkVoiceObj.value.currentTime;
|
||||
pauseTime = prevTime
|
||||
emit('changePlay', unref(dataInfo)?.id);
|
||||
});
|
||||
|
||||
talkVoiceObj.value.onTimeUpdate(() => {
|
||||
if (activeVoiceId.value === unref(dataInfo)?.id) {
|
||||
setTimeout(() => {
|
||||
@@ -446,18 +454,22 @@
|
||||
prevTime = talkVoiceObj.value.currentTime;
|
||||
}
|
||||
} else {
|
||||
emit('changePlay', '');
|
||||
if (props.isPlaying && (talkVoiceObj.value.currentTime > 0) && (pauseTime !== talkVoiceObj.value.currentTime) && props.activeVoiceId) {
|
||||
emit('changePlay', '');
|
||||
}
|
||||
}
|
||||
}, 500);
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
|
||||
talkVoiceObj.value.onError(() => {
|
||||
if(!talkVoiceObj.value.src) return
|
||||
talkVoiceObj.value.src = '';
|
||||
emit('changePlay', '');
|
||||
// console.log('onError');
|
||||
// if(!talkVoiceObj.value.src) return
|
||||
// talkVoiceObj.value.src = '';
|
||||
// emit('changePlay', '');
|
||||
});
|
||||
const pauseVoice = () => {
|
||||
console.log('手动')
|
||||
if (!talkVoiceObj.value) return;
|
||||
talkVoiceObj.value.pause();
|
||||
emit('changePlay', '');
|
||||
@@ -478,92 +490,95 @@
|
||||
};
|
||||
const playVoice = (readType = 'pgth') => {
|
||||
let _content = showContent.value;
|
||||
console.log(_content);
|
||||
if (!_content) {
|
||||
common.msg('没有可以播放的文字信息!');
|
||||
return;
|
||||
}
|
||||
emit('changePlay', unref(dataInfo)?.id);
|
||||
// readType 阅读内容类型pgrh段落/qns问题
|
||||
if (talkVoiceObj.value.src && talkVoiceObj.value.src === itemVoice.value) {
|
||||
talkVoiceObj.value.play();
|
||||
return;
|
||||
}
|
||||
talkVoiceObj.value.src = '';
|
||||
if (itemVoice.value) {
|
||||
setTimeout(() => {
|
||||
talkVoiceObj.value.src = itemVoice.value;
|
||||
setTimeout(() => {
|
||||
emit('changePlay', unref(dataInfo)?.id);
|
||||
console.log(1)
|
||||
// readType 阅读内容类型pgrh段落/qns问题
|
||||
if (talkVoiceObj.value.src && talkVoiceObj.value.src === itemVoice.value) {
|
||||
talkVoiceObj.value.play();
|
||||
}, 100);
|
||||
} else {
|
||||
voiceLoading.value = true;
|
||||
let _type =
|
||||
props.type == 2 ?
|
||||
'ans' :
|
||||
props.type == 3 ?
|
||||
'pgrh' :
|
||||
props.type == 4 ?
|
||||
'qns' :
|
||||
props.type == 5 ?
|
||||
'analysis' :
|
||||
props.type == 8 ?
|
||||
'stemAnalysis' :
|
||||
'';
|
||||
let _readId =
|
||||
props.type == 2 ?
|
||||
unref(dataInfo)?.intrctId :
|
||||
props.type == 3 ?
|
||||
unref(dataInfo)?.pgrphId :
|
||||
props.type == 4 ?
|
||||
unref(dataInfo)?.qnsId :
|
||||
props.type == 5 ?
|
||||
unref(dataInfo)?.qnsId :
|
||||
props.type == 8 ?
|
||||
unref(dataInfo)?.qnsId :
|
||||
'';
|
||||
let _params = {
|
||||
crsId: unref(dataInfo)?.crsId || '',
|
||||
pgrphId: unref(dataInfo)?.pgrphId || '',
|
||||
qnsId: unref(dataInfo)?.qnsId || '',
|
||||
readType: _type, // 2 文本回答 3, 段落信息 4 问题信息
|
||||
teachNo: unref(teacherInfo)?.teacherNo, // 必填
|
||||
readId: _readId
|
||||
// content: _content
|
||||
};
|
||||
|
||||
let _url =
|
||||
'/trastudy/traStdyInfo/readContent?' +
|
||||
Object.keys(_params)
|
||||
.map((t) => {
|
||||
return encodeURIComponent(t) + '=' + encodeURIComponent(_params[t]);
|
||||
})
|
||||
.join('&');
|
||||
|
||||
storageStore.getStorageById('audio', _url + _params.teachNo, (url) => {
|
||||
if (url) {
|
||||
voiceLoading.value = false;
|
||||
itemVoice.value = url;
|
||||
talkVoiceObj.value.src = url;
|
||||
return;
|
||||
}
|
||||
talkVoiceObj.value.src = '';
|
||||
if (itemVoice.value) {
|
||||
setTimeout(() => {
|
||||
talkVoiceObj.value.src = itemVoice.value;
|
||||
talkVoiceObj.value.play();
|
||||
} else {
|
||||
downloadVoiceFile(_url)
|
||||
.then((res) => {
|
||||
if (res?.data) {
|
||||
common.msg(res.data.message);
|
||||
return;
|
||||
}
|
||||
voiceLoading.value = false;
|
||||
itemVoice.value = res.tempFilePath;
|
||||
talkVoiceObj.value.src = res.tempFilePath;
|
||||
talkVoiceObj.value.play();
|
||||
storageStore.setStorage('audio', _url + _params.teachNo, itemVoice.value);
|
||||
})
|
||||
.catch((err) => {
|
||||
voiceLoading.value = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
voiceLoading.value = true;
|
||||
let _type =
|
||||
props.type == 2 ?
|
||||
'ans' :
|
||||
props.type == 3 ?
|
||||
'pgrh' :
|
||||
props.type == 4 ?
|
||||
'qns' :
|
||||
props.type == 5 ?
|
||||
'analysis' :
|
||||
props.type == 8 ?
|
||||
'stemAnalysis' :
|
||||
'';
|
||||
let _readId =
|
||||
props.type == 2 ?
|
||||
unref(dataInfo)?.intrctId :
|
||||
props.type == 3 ?
|
||||
unref(dataInfo)?.pgrphId :
|
||||
props.type == 4 ?
|
||||
unref(dataInfo)?.qnsId :
|
||||
props.type == 5 ?
|
||||
unref(dataInfo)?.qnsId :
|
||||
props.type == 8 ?
|
||||
unref(dataInfo)?.qnsId :
|
||||
'';
|
||||
let _params = {
|
||||
crsId: unref(dataInfo)?.crsId || '',
|
||||
pgrphId: unref(dataInfo)?.pgrphId || '',
|
||||
qnsId: unref(dataInfo)?.qnsId || '',
|
||||
readType: _type, // 2 文本回答 3, 段落信息 4 问题信息
|
||||
teachNo: unref(teacherInfo)?.teacherNo, // 必填
|
||||
readId: _readId
|
||||
// content: _content
|
||||
};
|
||||
|
||||
let _url =
|
||||
'/trastudy/traStdyInfo/readContent?' +
|
||||
Object.keys(_params)
|
||||
.map((t) => {
|
||||
return encodeURIComponent(t) + '=' + encodeURIComponent(_params[t]);
|
||||
})
|
||||
.join('&');
|
||||
|
||||
storageStore.getStorageById('audio', _url + _params.teachNo, (url) => {
|
||||
if (url) {
|
||||
voiceLoading.value = false;
|
||||
itemVoice.value = url;
|
||||
talkVoiceObj.value.src = url;
|
||||
talkVoiceObj.value.play();
|
||||
} else {
|
||||
downloadVoiceFile(_url)
|
||||
.then((res) => {
|
||||
if (res?.data) {
|
||||
common.msg(res.data.message);
|
||||
return;
|
||||
}
|
||||
voiceLoading.value = false;
|
||||
itemVoice.value = res.tempFilePath;
|
||||
talkVoiceObj.value.src = res.tempFilePath;
|
||||
talkVoiceObj.value.play();
|
||||
storageStore.setStorage('audio', _url + _params.teachNo, itemVoice.value);
|
||||
})
|
||||
.catch((err) => {
|
||||
voiceLoading.value = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
const saveFile = (buffer, filePath, cb = () => {}) => {
|
||||
let fileManager = uni.getFileSystemManager();
|
||||
|
||||
@@ -295,11 +295,13 @@ const showChangeSeekModelNow = () => {
|
||||
}
|
||||
const showBgModel = ref(false)
|
||||
const showChangeBgModelNow = () => {
|
||||
console.log(222)
|
||||
changePlayItemId()
|
||||
showBgModel.value = true
|
||||
}
|
||||
// 关闭播放状态
|
||||
const changePlayItemId = (id = '') => {
|
||||
console.log(id,'id')
|
||||
activeVoiceTalkingItemId.value = id
|
||||
// if(activeVoiceTalkingItemId.value === id){
|
||||
// activeVoiceTalkingItemId.value = ''
|
||||
@@ -1103,6 +1105,7 @@ const getQuestionEvalateRequest = (id, data, num) => {
|
||||
if (t.id === id) {
|
||||
lastTalkingInfo.value = {
|
||||
..._body.chatBody,
|
||||
crsId: crsId.value,
|
||||
pgrphId: data.pgrphId,
|
||||
qstLogId: loadingExecLogId.value,
|
||||
id,
|
||||
|
||||
Reference in New Issue
Block a user