diff --git a/src/pages/course/components/talkingItem.vue b/src/pages/course/components/talkingItem.vue index 08829578..5e5a3430 100644 --- a/src/pages/course/components/talkingItem.vue +++ b/src/pages/course/components/talkingItem.vue @@ -436,18 +436,14 @@ const audioCacheObj = computed(() => storageStore.audioObj) } const showNextBtn = ref(true) const showGoonBtn = computed(()=>{ - return showNextBtn.value && [3, 6].indexOf(props.type) >= 0 && isLast.value && !isPlaying.value + return showNextBtn.value && [3, 6].indexOf(props.type) >= 0 && isLast.value // && !isPlaying.value }) const goOnGetQues = () => { if(props.type === 5){ + // 完成问题 emit('nextQuestion', unref(dataInfo)) }else if(props.type === 3){ - // studyParagraphOverApi({ - // pgrphId:unref(dataInfo)?.pgrphId, - // logId:unref(dataInfo)?.logId, - // }).then(res=>{ - // showNextBtn.value = false - // }) + // 完成段落 emit('nextQuestion', unref(dataInfo), 'overGraph') } diff --git a/src/pages/course/components/touchBtn.vue b/src/pages/course/components/touchBtn.vue index 9c8eda8f..e6c25f2f 100644 --- a/src/pages/course/components/touchBtn.vue +++ b/src/pages/course/components/touchBtn.vue @@ -58,8 +58,9 @@ const audioPath = ref('') const audioObj = uni.createInnerAudioContext() //#ifdef APP-PLUS // app端 -const recordObjCom = uni.getRecorderManager() +const recordObjCom = ref({}) const initRecord = () => { + recordObjCom.value = uni.getRecorderManager() unref(recordObjCom)?.onStop((res, duration)=>{ audioPath.value = res.tempFilePath }) @@ -76,7 +77,7 @@ const stopRecord = () => { } // #endif //#ifndef APP-PLUS -const recordObjCom = {} +const recordObjCom = ref({}) const initRecord = () => {} // #endif onMounted(async ()=>{ diff --git a/src/pages/course/study.vue b/src/pages/course/study.vue index 2c4583bb..0ab17c52 100644 --- a/src/pages/course/study.vue +++ b/src/pages/course/study.vue @@ -15,7 +15,7 @@ - + {{item.teacherName}} @@ -82,7 +82,7 @@ @uploadVoice="uploadRecordNow" @submitAnswer="submitAnswerNow" @startRecord="changePlayItemId('')" - :isDisabled="(lastTalkingInfo.type||0) !== 4" + :isDisabled="((lastTalkingInfo.type||0) !== 4) || isUploadingVoice" /> @@ -162,6 +162,7 @@ const activeVoiceTalkingItemId = ref('') const answerValue = ref('') const inputRef = ref('') const flagVal = ref('1') +const isUploadingVoice = ref(false) // 初始化数据 const getData = async (flag) => { // if(flag === flagVal.value){ @@ -171,7 +172,6 @@ const getData = async (flag) => { // } try{ const { body } = await getCourseStudyInfoApi({crsId: crsId.value}) - console.log(body) initsocketTask() teacherList.value = body.teacheList.map(t=>({ ...t, @@ -584,7 +584,18 @@ onUnload(()=>{ teacherVoiceObj?.stop?.() teacherVoiceObj.src = '' }) +const testAnswer = computed(()=>{ + if(talkingList.value.length < 5) return true + let _arr = talkingList.value.slice(-5) + let _num = _arr.map(t=>[1,2,6].indexOf(Number(t.type))>=0).filter(t => !!t) + return _num.length < 5 +}) const uploadRecordNow = (voicePath) => { + if(!testAnswer.value){ + common.msg('每个问题最多连续发送五次答案!') + return + } + isUploadingVoice.value = true let _data = { qnsId: unref(lastTalkingInfo).qnsId,// 问题ID 必输项:true 类型:String pgrphId: unref(lastTalkingInfo).pgrphId,// 段落ID 必输项:true 类型:String @@ -606,7 +617,8 @@ const uploadRecordNow = (voicePath) => { userInfo: {...choiceTeacherInfo.value}, id: _id }) - scrollToBottomNow() + isUploadingVoice.value = false + scrollToBottomNow() // #endif //#ifdef APP-PLUS talkingList.value.push({ @@ -648,7 +660,9 @@ const uploadRecordNow = (voicePath) => { }) scrollToBottomNow() }else{} + isUploadingVoice.value = false }).catch(err=>{ + isUploadingVoice.value = false talkingList.value = talkingList.value.filter(t=>t.id !== _id) uni.showToast({ title: '系统异常,请联系管理员', @@ -660,6 +674,10 @@ const uploadRecordNow = (voicePath) => { } // 发送文本 const submitAnswerNow = (val, cb) => { + if(!testAnswer.value){ + common.msg('每个问题最多连续发送五次答案!') + return + } let _data = { qnsId: unref(lastTalkingInfo).qnsId,// 问题ID 必输项:true 类型:String pgrphId: unref(lastTalkingInfo).pgrphId,// 段落ID 必输项:true 类型:String