fix: bug
This commit is contained in:
@@ -123,7 +123,8 @@
|
||||
</view>
|
||||
<view class="icon text-btn" v-if="type === 1" @click.stop="translateVoice(dataInfo)">文</view>
|
||||
<view class="icon text-right-btn" @click.stop="finishQuestion(dataInfo)" v-if="isLast">完成</view>
|
||||
<view class="icon text-right-btn" @click.stop="withdraw(dataInfo)">撤回</view>
|
||||
<view class="icon text-right-btn" @click.stop="withdraw(dataInfo)" v-show="showWithdraw">撤回
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -162,10 +163,11 @@ import common from '@/common/common';
|
||||
import { getUserInfo } from '@/common/common';
|
||||
import { useStorageStore } from "@/store/storage.js"
|
||||
import { demoUsage } from "@/api/arraybuffer.js"
|
||||
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
|
||||
@@ -195,14 +197,24 @@ const audioCacheObj = computed(() => storageStore.audioObj)
|
||||
default: false,
|
||||
type: Boolean
|
||||
},
|
||||
lastQuestionInfo: {
|
||||
default: () => ({}),
|
||||
type: Object
|
||||
},
|
||||
})
|
||||
const { type, dataInfo, activeVoiceId, isPlaying, isLast} = toRefs(props)
|
||||
const { type, dataInfo, activeVoiceId, isPlaying, isLast, lastQuestionInfo} = toRefs(props)
|
||||
const emit = defineEmits(['changePlay', 'nextQuestion', 'withdraw', 'finishQuestion'])
|
||||
// 声音播放初始化
|
||||
const talkVoiceObj = ref(uni.createInnerAudioContext())
|
||||
talkVoiceObj.value.playbackRate = Number(props.voiceRate)
|
||||
const userInfo = computed(() => getUserInfo())
|
||||
|
||||
const showWithdraw = computed(()=>{
|
||||
let _isMe = unref(lastQuestionInfo).qnsLogId === unref(dataInfo).qnsLogId
|
||||
let _isQuestion = unref(lastQuestionInfo).isQuestion
|
||||
return _isMe && _isQuestion
|
||||
})
|
||||
|
||||
const voiceLoading = ref(false)
|
||||
watch(() => props.isPlaying,(val) => {
|
||||
if(!val){
|
||||
@@ -218,6 +230,10 @@ const audioCacheObj = computed(() => storageStore.audioObj)
|
||||
deep: true,
|
||||
immediate: true
|
||||
})
|
||||
watch(()=>props.lastTalkingInfo,()=>{},{
|
||||
deep: true,
|
||||
immediate: true
|
||||
})
|
||||
|
||||
const transformContent = ref('')
|
||||
const showContentBase = computed(() => {
|
||||
@@ -243,7 +259,9 @@ const audioCacheObj = computed(() => storageStore.audioObj)
|
||||
// })
|
||||
// if(props.isTransform){}
|
||||
})
|
||||
|
||||
onUnload(()=>{
|
||||
pauseVoice()
|
||||
})
|
||||
talkVoiceObj.value.onEnded(()=>{
|
||||
emit('changePlay', '')
|
||||
talkVoiceObj.value.src = ''
|
||||
|
||||
+20
-11
@@ -65,6 +65,7 @@
|
||||
:activeVoiceId="activeVoiceTalkingItemId"
|
||||
:isPlaying="activeVoiceTalkingItemId === item.id"
|
||||
:voiceRate="chooseRate"
|
||||
:lastQuestionInfo="lastTalkingInfo"
|
||||
@changePlay="changePlayItemId"
|
||||
@nextQuestion="nextQuestionSuccess"
|
||||
@withdraw="withdrawNow"
|
||||
@@ -103,7 +104,7 @@
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, computed, unref, onMounted, onUnmounted, getCurrentInstance, nextTick } from 'vue';
|
||||
import { onLoad,onShow,onHide } from '@dcloudio/uni-app';
|
||||
import { onLoad,onShow, onUnload } from '@dcloudio/uni-app';
|
||||
import {
|
||||
previewFile,
|
||||
downloadFile,
|
||||
@@ -332,7 +333,8 @@ const getQuestionInfoUnStudy = (pgrphId) => {
|
||||
...res.body,
|
||||
type: 4,
|
||||
userInfo: {...choiceTeacherInfo.value},
|
||||
id: _id
|
||||
id: _id,
|
||||
isQuestion: true
|
||||
}
|
||||
talkingList.value.push(lastTalkingInfo.value)
|
||||
qstLogId.value = res.body.qstLogId
|
||||
@@ -347,14 +349,13 @@ const getQuestionInfoUnStudy = (pgrphId) => {
|
||||
const nextQuestionSuccess = (info, type='next') => {
|
||||
let _id = new Date().getTime() + 'id'
|
||||
if(type === 'next'){
|
||||
lastTalkingInfo.value = {
|
||||
talkingList.value.push({
|
||||
crsId: info.crsId,
|
||||
pgrphId: info.pgrphId,
|
||||
talkingContent: '继续',
|
||||
type: 0,
|
||||
id: _id
|
||||
}
|
||||
talkingList.value.push(lastTalkingInfo.value)
|
||||
})
|
||||
scrollToBottomNow(0)
|
||||
getQuestionInfoUnStudy(info.pgrphId)
|
||||
}else if( type === 'overGraph'){
|
||||
@@ -365,14 +366,13 @@ const nextQuestionSuccess = (info, type='next') => {
|
||||
logId: info?.logId,
|
||||
})
|
||||
}).then(res=>{
|
||||
lastTalkingInfo.value = {
|
||||
talkingList.value.push({
|
||||
crsId: info.crsId,
|
||||
pgrphId: info.pgrphId,
|
||||
talkingContent: '继续',
|
||||
type: 0,
|
||||
id: _id
|
||||
}
|
||||
talkingList.value.push(lastTalkingInfo.value)
|
||||
})
|
||||
scrollToBottomNow(0)
|
||||
getQuestionInfoUnStudy(info.pgrphId)
|
||||
})
|
||||
@@ -391,9 +391,9 @@ const nextQuestionSuccess = (info, type='next') => {
|
||||
userInfo: {...choiceTeacherInfo.value},
|
||||
..._body.chatBody,
|
||||
type: Number(_body.bodyTyp) || 0,
|
||||
id: _id
|
||||
id: _id,
|
||||
isQuestion: true
|
||||
}
|
||||
|
||||
talkingList.value.push(lastTalkingInfo.value)
|
||||
scrollToBottomNow()
|
||||
})
|
||||
@@ -466,7 +466,8 @@ onMounted(()=>{
|
||||
onShow(()=>{
|
||||
getData('2');
|
||||
})
|
||||
onUnmounted(()=>{
|
||||
onUnload(()=>{
|
||||
changePlayItemId()
|
||||
teacherVoiceObj?.stop?.()
|
||||
teacherVoiceObj.src = ''
|
||||
})
|
||||
@@ -553,6 +554,7 @@ 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'
|
||||
@@ -586,6 +588,13 @@ const withdrawNow = (data) => {
|
||||
const loadingQstLogId = ref('')
|
||||
// 完成
|
||||
const finishQuestionNow = (data) => {
|
||||
let _id1 = new Date().getTime() + 'id'
|
||||
talkingList.value.push({
|
||||
id: _id1,
|
||||
talkingContent: '完成',
|
||||
userInfo: {...choiceTeacherInfo.value},
|
||||
type: 0
|
||||
})
|
||||
waitMakeEvaluateApi({
|
||||
qstLogId: data.qstLogId
|
||||
}).then(res=> {
|
||||
|
||||
Reference in New Issue
Block a user