From 6e56f0cce18b43d62b73b42500546695b73250cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E8=88=AA?= Date: Thu, 28 Aug 2025 09:52:40 +0800 Subject: [PATCH 1/2] fix: bug --- .env.development | 2 +- src/api/study.js | 12 +++ src/pages/course/index.vue | 30 +++++++- src/pages/course/study.vue | 149 +++++++++++++++++++++---------------- 4 files changed, 123 insertions(+), 70 deletions(-) diff --git a/.env.development b/.env.development index c4d7d7c5..0ddad43c 100644 --- a/.env.development +++ b/.env.development @@ -29,7 +29,7 @@ VITE_APP_BASE_H5_API_Url = 'http://25.18.122.65:7001' # VITE_APP_BASE_H5_API_Url_TRAAPP = 'http://25.64.16.130:9601' VITE_APP_BASE_H5_API_Url_TRASTUDY = 'http://25.64.16.130:9602' -VITE_APP_BASE_H5_API_Url_TRAASK = 'http://25.64.16.144:9605' +# VITE_APP_BASE_H5_API_Url_TRAASK = 'http://25.64.16.144:9605' # 王洋洋 diff --git a/src/api/study.js b/src/api/study.js index ef123a57..40e66559 100644 --- a/src/api/study.js +++ b/src/api/study.js @@ -158,6 +158,18 @@ export const textChartApi = (data) => { }); }; +// 预览 对话 +export const textChartPreviewApi = (data) => { + return request({ + url: base_url + '/traStdyInfoPreview/previewCrsInfo', + method: 'post', + toastErrors: true, + data + }); +}; + + + // 设置学习顾问音色/traStdyTeacher/setStudyTeacher export const setStudyTeacherApi = (data) => { return request({ diff --git a/src/pages/course/index.vue b/src/pages/course/index.vue index d0c93ccc..8e534140 100644 --- a/src/pages/course/index.vue +++ b/src/pages/course/index.vue @@ -25,7 +25,7 @@ > - 筛选 + 筛选 @@ -34,14 +34,15 @@ {{item.label}} - + {{itemT.label}} - 确定 + 取消 + 筛选 @@ -170,6 +171,21 @@ import { onShow } from "@dcloudio/uni-app" } = uni.getWindowInfo() const pageTopPadding = computed(() => statusBarHeight + 'px') + + const activeTagPop = ref([]) + + const chooseTagPop = (item) => { + if(!item.value){ + activeTagPop.value = [''] + return + } + activeTagPop.value = activeTagPop.value.filter((t=>!!t)) + if(activeTagPop.value.includes(item.value)){ + activeTagPop.value = activeTagPop.value.filter((t=>t !== item.value)) + }else{ + activeTagPop.value.push(item.value) + } + } // 点击标签 const chooseTag = (item)=>{ if(!item.value){ @@ -472,10 +488,16 @@ import { onShow } from "@dcloudio/uni-app" text-align: center; background-color: #06f; height: 60rpx; - line-height: 60rpx; + line-height: 58rpx; + border: 1rpx solid #06f; padding: 0 40rpx; color: #fff; border-radius: 8rpx; + &.cencle-btn{ + background-color: #fff; + color: #06f; + margin-right: 40rpx; + } } } } diff --git a/src/pages/course/study.vue b/src/pages/course/study.vue index c98dd00e..99b65f8c 100644 --- a/src/pages/course/study.vue +++ b/src/pages/course/study.vue @@ -150,7 +150,8 @@ afreshStudyCourseApi, queryQuestionEvalateApi, textChartApi, - setStudyTeacherApi + setStudyTeacherApi, + textChartPreviewApi } from "@/api/study.js" import common from '@/common/common'; import TalkingItem from '@/pages/course/components/talkingItem.vue' @@ -189,6 +190,9 @@ const inputRef = ref('') const flagVal = ref('1') const isUploadingVoice = ref(false) + const isPreview = ref(false) + + const ajaxApi = computed(()=> isPreview.value ? textChartPreviewApi: textChartApi) const { statusBarHeight @@ -209,25 +213,14 @@ voicePath: '', voiceObj: null })) - if (body.stdyProgressFlag === 'N') { - step.value = 1 - } else { - choiceTeacher.value = body.choiceTeacher - if (startPgrphId.value) { - sendMessage({ - "commond": 'STDY', - "body": { - crsId: crsId.value, - teacherNo: choiceTeacher.value - } - }) - return - } - common.show('提示', '系统检测到您已存在学习记录,要继续学习吗?', true, '重新学习', '继续学习').then((res) => { - if (res) { - // 继续学习 , 获取学习历史接口 - // 滚动到最下面 - scrollToBottomNow() + if(isPreview.value){ + resStartStudyNow() + }else{ + if (body.stdyProgressFlag === 'N') { + step.value = 1 + } else { + choiceTeacher.value = body.choiceTeacher + if (startPgrphId.value) { sendMessage({ "commond": 'STDY', "body": { @@ -235,28 +228,27 @@ teacherNo: choiceTeacher.value } }) - step.value = 2 - } else { - // 重新学习 - afreshStudyCourseApi({ - crsId: crsId.value, - }).then(res => { - step.value = 1 - teacherList.value = body.teacheList.map(t => ({ - ...t, - voicePath: '', - voiceObj: null - })) - }).catch(t => { - step.value = 1 - teacherList.value = body.teacheList.map(t => ({ - ...t, - voicePath: '', - voiceObj: null - })) - }) + return } - }).finally(() => {}) + common.show('提示', '系统检测到您已存在学习记录,要继续学习吗?', true, '重新学习', '继续学习').then((res) => { + if (res) { + // 继续学习 , 获取学习历史接口 + // 滚动到最下面 + scrollToBottomNow() + sendMessage({ + "commond": 'STDY', + "body": { + crsId: crsId.value, + teacherNo: choiceTeacher.value + } + }) + step.value = 2 + } else { + // 重新学习 + resStartStudyNow() + } + }).finally(() => {}) + } } } catch { @@ -264,7 +256,27 @@ watchFlag.value += 1 } }; - + // 重新学习 + const resStartStudyNow = () => { + afreshStudyCourseApi({ + crsId: crsId.value, + }).then(res => { + step.value = 1 + teacherList.value = body.teacheList.map(t => ({ + ...t, + voicePath: '', + voiceObj: null + })) + }).catch(t => { + step.value = 1 + teacherList.value = body.teacheList.map(t => ({ + ...t, + voicePath: '', + voiceObj: null + })) + }) + } + const showChangeSeekModelNow = () => { // changePlayItemId() showSeekModel.value = true @@ -383,7 +395,7 @@ if (flag === 1 && !!startPgrphId.value) { _data.pgrphId = startPgrphId.value } - textChartApi({ + unref(ajaxApi)({ processType: 'PRGH-STDY', requestBody: JSON.stringify(_data) }).then(res => { @@ -392,18 +404,25 @@ return } 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(() => {}) + if(isPreview.value){ + common.show('提示', '您已学完全部知识点', false, '取消', '确定').then((res) => { + common.redirectTo( + `/pages/courseDetail/index?crsId=${crsId.value}&crsNum=${crsNum.value}&from=study&isPreview=true`) + }).finally(() => {}) + }else{ + 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 } lastTalkingInfo.value = { @@ -433,7 +452,7 @@ // 获取问题 const getQuestionInfoUnStudy = (pgrphId) => { console.log(pgrphId) - textChartApi({ + unref(ajaxApi)({ processType: 'QNS-ANSER', requestBody: JSON.stringify({ crsId: crsId.value, @@ -504,7 +523,7 @@ scrollToBottomNow() getQuestionInfoUnStudy(info.pgrphId) } else if (type === 'overGraph') { - textChartApi({ + unref(ajaxApi)({ processType: 'PRGH-OVER', requestBody: JSON.stringify({ pgrphId: info?.pgrphId, @@ -540,7 +559,7 @@ id: _id }) // 重新回答 - textChartApi({ + unref(ajaxApi)({ processType: 'NEW-ANSER', //NEW-KNOW requestBody: info.qnsId }).then(res => { @@ -548,7 +567,6 @@ if (!_body.chatBody) { return } - console.log(info, 222222) lastTalkingInfo.value = { crsId: info.crsId, qstLogId: _body.chatBody, @@ -577,7 +595,7 @@ id: _id }) console.log(unref(logId)) - textChartApi({ + unref(ajaxApi)({ processType: 'NEW-KNOW', requestBody: JSON.stringify({ logId: unref(logId), @@ -680,6 +698,7 @@ const imageId = ref('') onLoad((params) => { watchFlag.value = 1 + isPreview.value = params.isPreview === 'preview' crsId.value = params.crsId || ''; crsNum.value = params.crsNum || ''; imageId.value = params.imgId || '' @@ -841,7 +860,7 @@ ansterContent: val, // 回答文本内容 必输项:false 类型:String asrStartTm: unref(lastTalkingInfo).asrStartTm } - textChartApi({ + unref(ajaxApi)({ processType: 'ANSER-TEXT', requestBody: JSON.stringify(_data) }) @@ -874,7 +893,7 @@ } // 撤回 const withdrawNow = (data) => { - textChartApi({ + unref(ajaxApi)({ processType: 'ANSER-WITHDRAW', requestBody: JSON.stringify({ recordId: data.recordId @@ -908,7 +927,7 @@ type: 0 }) scrollToBottomNow(0) - textChartApi({ + unref(ajaxApi)({ processType: 'ANSER-CHOICE', requestBody: JSON.stringify(_data) }).then(res => { @@ -938,7 +957,7 @@ } // 完成 const finishQuestionNow = (data) => { - textChartApi({ + unref(ajaxApi)({ processType: 'ANSER-OVER', requestBody: JSON.stringify({ qnsId: data.qnsId, @@ -983,7 +1002,7 @@ // 查询问题回答评分 const getQuestionEvalateRequest = (id, data, num) => { if (loadingExecLogId.value) { - textChartApi({ + unref(ajaxApi)({ processType: 'ANSER-RESULT', requestBody: JSON.stringify({ execLogId: loadingExecLogId.value From f181bc040c2380ec97b8ad04b11e10289834b1ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E8=88=AA?= Date: Thu, 28 Aug 2025 15:35:38 +0800 Subject: [PATCH 2/2] fix: bug --- src/api/study.js | 8 ++++++++ src/pages/course/study.vue | 15 ++++++++++----- src/pages/index/components/answer.vue | 4 ++-- src/pages/index/dialog.vue | 21 +++++++++++++++++++-- src/store/socket.js | 2 +- 5 files changed, 40 insertions(+), 10 deletions(-) diff --git a/src/api/study.js b/src/api/study.js index 40e66559..344c743d 100644 --- a/src/api/study.js +++ b/src/api/study.js @@ -169,6 +169,14 @@ export const textChartPreviewApi = (data) => { }; +export const previewAfreshStudyCourse = (data) => { + return request({ + url: base_url + '/traStdyInfo/previewAfreshStudyCourse', + method: 'post', + toastErrors: true, + data + }); +}; // 设置学习顾问音色/traStdyTeacher/setStudyTeacher export const setStudyTeacherApi = (data) => { diff --git a/src/pages/course/study.vue b/src/pages/course/study.vue index 99b65f8c..5e086c21 100644 --- a/src/pages/course/study.vue +++ b/src/pages/course/study.vue @@ -151,7 +151,8 @@ queryQuestionEvalateApi, textChartApi, setStudyTeacherApi, - textChartPreviewApi + textChartPreviewApi, + previewAfreshStudyCourse } from "@/api/study.js" import common from '@/common/common'; import TalkingItem from '@/pages/course/components/talkingItem.vue' @@ -225,7 +226,8 @@ "commond": 'STDY', "body": { crsId: crsId.value, - teacherNo: choiceTeacher.value + teacherNo: choiceTeacher.value, + studyType: isPreview.value ? 'P' : 'S' } }) return @@ -239,7 +241,8 @@ "commond": 'STDY', "body": { crsId: crsId.value, - teacherNo: choiceTeacher.value + teacherNo: choiceTeacher.value, + studyType: isPreview.value ? 'P' : 'S' } }) step.value = 2 @@ -258,7 +261,8 @@ }; // 重新学习 const resStartStudyNow = () => { - afreshStudyCourseApi({ + let _ajax = isPreview.value ? previewAfreshStudyCourse : afreshStudyCourseApi + _ajax({ crsId: crsId.value, }).then(res => { step.value = 1 @@ -359,7 +363,8 @@ "commond": 'STDY', "body": { crsId: crsId.value, - teacherNo: choiceTeacher.value + teacherNo: choiceTeacher.value, + studyType: isPreview.value ? 'P' : 'S' } }) step.value = 2 diff --git a/src/pages/index/components/answer.vue b/src/pages/index/components/answer.vue index 12bd9732..7f5c7413 100644 --- a/src/pages/index/components/answer.vue +++ b/src/pages/index/components/answer.vue @@ -262,7 +262,7 @@ height: 12rpx; border-right: 4rpx solid #333; border-bottom: 4rpx solid #333; - transform: rotate(45deg); + transform: rotate(135deg); } } @@ -270,7 +270,7 @@ .link-info { &::after { top: 18rpx; - transform: rotate(135deg); + transform: rotate(45deg); } } diff --git a/src/pages/index/dialog.vue b/src/pages/index/dialog.vue index 05b67f7e..c9af491b 100644 --- a/src/pages/index/dialog.vue +++ b/src/pages/index/dialog.vue @@ -321,8 +321,9 @@ answerIsOver.value = true } else if (body.event === 'sourceDocuments') { console.log('回答返回文件列表!') + console.log('body: ',body) if (talkingList.value.length === 0) return - let _data = JSON.parse(body.data) || {} + let _data = body.data talkingList.value[talkingList.value.length - 1].talkingFiles = _data.knowledgeList||[] talkingList.value[talkingList.value.length - 1].talkingCrsList = _data.crsList||[] } @@ -472,7 +473,21 @@ console.log(res) talkingList.value = (res.body || []).map((t,index)=> { - let _text = t.respContent.replace(/\\n/g, `\n`); + // let _obj = JSON.parse( t.respContent) + // console.log(_obj,0) + // if(t.chatRole === 'TCH'){ + // console.log(JSON.parse(_obj),1) + // } + let _text + let _talkingCrsList + let _talkingFiles + if(t.chatRole === 'TCH'){ + _text = t.respContentVo?.messageBuileder|| '' + _talkingCrsList = t.respContentVo?.resultMap?.crsList||[] + _talkingFiles = t.respContentVo?.resultMap?.knowledgeList||[] + }else{ + _text = t.respContent + } return { type: t.chatRole === 'TCH'? 'answer':'question', talkingText: _text, @@ -487,6 +502,8 @@ bucketKey: '', downvoteStat: t.downvoteStat, likeStat: t.likeStat, + talkingCrsList: _talkingCrsList, + talkingFiles: _talkingFiles } }) historyRef.value.close() diff --git a/src/store/socket.js b/src/store/socket.js index c0aeb905..73007c3e 100644 --- a/src/store/socket.js +++ b/src/store/socket.js @@ -21,7 +21,7 @@ export const useSocketStore = defineStore('socketStore',{ if(this.SocketObj?.isClose){ this.SocketObj.isClose = false } - let _baseUrl = get_base_url().split('http').join('ws') + let _baseUrl = get_base_url(url).split('http').join('ws') this.SocketObj = new SocketClass(_baseUrl + url + getToken()); }, closeSocket() {