From fbe9ad23927005d5dfea9f857d222b4b4964eb40 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期六, 24 七月 2021 19:03:36 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue into dev

---
 ruoyi-ui/src/components/TopNav/index.vue                                           |   15 +++++++++++++--
 ruoyi-ui/src/utils/request.js                                                      |    1 +
 ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java |    4 ++--
 ruoyi-ui/src/router/index.js                                                       |    2 --
 4 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
index 239825f..3aa6d18 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
@@ -65,7 +65,7 @@
         // 楠岃瘉鐮佸紑鍏�
         if (captchaOnOff)
         {
-            validateCapcha(username, code, uuid, request);
+            validateCaptcha(username, code, uuid, request);
         }
         // 鐢ㄦ埛楠岃瘉
         Authentication authentication = null;
@@ -103,7 +103,7 @@
      * @param uuid 鍞竴鏍囪瘑
      * @return 缁撴灉
      */
-    public void validateCapcha(String username, String code, String uuid, HttpServletRequest request) {
+    public void validateCaptcha(String username, String code, String uuid, HttpServletRequest request) {
 		String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
 		String captcha = redisCache.getCacheObject(verifyKey);
 		redisCache.deleteObject(verifyKey);
diff --git a/ruoyi-ui/src/components/TopNav/index.vue b/ruoyi-ui/src/components/TopNav/index.vue
index c8837f2..edb9c53 100644
--- a/ruoyi-ui/src/components/TopNav/index.vue
+++ b/ruoyi-ui/src/components/TopNav/index.vue
@@ -87,7 +87,7 @@
     // 榛樿婵�娲荤殑鑿滃崟
     activeMenu() {
       const path = this.$route.path;
-      let activePath = this.routers[0].path;
+      let activePath = this.defaultRouter();
       if (path.lastIndexOf("/") > 0) {
         const tmpPath = path.substring(1, path.length);
         activePath = "/" + tmpPath.substring(0, tmpPath.indexOf("/"));
@@ -100,7 +100,7 @@
       }
       var routes = this.activeRoutes(activePath);
       if (routes.length === 0) {
-        activePath = this.currentIndex || this.routers[0].path
+        activePath = this.currentIndex || this.defaultRouter()
         this.activeRoutes(activePath);
       }
       return activePath;
@@ -121,6 +121,17 @@
       const width = document.body.getBoundingClientRect().width / 3;
       this.visibleNumber = parseInt(width / 85);
     },
+    // 榛樿婵�娲荤殑璺敱
+    defaultRouter() {
+      let router;
+      Object.keys(this.routers).some((key) => {
+        if (!this.routers[key].hidden) {
+          router = this.routers[key].path;
+          return true;
+        }
+      });
+      return router;
+    },
     // 鑿滃崟閫夋嫨浜嬩欢
     handleSelect(key, keyPath) {
       this.currentIndex = key;
diff --git a/ruoyi-ui/src/router/index.js b/ruoyi-ui/src/router/index.js
index c7b9371..84b62c1 100644
--- a/ruoyi-ui/src/router/index.js
+++ b/ruoyi-ui/src/router/index.js
@@ -5,8 +5,6 @@
 
 /* Layout */
 import Layout from '@/layout'
-import ParentView from '@/components/ParentView';
-import InnerLink from '@/layout/components/InnerLink'
 
 /**
  * Note: 璺敱閰嶇疆椤�
diff --git a/ruoyi-ui/src/utils/request.js b/ruoyi-ui/src/utils/request.js
index a510d2d..6a7cbfa 100644
--- a/ruoyi-ui/src/utils/request.js
+++ b/ruoyi-ui/src/utils/request.js
@@ -64,6 +64,7 @@
           location.href = '/index';
         })
       }).catch(() => {});
+      return Promise.reject('error')
     } else if (code === 500) {
       Message({
         message: msg,

--
Gitblit v1.9.3