feat:菜单新增内链打开外网方式
This commit is contained in:
parent
ee64e90a87
commit
295366b0f6
@ -56,7 +56,8 @@ namespace ZR.Model.System
|
|||||||
public static string LAYOUT = "Layout";
|
public static string LAYOUT = "Layout";
|
||||||
/** ParentView组件标识 */
|
/** ParentView组件标识 */
|
||||||
public static string PARENT_VIEW = "ParentView";
|
public static string PARENT_VIEW = "ParentView";
|
||||||
|
/** InnerLink组件标识 */
|
||||||
|
public static string INNER_LINK = "InnerLink";
|
||||||
/** 校验返回结果码 */
|
/** 校验返回结果码 */
|
||||||
public static string UNIQUE = "0";
|
public static string UNIQUE = "0";
|
||||||
public static string NOT_UNIQUE = "1";
|
public static string NOT_UNIQUE = "1";
|
||||||
|
|||||||
@ -39,19 +39,32 @@ namespace ZR.Model.System.Vo
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool NoCache { get; set; }
|
public bool NoCache { get; set; }
|
||||||
public string TitleKey { get; set; } = string.Empty;
|
public string TitleKey { get; set; } = string.Empty;
|
||||||
|
public string Link { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public Meta(string title, string icon)
|
||||||
|
{
|
||||||
|
Title = title;
|
||||||
|
Icon = icon;
|
||||||
|
}
|
||||||
|
public Meta(string title, string icon, string path)
|
||||||
|
{
|
||||||
|
Title = title;
|
||||||
|
Icon = icon;
|
||||||
|
Link = path;
|
||||||
|
}
|
||||||
public Meta(string title, string icon, bool noCache)
|
public Meta(string title, string icon, bool noCache)
|
||||||
{
|
{
|
||||||
Title = title;
|
Title = title;
|
||||||
Icon = icon;
|
Icon = icon;
|
||||||
NoCache = noCache;
|
NoCache = noCache;
|
||||||
}
|
}
|
||||||
public Meta(string title, string icon, bool noCache, string titleKey)
|
public Meta(string title, string icon, bool noCache, string titleKey, string path)
|
||||||
{
|
{
|
||||||
Title = title;
|
Title = title;
|
||||||
Icon = icon;
|
Icon = icon;
|
||||||
NoCache = noCache;
|
NoCache = noCache;
|
||||||
TitleKey = titleKey;
|
TitleKey = titleKey;
|
||||||
|
Link = path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ using ZR.Model.System.Vo;
|
|||||||
using ZR.Repository.System;
|
using ZR.Repository.System;
|
||||||
using ZR.Service.System.IService;
|
using ZR.Service.System.IService;
|
||||||
using ZR.Common;
|
using ZR.Common;
|
||||||
|
using Infrastructure.Extensions;
|
||||||
|
|
||||||
namespace ZR.Service
|
namespace ZR.Service
|
||||||
{
|
{
|
||||||
@ -280,13 +281,13 @@ namespace ZR.Service
|
|||||||
|
|
||||||
foreach (var menu in menus)
|
foreach (var menu in menus)
|
||||||
{
|
{
|
||||||
RouterVo router = new RouterVo
|
RouterVo router = new()
|
||||||
{
|
{
|
||||||
Hidden = "1".Equals(menu.visible),
|
Hidden = "1".Equals(menu.visible),
|
||||||
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), menu.MenuNameKey)
|
Meta = new Meta(menu.MenuName, menu.icon, "1".Equals(menu.isCache), menu.MenuNameKey, menu.path)
|
||||||
};
|
};
|
||||||
|
|
||||||
List<SysMenu> cMenus = menu.children;
|
List<SysMenu> cMenus = menu.children;
|
||||||
@ -299,17 +300,32 @@ namespace ZR.Service
|
|||||||
}
|
}
|
||||||
else if (IsMeunFrame(menu))
|
else if (IsMeunFrame(menu))
|
||||||
{
|
{
|
||||||
List<RouterVo> childrenList = new List<RouterVo>();
|
router.Meta = null;
|
||||||
RouterVo children = new RouterVo
|
List<RouterVo> childrenList = new();
|
||||||
|
RouterVo children = new()
|
||||||
{
|
{
|
||||||
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), menu.MenuNameKey)
|
Meta = new Meta(menu.MenuName, menu.icon, "1".Equals(menu.isCache), menu.MenuNameKey, menu.path)
|
||||||
};
|
};
|
||||||
childrenList.Add(children);
|
childrenList.Add(children);
|
||||||
router.Children = childrenList;
|
router.Children = childrenList;
|
||||||
}
|
}
|
||||||
|
else if (menu.parentId == 0 && IsInnerLink(menu))
|
||||||
|
{
|
||||||
|
router.Meta = new Meta(menu.MenuName, menu.icon);
|
||||||
|
router.Path = "/";
|
||||||
|
List<RouterVo> childrenList = new();
|
||||||
|
RouterVo children = new();
|
||||||
|
string routerPath = InnerLinkReplaceEach(menu.path);
|
||||||
|
children.Path = routerPath;
|
||||||
|
children.Component = UserConstants.INNER_LINK;
|
||||||
|
children.Name = routerPath.ToLower();
|
||||||
|
children.Meta = new Meta(menu.MenuName, menu.icon, menu.path);
|
||||||
|
childrenList.Add(children);
|
||||||
|
router.Children = childrenList;
|
||||||
|
}
|
||||||
routers.Add(router);
|
routers.Add(router);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,10 +399,10 @@ namespace ZR.Service
|
|||||||
{
|
{
|
||||||
string routerPath = menu.path;
|
string routerPath = menu.path;
|
||||||
// 内链打开外网方式
|
// 内链打开外网方式
|
||||||
//if (menu.parentId != 0 && IsInnerLink(menu))
|
if (menu.parentId != 0 && IsInnerLink(menu))
|
||||||
//{
|
{
|
||||||
// routerPath = innerLinkReplaceEach(routerPath);
|
routerPath = InnerLinkReplaceEach(routerPath);
|
||||||
//}
|
}
|
||||||
// 非外链并且是一级目录(类型为目录)
|
// 非外链并且是一级目录(类型为目录)
|
||||||
if (0 == menu.parentId && UserConstants.TYPE_DIR.Equals(menu.menuType)
|
if (0 == menu.parentId && UserConstants.TYPE_DIR.Equals(menu.menuType)
|
||||||
&& UserConstants.NO_FRAME.Equals(menu.isFrame))
|
&& UserConstants.NO_FRAME.Equals(menu.isFrame))
|
||||||
@ -412,6 +428,10 @@ namespace ZR.Service
|
|||||||
{
|
{
|
||||||
component = menu.component;
|
component = menu.component;
|
||||||
}
|
}
|
||||||
|
else if (menu.component.IsEmpty() && menu.parentId != 0 && IsInnerLink(menu))
|
||||||
|
{
|
||||||
|
component = UserConstants.INNER_LINK;
|
||||||
|
}
|
||||||
else if (string.IsNullOrEmpty(menu.component) && IsParentView(menu))
|
else if (string.IsNullOrEmpty(menu.component) && IsParentView(menu))
|
||||||
{
|
{
|
||||||
component = UserConstants.PARENT_VIEW;
|
component = UserConstants.PARENT_VIEW;
|
||||||
@ -450,16 +470,16 @@ namespace ZR.Service
|
|||||||
{
|
{
|
||||||
return menu.parentId != 0 && UserConstants.TYPE_DIR.Equals(menu.menuType);
|
return menu.parentId != 0 && UserConstants.TYPE_DIR.Equals(menu.menuType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 内链域名特殊字符替换
|
/// 内链域名特殊字符替换
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name = "path" ></ param >
|
/// <param name = "path" ></ param >
|
||||||
/// < returns ></ returns >
|
/// < returns ></ returns >
|
||||||
//public string innerLinkReplaceEach(string path)
|
public string InnerLinkReplaceEach(string path)
|
||||||
//{
|
{
|
||||||
// return stringUtils.replaceEach(path, new String[] { Constants.HTTP, Constants.HTTPS },
|
return path.IsNotEmpty() ? path.Replace(UserConstants.HTTP, "").Replace(UserConstants.HTTPS, "") : path;
|
||||||
// new String[] { "", "" });
|
}
|
||||||
//}
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user