From fd59571a8536d48d4029eb7b09a717393f19e210 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期三, 22 六月 2022 17:29:46 +0800
Subject: [PATCH] 1.角色关联功能勾选提交功能 2.供方清单(新增、编辑、删除) 功能开发

---
 src/layout/components/Navbar.vue |   30 +++++++++++++++++++++++++++---
 1 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue
index 79c30ae..1ec4978 100644
--- a/src/layout/components/Navbar.vue
+++ b/src/layout/components/Navbar.vue
@@ -44,7 +44,9 @@
 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: {
@@ -70,8 +72,30 @@
       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 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')
+        this.$message.success('閫�鍑烘垚鍔燂紒')
+        this.$router.push(`/login?redirect=${this.$route.fullPath}`)
+        // this.$router.push(`/login?redirect=${this.$route.fullPath}`)
+      }
+      // this.$router.push(`/login`)
     }
   }
 }

--
Gitblit v1.9.3