From b8de3e9867e081dca13773e455fadf79f49287a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com> Date: Sun, 25 Sep 2022 19:56:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/AccountController.cs | 9 +++- .../yi-sqlsugar-dev.db | Bin 172032 -> 172032 bytes .../Yi.Framework.Common/Const/SystemConst.cs | 15 +++++++ .../Yi.Framework.Service/UserService.cs | 16 ++++++- Yi.Vue3.X.RuoYi/.env.development | 2 +- Yi.Vue3.X.RuoYi/.env.production | 4 +- Yi.Vue3.X.RuoYi/index.html | 2 +- Yi.Vue3.X.RuoYi/package.json | 6 +-- Yi.Vue3.X.RuoYi/src/assets/images/profile.jpg | Bin 81131 -> 30394 bytes .../src/layout/components/Sidebar/Logo.vue | 2 +- Yi.Vue3.X.RuoYi/src/views/index.vue | 42 +++++++++++++----- Yi.Vue3.X.RuoYi/src/views/login.vue | 2 +- Yi.Vue3.X.RuoYi/src/views/register.vue | 2 +- .../src/views/system/user/index.vue | 8 ++-- 14 files changed, 83 insertions(+), 27 deletions(-) create mode 100644 Yi.Framework.Net6/Yi.Framework.Common/Const/SystemConst.cs diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs index 1aec3327..4accc1eb 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Yi.Framework.Common.Const; using Yi.Framework.Common.Enum; using Yi.Framework.Common.Helper; using Yi.Framework.Common.Models; @@ -135,9 +136,15 @@ namespace Yi.Framework.ApiMicroservice.Controllers { var userId = HttpContext.GetUserIdInfo(); var data = await _iUserService.GetUserAllInfo(userId); + var menus = data.Menus.ToList(); + //为超级管理员直接给全部路由 + if (SystemConst.Admin.Equals(data.User.UserName)) + { + menus = await _iUserService._repository.ChangeRepository>().GetListAsync(); + } //将后端菜单转换成前端路由,组件级别需要过滤 - List routers = MenuEntity.RouterBuild(data.Menus.ToList()); + List routers = MenuEntity.RouterBuild(menus); return Result.Success().SetData(routers); } diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db index 467083e356373ddeced5f2c59590137155f12a2d..f907f23a990a9fa099122a05bac281313ba651b8 100644 GIT binary patch delta 361 zcmZoTz}0YoYl1Xm_(U0J#_){^3;DVESQ(gj-ZSvL=X<)DN8m9Jcat!qB%3@VgE52i zWFC1FSpx$j10y3{14~^aQw2jyDJ>_wB``HW`h7+JApwTT2KFM7NNTx&YMA(+Gw^@mf6jk)GoQnLenX&; tF;IP_(jfsRkcDbc4kI%UGaDn!Rwiy{Hckkq`JaFLKYzyU|NNPl0sz4dS{?uZ delta 449 zcmZoTz}0YoYl1Xm@I)DB#^8+!3;DSj7#NuNSQ+>k`B*pe2t4LdWin^r5WW89S=wX)S!q@iQ!4|5>5O(vBJ~F576ul^#>vU07G(kH zG{cC-YI@LiD_QG>DgH+Rh9RZ zmff{Ufkl9egNoHCUCnfUzYPFl<@)&oc0T;eXD5Ycrq2 tettt9W;T#fAfuUBkT{IYNE`+xZe})4u(GD+fBx user = o)) { userAction.Invoke(user); - if (user.Password == Common.Helper.MD5Helper.SHA2Encode(password, user.Salt)) + if (user.Password ==MD5Helper.SHA2Encode(password, user.Salt)) { return true; } @@ -149,6 +150,7 @@ namespace Yi.Framework.Service public async Task GetUserAllInfo(long userId) { + var userRoleMenu = new UserRoleMenuDto(); //首先获取到该用户全部信息,导航到角色、菜单,(菜单需要去重,完全交给Set来处理即可) @@ -160,6 +162,18 @@ namespace Yi.Framework.Service } user.Password = null; user.Salt = null; + + //超级管理员特殊处理 + if (SystemConst.Admin.Equals(user.UserName)) + { + userRoleMenu.User = user; + userRoleMenu.RoleCodes.Add(SystemConst.AdminRolesCode); + userRoleMenu.PermissionCodes.Add(SystemConst.AdminPermissionCode); + return userRoleMenu; + } + + + //得到角色集合 var roleList = user.Roles; diff --git a/Yi.Vue3.X.RuoYi/.env.development b/Yi.Vue3.X.RuoYi/.env.development index 59a05506..1215ddfd 100644 --- a/Yi.Vue3.X.RuoYi/.env.development +++ b/Yi.Vue3.X.RuoYi/.env.development @@ -1,5 +1,5 @@ # 页面标题 -VITE_APP_TITLE = 若依管理系统 +VITE_APP_TITLE = 意框架管理系统 # 开发环境配置 VITE_APP_ENV = 'development' diff --git a/Yi.Vue3.X.RuoYi/.env.production b/Yi.Vue3.X.RuoYi/.env.production index cbabf899..a3c73ff2 100644 --- a/Yi.Vue3.X.RuoYi/.env.production +++ b/Yi.Vue3.X.RuoYi/.env.production @@ -1,10 +1,10 @@ # 页面标题 -VITE_APP_TITLE = 若依管理系统 +VITE_APP_TITLE = 意框架管理系统 # 生产环境配置 VITE_APP_ENV = 'production' -# 若依管理系统/生产环境 +# 意框架管理系统/生产环境 VITE_APP_BASE_API = '/prod-api' # 是否在打包时开启压缩,支持 gzip 和 brotli diff --git a/Yi.Vue3.X.RuoYi/index.html b/Yi.Vue3.X.RuoYi/index.html index d20d02e5..12948d99 100644 --- a/Yi.Vue3.X.RuoYi/index.html +++ b/Yi.Vue3.X.RuoYi/index.html @@ -7,7 +7,7 @@ - 若依管理系统 + Yi意框架-ruoyi管理系统