优化音频播放

feature/v-xuexi
wangdong 8 months ago
parent eea3d35602
commit 4acb05b2c6
  1. 13
      pages/learningCenter/reciteDetail.vue

@ -11,15 +11,15 @@
]" @click="detailInfo.collect = !detailInfo.collect"></view> --> ]" @click="detailInfo.collect = !detailInfo.collect"></view> -->
</view> </view>
<view class="audio-box"> <view class="audio-box">
<view v-if="detailInfo.enAudio" class="audio" :class="{ audioActive: activeAudio === 1 }" @click="activeAudio = 1;"> <view v-if="detailInfo.enAudio" class="audio" :class="{ audioActive: activeAudio === 1 }" @click="openAudio(1)">
<text>{{ detailInfo.enAudio }}</text> <text>{{ detailInfo.enAudio }}</text>
<image v-if="activeAudio !== 1" src="@/static/images/learning/audio.png" mode="aspectFill" @click="openAudio(1)"></image> <image v-if="activeAudio !== 1" src="@/static/images/learning/audio.png" mode="aspectFill"></image>
<image v-else src="@/static/images/learning/audio_active.png" mode="aspectFill" @click="openAudio(1)"></image> <image v-else src="@/static/images/learning/audio_active.png" mode="aspectFill"></image>
</view> </view>
<view v-if="detailInfo.uaAudio" class="audio" :class="{ audioActive: activeAudio === 2 }" @click="activeAudio = 2;"> <view v-if="detailInfo.uaAudio" class="audio" :class="{ audioActive: activeAudio === 2 }" @click="openAudio(0)">
<text>{{ detailInfo.uaAudio }}</text> <text>{{ detailInfo.uaAudio }}</text>
<image v-if="activeAudio !== 2" src="@/static/images/learning/audio.png" mode="aspectFill" @click="openAudio(0)"></image> <image v-if="activeAudio !== 2" src="@/static/images/learning/audio.png" mode="aspectFill"></image>
<image v-else src="@/static/images/learning/audio_active.png" mode="aspectFill" @click="openAudio(0)"></image> <image v-else src="@/static/images/learning/audio_active.png" mode="aspectFill"></image>
</view> </view>
</view> </view>
<!-- <view class="info-remark flex flex-center-x"> <!-- <view class="info-remark flex flex-center-x">
@ -120,6 +120,7 @@
} }
}, },
openAudio(type) { openAudio(type) {
this.activeAudio = type || 2;
console.log(`https://dict.youdao.com/dictvoice?type=${type}&audio=${this.detailInfo.name}`, this.audioLoading); console.log(`https://dict.youdao.com/dictvoice?type=${type}&audio=${this.detailInfo.name}`, this.audioLoading);
if (this.audioLoading) { if (this.audioLoading) {
return false; return false;

Loading…
Cancel
Save