新增ai问答演示
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="answer-content" v-else>
|
||||
<view :class="['talking-gif', !voiceLoading&&(props.activeVoiceId === dataInfo.id) ? 'is-play' : '']">
|
||||
<view :class="['talking-gif', !voiceLoading&&isPlaying ? 'is-play' : '']">
|
||||
</view>
|
||||
<view class="talking-cont">
|
||||
<MarkdownPreview :mdString="mdText" />
|
||||
@@ -32,9 +32,10 @@
|
||||
<view class="btns-cont">
|
||||
<view class="replay-btn" >
|
||||
<image class="icon" src="@/static/images/course/play.png" style="width: 100%; height: 100%"
|
||||
v-show="!(!voiceLoading&&(props.activeVoiceId === dataInfo.id))"
|
||||
v-show="!isPlaying"
|
||||
@click.stop="playVoice()" ></image>
|
||||
<image class="icon"src="@/static/images/course/pause.png"
|
||||
v-show="isPlaying"
|
||||
style="width: 100%; height: 100%" @click.stop="pauseVoice"></image>
|
||||
</view>
|
||||
</view>
|
||||
@@ -48,9 +49,10 @@ import MarkdownPreview from '@/components/markdown-preview/markdown-preview.vue'
|
||||
import common from '@/common/common'
|
||||
import {
|
||||
downloadVoiceFile,
|
||||
downloadFile
|
||||
} from '@/api/common.js';
|
||||
|
||||
const emit = defineEmits(['handleEvents'])
|
||||
const emit = defineEmits(['handleEvents', 'changePlay'])
|
||||
const props = defineProps({
|
||||
dataInfo: {
|
||||
default: () => ({}),
|
||||
@@ -110,9 +112,11 @@ const isPlaying = ref(false)
|
||||
talkVoiceObj.value.onEnded(()=>{
|
||||
emit('changePlay', '')
|
||||
talkVoiceObj.value.src = ''
|
||||
isPlaying.value = false
|
||||
})
|
||||
talkVoiceObj.value.onError(()=>{
|
||||
talkVoiceObj.value.src = ''
|
||||
isPlaying.value = false
|
||||
})
|
||||
// itemVoice.value = unref(dataInfo).talkingVoice
|
||||
// talkVoiceObj.value.src = itemVoice.value
|
||||
@@ -143,16 +147,9 @@ const isPlaying = ref(false)
|
||||
isPlaying.value = true
|
||||
voiceLoading.value = true;
|
||||
setTimeout(() => {
|
||||
let _params = {}
|
||||
let _url =
|
||||
'/trastudy/traStdyInfo/readContent?' +
|
||||
Object.keys(_params)
|
||||
.map((t) => {
|
||||
return encodeURIComponent(t) + '=' + encodeURIComponent(_params[t]);
|
||||
})
|
||||
.join('&');
|
||||
|
||||
downloadVoiceFile(_url)
|
||||
|
||||
downloadFile(props.dataInfo?.talkingVoiceId)
|
||||
.then((res) => {
|
||||
if (res?.data) {
|
||||
common.msg(res.data.message);
|
||||
@@ -162,7 +159,6 @@ const isPlaying = ref(false)
|
||||
itemVoice.value = res.tempFilePath;
|
||||
talkVoiceObj.value.src = res.tempFilePath;
|
||||
talkVoiceObj.value.play();
|
||||
storageStore.setStorage('audio', _url + _params.teachNo, itemVoice.value);
|
||||
})
|
||||
.catch((err) => {
|
||||
voiceLoading.value = false;
|
||||
|
||||
Reference in New Issue
Block a user