From 4fee48124a4879980df5114f72fee4d9374888d6 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Tue, 1 Oct 2019 10:29:38 +0800 Subject: [PATCH] =?UTF-8?q?feat(#I12VKS):=20=E5=90=8E=E5=8F=B0=E7=BD=91?= =?UTF-8?q?=E7=AB=99=E6=A0=87=E9=A2=98=E9=A1=B5=E8=84=9A=E4=B8=8E=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=BA=94=E7=94=A8=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit comment #I12VKS 已登陆用户后台管理页面显示的网站标题跟页脚与个人中心设置的默认应用内设置的显示一致 link #I12VKS --- src/admin/Bootstrap.Admin/Models/HeaderBarModel.cs | 4 ++++ src/admin/Bootstrap.Admin/Models/ModelBase.cs | 4 ++-- src/admin/Bootstrap.DataAccess.MongoDB/Dict.cs | 12 +++++++----- src/admin/Bootstrap.DataAccess/Dict.cs | 11 +++++++---- src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs | 6 ++++-- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/admin/Bootstrap.Admin/Models/HeaderBarModel.cs b/src/admin/Bootstrap.Admin/Models/HeaderBarModel.cs index aeab1773..6297ab60 100644 --- a/src/admin/Bootstrap.Admin/Models/HeaderBarModel.cs +++ b/src/admin/Bootstrap.Admin/Models/HeaderBarModel.cs @@ -24,6 +24,10 @@ namespace Bootstrap.Admin.Models AppCode = user.App; Css = user.Css; ActiveCss = string.IsNullOrEmpty(Css) ? Theme : Css; + + // 通过 AppCode 获取用户默认应用的标题 + Title = DictHelper.RetrieveWebTitle(AppCode); + Footer = DictHelper.RetrieveWebFooter(AppCode); } } diff --git a/src/admin/Bootstrap.Admin/Models/ModelBase.cs b/src/admin/Bootstrap.Admin/Models/ModelBase.cs index cb445d5f..50dcdc3c 100644 --- a/src/admin/Bootstrap.Admin/Models/ModelBase.cs +++ b/src/admin/Bootstrap.Admin/Models/ModelBase.cs @@ -29,12 +29,12 @@ namespace Bootstrap.Admin.Models /// /// 获取 网站标题 /// - public string Title { get; private set; } + public string Title { get; protected set; } /// /// 获取 网站页脚 /// - public string Footer { get; private set; } + public string Footer { get; protected set; } /// /// 网站样式全局设置 diff --git a/src/admin/Bootstrap.DataAccess.MongoDB/Dict.cs b/src/admin/Bootstrap.DataAccess.MongoDB/Dict.cs index 1f067f5a..b5d131a1 100644 --- a/src/admin/Bootstrap.DataAccess.MongoDB/Dict.cs +++ b/src/admin/Bootstrap.DataAccess.MongoDB/Dict.cs @@ -74,21 +74,23 @@ namespace Bootstrap.DataAccess.MongoDB } /// - /// + /// 获得网站标题设置 /// + /// /// - public override string RetrieveWebTitle() + public override string RetrieveWebTitle(string appId = "0") { - var code = RetrieveAppName("网站标题"); + var code = RetrieveAppName("网站标题", appId); if (code == "网站标题未设置") code = DictHelper.RetrieveDicts().FirstOrDefault(d => d.Name == "网站标题" && d.Category == "网站设置" && d.Define == 0)?.Code ?? "后台管理系统"; return code; } /// - /// + /// 获得网站页脚设置 /// + /// /// - public override string RetrieveWebFooter() + public override string RetrieveWebFooter(string appId = "0") { var code = RetrieveAppName("网站页脚"); if (code == "网站页脚未设置") code = DictHelper.RetrieveDicts().FirstOrDefault(d => d.Name == "网站页脚" && d.Category == "网站设置" && d.Define == 0)?.Code ?? "2016 © 通用后台管理系统"; diff --git a/src/admin/Bootstrap.DataAccess/Dict.cs b/src/admin/Bootstrap.DataAccess/Dict.cs index a28b9e27..66de0427 100644 --- a/src/admin/Bootstrap.DataAccess/Dict.cs +++ b/src/admin/Bootstrap.DataAccess/Dict.cs @@ -63,11 +63,13 @@ namespace Bootstrap.DataAccess /// /// 获取系统网站标题 /// + /// /// - public virtual string RetrieveWebTitle() + public virtual string RetrieveWebTitle(string appId = "0") { // 优先查找配置的应用程序网站标题 - var code = DbHelper.RetrieveTitle(); + var code = DbHelper.RetrieveTitle(appId); + if (code == "网站标题未设置") code = DictHelper.RetrieveDicts().FirstOrDefault(d => d.Name == "网站标题" && d.Category == "网站设置" && d.Define == 0)?.Code ?? "后台管理系统"; return code; } @@ -75,11 +77,12 @@ namespace Bootstrap.DataAccess /// /// 获取系统网站页脚 /// + /// /// - public virtual string RetrieveWebFooter() + public virtual string RetrieveWebFooter(string appId = "0") { // 优先查找配置的应用程序网站标题 - var code = DbHelper.RetrieveFooter(); + var code = DbHelper.RetrieveFooter(appId); if (code == "网站页脚未设置") code = DictHelper.RetrieveDicts().FirstOrDefault(d => d.Name == "网站页脚" && d.Category == "网站设置" && d.Define == 0)?.Code ?? "2016 © 通用后台管理系统"; return code; } diff --git a/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs b/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs index ca3e2465..7ba70dc8 100644 --- a/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs +++ b/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs @@ -98,14 +98,16 @@ namespace Bootstrap.DataAccess /// /// 获取站点 Title 配置信息 /// + /// /// - public static string RetrieveWebTitle() => DbContextManager.Create().RetrieveWebTitle(); + public static string RetrieveWebTitle(string appId = "0") => DbContextManager.Create().RetrieveWebTitle(appId); /// /// 获取站点 Footer 配置信息 /// + /// /// - public static string RetrieveWebFooter() => DbContextManager.Create().RetrieveWebFooter(); + public static string RetrieveWebFooter(string appId = "0") => DbContextManager.Create().RetrieveWebFooter(appId); /// /// 获得系统中配置的可以使用的网站样式