接口联调

This commit is contained in:
yanghang
2025-07-07 21:16:12 +08:00
parent 748daa21ce
commit 4d5be29cd5
2 changed files with 52 additions and 20 deletions
+5 -1
View File
@@ -1,4 +1,4 @@
<!-- type: 3, 段落信息 4 问题信息 5 统计信息 1语音回答 2 文本回答 0纯文本信息 不翻译 6: 发送loading状态--> <!-- type: 0纯文本信息不翻译 1语音回答 2 文本回答 3, 段落信息 4 问题信息 5 统计信息 6: 发送loading状态 -->
<template> <template>
<view class="ai-answer" v-if="[3,4,5].indexOf(type) >= 0"> <view class="ai-answer" v-if="[3,4,5].indexOf(type) >= 0">
<view class="user-info"> <view class="user-info">
@@ -233,6 +233,10 @@ const audioCacheObj = computed(() => storageStore.audioObj)
deep: true, deep: true,
immediate: true immediate: true
}) })
watch(() => props.dataInfo,()=>{},{
deep: true,
immediate: true
})
const transformContent = ref('') const transformContent = ref('')
const showContentBase = computed(() => { const showContentBase = computed(() => {
+47 -19
View File
@@ -117,8 +117,6 @@ import { get_base_url, goto_login_fun } from '@/api/request'
import { import {
getCourseStudyInfoApi, getCourseStudyInfoApi,
afreshStudyCourseApi, afreshStudyCourseApi,
withdrawalAnswerApi,
waitMakeEvaluateApi,
queryQuestionEvalateApi, queryQuestionEvalateApi,
textChartApi textChartApi
} from "@/api/study.js" } from "@/api/study.js"
@@ -331,7 +329,8 @@ const getQuestionInfoUnStudy = (pgrphId) => {
.then(res=>{ .then(res=>{
let _id = new Date().getTime() + 'id' let _id = new Date().getTime() + 'id'
let _body = res.body || {} let _body = res.body || {}
if(res.body.stdyStat !== 'N'){ console.log(_body.chatBody)
if(_body.chatBody && _body.chatBody?.stdyStat !== 'N'){
let _id = new Date().getTime() + 'id' let _id = new Date().getTime() + 'id'
lastTalkingInfo.value = { lastTalkingInfo.value = {
crsId: crsId.value, crsId: crsId.value,
@@ -348,7 +347,7 @@ const getQuestionInfoUnStudy = (pgrphId) => {
isQuestion: true isQuestion: true
} }
talkingList.value.push(lastTalkingInfo.value) talkingList.value.push(lastTalkingInfo.value)
qstLogId.value = lastTalkingInfo.value.qstLogId qstLogId.value = _body.chatBody?.qstLogId
scrollToBottomNow() scrollToBottomNow()
}else{ }else{
getGraphInfoUnStudy() getGraphInfoUnStudy()
@@ -409,6 +408,7 @@ const nextQuestionSuccess = (info, type='next') => {
isQuestion: true isQuestion: true
} }
talkingList.value.push(lastTalkingInfo.value) talkingList.value.push(lastTalkingInfo.value)
qstLogId.value = _body.chatBody.qstLogId
scrollToBottomNow() scrollToBottomNow()
}) })
} }
@@ -523,8 +523,12 @@ const uploadRecordNow = (voicePath) => {
id: _id id: _id
}) })
scrollToBottomNow() scrollToBottomNow()
commonUploadVoiceFile(voicePath, '/trastudy/traStdyInfo/studyAnswerVoiceUp', _data).then(res=>{ commonUploadVoiceFile(voicePath, '/trastudy/traStdychat/voiceChart', {
processType: 'ANSER-VOICE',
requestBody: JSON.stringify(_data)
}).then(res=>{
let _res = JSON.parse(res.data) let _res = JSON.parse(res.data)
console.log(_res)
if(_res.rtnCode === '0000'){ if(_res.rtnCode === '0000'){
talkingList.value = talkingList.value.map(t=>{ talkingList.value = talkingList.value.map(t=>{
if(t.id === _id){ if(t.id === _id){
@@ -535,7 +539,7 @@ const uploadRecordNow = (voicePath) => {
qnsId: _data.qnsId, qnsId: _data.qnsId,
talkingContent: '', talkingContent: '',
talkingVoice: voicePath, talkingVoice: voicePath,
intrctId: res.body||'', intrctId: _res.chatBody,
type: 1, type: 1,
userInfo: {...choiceTeacherInfo.value}, userInfo: {...choiceTeacherInfo.value},
id: _id id: _id
@@ -593,9 +597,13 @@ const submitAnswerNow = (val, cb) => {
} }
// 撤回 // 撤回
const withdrawNow = (data) => { const withdrawNow = (data) => {
withdrawalAnswerApi({ textChartApi({
intrctId: data.intrctId processType: 'ANSER-WITHDRAW',
}).then(res=> { requestBody: JSON.stringify({
intrctId: data.intrctId
})
})
.then(res=> {
// 删除撤回的数据item // 删除撤回的数据item
common.msg('撤回成功!') common.msg('撤回成功!')
talkingList.value = talkingList.value.filter(t => t.intrctId !== data.intrctId) talkingList.value = talkingList.value.filter(t => t.intrctId !== data.intrctId)
@@ -611,11 +619,20 @@ const finishQuestionNow = (data) => {
userInfo: {...choiceTeacherInfo.value}, userInfo: {...choiceTeacherInfo.value},
type: 0 type: 0
}) })
waitMakeEvaluateApi({ // waitMakeEvaluateApi({
qstLogId: data.qstLogId // qstLogId: data.qstLogId
}).then(res=> { // })
textChartApi({
processType: 'ANSER-OVER',
requestBody: JSON.stringify({
qstLogId: data.qstLogId
})
})
.then(res=> {
// common.msg('完成成功,开始获取评分维度数据!') // common.msg('完成成功,开始获取评分维度数据!')
loadingQstLogId.value = res.body.qstLogId loadingQstLogId.value = res.body.chatBody.qstLogId
qstLogId.value = loadingQstLogId.value
let _id = new Date().getTime() + 'id' let _id = new Date().getTime() + 'id'
lastTalkingInfo.value = { lastTalkingInfo.value = {
isLoading: true, isLoading: true,
@@ -631,15 +648,26 @@ const finishQuestionNow = (data) => {
// 查询问题回答评分 // 查询问题回答评分
const getQuestionEvalateRequest = (id, data) => { const getQuestionEvalateRequest = (id, data) => {
if(loadingQstLogId.value){ if(loadingQstLogId.value){
queryQuestionEvalateApi({ // queryQuestionEvalateApi({
qstLogId:loadingQstLogId.value // qstLogId:loadingQstLogId.value
}).then(res=>{ // })
if(res.body && res.body.evalOver === 'Y'){
let _body = res.body textChartApi({
processType: 'ANSER-RESULT',
requestBody: JSON.stringify({
qstLogId:loadingQstLogId.value
})
})
.then(res=>{
let _body = res.body|| {}
if(!_body.chatBody) {
return
}
if(_body.chatBody && _body.chatBody.evalOver === 'Y'){
talkingList.value = talkingList.value.map(t=>{ talkingList.value = talkingList.value.map(t=>{
if(t.id === id){ if(t.id === id){
lastTalkingInfo.value = { lastTalkingInfo.value = {
..._body, ..._body.chatBody,
pgrphId: data.pgrphId, pgrphId: data.pgrphId,
qstLogId: loadingQstLogId.value, qstLogId: loadingQstLogId.value,
id, id,