fix: 接口调整

This commit is contained in:
杨航
2025-08-20 16:38:47 +08:00
parent c9bc5dbbbb
commit 41114c2b54
2 changed files with 79 additions and 11 deletions
+36 -9
View File
@@ -1,6 +1,17 @@
<!-- type: 0纯文本信息不翻译 1语音回答 2 文本回答 3, 段落信息 4 问题信息 5 统计信息 6: 发送loading状态 7: 教师反馈文本不翻译 -->
<!-- type:
0纯文本信息不翻译
1语音回答
2 文本回答
3 段落信息
4 问题信息
5 统计信息
6 发送loading状态
7 教师反馈文本不翻译
8 问题反馈信息
-->
<template>
<view :class="['ai-answer', props.class]" :id="props.id" v-if="[3,4,5].indexOf(type) >= 0">
<view :class="['ai-answer', props.class]" :id="props.id" v-if="[3,4,5,8].indexOf(type) >= 0">
<!-- 头像信息 -->
<view class="user-info">
<view class="avatar-box">
<ImagePreview class="img-box" :imgId="teacherInfo?.imgAddr"></ImagePreview>
@@ -10,12 +21,16 @@
<view class="ai-name-desc">{{teacherInfo?.teacherDesc}}</view>
</view>
</view>
<!-- 对话信息 -->
<view :class="['talking-info', [4].indexOf(type) >= 0 ? 'talking-info-less':''] ">
<!-- 语音加载状态 -->
<view :class="['talking-gif', !voiceLoading && (activeVoiceId === dataInfo.id)?'is-play':'']" v-if="type !== 5">
<CommonLoading color="#06f" v-show="voiceLoading"/>
</view>
<view class="talking-cont">
<!-- 加载状态 -->
<CommonLoading color="#06f" v-show="dataInfo.isLoading"/>
<!-- 题干/段落内容 -->
<text class="talking-text" v-if="[3, 5, 6].indexOf(type) >= 0 && !dataInfo.isLoading">
{{ showContent }}
</text>
@@ -23,24 +38,32 @@
<!-- 请您思考并作答:<br> -->
{{ showContent }}
</text>
<RadioSubject v-if="[4].indexOf(type) >= 0 && dataInfo.qnsTyp !== 'ES'" :item="dataInfo" :mode="mode" @subject_click="subject_click" />
<!-- 试题问题 -->
<RadioSubject v-if="[4].indexOf(type) >= 0 && dataInfo.qnsTyp !== 'ES'" :isPreview="!isLast" :item="dataInfo" :mode="mode" @subject_click="subject_click" />
<!-- 试题问题反馈 -->
<!-- <RadioSubjectRequest v-if="[8].indexOf(type) >= 0 && dataInfo.qnsTyp !== 'ES'" :item="dataInfo" :mode="mode" @subject_click="subject_click" /> -->
<!-- 段落图片视频预览 -->
<view v-if="type === 3" style="overflow: hidden;">
<ImagePreview class="cont-img-box" v-if="(dataInfo.imageAddrs||[]).length>0" :imgId="dataInfo.imageAddrs[0]" :previewDetail="true"></ImagePreview>
<VideoPreview class="cont-img-box" v-if="(dataInfo.vidoAddrs||[]).length>0" :fileId="dataInfo.vidoAddrs[0]"></VideoPreview>
</view>
<!-- 维度信息预览 -->
<view v-if="type === 5 && !dataInfo.isLoading" style="padding-top: 16rpx;">
<ChartFour v-if="dataInfo.evalDimens.length === 4" :dataList="dataInfo.evalDimens" :score="dataInfo.intrctGrade"/>
<ChartThree v-if="dataInfo.evalDimens.length === 3" :dataList="dataInfo.evalDimens" :score="dataInfo.intrctGrade"/>
<ChartFive v-if="dataInfo.evalDimens.length === 5" :dataList="dataInfo.evalDimens" :score="dataInfo.intrctGrade"/>
</view>
<view v-if="type === 3 && dataInfo.knoExampie " style="overflow: hidden;">
<!-- 举例预览 -->
<view class="talking-text" v-if="type === 3 && dataInfo.knoExampie " style="overflow: hidden;">
举例{{ dataInfo.knoExampie }}
</view>
</view>
<view class="btns-cont" v-show="!dataInfo.isLoading">
<view class="replay-btn" @click.stop="restartPlay" v-if="!([5].indexOf(type) >= 0)">
<!-- 重新回答 -->
<view class="replay-btn" @click.stop="restartPlay" v-if="!([5, 8].indexOf(type) >= 0)">
<image class="icon" src="@/static/images/course/replay.png" style="width: 100%;height: 100%;"></image>
</view>
<!-- 停止回答 -->
<view class="play-btn" v-if="!([5].indexOf(type) >= 0)">
<image
class="icon"
@@ -58,7 +81,7 @@
></image>
</view>
<view class="next-learn-btn"
v-if="showNextBtn && [5].indexOf(type) >= 0 && isLast"
v-if="showNextBtn && [5,8].indexOf(type) >= 0 && isLast"
@click.stop="goOnRestartPrgh"
>
重新学
@@ -66,7 +89,7 @@
</view>
<view
class="next-learn-btn restart"
v-if="showNextBtn && [5].indexOf(type) >= 0 && isLast"
v-if="showNextBtn && [5,8].indexOf(type) >= 0 && isLast"
@click.stop="goOnRestart"
>
重新答
@@ -74,7 +97,7 @@
</view>
<view
class="replay-study-btn next-learn-btn"
v-if="showNextBtn && [5].indexOf(type) >= 0 && isLast && dataInfo.passStat === 'PS'"
v-if="showNextBtn && [5,8].indexOf(type) >= 0 && isLast && (dataInfo.passStat === 'PS' || dataInfo.judgeResult === 'P')"
@click.stop="goOnGetQues"
>
继续学
@@ -83,6 +106,7 @@
<view class="next-btn" @click.stop="goOnGetQues" v-if="showGoonBtn">继续
<image class="icon icon-iamge" src="@/static/images/course/goon.png" ></image></view>
</view>
<!-- 解析信息 -->
<view class="talking-cont last-cont" v-if=" [5].indexOf(type) >= 0 && !dataInfo.isLoading">
<view class="talking-text">
{{ changeBr(dataInfo.suggestContent || '--') }}
@@ -90,6 +114,7 @@
</view>
</view>
</view>
<!-- ai回答 -->
<view :class="['ai-answer', props.class]" :id="props.id" v-if="[7].indexOf(type) >= 0">
<view class="user-info">
<view class="avatar-box">
@@ -108,6 +133,7 @@
</view>
</view>
</view>
<!-- 用户对话 -->
<view :class="['user-answer', props.class]" :id="props.id" v-else-if="[1, 2].indexOf(type) >= 0">
<view class="user-info">
<view class="avatar-box">
@@ -201,6 +227,7 @@ import { useStorageStore } from "@/store/storage.js"
import { onUnload } from '@dcloudio/uni-app'
import RadioSubject from '@/components/examination/radio-subject.vue'
// import RadioSubjectRequest from '@/pages/wrong_question_record/components/radio-subject.vue'
const storageStore = useStorageStore()
const audioCacheObj = computed(() => storageStore.audioObj)
@@ -513,7 +540,7 @@ const audioCacheObj = computed(() => storageStore.audioObj)
// 答题 选择
const subject_click = (type,data) => {
if(type === 'answer'){
emit('answerQuestion', data)
emit('answerQuestion', data, unref(dataInfo))
}
}
+43 -2
View File
@@ -832,8 +832,49 @@ const withdrawNow = (data) => {
})
}
const loadingQstLogId = ref('')
const answerQuestionNow = (data) => {
console.log(data,1111111111)
const answerQuestionNow = (data, item) => {
// 发出答案
let _answer = data.answerItems.map(t=>t.itemNo).join('')
let _id1 = new Date().getTime() + '3d'
talkingList.value.push({
id: _id1,
talkingContent: _answer,
userInfo: {...choiceTeacherInfo.value},
type: 0
})
scrollToBottomNow(0)
let _data = {
qnsId: item.qnsId,// 问题ID 必输项:true 类型:String
pgrphId: item.pgrphId,// 段落ID 必输项:true 类型:String
crsId: crsId.value,// 课程ID 必输项:true 类型:String
stdyBatch: stdyBatch.value,// 学习批次 必输项:true 类型:String
ansterContent: data.answer.join(',') // 回答文本内容 必输项:false 类型:String
}
textChartApi({
processType: 'ANSER-CHOICE',
requestBody: JSON.stringify(_data)
}).then(res=>{
let _id = new Date().getTime() + 'id'
let _body = res.body
lastTalkingInfo.value = {
crsId: crsId.value,
stdyId: unref(stdyId),
stdyBatch: unref(stdyBatch),
logId: unref(logId),
pgrphId: item.pgrphId,
qnsId: item.qnsId,
chatContent: _body.chatContent||'',
...(_body.chatBody||{}),
type: Number(_body.bodyTyp || 8),
userInfo: {...choiceTeacherInfo.value},
id: _id,
isQuestion: true,
my_answer:[],
backend_answer: []
}
talkingList.value.push(lastTalkingInfo.value)
scrollToBottomNow(0)
})
}
// 完成
const finishQuestionNow = (data) => {