Pārlūkot izejas kodu

新增 无邮箱强制退出

wzg 1 gadu atpakaļ
vecāks
revīzija
fb82deb1ca
2 mainītis faili ar 12 papildinājumiem un 1 dzēšanām
  1. 1 1
      src/main.js
  2. 11 0
      src/store/index.js

+ 1 - 1
src/main.js

@@ -25,7 +25,7 @@ if (userId) {
 }
 
 router.beforeEach(async (to, from, next) => {
-  if (localStorage.userId) {
+  if (localStorage.userId && localStorage.email) {
     store.commit("changeLogin", true);
     let rolePermission = localStorage.rolePermission?.split(",") || [];
     if (store.state.menuData.length) {

+ 11 - 0
src/store/index.js

@@ -35,6 +35,17 @@ const store = createStore({
       state.secondTitle = text;
     },
     changeLogin(state, b) {
+      if (!b) {
+        localStorage.clear();
+        state.isLogin = false;
+        state.firstTitle = "";
+        state.secondTitle = "";
+        state.currentMenuItem = "/cargoOwnerManage/cargoOwnerList";
+        state.basePermissionData = [];
+        state.userPermission = [];
+        state.menuData = [];
+        state.baseParentNodes = [];
+      }
       state.isLogin = b;
     },
     setCurrentMenuItem(state, index) {