This commit is contained in:
yanghang
2025-07-07 15:45:50 +08:00
parent 6d1965c231
commit 1de0d74010
3 changed files with 16 additions and 8 deletions
+2
View File
@@ -65,12 +65,14 @@ export default class WebSocketUtil {
console.log('收到WebSocket消息', JSON.parse(res.data) );
if(['0005', 'QQ0005'].includes(rtnCode)) {
clearInterval(this.reconnectTimer);
this.reconnectTimer = null
this.close()
goto_login_fun();
return
}
}else{
clearInterval(this.reconnectTimer); // 清除重连计时器
this.reconnectTimer = null
goto_login_fun();
return
}
-4
View File
@@ -76,10 +76,6 @@ const initRecord = () => {}
onMounted(()=>{
initRecord?.()
})
onUnmounted(()=>{
teacherVoiceObj?.stop?.()
teacherVoiceObj.src = ''
})
// const playRecord = () => {
// audioObj.src = audioPath.value
// unref(audioObj).play()
+14 -4
View File
@@ -151,8 +151,14 @@ const talkingList = ref([])
const activeVoiceTalkingItemId = ref('')
const answerValue = ref('')
const inputRef = ref('')
const flagVal = ref('1')
// 初始化数据
const getData = async () => {
const getData = async (flag) => {
if(flag === flagVal.value){
flagVal.value = '2'
}else{
return
}
try{
const { body } = await getCourseStudyInfoApi({crsId: crsId.value})
initsocketTask()
@@ -223,7 +229,7 @@ const choiceTeacherInfo = computed(()=>{
})
// 选择教师语音对象
const activeVoiceTeachNo = ref('')
const teacherVoiceObj = uni.createInnerAudioContext()
let teacherVoiceObj = uni.createInnerAudioContext()
teacherVoiceObj.onEnded(()=>{
activeVoiceTeachNo.value = ''
@@ -455,10 +461,14 @@ onLoad((params) => {
const showTalkingModel = ref(false)
// 录音
onMounted(()=>{
getData();
getData('1');
})
onShow(()=>{
// getData();
getData('2');
})
onUnmounted(()=>{
teacherVoiceObj?.stop?.()
teacherVoiceObj.src = ''
})
const uploadRecordNow = (voicePath) => {