update
1. fix side menu height 2. add logout button
This commit is contained in:
parent
18f14d66a4
commit
cb541abacb
@ -1,9 +1,11 @@
|
||||
<template>
|
||||
<div class='f-container' v-if="channel !== null">
|
||||
<div class='f-menu'>
|
||||
<sui-segment style='margin: 0 auto; width: 80%;'>
|
||||
<ChannelMenu />
|
||||
</sui-segment>
|
||||
<sui-container textAlign='center'>
|
||||
<sui-segment style="width: 80%; margin: 0 auto;">
|
||||
<ChannelMenu />
|
||||
</sui-segment>
|
||||
</sui-container>
|
||||
</div>
|
||||
<div class='f-full'>
|
||||
<sui-container>
|
||||
|
@ -8,18 +8,29 @@
|
||||
</sui-menu-menu>
|
||||
<sui-menu-menu position='right'>
|
||||
<sui-menu-item>User: {{userInfo.name}}</sui-menu-item>
|
||||
<sui-menu-item @click.native="doLogout">Logout</sui-menu-item>
|
||||
</sui-menu-menu>
|
||||
</sui-container>
|
||||
</sui-menu>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapGetters} from 'vuex'
|
||||
import {mapGetters, mapActions} from 'vuex'
|
||||
export default {
|
||||
name: 'TopMenu',
|
||||
data () {
|
||||
return {}
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['sendLogout']),
|
||||
doLogout: function () {
|
||||
this.sendLogout({
|
||||
cb: () => {
|
||||
this.$router.replace('/')
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['userInfo']),
|
||||
activeItem: function () {
|
||||
|
@ -70,6 +70,19 @@ export default {
|
||||
}
|
||||
commit('toggleLoading', false)
|
||||
},
|
||||
async sendLogout ({commit}, {cb}) {
|
||||
commit('toggleLoading', true)
|
||||
try {
|
||||
await client({
|
||||
method: 'post',
|
||||
url: '/api/logout'
|
||||
})
|
||||
} catch (err) {
|
||||
|
||||
}
|
||||
if (typeof cb === 'function') cb()
|
||||
commit('toggleLoading', false)
|
||||
},
|
||||
async getChannelList ({commit}, cb = null) {
|
||||
commit('toggleLoading', true)
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user