From 125e0fe4adf12d4d6e012f82fc5f234166c19066 Mon Sep 17 00:00:00 2001 From: yanghang Date: Wed, 16 Jul 2025 18:04:17 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=20bug=20=20=E9=97=AE=E7=AD=94?= =?UTF-8?q?=E8=AF=AD=E9=9F=B3=E8=81=94=E8=B0=8320%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 4 +- src/api/socket.js | 2 +- src/pages/course/components/touchBtn.vue | 14 +++- src/pages/course/study.vue | 22 ++++-- src/pages/index/components/answer.vue | 1 + src/pages/index/components/question.vue | 27 +++++++- src/pages/index/components/talking-item.vue | 1 + src/pages/index/dialog.vue | 75 +++++++++++++++------ 8 files changed, 114 insertions(+), 32 deletions(-) diff --git a/.env.development b/.env.development index 59b43ae1..83cf2831 100644 --- a/.env.development +++ b/.env.development @@ -3,13 +3,13 @@ ENV = 'development' # 'development' # 苗扬 -VITE_APP_BASE_API_Url = 'http://25.64.16.133:9786' +# VITE_APP_BASE_API_Url = 'http://25.64.16.133:9786' # UAT # VITE_APP_BASE_API_Url = 'http://25.18.122.78:9786' # DEV -# VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001' +VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001' # app入口 diff --git a/src/api/socket.js b/src/api/socket.js index 51737370..454df64a 100644 --- a/src/api/socket.js +++ b/src/api/socket.js @@ -63,7 +63,7 @@ export default class WebSocketUtil { this.socketTask.onMessage((res) => { if(res.data){ const { rtnCode } = JSON.parse(res.data) - console.log('收到WebSocket消息', JSON.parse(res.data) ); + // console.log('收到WebSocket消息', JSON.parse(res.data) ); if(['0005', 'QQ0005'].includes(rtnCode)) { clearInterval(this.reconnectTimer); this.reconnectTimer = null diff --git a/src/pages/course/components/touchBtn.vue b/src/pages/course/components/touchBtn.vue index fc90d399..9818ec00 100644 --- a/src/pages/course/components/touchBtn.vue +++ b/src/pages/course/components/touchBtn.vue @@ -53,6 +53,10 @@ const props = defineProps({ default: false, type: Boolean }, + loadingText:{ + default: '发送回答中,请稍后再试!', + type: String + }, onlyVoice:{ default: false, type: Boolean @@ -168,7 +172,7 @@ const getRecordPermission = async (obj) => { const showOverlayTalking = (obj) => { if(isLoadingState.value){ uni.showToast({ - title: '发送回答中,请稍后再试!', + title: props.loadingText, icon: "none", duration:1000 }) @@ -224,6 +228,14 @@ const handleMove = (obj) => { } // 发送文本 const showKeyboard = () => { + if(isLoadingState.value){ + uni.showToast({ + title: props.loadingText, + icon: "none", + duration:1000 + }) + return + } if(!isDisabled.value){ if(keyboardIsShow.value){ if(answerValue.value){ diff --git a/src/pages/course/study.vue b/src/pages/course/study.vue index 89a2959b..7ae7e1d7 100644 --- a/src/pages/course/study.vue +++ b/src/pages/course/study.vue @@ -182,8 +182,8 @@ const getData = async (flag) => { // return // } try{ + await initsocketTask() const { body } = await getCourseStudyInfoApi({crsId: crsId.value}) - initsocketTask() teacherList.value = body.teacheList.map(t=>({ ...t, voicePath: '', @@ -193,7 +193,6 @@ const getData = async (flag) => { step.value = 1 }else{ if(startPgrphId.value){ - scrollToBottomNow() choiceTeacher.value = body.choiceTeacher sendMessage({ "commond" : 'STDY', @@ -375,6 +374,7 @@ const getGraphInfoUnStudy = (flag = 0) => { if(!_body.chatBody) { return } + console.log('prgh', _body) if(Number(_body.bodyTyp) === 7){ common.show('恭喜你已学完全部知识点', '有什么心得跟我们分享吗?',true, '取消','去评论').then((res) => { if(res) { @@ -425,6 +425,18 @@ const getQuestionInfoUnStudy = (pgrphId) => { let _id = new Date().getTime() + 'id' let _body = res.body || {} console.log(_body) + if(Number(_body.bodyTyp) === 7){ + common.show('恭喜你已学完全部知识点', '有什么心得跟我们分享吗?',true, '取消','去评论').then((res) => { + if(res) { + // 去评论 + common.redirectTo(`/pages/courseDetail/submit?crsId=${crsId.value}&crsNum=${crsNum.value}&from=study&imgId=${imageId.value}`) + }else{ + // 取消 + common.redirectTo(`/pages/courseDetail/index?crsId=${crsId.value}&crsNum=${crsNum.value}&from=study`) + } + }).finally(() => {}) + return + } if(_body.chatBody && _body.chatBody?.stdyStat !== 'N'){ let _id = new Date().getTime() + 'id' lastTalkingInfo.value = { @@ -485,7 +497,7 @@ const nextQuestionSuccess = (info, type='next') => { talkingList.value.push({ crsId: info.crsId, pgrphId: info.pgrphId, - talkingContent: '重新学', + talkingContent: '重新答', type: 0, id: _id }) @@ -575,8 +587,8 @@ const stdyId = ref('') const stdyBatch = ref('') const logId = ref('') // ws 初始化逻辑 -const initsocketTask = () => { - socketStore.creatSocket() +const initsocketTask = async () => { + await socketStore.creatSocket() unref(SocketObj).on('message', (res)=>{ const { rtnCode, body, commond } = JSON.parse(res.data) if(rtnCode === '0000'){ diff --git a/src/pages/index/components/answer.vue b/src/pages/index/components/answer.vue index 5abf3473..218f7494 100644 --- a/src/pages/index/components/answer.vue +++ b/src/pages/index/components/answer.vue @@ -70,6 +70,7 @@ border-radius: 15rpx; padding-bottom: 10rpx; position: relative; + float: left; .talking-cont{ padding-bottom: 20rpx; } diff --git a/src/pages/index/components/question.vue b/src/pages/index/components/question.vue index 39bb8809..d8cb585e 100644 --- a/src/pages/index/components/question.vue +++ b/src/pages/index/components/question.vue @@ -1,5 +1,5 @@