From e6160e56cc99c7bb85ea2d32bebe74ebc7582c0a Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Sat, 19 Apr 2025 22:17:38 +0800
Subject: [PATCH] feat: 添加重定向

---
 src/permission.js |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/permission.js b/src/permission.js
index 3eaffcf..5b10bf5 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -4,7 +4,7 @@
  * @LastEditors: GuLiMmo 2820890765@qq.com
  * @LastEditTime: 2024-08-29 14:10:56
  * @FilePath: /drone-web-manage/src/permission.js
- * @Description: 
+ * @Description:
  * Copyright (c) 2024 by GuLiMmo, All Rights Reserved.
  */
 import router from './router/';
@@ -20,6 +20,7 @@
 router.beforeEach((to, from, next) => {
   const meta = to.meta || {};
   const isMenu = meta.menu === undefined ? to.query.menu : meta.menu;
+  const redirect = decodeURIComponent(to.query.redirect || '');
   store.commit('SET_IS_MENU', isMenu === undefined);
   if (getToken()) {
     if (store.getters.isLock && to.path !== lockPage) {
@@ -28,6 +29,9 @@
     } else if (to.path === '/login') {
       //如果登录成功访问登录页跳转到主页
       next({ path: '/' });
+    } else if (redirect){
+      console.log('redirect',redirect);
+      next({ path: redirect})
     } else {
       const systemToken = store.getters.token || urlParams?.token
       if (systemToken === 0) {

--
Gitblit v1.9.3