158 lines
3.4 KiB
Vue
158 lines
3.4 KiB
Vue
<template>
|
|
<view class="talking-info">
|
|
<view :class="['talking-gif', !voiceLoading ? 'is-play' : '']">
|
|
<CommonLoading color="#fff" v-show="voiceLoading"/>
|
|
</view>
|
|
<view class="right-time">{{voiceTime}}</view>
|
|
<view class="talking-cont">
|
|
<text :class="['talking-text translate-text loading']" v-show="!translateLoading">
|
|
{{ showContent }}
|
|
</text>
|
|
<view class="talking-text translate-text" v-if="translateLoading">
|
|
<CommonLoading color="#fff"/>
|
|
</view>
|
|
</view>
|
|
<view class="btns-cont">
|
|
<view class="play-btn">
|
|
<image class="icon"
|
|
src="@/static/images/course/play-blue.png"
|
|
style="width: 100%;height: 100%;"
|
|
></image>
|
|
<!-- <view class="icon text-btn" v-if="type === 1" @click.stop="translateVoice(dataInfo)">文</view> -->
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { computed, ref, toRefs, watch } from "vue"
|
|
const props = defineProps({
|
|
dataInfo: {
|
|
default: () => ({}),
|
|
type: Object
|
|
},
|
|
activeVoiceId:{
|
|
default:'',
|
|
type: String
|
|
},
|
|
})
|
|
const { activeVoiceId, dataInfo } = toRefs(props)
|
|
watch(() => props.dataInfo, () => {},{deep: true,immediate: true})
|
|
const voiceLoading = ref(false)
|
|
const translateLoading = ref(false)
|
|
|
|
const voiceTime = ref('')
|
|
const showContent = computed(()=>{
|
|
return dataInfo.value.talkingText || ''
|
|
})
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.talking-info{
|
|
padding: 20rpx;
|
|
border-radius: 15rpx;
|
|
background-color: #06f;
|
|
padding-bottom: 30rpx;
|
|
position: relative;
|
|
color: #fff;
|
|
.talking-gif{
|
|
width: 200rpx;
|
|
height: 38rpx;
|
|
background: url(@/static/images/course/voice-gray.png) no-repeat;
|
|
background-size: contain;
|
|
padding-left: 168rpx;
|
|
&.is-play{
|
|
background: url(@/static/images/course/voice-white.gif) no-repeat;
|
|
background-size: contain;
|
|
}
|
|
}
|
|
.right-time{
|
|
position: absolute;
|
|
right: 20rpx;
|
|
top: 20rpx;
|
|
font-size: 28rpx;
|
|
height: 38rpx;
|
|
line-height: 38rpx;
|
|
}
|
|
.talking-cont{
|
|
margin-top: 16rpx;
|
|
overflow: hidden;
|
|
.talking-text{
|
|
font-size: 28rpx;
|
|
line-height: 48rpx;
|
|
margin-bottom: 20rpx;
|
|
word-break: break-all;
|
|
white-space: pre-line;
|
|
overflow: hidden;
|
|
&.translate-text{
|
|
min-height: 48rpx;
|
|
}
|
|
}
|
|
}
|
|
.btns-cont{
|
|
overflow: hidden;
|
|
border-top: 3rpx solid #eee;
|
|
.replay-btn{
|
|
float: left;
|
|
width: 46rpx;
|
|
height: 46rpx;
|
|
overflow: hidden;
|
|
margin-right: 16rpx;
|
|
margin-top: 25rpx;
|
|
}
|
|
.play-btn{
|
|
float: left;
|
|
width: 46rpx;
|
|
height: 46rpx;
|
|
overflow: hidden;
|
|
margin-right: 16rpx;
|
|
margin-top: 25rpx;
|
|
}
|
|
.text-btn{
|
|
float: left;
|
|
width: 46rpx;
|
|
height: 46rpx;
|
|
overflow: hidden;
|
|
line-height: 46rpx;
|
|
text-align: center;
|
|
color: #fff;
|
|
margin-right: 16rpx;
|
|
margin-top: 25rpx;
|
|
background-color: #67A4ff;
|
|
font-size: 24rpx;
|
|
font-weight: bold;
|
|
border-radius: 20rpx;
|
|
}
|
|
.text-right-btn{
|
|
float: right;
|
|
padding: 0 10rpx;
|
|
height: 46rpx;
|
|
overflow: hidden;
|
|
line-height: 46rpx;
|
|
text-align: center;
|
|
margin-left: 16rpx;
|
|
margin-top: 25rpx;
|
|
}
|
|
.next-btn{
|
|
float: right;
|
|
padding: 0 60rpx 0 20rpx;
|
|
height: 62rpx;
|
|
line-height: 62rpx;
|
|
font-size: 30rpx;
|
|
background-color: #06f;
|
|
color: #fff;
|
|
border-radius: 8rpx;
|
|
margin-top: 16rpx;
|
|
position: relative;
|
|
.icon-iamge{
|
|
width: 25rpx;
|
|
height: 25rpx;
|
|
position: absolute;
|
|
right: 20rpx;
|
|
top: 50%;
|
|
margin-top: -12rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style> |