!41 增加功能:网站图标与默认应用一致

This commit is contained in:
Argo 2019-10-05 17:43:40 +08:00 committed by Gitee
commit f240a68617
11 changed files with 33 additions and 9 deletions

View File

@ -281,5 +281,11 @@
"Name": "自动锁屏",
"Code": "0",
"Define": NumberInt(0)
},
{
"Category": "测试平台",
"Name": "网站图标",
"Code": "http://localhost:49185/favicon.ico",
"Define": NumberInt(1)
}
];

View File

@ -157,6 +157,7 @@ Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '网站
Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '个人中心地址', 'http://localhost:50852/Admin/Profiles', 1);
Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '系统设置地址', 'http://localhost:50852/Admin/Index', 1);
Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '系统通知地址', 'http://localhost:50852/Admin/Notifications', 1);
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('测试平台', '网站图标', 'http://localhost:49185/favicon.ico', 1);
Delete from Navigations where Application = 2;
INSERT into Navigations (ParentId, Name, `Order`, Icon, Url, Category, Application) VALUES (0, '首页', 10, 'fa fa-fa', '~/Home/Index', '1', 2);

View File

@ -158,6 +158,7 @@ Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '网站
Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '个人中心地址', 'http://localhost:50852/Admin/Profiles', 1);
Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '系统设置地址', 'http://localhost:50852/Admin/Index', 1);
Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '系统通知地址', 'http://localhost:50852/Admin/Notifications', 1);
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('测试平台', '网站图标', 'http://localhost:49185/favicon.ico', 1);
Delete from Navigations where Application = '2';
INSERT into Navigations (ParentId, Name, "order", Icon, Url, Category, Application) VALUES (0, '首页', 10, 'fa fa-fa', '~/Home/Index', '1', 2);

View File

@ -163,6 +163,7 @@ Insert into Dicts (Category, [Name], Code, Define) values ('测试平台', '网
Insert into Dicts (Category, [Name], Code, Define) values ('测试平台', '个人中心地址', 'http://localhost:50852/Admin/Profiles', 1);
Insert into Dicts (Category, [Name], Code, Define) values ('测试平台', '系统设置地址', 'http://localhost:50852/Admin/Index', 1);
Insert into Dicts (Category, [Name], Code, Define) values ('测试平台', '系统通知地址', 'http://localhost:50852/Admin/Notifications', 1);
INSERT INTO Dicts (Category, [Name], Code, Define) VALUES ('测试平台', '网站图标', 'http://localhost:49185/favicon.ico', 1);
Delete from [Navigations] where Application = 2;
INSERT into [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (0, '首页', 10, 'fa fa-fa', '~/Home/Index', '1', 2);

View File

@ -170,6 +170,7 @@ Insert Dicts (Category, Name, Code, Define) values (@AppName, N'网站页脚', N
Insert Dicts (Category, Name, Code, Define) values (@AppName, N'个人中心地址', N'http://localhost:50852/Admin/Profiles', 1);
Insert Dicts (Category, Name, Code, Define) values (@AppName, N'系统设置地址', N'http://localhost:50852/Admin/Index', 1);
Insert Dicts (Category, Name, Code, Define) values (@AppName, N'系统通知地址', N'http://localhost:50852/Admin/Notifications', 1);
INSERT Dicts (Category, Name, Code, Define) VALUES (@AppName, N'网站图标', N'http://localhost:49185/favicon.ico', 1);
-- 菜单
DELETE FROM Navigations Where [Application] = @AppId

View File

@ -28,6 +28,10 @@ namespace Bootstrap.Admin.Models
// 通过 AppCode 获取用户默认应用的标题
Title = DictHelper.RetrieveWebTitle(AppId);
Footer = DictHelper.RetrieveWebFooter(AppId);
// feat: https://gitee.com/LongbowEnterprise/dashboard/issues?id=I12VKZ
// 后台系统网站图标跟随个人中心设置的默认应用站点的展示
WebSiteLogo = DictHelper.RetrieveWebLogo(AppId);
}
}

View File

@ -28,12 +28,9 @@ namespace Bootstrap.Admin.Models
}
/// <summary>
/// 默认构造函数
/// 获取 网站 logo 小图标
/// </summary>
public ModelBase() : this("0")
{
}
public string WebSiteLogo { get; protected set; } = "~/favicon.ico";
/// <summary>
/// 获取 网站标题

View File

@ -1,11 +1,12 @@
<!DOCTYPE html>
@model ModelBase
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="icon" href="~/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="~/favicon.ico" type="image/x-icon" />
<link rel="icon" href="@Url.Content(Model.WebSiteLogo)" type="image/x-icon" />
<link rel="shortcut icon" href="@Url.Content(Model.WebSiteLogo)" type="image/x-icon" />
<link rel="apple-touch-icon" href="~/favicon.png"/>
<title>@ViewBag.Title</title>
@RenderSection("css", false)

View File

@ -69,7 +69,6 @@ namespace Bootstrap.DataAccess
{
// 优先查找配置的应用程序网站标题
var code = DbHelper.RetrieveTitle(appId);
if (code == "网站标题未设置") code = DictHelper.RetrieveDicts().FirstOrDefault(d => d.Name == "网站标题" && d.Category == "网站设置" && d.Define == 0)?.Code ?? "后台管理系统";
return code;
}

View File

@ -31,6 +31,19 @@ namespace Bootstrap.DataAccess
private static IEnumerable<BootstrapDict> RetrieveProtectedDicts() => RetrieveDicts().Where(d => d.Define == 0 || d.Category == "测试平台");
/// <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.ico";
}
/// <summary>
/// 删除字典中的数据
/// </summary>