| | |
| | | import { mapGetters } from 'vuex' |
| | | import Breadcrumb from '@/components/Breadcrumb' |
| | | import Hamburger from '@/components/Hamburger' |
| | | import { getCookie } from '@/utils/auth' |
| | | import { getCookie, removeCookie, removeToken } from '@/utils/auth' |
| | | import { logout } from '@/api/user' |
| | | import { resetRouter } from '@/router' |
| | | |
| | | export default { |
| | | components: { |
| | |
| | | this.$store.dispatch('app/toggleSideBar') |
| | | }, |
| | | async logout() { |
| | | await this.$store.dispatch('user/logout') |
| | | this.$router.push(`/login?redirect=${this.$route.fullPath}`) |
| | | // await this.$store.dispatch('user/logout') |
| | | const usercode = getCookie('navTabId') |
| | | const username = getCookie('admin') |
| | | const usertype = getCookie('usertype') |
| | | const data = { |
| | | usercode, |
| | | username, |
| | | usertype |
| | | } |
| | | const res = await logout(data) |
| | | if (res.code === '200') { |
| | | removeToken() |
| | | resetRouter() |
| | | removeCookie('admin') |
| | | removeCookie('navTabId') |
| | | removeCookie('usertype') |
| | | this.$message.success('退出成功!') |
| | | this.$router.push(`/login?redirect=${this.$route.fullPath}`) |
| | | // this.$router.push(`/login?redirect=${this.$route.fullPath}`) |
| | | } |
| | | // this.$router.push(`/login`) |
| | | } |
| | | } |
| | | } |