Browse Source

退出登录时清除用户相关缓存信息

niuheng 3 years ago
parent
commit
9b9d9ce03f
2 changed files with 23 additions and 2 deletions
  1. 22 2
      src/framework/layout/PageHeader.vue
  2. 1 0
      src/framework/layout/layout-store.js

+ 22 - 2
src/framework/layout/PageHeader.vue

@@ -77,7 +77,8 @@ import MessageSever from "../components/messagesever/index";
 import changePass from "../components/changepass/index";
 import lStorage from "@/utils/localStorage";
 import Bus from "@/utils/bus.js";
-import store from '@/store';
+import store from "@/store";
+import storage from "@/framework/utils/storage";
 
 export default {
   name: "PageHeader",
@@ -181,9 +182,28 @@ export default {
          * 改为本地退出
          */
         store.commit("setSsoToken", null);
-        lStorage.remove("");
         lStorage.remove("ssoToken");
+
+        store.commit("layout/setprojectId", null);
+        lStorage.remove("projectId");
+
         store.commit("layout/setUserInfo", null);
+        storage.remove("user_name");
+
+        store.commit("layout/setGroupCode", null);
+        lStorage.remove("group_code");
+
+        // store.state.layout.projectId = null;
+        // lStorage.remove("projectId");
+
+        // store.state.layout.userInfo = null;
+        // storage.remove("user_name");
+
+        // store.state.layout.group_code = null;
+        // lStorage.remove("group_code");
+
+        
+
         store.commit("layout/setUserId", "");
         this.$router.replace({ path: "/login" });
       } else if (cmd == "changePass") {

+ 1 - 0
src/framework/layout/layout-store.js

@@ -92,6 +92,7 @@ export default {
     setErrorReport: (state, val) => (state.errorReport = val),
     setSidebarClosed: (state, val) => (state.sidebarClosed = val),
     setUserInfo: (state, val) => (state.userInfo = val),
+    setGroupCode: (state, val) => (state.group_code = val),
     setUserId: (state, val) => (state.userId = val),
     setSidebarSelected: (state, val) => {
       state.sidebarSelected = val