diff --git a/internal/app/system/model/sys_auth_rule.go b/internal/app/system/model/sys_auth_rule.go index 1e635c1..d1f231a 100644 --- a/internal/app/system/model/sys_auth_rule.go +++ b/internal/app/system/model/sys_auth_rule.go @@ -28,18 +28,22 @@ type SysAuthRuleInfoRes struct { } type UserMenu struct { - *SysAuthRuleInfoRes + Id uint `json:"id"` + Pid uint `json:"pid"` Index string `json:"index"` Name string `json:"name"` MenuName string `json:"menuName"` Component string `json:"component"` Path string `json:"path"` Meta struct { - Icon string `json:"icon"` - Title string `json:"title"` + Icon string `json:"icon"` + Title string `json:"title"` + IsLink string `json:"isLink"` + IsHide bool `json:"isHide"` + IsKeepAlive bool `json:"isKeepAlive"` + IsAffix bool `json:"isAffix"` + IsIframe bool `json:"isIframe"` } `json:"meta"` - Hidden bool `json:"hidden"` - AlwaysShow bool `json:"alwaysShow"` } type UserMenus struct { diff --git a/internal/app/system/service/sys_user.go b/internal/app/system/service/sys_user.go index 0686ba0..a7950c3 100644 --- a/internal/app/system/service/sys_user.go +++ b/internal/app/system/service/sys_user.go @@ -253,17 +253,36 @@ func (s *userImpl) GetMenusTree(menus []*model.UserMenus, pid uint) []*model.Use func (s *userImpl) setMenuData(menu *model.UserMenu, entity *model.SysAuthRuleInfoRes) *model.UserMenu { menu = &model.UserMenu{ - SysAuthRuleInfoRes: entity, - Index: entity.Name, - Name: gstr.UcFirst(entity.Path), - MenuName: entity.Title, + Id: entity.Id, + Pid: entity.Pid, + Index: entity.Name, + Name: gstr.UcFirst(entity.Path), + MenuName: entity.Title, Meta: struct { - Icon string `json:"icon"` - Title string `json:"title"` + Icon string `json:"icon"` + Title string `json:"title"` + IsLink string `json:"isLink"` + IsHide bool `json:"isHide"` + IsKeepAlive bool `json:"isKeepAlive"` + IsAffix bool `json:"isAffix"` + IsIframe bool `json:"isIframe"` }(struct { - Icon string - Title string - }{Icon: entity.Icon, Title: entity.Title}), + Icon string + Title string + IsLink string + IsHide bool + IsKeepAlive bool + IsAffix bool + IsIframe bool + }{ + Icon: entity.Icon, + Title: entity.Title, + IsLink: "", + IsHide: false, + IsKeepAlive: false, + IsAffix: false, + IsIframe: false, + }), } if entity.MenuType != 0 { menu.Component = entity.Component @@ -273,14 +292,14 @@ func (s *userImpl) setMenuData(menu *model.UserMenu, entity *model.SysAuthRuleIn menu.Path = "/" + entity.Path } if entity.AlwaysShow == 1 { - menu.Hidden = false + menu.Meta.IsHide = false } else { - menu.Hidden = true + menu.Meta.IsHide = true } if entity.AlwaysShow == 1 && entity.MenuType == 0 { - menu.AlwaysShow = true + menu.Meta.IsHide = true } else { - menu.AlwaysShow = false + menu.Meta.IsHide = false } return menu }