loulijun2021
2022-06-26 0d86c19b122011dc528c624597b0952660d69aba
src/layout/components/Navbar.vue
@@ -72,30 +72,9 @@
      this.$store.dispatch('app/toggleSideBar')
    },
    async logout() {
      // await this.$store.dispatch('user/logout')
      const usercode = getCookie('navTabId')
      const username = getCookie('admin')
      const usertype = getCookie('usertype')
      const userid = getCookie('userid')
      const data = {
        usercode,
        username,
        usertype,
        userid
      }
      const res = await logout(data)
      if (res.code === '200') {
        removeToken()
        resetRouter()
        removeCookie('admin')
        removeCookie('navTabId')
        removeCookie('usertype')
        removeCookie('userid')
      await this.$store.dispatch('user/logout')
        this.$message.success('退出成功!')
        this.$router.push('/login')
        // this.$router.push(`/login?redirect=${this.$route.fullPath}`)
      }
      // this.$router.push(`/login`)
      this.$router.push(`/login`)
    }
  }
}