From b2c1c0869b07bd264369a7c480dc7e45e2c7772b Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 5 Oct 2019 17:18:58 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(#I12VKZ):=20=E7=BD=91=E7=AB=99?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E8=B7=9F=E9=9A=8F=E5=89=8D=E5=8F=B0=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E5=9B=BE=E6=A0=87=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #Comment comment #I12VKZ #Issue link #I12VKZ --- src/admin/Bootstrap.Admin/Models/HeaderBarModel.cs | 4 ++++ src/admin/Bootstrap.Admin/Models/ModelBase.cs | 7 ++----- .../Bootstrap.Admin/Views/Shared/_Layout.cshtml | 7 ++++--- src/admin/Bootstrap.DataAccess/Dict.cs | 1 - src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs | 13 +++++++++++++ 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/admin/Bootstrap.Admin/Models/HeaderBarModel.cs b/src/admin/Bootstrap.Admin/Models/HeaderBarModel.cs index 925b99f6..724168bc 100644 --- a/src/admin/Bootstrap.Admin/Models/HeaderBarModel.cs +++ b/src/admin/Bootstrap.Admin/Models/HeaderBarModel.cs @@ -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); } } diff --git a/src/admin/Bootstrap.Admin/Models/ModelBase.cs b/src/admin/Bootstrap.Admin/Models/ModelBase.cs index 8f5da079..9defc37c 100644 --- a/src/admin/Bootstrap.Admin/Models/ModelBase.cs +++ b/src/admin/Bootstrap.Admin/Models/ModelBase.cs @@ -28,12 +28,9 @@ namespace Bootstrap.Admin.Models } /// - /// 默认构造函数 + /// 获取 网站 logo 小图标 /// - public ModelBase() : this("0") - { - - } + public string WebSiteLogo { get; protected set; } = "~/favicon.ico"; /// /// 获取 网站标题 diff --git a/src/admin/Bootstrap.Admin/Views/Shared/_Layout.cshtml b/src/admin/Bootstrap.Admin/Views/Shared/_Layout.cshtml index 9e830cd2..454169a3 100644 --- a/src/admin/Bootstrap.Admin/Views/Shared/_Layout.cshtml +++ b/src/admin/Bootstrap.Admin/Views/Shared/_Layout.cshtml @@ -1,11 +1,12 @@ - +@model ModelBase + - - + + @ViewBag.Title @RenderSection("css", false) diff --git a/src/admin/Bootstrap.DataAccess/Dict.cs b/src/admin/Bootstrap.DataAccess/Dict.cs index 66de0427..f395dfbf 100644 --- a/src/admin/Bootstrap.DataAccess/Dict.cs +++ b/src/admin/Bootstrap.DataAccess/Dict.cs @@ -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; } diff --git a/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs b/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs index 7ba70dc8..055e855c 100644 --- a/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs +++ b/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs @@ -31,6 +31,19 @@ namespace Bootstrap.DataAccess private static IEnumerable RetrieveProtectedDicts() => RetrieveDicts().Where(d => d.Define == 0 || d.Category == "测试平台"); + /// + /// 获取网站 logo 小图标 + /// + /// + /// + 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"; + } + /// /// 删除字典中的数据 /// From 8d769bc6a07c2e94f8fa54101e9678f0fbe2436d Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 5 Oct 2019 17:38:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?db(#I12VKZ):=20=E5=AD=97=E5=85=B8=E8=A1=A8?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=89=8D=E5=8F=B0=E7=BD=91=E7=AB=99=E5=9B=BE?= =?UTF-8?q?=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #Comment comment #I12VKZ #Issue link#I12VKZ --- db/MongoDB/Dicts.js | 6 ++++++ db/MySQL/initData.sql | 1 + db/Postgresql/initData.sql | 1 + db/SQLite/InitData.sql | 1 + db/SqlServer/InitData.sql | 1 + src/admin/Bootstrap.Admin/BootstrapAdmin.db | Bin 110592 -> 110592 bytes 6 files changed, 10 insertions(+) diff --git a/db/MongoDB/Dicts.js b/db/MongoDB/Dicts.js index ccf9f6b2..25c1f12e 100644 --- a/db/MongoDB/Dicts.js +++ b/db/MongoDB/Dicts.js @@ -281,5 +281,11 @@ "Name": "自动锁屏", "Code": "0", "Define": NumberInt(0) + }, + { + "Category": "测试平台", + "Name": "网站图标", + "Code": "http://localhost:49185/favicon.ico", + "Define": NumberInt(1) } ]; \ No newline at end of file diff --git a/db/MySQL/initData.sql b/db/MySQL/initData.sql index 32e693a6..b425cbed 100644 --- a/db/MySQL/initData.sql +++ b/db/MySQL/initData.sql @@ -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); diff --git a/db/Postgresql/initData.sql b/db/Postgresql/initData.sql index 2762c29c..017796ad 100644 --- a/db/Postgresql/initData.sql +++ b/db/Postgresql/initData.sql @@ -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); diff --git a/db/SQLite/InitData.sql b/db/SQLite/InitData.sql index 5aedae78..14bbe97e 100644 --- a/db/SQLite/InitData.sql +++ b/db/SQLite/InitData.sql @@ -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); diff --git a/db/SqlServer/InitData.sql b/db/SqlServer/InitData.sql index 9f92aa78..2ad45ddc 100644 --- a/db/SqlServer/InitData.sql +++ b/db/SqlServer/InitData.sql @@ -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 diff --git a/src/admin/Bootstrap.Admin/BootstrapAdmin.db b/src/admin/Bootstrap.Admin/BootstrapAdmin.db index 764248e799b1567658ef1489219aefb72543134f..92bac051f67f5ae6909b6d418da3573f7ad806ac 100644 GIT binary patch delta 118 zcmZp8z}E19ZGtqT^h6nFM(K?SOU^SJuuqxHej%QTeadD*0UdTv2Lm<+Rn