ffplayout/components/Menu.vue

114 lines
3.0 KiB
Vue
Raw Normal View History

2020-04-15 12:10:34 -04:00
<template>
<div>
<div class="menu">
<b-nav align="right">
<b-nav-item to="/" class="nav-item" exact-active-class="active-menu-item">
2020-04-16 12:26:19 -04:00
Home
</b-nav-item>
<b-nav-item to="/player" exact-active-class="active-menu-item">
2020-04-30 04:42:35 -04:00
Player
</b-nav-item>
<b-nav-item to="/media" exact-active-class="active-menu-item">
2020-04-15 12:10:34 -04:00
Media
</b-nav-item>
<b-nav-item to="/message" exact-active-class="active-menu-item">
2020-04-22 11:19:14 -04:00
Message
</b-nav-item>
<b-nav-item to="/logging" exact-active-class="active-menu-item">
2020-04-15 12:10:34 -04:00
Logging
</b-nav-item>
<b-nav-item to="/configure" exact-active-class="active-menu-item">
2020-04-15 12:10:34 -04:00
Configure
</b-nav-item>
2022-07-19 05:33:15 -04:00
<b-nav-text v-if="configGui.length > 1">
&nbsp;&nbsp;
</b-nav-text>
2022-07-19 05:33:15 -04:00
<b-nav-item-dropdown v-if="configGui.length > 1" :text="configGui[configID].name" right>
<b-dropdown-item v-for="(channel, index) in configGui" :key="index" @click="selectChannel(index)">
{{ channel.name }}
</b-dropdown-item>
</b-nav-item-dropdown>
2022-07-19 05:33:15 -04:00
<b-nav-text v-if="configGui.length > 1">
&nbsp;&nbsp;
</b-nav-text>
2022-09-08 08:12:45 -04:00
<b-nav-item @click="logout()">
2020-04-15 12:10:34 -04:00
Logout
</b-nav-item>
</b-nav>
2020-04-15 12:10:34 -04:00
</div>
</div>
</template>
<script>
import { mapState } from 'vuex'
2020-04-15 12:10:34 -04:00
export default {
name: 'Menu',
computed: {
2022-07-19 05:33:15 -04:00
...mapState('config', ['configID', 'configGui'])
2020-04-15 12:10:34 -04:00
},
methods: {
2021-03-23 16:46:05 -04:00
logout () {
2020-04-15 12:10:34 -04:00
try {
2021-03-23 16:46:05 -04:00
this.$store.commit('auth/REMOVE_TOKEN')
this.$store.commit('auth/UPDATE_IS_LOGIN', false)
2022-09-08 08:12:45 -04:00
this.$router.push('/')
2020-04-15 12:10:34 -04:00
} catch (e) {
this.formError = e.message
}
},
selectChannel (index) {
this.$store.commit('config/UPDATE_CONFIG_ID', index)
2020-12-30 16:08:33 -05:00
this.$store.dispatch('config/getPlayoutConfig')
2020-04-15 12:10:34 -04:00
}
}
}
</script>
<style lang="scss" >
.menu {
width: 100%;
height: 40px;
margin: 0;
padding: .5em;
}
.nav-item {
background-image: linear-gradient(#484e55, #3A3F44 60%, #313539);
background-repeat: no-repeat;
height: 28px;
margin: .05em;
border-radius: 3px;
font-size: .95em;
}
.nav-item:hover {
background-image: linear-gradient(#5a636c, #4c545b 60%, #42484e);
background-repeat: no-repeat;
}
.nav-item a {
padding: .2em .6em .2em .6em;
}
.active-menu-item {
position: relative;
}
.active-menu-item::after {
background: #ff9c36;
content: " ";
width: 100%;
height: 2px;
color: red;
position: absolute;
display: block;
left: 0;
right: 0;
border-radius: 1px;
2020-04-15 12:10:34 -04:00
}
</style>