Commit ba23f732 authored by zhengke's avatar zhengke

修改

parent be795b78
...@@ -18,8 +18,10 @@ ...@@ -18,8 +18,10 @@
</view> </view>
</view> </view>
<view class="listen" @click="play"> <view class="listen" @click="play">
<image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/laba2x.png" <!-- <image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/laba2x.png"
mode="aspectFit" class="listenIcon"></image> mode="aspectFit" class="listenIcon"></image> -->
<i class="icon_audio_default" v-if="!isPlay"></i>
<i class="icon_audio_playing" v-else></i>
</view> </view>
<view class="listenText"> <view class="listenText">
播放读音 播放读音
...@@ -63,13 +65,22 @@ ...@@ -63,13 +65,22 @@
} }
}, },
setup(props) { setup(props) {
const data = reactive({
isPlay: false
})
const methods = { const methods = {
play() { play() {
innerAudioContext.src=`https://fanyi.baidu.com/gettts?lan=jp&text=${encodeURIComponent(props.item.WordContent)}&spd=3&source=web` innerAudioContext.src =
`https://fanyi.baidu.com/gettts?lan=jp&text=${encodeURIComponent(props.item.WordContent)}&spd=3&source=web`
innerAudioContext.play() innerAudioContext.play()
data.isPlay = true;
innerAudioContext.onEnded((e)=>{
data.isPlay = false;
})
} }
} }
return { return {
...toRefs(data),
...methods ...methods
}; };
} }
...@@ -77,6 +88,51 @@ ...@@ -77,6 +88,51 @@
</script> </script>
<style scoped> <style scoped>
.icon_audio_default {
background: transparent url('https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/iconloop.png') no-repeat 0 0;
width: 18px;
height: 25px;
vertical-align: middle;
display: inline-block;
-webkit-background-size: 54px 25px;
background-size: 54px 25px;
background-position: -36px center;
}
.icon_audio_playing {
background: transparent url('https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/iconloop.png') no-repeat 0 0;
width: 18px;
height: 25px;
vertical-align: middle;
display: inline-block;
-webkit-background-size: 54px 25px;
background-size: 54px 25px;
-webkit-animation: audio_playing 1s infinite;
background-position: 0px center;
}
@-webkit-keyframes audio_playing {
30% {
background-position: 0px center;
}
31% {
background-position: -18px center;
}
61% {
background-position: -18px center;
}
61.5% {
background-position: -36px center;
}
100% {
background-position: -36px center;
}
}
.wordPronItem { .wordPronItem {
width: 640rpx; width: 640rpx;
height: 990rpx; height: 990rpx;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment