From 8ef2c12be1b9a0d7cdf79c8fcb7125cbbd3dd9c8 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 18:06:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=97=E5=85=B8=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/TestController.cs | 20 +- .../yi-sqlsugar-dev.db | Bin 163840 -> 163840 bytes .../Models/VueRouterModel.cs | 2 +- .../Yi.Framework.Model/MenuEntity.cs | 1 + .../ModelsTemplate/MenuEntity.cs | 1 + .../SeedData/DictionarySeed.cs | 109 ++++ .../Yi.Framework.Model/SeedData/MenuSeed.cs | 50 +- .../SeedData/SeedFactory.cs | 4 + .../DbExtend/DbSeedExtend.cs | 6 + .../src/store/modules/permission.js | 617 +++++++++--------- Yi.Vue3.X.RuoYi/src/store/modules/user.js | 12 +- 11 files changed, 480 insertions(+), 342 deletions(-) diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs index 6e8cdb28..55be5dd9 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/TestController.cs @@ -201,8 +201,26 @@ namespace Yi.Framework.ApiMicroservice.Controllers [Authorize] [HttpGet] public Result AuthorizeTest() - { + { return Result.Success(); } + + [HttpGet] + public async Task ClearDb() + { + var rep = _iUserService._repository; + return Result.Success().SetStatus(await rep.UseTranAsync(async () => + { + await rep.DeleteAsync(u => true); + await rep.ChangeRepository>().DeleteAsync(u => true); + await rep.ChangeRepository>().DeleteAsync(u => true); + await rep.ChangeRepository>().DeleteAsync(u => true); + await rep.ChangeRepository>().DeleteAsync(u => true); + await rep.ChangeRepository>().DeleteAsync(u => true); + await rep.ChangeRepository>().DeleteAsync(u => true); + await rep.ChangeRepository>().DeleteAsync(u => true); + })); + + } } } 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 649c915431c6c50a191955a72cd1e477cad79e91..614c01a771ddec69e36df9d0dcc659a398394a9d 100644 GIT binary patch delta 10893 zcmc&)dvsLQy*~TQWZrYmge3DyCTAp+hZJoK#s~rd#WXX7w1k9A0>s)L zh;0|vs?gDnT5QB+t9G>wk`{CcLL;=&F8lbS+FJYYY98uRx^C}k@49!{_P5VIui0m| zz5aEXm9W1#=lk|P``df}_HXALKI}Ps*mJBJtvFt@4y}0R_LE|Th&bMNmGfN{ik#cE zk9+4-{laxl-t}bm){6J+9Opcf-BdXb1;@{_$7;9S91|J=2N4{$S2JURRH!!zGMRu&CMqfKF{DcZU)l1R3; zCc|OstF~k;-Yi98ZSi<}Z|^Ogk&&_1@GXh8Hw_%xy{WHj%lcjWhIWnh$+3Ywk*3y- zsrKD_*QZnQ8xC&m+7=%f+Wfiw2S+z|54Lp=TtC(}I=p9FU#5TC=+>?cQfp!$m4TXf z?e2@L*%H~hVRYRcnHvs$I`u@L)#=X=S`M9*e|U!{OEY_c!+r4$Pi?X6D3H zB-S2Q|IJ@`NS-}$_x!0NSIqt5?a?7Dj!@GBFl-6Fi=H^YG9O~TE z)!7@_DtB)fI=JVK&7+B~{(;OV`?|-r-qE^$@6EeY(%5wedg7bgw|t^$`-YKp-=?^Z|6i?9t;_&mDo^v!_pDsPqJU!*Sd{@u*Oq{-cfx^7O53A7Xz@{{OXqHt}!l z_dpNu;v6UbmpCVWNB=xLRe$@J#O#R{j|?|-2VeR^)CUv931DOJ@{1!sg;C)EusT>~ zzi~ZWDFP4!P>yed>BlVr;QTDyX7kw`2+uG)l6bGp;nt>`A8xaYWt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HKAVh5i<$FJc zF+z)6nHUGJ?*W>**Qr{%+6B)ZzfP^CtDGSH z^L1(!z1jg%(HqoCx;_V_)En^LCK{w0Z%}n~!Vc1$A!<3j$p+H4A^2_u1=6)4YL(r? zXoJpD+X050MZ8znGdu12_v#KGOnd&;75cs5pmBwFYw&j+3G=%7*5GgOr84pS&8Ghz z1ciA1X49|m-5l}!Tc3XZWUqPM{MO}V9(av-{;i9D>=_>X=3UBh#6>aZ5S*D@0Z$Y% o{qq}aN9cNN_A3pxIxq7DqQK8^B{l&b{&z-ic<{IFwovf@05{4=V*mgE diff --git a/Yi.Framework.Net6/Yi.Framework.Common/Models/VueRouterModel.cs b/Yi.Framework.Net6/Yi.Framework.Common/Models/VueRouterModel.cs index a6bb5cf4..30af6f11 100644 --- a/Yi.Framework.Net6/Yi.Framework.Common/Models/VueRouterModel.cs +++ b/Yi.Framework.Net6/Yi.Framework.Common/Models/VueRouterModel.cs @@ -18,7 +18,7 @@ namespace Yi.Framework.Common.Models public string Redirect { get; set; } public string Component { get; set; } public bool AlwaysShow { get; set; } - public Meta Meta { get; set; } + public Meta Meta { get; set; } = new Meta(); public List Children { get; set; } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/MenuEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/MenuEntity.cs index 911c3c63..dfca072a 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/MenuEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/MenuEntity.cs @@ -46,6 +46,7 @@ namespace Yi.Framework.Model.Models r.Redirect = "noRedirect"; r.AlwaysShow = true; r.Component = m.Component; + r.AlwaysShow = false; } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs index b20eb81b..d10103ad 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs @@ -13,6 +13,7 @@ namespace Yi.Framework.Model.Models { public MenuEntity() { + this.IsCache = false; this.CreateTime = DateTime.Now; } [JsonConverter(typeof(ValueToStringConverter))] diff --git a/Yi.Framework.Net6/Yi.Framework.Model/SeedData/DictionarySeed.cs b/Yi.Framework.Net6/Yi.Framework.Model/SeedData/DictionarySeed.cs index ff3c5590..89667d23 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/SeedData/DictionarySeed.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/SeedData/DictionarySeed.cs @@ -12,6 +12,115 @@ namespace Yi.Framework.Model.SeedData { public override List GetSeed() { + DictionaryEntity dict1 = new DictionaryEntity() + { + Id = SnowFlakeSingle.Instance.NextId(), + DictName = "用户性别", + DictType = "sys_user_sex", + OrderNum = 100, + Remark = "用户性别列表", + IsDeleted = false, + }; + Entitys.Add(dict1); + + DictionaryEntity dict2 = new DictionaryEntity() + { + Id = SnowFlakeSingle.Instance.NextId(), + DictName = "菜单状态", + DictType = "sys_show_hide", + OrderNum = 100, + Remark = "菜单状态列表", + IsDeleted = false, + }; + Entitys.Add(dict2); + + DictionaryEntity dict3 = new DictionaryEntity() + { + Id = SnowFlakeSingle.Instance.NextId(), + DictName = "系统开关", + DictType = "sys_normal_disable", + OrderNum = 100, + Remark = "系统开关列表", + IsDeleted = false, + }; + Entitys.Add(dict3); + + DictionaryEntity dict4 = new DictionaryEntity() + { + Id = SnowFlakeSingle.Instance.NextId(), + DictName = "任务状态", + DictType = "sys_job_status", + OrderNum = 100, + Remark = "任务状态列表", + IsDeleted = false, + }; + Entitys.Add(dict4); + + DictionaryEntity dict5 = new DictionaryEntity() + { + Id = SnowFlakeSingle.Instance.NextId(), + DictName = "任务分组", + DictType = "sys_job_group", + OrderNum = 100, + Remark = "任务分组列表", + IsDeleted = false, + }; + Entitys.Add(dict5); + + DictionaryEntity dict6 = new DictionaryEntity() + { + Id = SnowFlakeSingle.Instance.NextId(), + DictName = "系统是否", + DictType = "sys_yes_no", + OrderNum = 100, + Remark = "系统是否列表", + IsDeleted = false, + }; + Entitys.Add(dict6); + + DictionaryEntity dict7 = new DictionaryEntity() + { + Id = SnowFlakeSingle.Instance.NextId(), + DictName = "通知类型", + DictType = "sys_notice_type", + OrderNum = 100, + Remark = "通知类型列表", + IsDeleted = false, + }; + Entitys.Add(dict7); + DictionaryEntity dict8 = new DictionaryEntity() + { + Id = SnowFlakeSingle.Instance.NextId(), + DictName = "通知状态", + DictType = "sys_notice_status", + OrderNum = 100, + Remark = "通知状态列表", + IsDeleted = false, + }; + Entitys.Add(dict8); + + DictionaryEntity dict9 = new DictionaryEntity() + { + Id = SnowFlakeSingle.Instance.NextId(), + DictName = "操作类型", + DictType = "sys_oper_type", + OrderNum = 100, + Remark = "操作类型列表", + IsDeleted = false, + }; + Entitys.Add(dict9); + + + DictionaryEntity dict10 = new DictionaryEntity() + { + Id = SnowFlakeSingle.Instance.NextId(), + DictName = "系统状态", + DictType = "sys_common_status", + OrderNum = 100, + Remark = "登录状态列表", + IsDeleted = false, + }; + Entitys.Add(dict10); return Entitys; } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/SeedData/MenuSeed.cs b/Yi.Framework.Net6/Yi.Framework.Model/SeedData/MenuSeed.cs index 9659a966..aa87ea54 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/SeedData/MenuSeed.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/SeedData/MenuSeed.cs @@ -124,7 +124,7 @@ namespace Yi.Framework.Model.SeedData PermissionCode = "system:role:query", MenuType = MenuTypeEnum.Component.GetHashCode(), OrderNum = 100, - ParentId = user.Id, + ParentId = role.Id, IsDeleted = false }; Entitys.Add(roleQuery); @@ -136,7 +136,7 @@ namespace Yi.Framework.Model.SeedData PermissionCode = "system:role:add", MenuType = MenuTypeEnum.Component.GetHashCode(), OrderNum = 100, - ParentId = user.Id, + ParentId = role.Id, IsDeleted = false }; Entitys.Add(roleAdd); @@ -148,7 +148,7 @@ namespace Yi.Framework.Model.SeedData PermissionCode = "system:role:edit", MenuType = MenuTypeEnum.Component.GetHashCode(), OrderNum = 100, - ParentId = user.Id, + ParentId = role.Id, IsDeleted = false }; Entitys.Add(roleEdit); @@ -160,7 +160,7 @@ namespace Yi.Framework.Model.SeedData PermissionCode = "system:role:remove", MenuType = MenuTypeEnum.Component.GetHashCode(), OrderNum = 100, - ParentId = user.Id, + ParentId = role.Id, IsDeleted = false }; Entitys.Add(roleRemove); @@ -370,71 +370,71 @@ namespace Yi.Framework.Model.SeedData Entitys.Add(postRemove); //字典管理 - MenuEntity dic = new MenuEntity() + MenuEntity dict = new MenuEntity() { Id = SnowFlakeSingle.Instance.NextId(), MenuName = "字典管理", - PermissionCode = "system:dic:list", + PermissionCode = "system:dict:list", MenuType = MenuTypeEnum.Menu.GetHashCode(), - Router = "dic", + Router = "dict", IsShow = true, IsLink = false, IsCache = true, - Component = "system/dic/index", + Component = "system/dict/index", MenuIcon = "dict", OrderNum = 100, ParentId = system.Id, IsDeleted = false }; - Entitys.Add(dic); + Entitys.Add(dict); - MenuEntity dicQuery = new MenuEntity() + MenuEntity dictQuery = new MenuEntity() { Id = SnowFlakeSingle.Instance.NextId(), MenuName = "字典查询", - PermissionCode = "system:dic:query", + PermissionCode = "system:dict:query", MenuType = MenuTypeEnum.Component.GetHashCode(), OrderNum = 100, - ParentId = dic.Id, + ParentId = dict.Id, IsDeleted = false }; - Entitys.Add(dicQuery); + Entitys.Add(dictQuery); - MenuEntity dicAdd = new MenuEntity() + MenuEntity dictAdd = new MenuEntity() { Id = SnowFlakeSingle.Instance.NextId(), MenuName = "字典新增", - PermissionCode = "system:dic:add", + PermissionCode = "system:dict:add", MenuType = MenuTypeEnum.Component.GetHashCode(), OrderNum = 100, - ParentId = dic.Id, + ParentId = dict.Id, IsDeleted = false }; - Entitys.Add(dicAdd); + Entitys.Add(dictAdd); - MenuEntity dicEdit = new MenuEntity() + MenuEntity dictEdit = new MenuEntity() { Id = SnowFlakeSingle.Instance.NextId(), MenuName = "字典修改", - PermissionCode = "system:dic:edit", + PermissionCode = "system:dict:edit", MenuType = MenuTypeEnum.Component.GetHashCode(), OrderNum = 100, - ParentId = dic.Id, + ParentId = dict.Id, IsDeleted = false }; - Entitys.Add(dicEdit); + Entitys.Add(dictEdit); - MenuEntity dicRemove = new MenuEntity() + MenuEntity dictRemove = new MenuEntity() { Id = SnowFlakeSingle.Instance.NextId(), MenuName = "字典删除", - PermissionCode = "system:dic:remove", + PermissionCode = "system:dict:remove", MenuType = MenuTypeEnum.Component.GetHashCode(), OrderNum = 100, - ParentId = dic.Id, + ParentId = dict.Id, IsDeleted = false }; - Entitys.Add(dicRemove); + Entitys.Add(dictRemove); diff --git a/Yi.Framework.Net6/Yi.Framework.Model/SeedData/SeedFactory.cs b/Yi.Framework.Net6/Yi.Framework.Model/SeedData/SeedFactory.cs index 0320a355..ee32cc57 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/SeedData/SeedFactory.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/SeedData/SeedFactory.cs @@ -22,6 +22,10 @@ namespace Yi.Framework.Model.SeedData { return new MenuSeed().GetSeed(); } + public static List GetDictionarySeed() + { + return new DictionarySeed().GetSeed(); + } public static List GetUserRoleSeed(List users, List roles) { List userRoleEntities = new(); diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbSeedExtend.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbSeedExtend.cs index 5ab736e8..8e1b11fe 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbSeedExtend.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/DbExtend/DbSeedExtend.cs @@ -23,6 +23,7 @@ namespace Yi.Framework.WebCore.DbExtend var users = SeedFactory.GetUserSeed(); var roles = SeedFactory.GetRoleSeed(); var menus = SeedFactory.GetMenuSeed(); + var dicts= SeedFactory.GetDictionarySeed(); if (!_Db.Queryable().Any()) { _Db.Insertable(users).ExecuteCommand(); @@ -38,6 +39,11 @@ namespace Yi.Framework.WebCore.DbExtend _Db.Insertable(menus).ExecuteCommand(); } + if (!_Db.Queryable().Any()) + { + _Db.Insertable(dicts).ExecuteCommand(); + } + if (!_Db.Queryable().Any()) { _Db.Insertable(SeedFactory.GetUserRoleSeed(users, roles)).ExecuteCommand(); diff --git a/Yi.Vue3.X.RuoYi/src/store/modules/permission.js b/Yi.Vue3.X.RuoYi/src/store/modules/permission.js index 2aa465c9..c1168047 100644 --- a/Yi.Vue3.X.RuoYi/src/store/modules/permission.js +++ b/Yi.Vue3.X.RuoYi/src/store/modules/permission.js @@ -36,318 +36,317 @@ const usePermissionStore = defineStore( return new Promise(resolve => { // 向后端请求路由数据 getRouters().then(response => { - // const res=response.data; - + -const res=[ - { - "name": "System", - "path": "/system", - "hidden": false, - "redirect": "noRedirect", - "component": "Layout", - "alwaysShow": true, - "meta": { - "title": "系统管理", - "icon": "system", - "noCache": false, - "link": null - }, - "children": [ - { - "name": "User", - "path": "user", - "hidden": false, - "component": "system/user/index", - "meta": { - "title": "用户管理", - "icon": "user", - "noCache": false, - "link": null - } - }, - { - "name": "Role", - "path": "role", - "hidden": false, - "component": "system/role/index", - "meta": { - "title": "角色管理", - "icon": "peoples", - "noCache": false, - "link": null - } - }, - { - "name": "Menu", - "path": "menu", - "hidden": false, - "component": "system/menu/index", - "meta": { - "title": "菜单管理", - "icon": "tree-table", - "noCache": false, - "link": null - } - }, - { - "name": "Dept", - "path": "dept", - "hidden": false, - "component": "system/dept/index", - "meta": { - "title": "部门管理", - "icon": "tree", - "noCache": false, - "link": null - } - }, - { - "name": "Post", - "path": "post", - "hidden": false, - "component": "system/post/index", - "meta": { - "title": "岗位管理", - "icon": "post", - "noCache": false, - "link": null - } - }, - { - "name": "Dict", - "path": "dict", - "hidden": false, - "component": "system/dict/index", - "meta": { - "title": "字典管理", - "icon": "dict", - "noCache": false, - "link": null - } - }, - { - "name": "Config", - "path": "config", - "hidden": false, - "component": "system/config/index", - "meta": { - "title": "参数设置", - "icon": "edit", - "noCache": false, - "link": null - } - }, - { - "name": "Notice", - "path": "notice", - "hidden": false, - "component": "system/notice/index", - "meta": { - "title": "通知公告", - "icon": "message", - "noCache": false, - "link": null - } - }, - { - "name": "Log", - "path": "log", - "hidden": false, - "redirect": "noRedirect", - "component": "ParentView", - "alwaysShow": true, - "meta": { - "title": "日志管理", - "icon": "log", - "noCache": false, - "link": null - }, - "children": [ - { - "name": "Operlog", - "path": "operlog", - "hidden": false, - "component": "monitor/operlog/index", - "meta": { - "title": "操作日志", - "icon": "form", - "noCache": false, - "link": null - } - }, - { - "name": "Logininfor", - "path": "logininfor", - "hidden": false, - "component": "monitor/logininfor/index", - "meta": { - "title": "登录日志", - "icon": "logininfor", - "noCache": false, - "link": null - } - } - ] - } - ] - }, - { - "name": "Monitor", - "path": "/monitor", - "hidden": false, - "redirect": "noRedirect", - "component": "Layout", - "alwaysShow": true, - "meta": { - "title": "系统监控", - "icon": "monitor", - "noCache": false, - "link": null - }, - "children": [ - { - "name": "Online", - "path": "online", - "hidden": false, - "component": "monitor/online/index", - "meta": { - "title": "在线用户", - "icon": "online", - "noCache": false, - "link": null - } - }, - { - "name": "Job", - "path": "job", - "hidden": false, - "component": "monitor/job/index", - "meta": { - "title": "定时任务", - "icon": "job", - "noCache": false, - "link": null - } - }, - { - "name": "Druid", - "path": "druid", - "hidden": false, - "component": "monitor/druid/index", - "meta": { - "title": "数据监控", - "icon": "druid", - "noCache": false, - "link": null - } - }, - { - "name": "Server", - "path": "server", - "hidden": false, - "component": "monitor/server/index", - "meta": { - "title": "服务监控", - "icon": "server", - "noCache": false, - "link": null - } - }, - { - "name": "Cache", - "path": "cache", - "hidden": false, - "component": "monitor/cache/index", - "meta": { - "title": "缓存监控", - "icon": "redis", - "noCache": false, - "link": null - } - }, - { - "name": "CacheList", - "path": "cacheList", - "hidden": false, - "component": "monitor/cache/list", - "meta": { - "title": "缓存列表", - "icon": "redis-list", - "noCache": false, - "link": null - } - } - ] - }, - { - "name": "Tool", - "path": "/tool", - "hidden": false, - "redirect": "noRedirect", - "component": "Layout", - "alwaysShow": true, - "meta": { - "title": "系统工具", - "icon": "tool", - "noCache": false, - "link": null - }, - "children": [ - { - "name": "Build", - "path": "build", - "hidden": false, - "component": "tool/build/index", - "meta": { - "title": "表单构建", - "icon": "build", - "noCache": false, - "link": null - } - }, - { - "name": "Gen", - "path": "gen", - "hidden": false, - "component": "tool/gen/index", - "meta": { - "title": "代码生成", - "icon": "code", - "noCache": false, - "link": null - } - }, - { - "name": "Swagger", - "path": "swagger", - "hidden": false, - "component": "tool/swagger/index", - "meta": { - "title": "系统接口", - "icon": "swagger", - "noCache": false, - "link": null - } - } - ] - }, - { - "name": "Http://ruoyi.vip", - "path": "http://ruoyi.vip", - "hidden": false, - "component": "Layout", - "meta": { - "title": "若依官网", - "icon": "guide", - "noCache": false, - "link": "http://ruoyi.vip" - } - } -]; - +// const res=[ +// { +// "name": "System", +// "path": "/system", +// "hidden": false, +// "redirect": "noRedirect", +// "component": "Layout", +// "alwaysShow": true, +// "meta": { +// "title": "系统管理", +// "icon": "system", +// "noCache": false, +// "link": null +// }, +// "children": [ +// { +// "name": "User", +// "path": "user", +// "hidden": false, +// "component": "system/user/index", +// "meta": { +// "title": "用户管理", +// "icon": "user", +// "noCache": false, +// "link": null +// } +// }, +// { +// "name": "Role", +// "path": "role", +// "hidden": false, +// "component": "system/role/index", +// "meta": { +// "title": "角色管理", +// "icon": "peoples", +// "noCache": false, +// "link": null +// } +// }, +// { +// "name": "Menu", +// "path": "menu", +// "hidden": false, +// "component": "system/menu/index", +// "meta": { +// "title": "菜单管理", +// "icon": "tree-table", +// "noCache": false, +// "link": null +// } +// }, +// { +// "name": "Dept", +// "path": "dept", +// "hidden": false, +// "component": "system/dept/index", +// "meta": { +// "title": "部门管理", +// "icon": "tree", +// "noCache": false, +// "link": null +// } +// }, +// { +// "name": "Post", +// "path": "post", +// "hidden": false, +// "component": "system/post/index", +// "meta": { +// "title": "岗位管理", +// "icon": "post", +// "noCache": false, +// "link": null +// } +// }, +// { +// "name": "Dict", +// "path": "dict", +// "hidden": false, +// "component": "system/dict/index", +// "meta": { +// "title": "字典管理", +// "icon": "dict", +// "noCache": false, +// "link": null +// } +// }, +// { +// "name": "Config", +// "path": "config", +// "hidden": false, +// "component": "system/config/index", +// "meta": { +// "title": "参数设置", +// "icon": "edit", +// "noCache": false, +// "link": null +// } +// }, +// { +// "name": "Notice", +// "path": "notice", +// "hidden": false, +// "component": "system/notice/index", +// "meta": { +// "title": "通知公告", +// "icon": "message", +// "noCache": false, +// "link": null +// } +// }, +// { +// "name": "Log", +// "path": "log", +// "hidden": false, +// "redirect": "noRedirect", +// "component": "ParentView", +// "alwaysShow": true, +// "meta": { +// "title": "日志管理", +// "icon": "log", +// "noCache": false, +// "link": null +// }, +// "children": [ +// { +// "name": "Operlog", +// "path": "operlog", +// "hidden": false, +// "component": "monitor/operlog/index", +// "meta": { +// "title": "操作日志", +// "icon": "form", +// "noCache": false, +// "link": null +// } +// }, +// { +// "name": "Logininfor", +// "path": "logininfor", +// "hidden": false, +// "component": "monitor/logininfor/index", +// "meta": { +// "title": "登录日志", +// "icon": "logininfor", +// "noCache": false, +// "link": null +// } +// } +// ] +// } +// ] +// }, +// { +// "name": "Monitor", +// "path": "/monitor", +// "hidden": false, +// "redirect": "noRedirect", +// "component": "Layout", +// "alwaysShow": true, +// "meta": { +// "title": "系统监控", +// "icon": "monitor", +// "noCache": false, +// "link": null +// }, +// "children": [ +// { +// "name": "Online", +// "path": "online", +// "hidden": false, +// "component": "monitor/online/index", +// "meta": { +// "title": "在线用户", +// "icon": "online", +// "noCache": false, +// "link": null +// } +// }, +// { +// "name": "Job", +// "path": "job", +// "hidden": false, +// "component": "monitor/job/index", +// "meta": { +// "title": "定时任务", +// "icon": "job", +// "noCache": false, +// "link": null +// } +// }, +// { +// "name": "Druid", +// "path": "druid", +// "hidden": false, +// "component": "monitor/druid/index", +// "meta": { +// "title": "数据监控", +// "icon": "druid", +// "noCache": false, +// "link": null +// } +// }, +// { +// "name": "Server", +// "path": "server", +// "hidden": false, +// "component": "monitor/server/index", +// "meta": { +// "title": "服务监控", +// "icon": "server", +// "noCache": false, +// "link": null +// } +// }, +// { +// "name": "Cache", +// "path": "cache", +// "hidden": false, +// "component": "monitor/cache/index", +// "meta": { +// "title": "缓存监控", +// "icon": "redis", +// "noCache": false, +// "link": null +// } +// }, +// { +// "name": "CacheList", +// "path": "cacheList", +// "hidden": false, +// "component": "monitor/cache/list", +// "meta": { +// "title": "缓存列表", +// "icon": "redis-list", +// "noCache": false, +// "link": null +// } +// } +// ] +// }, +// { +// "name": "Tool", +// "path": "/tool", +// "hidden": false, +// "redirect": "noRedirect", +// "component": "Layout", +// "alwaysShow": true, +// "meta": { +// "title": "系统工具", +// "icon": "tool", +// "noCache": false, +// "link": null +// }, +// "children": [ +// { +// "name": "Build", +// "path": "build", +// "hidden": false, +// "component": "tool/build/index", +// "meta": { +// "title": "表单构建", +// "icon": "build", +// "noCache": false, +// "link": null +// } +// }, +// { +// "name": "Gen", +// "path": "gen", +// "hidden": false, +// "component": "tool/gen/index", +// "meta": { +// "title": "代码生成", +// "icon": "code", +// "noCache": false, +// "link": null +// } +// }, +// { +// "name": "Swagger", +// "path": "swagger", +// "hidden": false, +// "component": "tool/swagger/index", +// "meta": { +// "title": "系统接口", +// "icon": "swagger", +// "noCache": false, +// "link": null +// } +// } +// ] +// }, +// { +// "name": "Http://ruoyi.vip", +// "path": "http://ruoyi.vip", +// "hidden": false, +// "component": "Layout", +// "meta": { +// "title": "若依官网", +// "icon": "guide", +// "noCache": false, +// "link": "http://ruoyi.vip" +// } +// } +// ]; + const res=response.data; const sdata = JSON.parse(JSON.stringify(res)) const rdata = JSON.parse(JSON.stringify(res)) diff --git a/Yi.Vue3.X.RuoYi/src/store/modules/user.js b/Yi.Vue3.X.RuoYi/src/store/modules/user.js index e856e983..aa839ad9 100644 --- a/Yi.Vue3.X.RuoYi/src/store/modules/user.js +++ b/Yi.Vue3.X.RuoYi/src/store/modules/user.js @@ -39,16 +39,16 @@ const useUserStore = defineStore( const avatar = (user.avatar == "" || user.avatar == null) ? defAva : import.meta.env.VITE_APP_BASE_API + user.avatar; if (res.roleCodes && res.roleCodes.length > 0) { // 验证返回的roles是否是一个非空数组 - // this.roles = res.roleCodes - // this.permissions = res.permissionCodes - this.roles = ["admin"]; - this.permissions=["*:*:*"] + this.roles = res.roleCodes + this.permissions = res.permissionCodes + // this.roles = ["admin"]; + // this.permissions=["*:*:*"] } else { this.roles = ['ROLE_DEFAULT'] } - this.roles = ["admin"]; - this.permissions=["*:*:*"] + // this.roles = ["admin"]; + // this.permissions=["*:*:*"] this.name = user.userName this.avatar = avatar; resolve(res)