Explorar el Código

取消登录页面

sunzehao hace 3 días
padre
commit
2fc4f718fc
Se han modificado 3 ficheros con 27 adiciones y 67 borrados
  1. 2 2
      src/App.vue
  2. 12 59
      src/permission.js
  3. 13 6
      src/router/index.js

+ 2 - 2
src/App.vue

@@ -8,7 +8,7 @@
       transform: `${style.transform}`,
     }"
   >
-    <div v-if="isLogined" class="main">
+    <div class="main">
       <div class="header-body" v-if="hideHeard === '0'">
         <!-- <div class="header-title" @click="handleClickJump()"> -->
           <!-- <img v-if="$store.state.themeName === 'dark'" src="./assets/projectLogo.png" alt="" />
@@ -87,7 +87,7 @@
       </div>
       <alarmBadge />
     </div>
-    <div v-else class="login"><login-page @onLogin="login" /></div>
+    <!-- <div v-else class="login"><login-page @onLogin="login" /></div> -->
   </div>
 </template>
 

+ 12 - 59
src/permission.js

@@ -1,68 +1,21 @@
 import router from "./router";
 import { getCookie,removeToken } from "@/utills/auth"; // getToken from cookie
 import { Base64 } from "js-base64";
-const whiteList = ["/login", "/logout"]; // 不重定向白名单
+const whiteList = ["/integratedAlarm", "/login", "/logout"]; // 不重定向白名单
 import store from "@/store";
 router.beforeEach((to, from, next) => {
-  if (getCookie("authToken")) {
-    if (to.path == "/login" || to.path == "/") {
-      next({ path: "/integratedAlarm" });
-    } else {
-      next();
-      //   if (store.getters.roles.length === 0) {
-      //     // 判断当前用户是否已拉取完user_info信息
-      //     store
-      //       .dispatch("user/GetInfo")
-      //       .then(async () => {
-      //         let permissions = store.getters.permissions;
-      //         let accessRoutes = [];
-      //         accessRoutes = await store.dispatch(
-      //           "routes/setRoutes",
-      //           permissions
-      //         );
-      //         accessRoutes?.forEach((item) => {
-      //           router.addRoute(item);
-      //         });
-      //         next({ ...to, replace: true });
-      //       })
-      //       .catch((err) => {});
-      //   } else {
-      //     next();
-      //   }
-    }
-  } else if (whiteList.indexOf(to.path) !== -1) {
+    // if (getCookie("authToken")) {
+    //     if (to.path == "/login" || to.path == "/") {
+    //     next({ path: "/integratedAlarm" });
+    //     } else {
+    //     next();
+    //     }
+    // } else if (whiteList.indexOf(to.path) !== -1) {
+    //     next();
+    // } else {
+    //     next(`/login?redirect=${to.fullPath}`);
+    // }
     next();
-  } else {
-    next(`/login?redirect=${to.fullPath}`);
-  }
-
-  //有token或在免登录白名单,直接放行
-  //   if (getCookie("iamAccessToken")) {
-  //     if (!store.state.userInfo) {
-  //       //获取用户资料
-  //       const result1 = store.dispatch("getUserInfo");
-  //       //获取菜单
-  //       const result2 = store.dispatch("getmenuList");
-  //       next();
-  //     } else {
-  //       next();
-  //     }
-  //     // next();//放行
-  //   } else if (whiteList.indexOf(to.path) !== -1) {
-  //     next(); //放行
-  //   } else {
-  //     removeImsCookie();
-  //     store.state.userInfo = null;
-  //     const mode = process.env.VUE_APP_LOGIN_MODE;
-  //     if (mode == 1) {
-  //       let base64Url = Base64.encode(process.env.VUE_APP_REDIRECT_URL);
-  //       window.location.href =
-  //         process.env.VUE_APP_UNIFIED_LOGIN + "&redirect_url=" + base64Url;
-  //     } else {
-  //       // router.push('/login');
-  //       next("/login");
-  //     }
-  //   }
 });
 
 router.afterEach((to, from, next) => {});

+ 13 - 6
src/router/index.js

@@ -1,12 +1,12 @@
 import { createRouter, createWebHashHistory } from "vue-router";
 
 export const constantRoutes = [
-    {
-        path: "/login",
-        name: "Login",
-        component: () =>
-            import(/* webpackChunkName: "Login" */ "../views/layout/login-page.vue"),
-    },
+    // {
+    //     path: "/login",
+    //     name: "Login",
+    //     component: () =>
+    //         import(/* webpackChunkName: "Login" */ "../views/layout/login-page.vue"),
+    // },
 ];
 export const asyncRoutes = [
     //   {
@@ -28,6 +28,13 @@ export const asyncRoutes = [
     //       permissions: ["jn_sy"],
     //     },
     //   },
+    {
+    path: "/",
+    redirect: "/integratedAlarm",
+    meta: {
+        title: "综合报警",
+    },
+    },
     //综合报警
     {
         path: "/integratedAlarm",