From 1bf2e4141c5c05ac3ed0743eba6631bb216d75c7 Mon Sep 17 00:00:00 2001 From: Argo-Tianyi Date: Thu, 20 Jan 2022 20:25:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E7=BD=91=E7=AB=99?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=89=8D=E5=8F=B0=E5=BA=94=E7=94=A8=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppInfo.cs | 62 ----------- .../Components/ClientDialog.razor | 100 ++++-------------- .../Components/ClientDialog.razor.cs | 75 +++++++++++++ .../Components/ClientList.razor | 26 ++--- .../Components/ClientList.razor.cs | 44 +++----- .../Pages/Admin/Settings.razor | 1 + .../Pages/Admin/Settings.razor.cs | 2 + 7 files changed, 126 insertions(+), 184 deletions(-) create mode 100644 src/blazor/admin/BootstrapAdmin.Web/Components/ClientDialog.razor.cs diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/AppInfo.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/AppInfo.cs index 45dcc857..cea0c54e 100644 --- a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/AppInfo.cs +++ b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/AppInfo.cs @@ -153,68 +153,6 @@ public class AppInfo [Required(ErrorMessage = "{0}不可为空")] public int IPCacheExpired { get; set; } - /// - /// - /// - [NotNull] - public Dictionary? FrontApp { get; set; } - - /// - /// - /// - [NotNull] - [Display(Name = "应用ID")] - [Required(ErrorMessage = "{0}不可为空")] - public string? AppID { get; set; } - - /// - /// - /// - [NotNull] - [Display(Name = "应用名称")] - [Required(ErrorMessage = "{0}不可为空")] - public string? AppName { get; set; } - - /// - /// - /// - [NotNull] - [Display(Name = "应用首页")] - [Required(ErrorMessage = "{0}不可为空")] - public string? Home { get; set; } - - /// - /// - /// - [NotNull] - [Display(Name = "网站标题")] - [Required(ErrorMessage = "{0}不可为空")] - public string? WebTitle { get; set; } - - /// - /// - /// - [NotNull] - [Display(Name = "网站页脚")] - [Required(ErrorMessage = "{0}不可为空")] - public string? WebFooter { get; set; } - - /// - /// - /// - [NotNull] - [Display(Name = "网站图标")] - [Required(ErrorMessage = "{0}不可为空")] - public string? WebIcon { get; set; } - - /// - /// - /// - [NotNull] - [Display(Name = "Favicon")] - [Required(ErrorMessage = "{0}不可为空")] - public string? Favicon { get; set; } - /// /// /// diff --git a/src/blazor/admin/BootstrapAdmin.Web/Components/ClientDialog.razor b/src/blazor/admin/BootstrapAdmin.Web/Components/ClientDialog.razor index faacdeae..15424490 100644 --- a/src/blazor/admin/BootstrapAdmin.Web/Components/ClientDialog.razor +++ b/src/blazor/admin/BootstrapAdmin.Web/Components/ClientDialog.razor @@ -1,98 +1,40 @@ -@using BootstrapAdmin.Web.Core; -@using BootstrapAdmin.Web.Validators; - - +
- +
- +
- +
- +
- +
- + +
+
+ +
+
+ +
+
+
-
- - +
+
- -@code{ - - /// - /// - /// - [NotNull] - [Parameter] - public AppInfo? Value { get; set; } = new(); - - /// - /// - /// - [Parameter] - public EventCallback? ValueChanged { get; set; } - - /// - /// - /// - [Parameter] - public Func? OnSaveComplete { get; set; } - - /// - /// - /// - [Parameter] - [NotNull] - public Func? OnClose { get; set; } - - [NotNull] - [Inject] - private IDict? DictService { get; set; } - - private List Validators = new List(); - - protected override void OnInitialized() - { - base.OnInitialized(); - if (Value?.AppID == null) - { - Validators.Add(new AppIdValidator(DictService)); - } - } - - private Task OnSaveCleint(EditContext context) - { - - if (OnSaveComplete != null) - { - OnSaveComplete(Value); - } - - return Task.CompletedTask; - } - - private Task OnCloseDialog(EditContext context) - { - - if (OnClose != null) - { - OnClose(); - } - - return Task.CompletedTask; - } -} \ No newline at end of file diff --git a/src/blazor/admin/BootstrapAdmin.Web/Components/ClientDialog.razor.cs b/src/blazor/admin/BootstrapAdmin.Web/Components/ClientDialog.razor.cs new file mode 100644 index 00000000..324f82c9 --- /dev/null +++ b/src/blazor/admin/BootstrapAdmin.Web/Components/ClientDialog.razor.cs @@ -0,0 +1,75 @@ +using BootstrapAdmin.Web.Core; +using BootstrapAdmin.Web.Validators; +using Microsoft.AspNetCore.Components.Forms; + +namespace BootstrapAdmin.Web.Components; + +/// +/// +/// +public partial class ClientDialog +{ + /// + /// + /// + [Parameter] + [NotNull] + public ClientApp? Value { get; set; } + + /// + /// + /// + [Parameter] + public EventCallback ValueChanged { get; set; } + + /// + /// + /// + [Parameter] + public Func? OnSave { get; set; } + + /// + /// + /// + [Parameter] + [NotNull] + public Func? OnClose { get; set; } + + [Inject] + [NotNull] + private IDict? DictService { get; set; } + + [NotNull] + private List? Validators { get; set; } + + /// + /// + /// + protected override void OnInitialized() + { + base.OnInitialized(); + + Validators = new List(); + if (Value.AppId == null) + { + Validators.Add(new AppIdValidator(DictService)); + } + } + + private Task OnSaveCleint(EditContext context) + { + if (OnSave != null) + { + OnSave(Value); + } + return Task.CompletedTask; + } + + private async Task OnClickClose() + { + if (OnClose != null) + { + await OnClose(); + } + } +} diff --git a/src/blazor/admin/BootstrapAdmin.Web/Components/ClientList.razor b/src/blazor/admin/BootstrapAdmin.Web/Components/ClientList.razor index 7404083f..5f353249 100644 --- a/src/blazor/admin/BootstrapAdmin.Web/Components/ClientList.razor +++ b/src/blazor/admin/BootstrapAdmin.Web/Components/ClientList.razor @@ -1,19 +1,15 @@ - -
- @if (Client != null) +
+ @foreach (var item in Clients) { - foreach (var item in Client) - { - var value = DictService.GetClientUrl(item.Value); -
- - - - -
- } + var value = DictService.GetClientUrl(item.Value); +
+ + + + +
}