Files
ClassContent/历届学生/陈一航/项目/contact/zhbaohe/src/views/Radio.vue
2024-09-27 02:06:13 +08:00

58 lines
1.5 KiB
Vue

<template lang="pug">
.radio.content
.radio_info
h2 {{RadioInfo.title}}
img(class="back" :src="RadioInfo.logo")
img.gif(:src="showPlay ? one : two")
.radio_action
img.refresh(src="/img/icon/live_broadcast_icon.png")
img.start(@click="StartPlay" :src="showPlay ? start : pause")
img.list(src="/img/icon/program_list_icon.png")
VideoPlayComponents(ref="video" :videoUrl="playUrl" :isHidden="true")
</template>
<script>
import VideoPlayComponents from "@/components/videPlayer.vue"
export default {
components: {
VideoPlayComponents
},
data() {
return {
RadioInfo: {},
showPlay: true, // 控制图片的切换 true radio_up false radio_stop
start: '/img/radio_up.png',
pause: '/img/radio_stop.png',
one: '/img/sound_spectrum.png',
two: '/img/sound_spectrum.gif',
playUrl: {}
}
},
created() {
this.getRadioList()
},
methods: {
async getRadioList() {
this.RadioInfo = await this.$http.IndexService.radio({});
this.playUrl = {
type: "application/x-mpegURL",
src: this.RadioInfo.play_url
}
},
StartPlay() {
if (this.showPlay) {
this.$refs.video.play()
} else {
this.$refs.video.pause()
}
this.showPlay = !this.showPlay
}
}
}
</script>
<style scoped lang="stylus">
@import "~@styl/radio.styl"
</style>