diff --git a/src/admin/Bootstrap.Admin/Pages/Components/DefaultLayoutComponentBase.cs b/src/admin/Bootstrap.Admin/Pages/Components/DefaultLayoutComponentBase.cs index 2af8874d..0549edeb 100644 --- a/src/admin/Bootstrap.Admin/Pages/Components/DefaultLayoutComponentBase.cs +++ b/src/admin/Bootstrap.Admin/Pages/Components/DefaultLayoutComponentBase.cs @@ -87,6 +87,11 @@ namespace Bootstrap.Admin.Pages.Components /// protected SideBar? SideBar { get; set; } + /// + /// Footer 组件引用实例 + /// + protected Footer? Footer { get; set; } + /// /// OnInitializedAsync 方法 /// @@ -128,6 +133,7 @@ namespace Bootstrap.Admin.Pages.Components Model = new NavigatorBarModel(UserName, RequestUrl.ToMvcMenuUrl()); DisplayName = Model.DisplayName; WebTitle = Model.Title; + WebFooter = Model.Footer; if (HomeUrl.StartsWith("/")) HomeUrl = NavigationManager.ToBlazorLink(HomeUrl); } } @@ -152,6 +158,18 @@ namespace Bootstrap.Admin.Pages.Components SideBar?.WebTitleChanged.InvokeAsync(title); } + /// + /// 获得/设置 网站页脚文字 + /// + /// + public string WebFooter { get; set; } = ""; + + /// + /// 网站页脚文字变化是触发此方法 + /// + /// + public void OnWebFooterChanged(string text) => Footer?.TextChanged.InvokeAsync(text); + /// /// OnAfterRender 方法 /// diff --git a/src/admin/Bootstrap.Admin/Pages/Shared/DefaultLayout.razor b/src/admin/Bootstrap.Admin/Pages/Shared/DefaultLayout.razor index f74833ce..719d4b42 100644 --- a/src/admin/Bootstrap.Admin/Pages/Shared/DefaultLayout.razor +++ b/src/admin/Bootstrap.Admin/Pages/Shared/DefaultLayout.razor @@ -4,5 +4,5 @@
@Body -
+
diff --git a/src/admin/Bootstrap.Admin/Pages/Shared/Footer.razor b/src/admin/Bootstrap.Admin/Pages/Shared/Footer.razor index 88442b3e..2f100733 100644 --- a/src/admin/Bootstrap.Admin/Pages/Shared/Footer.razor +++ b/src/admin/Bootstrap.Admin/Pages/Shared/Footer.razor @@ -15,6 +15,9 @@ [Parameter] public string Text { get; set; } = "未设置"; + [Parameter] + public EventCallback TextChanged { get; set; } + [Parameter] public bool IsDemo { get; set; } } \ No newline at end of file diff --git a/src/admin/Bootstrap.Admin/Pages/Views/Admin/Settings.razor b/src/admin/Bootstrap.Admin/Pages/Views/Admin/Settings.razor index 4e5884ef..2eb3556d 100644 --- a/src/admin/Bootstrap.Admin/Pages/Views/Admin/Settings.razor +++ b/src/admin/Bootstrap.Admin/Pages/Views/Admin/Settings.razor @@ -33,10 +33,10 @@
- +
- +
diff --git a/src/admin/Bootstrap.Admin/Pages/Views/Components/SettingsBase.cs b/src/admin/Bootstrap.Admin/Pages/Views/Components/SettingsBase.cs index 9919552f..686f30dd 100644 --- a/src/admin/Bootstrap.Admin/Pages/Views/Components/SettingsBase.cs +++ b/src/admin/Bootstrap.Admin/Pages/Views/Components/SettingsBase.cs @@ -170,6 +170,16 @@ namespace Bootstrap.Admin.Pages.Views.Admin.Components ShowMessage("保存网站标题", ret); } + /// + /// 保存网站页脚 + /// + protected void SaveWebFooter() + { + var ret = DictHelper.SaveWebFooter(Model.Footer); + RootLayout?.OnWebFooterChanged(Model.Footer); + ShowMessage("保存网站页脚", ret); + } + /// /// 网站设置编辑模型实体类 /// diff --git a/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs b/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs index 873b6d88..1638534c 100644 --- a/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs +++ b/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs @@ -129,6 +129,20 @@ namespace Bootstrap.DataAccess return ret; } + /// + /// 保存网站页脚 + /// + /// + /// + public static bool SaveWebFooter(string code) + { + var ret = DictHelper.SaveSettings(new BootstrapDict[] + { + new BootstrapDict() { Category = "网站设置", Name = "网站页脚", Code = code } + }); + return ret; + } + /// /// 获取字典分类名称 ///