From 1220e38d3870ed32a9790b59ee024fb556177d15 Mon Sep 17 00:00:00 2001 From: MerCry Date: Tue, 10 Feb 2026 03:26:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/nginx.conf | 4 +-- ruoyi-ui/src/components/Breadcrumb/index.vue | 5 +++- ruoyi-ui/src/router/index.js | 26 ++++++++++---------- ruoyi-ui/src/views/login.vue | 2 +- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/ruoyi-ui/nginx.conf b/ruoyi-ui/nginx.conf index 9fbb002..fdd3fd2 100644 --- a/ruoyi-ui/nginx.conf +++ b/ruoyi-ui/nginx.conf @@ -3,8 +3,8 @@ server { server_name localhost; # 前端静态文件路径 - location { - alias /usr/share/nginx/html; + location / { + root /usr/share/nginx/html; try_files $uri $uri/ /index.html; index index.html; } diff --git a/ruoyi-ui/src/components/Breadcrumb/index.vue b/ruoyi-ui/src/components/Breadcrumb/index.vue index 98602a9..84f4831 100644 --- a/ruoyi-ui/src/components/Breadcrumb/index.vue +++ b/ruoyi-ui/src/components/Breadcrumb/index.vue @@ -45,7 +45,10 @@ export default { } else { matched = router.matched.filter(item => item.meta && item.meta.title) } - + // 判断是否为首页 + if (!this.isDashboard(matched[0])) { + matched = [{ path: "/index", meta: { title: "首页" } }].concat(matched) + } this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false) }, findPathNum(str, char = "/") { diff --git a/ruoyi-ui/src/router/index.js b/ruoyi-ui/src/router/index.js index 4205de1..400600c 100644 --- a/ruoyi-ui/src/router/index.js +++ b/ruoyi-ui/src/router/index.js @@ -61,6 +61,19 @@ export const constantRoutes = [ component: () => import('@/views/error/401'), hidden: true }, + { + path: '', + component: Layout, + redirect: 'index', + children: [ + { + path: 'index', + component: () => import('@/views/index'), + name: 'Index', + meta: { title: '首页', icon: 'dashboard', affix: true } + } + ] + }, { path: '/user', component: Layout, @@ -74,19 +87,6 @@ export const constantRoutes = [ meta: { title: '个人中心', icon: 'user' } } ] - }, - { - path: '/', - component: Layout, - redirect: '/index', - children: [ - { - path: 'index', - component: () => import('@/views/index'), - name: 'Index', - meta: { title: '首页', icon: 'dashboard', affix: true } - } - ] } ] diff --git a/ruoyi-ui/src/views/login.vue b/ruoyi-ui/src/views/login.vue index ee8740c..dde986d 100644 --- a/ruoyi-ui/src/views/login.vue +++ b/ruoyi-ui/src/views/login.vue @@ -144,7 +144,7 @@ export default { Cookies.remove('rememberMe') } this.$store.dispatch("Login", this.loginForm).then(() => { - this.$router.push({ path: "/" }).catch(()=>{}) + this.$router.push({ path: this.redirect || "/" }).catch(()=>{}) }).catch(() => { this.loading = false if (this.captchaEnabled) {