From 5b4e348267b5541d54fffcc75c7b307ad514a692 Mon Sep 17 00:00:00 2001
From: wwl <xchao828@163.com>
Date: 星期六, 15 二月 2025 18:24:58 +0800
Subject: [PATCH] 20250215

---
 src/router/index.js |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/router/index.js b/src/router/index.js
index 1f5425c..aaaa00e 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -1,6 +1,6 @@
 import Vue from 'vue'
 import Router from 'vue-router'
-
+import Cookies from "js-cookie";
 Vue.use(Router)
 
 /* Layout */
@@ -405,8 +405,26 @@
   return routerPush.call(this, location).catch(err => err)
 }
 
-export default new Router({
+const router = new Router({
   mode: 'history', // 鍘绘帀url涓殑#
   scrollBehavior: () => ({ y: 0 }),
   routes: constantRoutes
 })
+
+router.beforeEach((to, from, next) => {
+  if (from.path === '/login') {
+    // 鑾峰彇褰撳墠鐜
+    const env = process.env.VUE_APP_ENV
+    // 鐢熶骇鐜澶勭悊
+    if (env === 'production') {
+      // 闃叉鐢ㄦ埛閫氳繃鍦板潃鏍忕洿鎺ヨ緭鍏RL璁块棶
+      if (from.name === null && to.path !== window.location.pathname) {
+        next(false)
+        return
+      }
+    } 
+  }
+  next()
+})
+
+export default router

--
Gitblit v1.8.0