diff --git a/src/pages/course/components/talkingItem.vue b/src/pages/course/components/talkingItem.vue index c96650ae..2264be70 100644 --- a/src/pages/course/components/talkingItem.vue +++ b/src/pages/course/components/talkingItem.vue @@ -167,7 +167,6 @@ import { onUnload } from '@dcloudio/uni-app' const storageStore = useStorageStore() const audioCacheObj = computed(() => storageStore.audioObj) -defineExpose(['pauseVoice']) const props = defineProps({ type:{ default: 0,// 1: userAnswer 0: AIAnswer @@ -249,7 +248,8 @@ defineExpose(['pauseVoice']) } }) const showContent = computed(() => { - return showContentBase.value.replace(/\/n/g,"\n") + let _str = showContentBase.value || '' + return _str.replace(/\/n/g,"\n") }) onMounted(()=>{ diff --git a/src/pages/course/study.vue b/src/pages/course/study.vue index 3d5d9201..d4b19b5f 100644 --- a/src/pages/course/study.vue +++ b/src/pages/course/study.vue @@ -116,12 +116,7 @@ import { getToken } from '@/common/common.js' import { get_base_url, goto_login_fun } from '@/api/request' import { getCourseStudyInfoApi, - queryTraStdyBatchWaitParagraphInfoApi, - audioTranscriptionsApi, - deleteTraStdyInfoByIdApi, afreshStudyCourseApi, - queryTraStdyBatchWaitQuestionInfoApi, - studyAnswerTextUpApi, withdrawalAnswerApi, waitMakeEvaluateApi, queryQuestionEvalateApi, @@ -297,6 +292,9 @@ const getGraphInfoUnStudy = () => { }).then(res=>{ let _id = new Date().getTime() + 'id' let _body = res.body|| {} + if(!_body.chatBody) { + return + } lastTalkingInfo.value = { crsId: crsId.value, qstLogId: _body.chatBody, @@ -320,24 +318,37 @@ const lastTalkingInfo = ref({}) const qstLogId = ref('') // 获取问题 const getQuestionInfoUnStudy = (pgrphId) => { - queryTraStdyBatchWaitQuestionInfoApi({ - crsId: crsId.value, - stdyId: unref(stdyId), - stdyBatch: unref(stdyBatch), - logId: unref(logId), - pgrphId - }).then(res=>{ + textChartApi({ + processType: 'QSN-ANSER', + requestBody: JSON.stringify({ + crsId: crsId.value, + stdyId: unref(stdyId), + stdyBatch: unref(stdyBatch), + logId: unref(logId), + pgrphId + }) + }) + .then(res=>{ + let _id = new Date().getTime() + 'id' + let _body = res.body || {} if(res.body.stdyStat !== 'N'){ let _id = new Date().getTime() + 'id' lastTalkingInfo.value = { - ...res.body, + crsId: crsId.value, + stdyId: unref(stdyId), + stdyBatch: unref(stdyBatch), + logId: unref(logId), + pgrphId, + chatContent: _body.chatContent||'', + userInfo: {...choiceTeacherInfo.value}, + ...(_body.chatBody||{}), type: 4, userInfo: {...choiceTeacherInfo.value}, id: _id, isQuestion: true } talkingList.value.push(lastTalkingInfo.value) - qstLogId.value = res.body.qstLogId + qstLogId.value = lastTalkingInfo.value.qstLogId scrollToBottomNow() }else{ getGraphInfoUnStudy() @@ -383,6 +394,9 @@ const nextQuestionSuccess = (info, type='next') => { requestBody: info.qstLogId }).then(res=>{ let _body = res.body|| {} + if(!_body.chatBody) { + return + } lastTalkingInfo.value = { crsId: info.crsId, qstLogId: _body.chatBody, @@ -472,7 +486,6 @@ onUnload(()=>{ teacherVoiceObj.src = '' }) const uploadRecordNow = (voicePath) => { - let _data = { qnsId: unref(lastTalkingInfo).qnsId,// 问题ID 必输项:true 类型:String pgrphId: unref(lastTalkingInfo).pgrphId,// 段落ID 必输项:true 类型:String @@ -481,7 +494,6 @@ const uploadRecordNow = (voicePath) => { stdyBatch: stdyBatch.value,// 学习批次 必输项:true 类型:String ansterContent: '',// 回答文本内容 必输项:false 类型:String } - console.log(_data) let _id = new Date().getTime() + 'id' //#ifndef APP-PLUS // h5 假数据 @@ -554,25 +566,29 @@ const submitAnswerNow = (val, cb) => { stdyBatch: stdyBatch.value,// 学习批次 必输项:true 类型:String ansterContent: val // 回答文本内容 必输项:false 类型:String } - console.log(lastTalkingInfo.value) - studyAnswerTextUpApi(_data).then(res=>{ - if(res.rtnCode === '0000'){ - let _id = new Date().getTime() + 'id' - talkingList.value.push({ - crsId: crsId.value, - pgrphId: _data.pgrphId, - qstLogId: _data.qstLogId, - qnsId: _data.qnsId, - talkingContent: val, - talkingVoice: '', - intrctId: res.body||'', - type: 2, - userInfo: {...choiceTeacherInfo.value}, - id: _id - }) - scrollToBottomNow() - cb && cb() + textChartApi({ + processType: 'ANSER-TEXT', + requestBody: JSON.stringify(_data) + }) + .then(res=>{ + let _id = new Date().getTime() + 'id' + let _body = res.body|| {} + if(!_body.chatBody) { + return } + talkingList.value.push({ + ..._data, + chatContent: _body.chatContent, + userInfo: {...choiceTeacherInfo.value}, + intrctId: _body.chatBody ||'', + talkingContent: val, + talkingVoice: '', + type: 2, + userInfo: {...choiceTeacherInfo.value}, + id: _id + }) + scrollToBottomNow() + cb && cb() }) } // 撤回 @@ -614,7 +630,6 @@ const finishQuestionNow = (data) => { } // 查询问题回答评分 const getQuestionEvalateRequest = (id, data) => { - console.log( 'qstLogId',data.qstLogId) if(loadingQstLogId.value){ queryQuestionEvalateApi({ qstLogId:loadingQstLogId.value