From e06044d2db5e57dade2aec6a2ac398129f61d0f2 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Mon, 01 Jun 2026 19:00:15 +0800
Subject: [PATCH] feat: 增加登录页面,注释测试监控的播放
---
src/permission.js | 61 ++++++++++++++----------------
1 files changed, 28 insertions(+), 33 deletions(-)
diff --git a/src/permission.js b/src/permission.js
index a696a51..8d8cd90 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -1,40 +1,35 @@
-/*
- * @Author: shuishen 1109946754@qq.com
- * @Date: 2022-08-18 16:16:10
- * @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2023-05-04 11:09:35
- * @FilePath: \web\bigScreen\src\permission.js
- * @Description: 路由守卫
- *
- * Copyright (c) 2022 by shuishen 1109946754@qq.com, All Rights Reserved.
- */
import router from "@/router/page/index";
+import store from './store'
import { getToken } from "./utils/auth";
+import NProgress from 'nprogress'
+import 'nprogress/nprogress.css'
+
+NProgress.configure({showSpinner: false});
router.beforeEach((to, from, next) => {
- // window._axiosPromiseArr && window._axiosPromiseArr.length && window._axiosPromiseArr.forEach((ele, index) => {
- // ele.cancel()
- // delete window._axiosPromiseArr[index]
- // console.clear()
- // })
-
const meta = to.meta || {};
- next();
- // if (getToken()) {
- // if (to.path === '/login') { // 如果登录成功访问登录页跳转到主页
- // next({
- // path: '/'
- // })
- // } else {
- // next()
- // }
- // } else {
- // // 判断是否需要认证,没有登录访问去登录页
- // if (meta.isAuth === false) {
- // next()
- // } else {
- // window.open('https://sk.hubeishuiyi.cn/business/', "_self")
- // }
- // }
+ if (getToken()) {
+ if (to.path === '/login') {
+ next({ path: '/layout/home' })
+ } else {
+ if (store.getters.token.length === 0) {
+ store.dispatch('FedLogOut').then(() => {
+ next({ path: '/login' })
+ })
+ } else {
+ next()
+ }
+ }
+ } else {
+ if (meta.isAuth === false) {
+ next()
+ } else {
+ next('/login')
+ }
+ }
});
+
+router.afterEach(() => {
+ NProgress.done();
+});
\ No newline at end of file
--
Gitblit v1.9.3