|
|
@ -5,6 +5,9 @@ import {ElMessage} from 'element-plus'; |
|
|
|
import router from '@/router'; |
|
|
|
import ChannelApi from '@/api/ChannelApi'; |
|
|
|
|
|
|
|
|
|
|
|
const activeId = ref(1); |
|
|
|
|
|
|
|
//频道列表 |
|
|
|
const channelList = ref([]); |
|
|
|
//视频上的导航栏 |
|
|
@ -38,6 +41,8 @@ function toLink(channelId) { |
|
|
|
flagType.value = null; |
|
|
|
currentTab.value = null; |
|
|
|
loadShows(channelId,flagType.value); |
|
|
|
//将当前频道id添加到激活状态数组中 |
|
|
|
activeId.value = channelId; |
|
|
|
console.log("flga",flagType.value); |
|
|
|
} |
|
|
|
|
|
|
@ -65,11 +70,11 @@ loadShows(channel.value.id,flagType.value); |
|
|
|
function submit(channelId) { |
|
|
|
console.log("频道id",channelId); |
|
|
|
ChannelApi.subscribe(channelId,90000000).then((result)=>{ |
|
|
|
if(result && result.data.success){ |
|
|
|
if(result.code ==200){ |
|
|
|
ElMessage.success('订阅成功!'); |
|
|
|
loadShows(channelId,null); |
|
|
|
}else{ |
|
|
|
ElMessage.console.error('订阅失败!'); |
|
|
|
ElMessage.error(result.messsage); |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
@ -79,26 +84,25 @@ function unsubmit(channelId){ |
|
|
|
console.log("取消频道id",channelId); |
|
|
|
ChannelApi.unSubscribe(channelId,90000000).then((result) =>{ |
|
|
|
|
|
|
|
if(result && result.data.success){ |
|
|
|
if(result.code ==200){ |
|
|
|
console.log("取消频道id+++++++",channelId); |
|
|
|
ElMessage.success('取消订阅成功!'); |
|
|
|
loadShows(channelId,null); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
ElMessage.error(result.messsage); |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
// function buttonActive(){ |
|
|
|
|
|
|
|
// } |
|
|
|
// buttonActive(); |
|
|
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
<template> |
|
|
|
<Nav></Nav> |
|
|
|
<ChannelNav></ChannelNav> |
|
|
|
<div class="club-nav"> |
|
|
|
<div class="channel-nav"> |
|
|
|
<div class="container"> |
|
|
|
<button v-for="ch in channelList.list" @click="toLink(ch.id)" class="nav-item">{{ ch.name }}</button> |
|
|
|
<button v-for="ch in channelList" @click="toLink(ch.id)" |
|
|
|
:class="{'button-active': activeId==ch.id}" |
|
|
|
class="nav-item">{{ ch.name }}</button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="channel"> |
|
|
@ -254,8 +258,9 @@ function unsubmit(channelId){ |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<style scoped> |
|
|
|
.club-nav { |
|
|
|
.channel-nav { |
|
|
|
height: 100vh; |
|
|
|
width: 15%; |
|
|
|
position: fixed; |
|
|
|
left: 30px; |
|
|
|
top: 30px; |
|
|
@ -278,8 +283,6 @@ function unsubmit(channelId){ |
|
|
|
border: none; |
|
|
|
background-color: #ffffff; |
|
|
|
padding: 10px 15px; |
|
|
|
width: 250px; |
|
|
|
height: 60px; |
|
|
|
text-decoration: none; |
|
|
|
font-size: 18px; |
|
|
|
color: rgb(19, 18, 18); |
|
|
@ -293,14 +296,14 @@ function unsubmit(channelId){ |
|
|
|
color: #f1f1f1; |
|
|
|
} |
|
|
|
|
|
|
|
.nav-item.router-link-active { |
|
|
|
.nav-item.button-active { |
|
|
|
background-color: #407fdf; |
|
|
|
color: white; |
|
|
|
border-radius: 5%; |
|
|
|
} |
|
|
|
|
|
|
|
.channel { |
|
|
|
width: 800px; |
|
|
|
width: 46%; |
|
|
|
margin-left: auto; |
|
|
|
margin-right: auto; |
|
|
|
} |
|
|
|