diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/AppInfo.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/AppInfo.cs index 7fd882c7..c926cba5 100644 --- a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/AppInfo.cs +++ b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/AppInfo.cs @@ -56,6 +56,30 @@ public class AppInfo [Display(Name = "系统演示")] public bool IsDemo { get; set; } + /// + /// + /// + [Display(Name = "侧边栏设置")] + public bool SiderbarSetting { get; set; } + + /// + /// + /// + [Display(Name = "标题设置")] + public bool TitleSetting { get; set; } + + /// + /// + /// + [Display(Name = "固定表头")] + public bool FixHeaderSetting { get; set; } + + /// + /// + /// + [Display(Name = "健康检查")] + public bool HealthCheckSetting { get; set; } + /// /// /// diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/Services/DictService.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/Services/DictService.cs index 71b7affa..ce5c6d55 100644 --- a/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/Services/DictService.cs +++ b/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/Services/DictService.cs @@ -257,4 +257,36 @@ class DictService : IDict } return url; } + + public bool GetAppSiderbar() + { + var dicts = GetAll(); + return dicts.FirstOrDefault(s => s.Category == "网站设置" && s.Name == "侧边栏状态" && s.Define == EnumDictDefine.System)?.Code == "1" ? true : false; + } + + public bool SaveAppSiderbar(bool value) => SaveDict(new Dict { Category = "网站设置", Name = "侧边栏状态", Code = value ? "1" : "0" }); + + public bool GetAppTitle() + { + var dicts = GetAll(); + return dicts.FirstOrDefault(s => s.Category == "网站设置" && s.Name == "卡片标题状态" && s.Define == EnumDictDefine.System)?.Code == "1" ? true : false; + } + + public bool SaveAppTitle(bool value) => SaveDict(new Dict { Category = "网站设置", Name = "卡片标题状态", Code = value ? "1" : "0" }); + + public bool GetAppFixHeader() + { + var dicts = GetAll(); + return dicts.FirstOrDefault(s => s.Category == "网站设置" && s.Name == "固定表头" && s.Define == EnumDictDefine.System)?.Code == "1" ? true : false; + } + + public bool SaveAppFixHeader(bool value) => SaveDict(new Dict { Category = "网站设置", Name = "固定表头", Code = value ? "1" : "0" }); + + public bool GetAppHealthCheck() + { + var dicts = GetAll(); + return dicts.FirstOrDefault(s => s.Category == "网站设置" && s.Name == "健康检查" && s.Define == EnumDictDefine.System)?.Code == "1" ? true : false; + } + + public bool SaveAppHealthCheck(bool value) => SaveDict(new Dict { Category = "网站设置", Name = "健康检查", Code = value ? "1" : "0" }); } diff --git a/src/blazor/admin/BootstrapAdmin.Web.Core/IDict.cs b/src/blazor/admin/BootstrapAdmin.Web.Core/IDict.cs index 176eaa7e..8683b1e1 100644 --- a/src/blazor/admin/BootstrapAdmin.Web.Core/IDict.cs +++ b/src/blazor/admin/BootstrapAdmin.Web.Core/IDict.cs @@ -168,4 +168,52 @@ public interface IDict /// /// bool GetEnableDefaultApp(); + + /// + /// 是否开启侧边栏设置 + /// + /// + bool GetAppSiderbar(); + + /// + /// 保存侧边栏设置 + /// + /// + bool SaveAppSiderbar(bool value); + + /// + /// 是否开启标题设置 + /// + /// + bool GetAppTitle(); + + /// + /// 保存标题设置 + /// + /// + bool SaveAppTitle(bool value); + + /// + /// 是否开启固定表头设置 + /// + /// + bool GetAppFixHeader(); + + /// + /// 保存固定表头设置 + /// + /// + bool SaveAppFixHeader(bool value); + + /// + /// 是否开启健康检查设置 + /// + /// + bool GetAppHealthCheck(); + + /// + /// 保存健康检查设置 + /// + /// + bool SaveAppHealthCheck(bool value); } diff --git a/src/blazor/admin/BootstrapAdmin.Web/BootstrapAdmin.db b/src/blazor/admin/BootstrapAdmin.Web/BootstrapAdmin.db index 07538134..b252bb53 100644 Binary files a/src/blazor/admin/BootstrapAdmin.Web/BootstrapAdmin.db and b/src/blazor/admin/BootstrapAdmin.Web/BootstrapAdmin.db differ diff --git a/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Settings.razor b/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Settings.razor index 1939683c..60caa1a6 100644 --- a/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Settings.razor +++ b/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Settings.razor @@ -64,6 +64,28 @@ + + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+ diff --git a/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Settings.razor.cs b/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Settings.razor.cs index 104e00b4..a2b903e1 100644 --- a/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Settings.razor.cs +++ b/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Settings.razor.cs @@ -49,7 +49,11 @@ public partial class Settings AuthCode = "123789", Title = DictService.GetWebTitle(), Footer = DictService.GetWebFooter(), - Login = DictService.GetCurrentLogin() + Login = DictService.GetCurrentLogin(), + SiderbarSetting = DictService.GetAppSiderbar(), + TitleSetting = DictService.GetAppTitle(), + FixHeaderSetting = DictService.GetAppFixHeader(), + HealthCheckSetting = DictService.GetAppHealthCheck(), }; } @@ -106,4 +110,13 @@ public partial class Settings var ret = DictService.SaveDemo(AppInfo.EnableDefaultApp); await ShowToast(ret, "默认应用"); } + + private async Task OnSaveAppFeatures(EditContext context) + { + var ret = DictService.SaveAppSiderbar(AppInfo.SiderbarSetting); + DictService.SaveAppTitle(AppInfo.TitleSetting); + DictService.SaveAppFixHeader(AppInfo.FixHeaderSetting); + DictService.SaveAppHealthCheck(AppInfo.HealthCheckSetting); + await ShowToast(ret, "网站功能"); + } }