namespace ZR.Model.System.Vo { /// /// 路由展示 /// public class RouterVo { /// /// 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面 /// [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public bool AlwaysShow { get; set; } /// /// 组件地址 /// private string component; /// /// 是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现 /// [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public bool Hidden { get; set; } /// /// 路由名字 /// public string Name { get; set; } /// /// 路由地址 /// public string Path { get; set; } /// /// 重定向地址,当设置 noRedirect 的时候该路由在面包屑导航中不可被点击 /// public string Redirect { get; set; } /// /// 路由参数: 如{ "key": "value"} /// public string Query { get; set; } /// /// 其他元素 /// public Meta Meta { get; set; } /// /// 子路由 /// [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public List Children { get; set; } public string Component { get => component; set => component = value; } } public class Meta { /// /// 设置该路由在侧边栏和面包屑中展示的名字 /// public string Title { get; set; } /// /// 设置该路由的图标,对应路径src/assets/icons/svg /// public string Icon { get; set; } /// /// 设置为true,则不会被 缓存 /// public bool NoCache { get; set; } public string TitleKey { get; set; } = string.Empty; public string Link { get; set; } = string.Empty; public int IsNew { get; set; } /// /// icon颜色 /// public string IconColor { get; set; } /// /// 权限字符 /// public string Permi { get; set; } 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, string titleKey, string path, DateTime addTime) { Title = title; Icon = icon; NoCache = noCache; TitleKey = titleKey; if (!string.IsNullOrEmpty(path) && (path.StartsWith(UserConstants.HTTP) || path.StartsWith(UserConstants.HTTPS))) { Link = path; } if (addTime != DateTime.MinValue) { TimeSpan ts = DateTime.Now - addTime; if (ts.Days < 7) { IsNew = 1; } } } } }