菜单新增多语言配置

This commit is contained in:
不做码农 2022-05-06 22:12:15 +08:00
parent 8154beb9e7
commit 854a05cd5d
4 changed files with 19 additions and 3 deletions

View File

@ -68,5 +68,9 @@ namespace ZR.Model.System.Dto
/// 菜单图标 /// 菜单图标
/// </summary> /// </summary>
public string icon { get; set; } = string.Empty; public string icon { get; set; } = string.Empty;
/// <summary>
/// 翻译key
/// </summary>
public string MenuNameKey { get; set; }
} }
} }

View File

@ -80,7 +80,11 @@ namespace ZR.Model.System
/// 菜单图标 /// 菜单图标
/// </summary> /// </summary>
public string icon { get; set; } = string.Empty; public string icon { get; set; } = string.Empty;
/// <summary>
/// 菜单名key
/// </summary>
[SugarColumn(ColumnName = "menuName_key")]
public string MenuNameKey { get; set; }
/// <summary> /// <summary>
/// 子菜单 /// 子菜单
/// </summary> /// </summary>

View File

@ -39,6 +39,7 @@ namespace ZR.Model.System.Vo
/// 设置为true则不会被 <keep-alive>缓存 /// 设置为true则不会被 <keep-alive>缓存
/// </summary> /// </summary>
public bool NoCache { get; set; } public bool NoCache { get; set; }
public string TitleKey { get; set; } = string.Empty;
public Meta(string title, string icon, bool noCache) public Meta(string title, string icon, bool noCache)
{ {
@ -46,5 +47,12 @@ namespace ZR.Model.System.Vo
Icon = icon; Icon = icon;
NoCache = noCache; NoCache = noCache;
} }
public Meta(string title, string icon, bool noCache, string titleKey)
{
Title = title;
Icon = icon;
NoCache = noCache;
TitleKey = string.IsNullOrEmpty(titleKey) ? title : titleKey;
}
} }
} }

View File

@ -273,7 +273,7 @@ namespace ZR.Service
Name = GetRouteName(menu), Name = GetRouteName(menu),
Path = GetRoutePath(menu), Path = GetRoutePath(menu),
Component = GetComponent(menu), Component = GetComponent(menu),
Meta = new Meta(menu.MenuName, menu.icon, "1".Equals(menu.isCache)) Meta = new Meta(menu.MenuName, menu.icon, "1".Equals(menu.isCache), menu.MenuNameKey)
}; };
List<SysMenu> cMenus = menu.children; List<SysMenu> cMenus = menu.children;
@ -292,7 +292,7 @@ namespace ZR.Service
Path = menu.path, Path = menu.path,
Component = menu.component, Component = menu.component,
Name = string.IsNullOrEmpty(menu.path) ? "" : menu.path.ToLower(), Name = string.IsNullOrEmpty(menu.path) ? "" : menu.path.ToLower(),
Meta = new Meta(menu.MenuName, menu.icon, "1".Equals(menu.isCache)) Meta = new Meta(menu.MenuName, menu.icon, "1".Equals(menu.isCache), menu.MenuNameKey)
}; };
childrenList.Add(children); childrenList.Add(children);
router.Children = childrenList; router.Children = childrenList;