From 155a30a172e4cf04838dcf7c8bb73ce6b200e574 Mon Sep 17 00:00:00 2001 From: qx <1084500556@qq.com> Date: 星期三, 26 三月 2025 14:52:54 +0800 Subject: [PATCH] Merge branch 'master' of http://101.42.27.146:5001/r/ltkj_peisweb_region --- src/router/index.js | 27 +++++++++++++++++++++++---- 1 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 4a05f71..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 */ @@ -38,7 +38,7 @@ children: [ { path: '/redirect/:path(.*)', - component: () => import('@/views/redirect') + component: () => import('@/views/redirect'), }, { path: '/emer', @@ -203,7 +203,8 @@ path: 'index', component: () => import('@/views/index'), name: 'Index', - meta: { title: '棣栭〉', icon: 'dashboard', affix: true } + meta: { title: '棣栭〉', icon: 'dashboard', affix: true ,} + // routerType:"xamjyy", } ] }, @@ -404,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