diff --git a/src/pages/course/components/talkingItem.vue b/src/pages/course/components/talkingItem.vue
index 41fcf10d..c96650ae 100644
--- a/src/pages/course/components/talkingItem.vue
+++ b/src/pages/course/components/talkingItem.vue
@@ -123,7 +123,8 @@
文
完成
- 撤回
+ 撤回
+
@@ -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 = ''
diff --git a/src/pages/course/study.vue b/src/pages/course/study.vue
index fec4fbec..3d5d9201 100644
--- a/src/pages/course/study.vue
+++ b/src/pages/course/study.vue
@@ -65,6 +65,7 @@
:activeVoiceId="activeVoiceTalkingItemId"
:isPlaying="activeVoiceTalkingItemId === item.id"
:voiceRate="chooseRate"
+ :lastQuestionInfo="lastTalkingInfo"
@changePlay="changePlayItemId"
@nextQuestion="nextQuestionSuccess"
@withdraw="withdrawNow"
@@ -103,7 +104,7 @@