feat(#I12VKZ): 网站图标与前台一致

#Comment
comment #I12VKZ

#Issue
link #I12VKZ
This commit is contained in:
Argo Zhang 2019-10-06 22:12:51 +08:00
parent 9ae9015590
commit dca9b0c454
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
3 changed files with 29 additions and 7 deletions

View File

@ -8,12 +8,12 @@ using System.Linq;
namespace Bootstrap.Admin.Models
{
/// <summary>
///
/// 侧边栏导航条 Model
/// </summary>
public class NavigatorBarModel : HeaderBarModel
{
/// <summary>
///
/// 构造函数
/// </summary>
/// <param name="controller"></param>
public NavigatorBarModel(ControllerBase controller) : base(controller.User.Identity)
@ -21,16 +21,25 @@ namespace Bootstrap.Admin.Models
Navigations = MenuHelper.RetrieveSystemMenus(UserName, $"~{controller.HttpContext.Request.Path}");
var authApps = AppHelper.RetrievesByUserName(controller.User.Identity.Name);
Applications = DictHelper.RetrieveApps().Where(app => app.Key == "0" || authApps.Any(key => key.Equals(app.Key, StringComparison.OrdinalIgnoreCase)));
// feat: https://gitee.com/LongbowEnterprise/dashboard/issues?id=I12VKZ
// 后台系统网站图标跟随个人中心设置的默认应用站点的展示
WebSiteLogo = DictHelper.RetrieveWebLogo(AppId);
}
/// <summary>
///
/// 获得 网站图标
/// </summary>
public string WebSiteLogo { get; protected set; }
/// <summary>
/// 获得 网站菜单
/// </summary>
public IEnumerable<BootstrapMenu> Navigations { get; private set; }
/// <summary>
///
/// 获得 网站应用程序
/// </summary>
public IEnumerable<KeyValuePair<string, string>> Applications { get; private set; }
}
}
}

View File

@ -3,7 +3,7 @@
<div class="bg"></div>
<div class="nav-brand justify-content-center">
<a href="#">
<img src="~/favicon.png" />
<img src="@Url.Content(@Model.WebSiteLogo)" />
<span>@Model.Title</span>
</a>
</div>

View File

@ -44,6 +44,19 @@ namespace Bootstrap.DataAccess
return ditcs.FirstOrDefault(d => d.Category == platName && d.Name == "favicon")?.Code ?? $"~/favicon.ico";
}
/// <summary>
/// 获取网站 logo 小图标
/// </summary>
/// <param name="appId"></param>
/// <returns></returns>
public static string RetrieveWebLogo(string appId)
{
// 获取应用程序 logo
var ditcs = RetrieveDicts();
var platName = ditcs.FirstOrDefault(d => d.Category == "应用程序" && d.Code == appId)?.Name;
return ditcs.FirstOrDefault(d => d.Category == platName && d.Name == "网站图标")?.Code ?? $"~/favicon.png";
}
/// <summary>
/// 删除字典中的数据
/// </summary>