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 d6567291..e2fcaeed 100644
--- a/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Settings.razor.cs
+++ b/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Settings.razor.cs
@@ -1,4 +1,5 @@
using BootstrapAdmin.DataAccess.Models;
+using BootstrapAdmin.Web.Components;
using BootstrapAdmin.Web.Core;
using BootstrapAdmin.Web.Extensions;
using Microsoft.AspNetCore.Components.Forms;
@@ -36,6 +37,10 @@ public partial class Settings
[NotNull]
private ToastService? ToastService { get; set; }
+ [Inject]
+ [NotNull]
+ private DialogService? DialogService { get; set; }
+
///
///
///
@@ -61,13 +66,14 @@ public partial class Settings
MobileLogin = DictService.GetAppMobileLogin(),
OAuthLogin = DictService.GetAppOAuthLogin(),
AutoLock = DictService.GetAutoLockScreen(),
- Interval = Convert.ToInt32(DictService.GetAutoLockScreenInterval()),
+ Interval = DictService.GetAutoLockScreenInterval(),
ExceptionExpired = DictService.GetExceptionExpired(),
OperateExpired = DictService.GetOperateExpired(),
LoginExpired = DictService.GetLoginExpired(),
AccessExpired = DictService.GetAccessExpired(),
CookieExpired = DictService.GetCookieExpiresPeriod(),
IPCacheExpired = DictService.GetIPCacheExpired(),
+ FrontApp = DictService.GetFrontApp()
};
}
@@ -137,14 +143,14 @@ public partial class Settings
private async Task OnSaveSaveAppLogin(EditContext context)
{
var ret = DictService.SaveAppMobileLogin(AppInfo.MobileLogin);
- DictService.SaveAppOAuthLogin(AppInfo.TitleSetting);
+ DictService.SaveAppOAuthLogin(AppInfo.OAuthLogin);
await ShowToast(ret, "网站登录");
}
private async Task OnSaveAppLockScreen(EditContext context)
{
var ret = DictService.SaveAutoLockScreen(AppInfo.AutoLock);
- DictService.SaveAutoLockScreenInterval(AppInfo.Interval.ToString());
+ DictService.SaveAutoLockScreenInterval(AppInfo.Interval);
await ShowToast(ret, "自动锁屏");
}
@@ -165,4 +171,33 @@ public partial class Settings
await ShowToast(ret, "日志缓存");
}
+
+ private async Task OnSaveFrontApp()
+ {
+
+ DialogOption option = new DialogOption
+ {
+ Title = "添加前台应用",
+ BodyTemplate = BootstrapDynamicComponent.CreateComponent
(new Dictionary
+ {
+ [nameof(FrontAppDialog.Value)] = AppInfo
+ }).Render(),
+ ShowFooter = false,
+ };
+ await DialogService.Show(option);
+ }
+
+ private async Task OnDeleteFrontApp()
+ {
+ DialogOption option = new DialogOption
+ {
+ Title = "添加前台应用",
+ BodyTemplate = BootstrapDynamicComponent.CreateComponent(new Dictionary
+ {
+ [nameof(FrontAppDialog.Value)] = AppInfo
+ }).Render(),
+ ShowFooter = false,
+ };
+ await DialogService.Show(option);
+ }
}
diff --git a/src/blazor/admin/BootstrapAdmin.Web/Validators/AppIdValidator.cs b/src/blazor/admin/BootstrapAdmin.Web/Validators/AppIdValidator.cs
new file mode 100644
index 00000000..05910c9d
--- /dev/null
+++ b/src/blazor/admin/BootstrapAdmin.Web/Validators/AppIdValidator.cs
@@ -0,0 +1,46 @@
+using BootstrapAdmin.Web.Core;
+using System.ComponentModel.DataAnnotations;
+
+namespace BootstrapAdmin.Web.Validators;
+
+///
+///
+///
+public class AppIdValidator : IValidator
+{
+ private IDict DictService { get; set; }
+
+ ///
+ ///
+ ///
+ ///
+ public AppIdValidator(IDict dictService) => DictService = dictService;
+
+ ///
+ ///
+ ///
+ public string? ErrorMessage { get; set; }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void Validate(object? propertyValue, ValidationContext context, List results)
+ {
+ var AppName = DictService.GetAppNameByAppName(propertyValue?.ToString()!);
+ if (!string.IsNullOrEmpty(AppName))
+ {
+ ErrorMessage = $"{context.DisplayName}已存在";
+ }
+ else
+ {
+ ErrorMessage = null;
+ }
+ if (!string.IsNullOrEmpty(ErrorMessage))
+ {
+ results.Add(new ValidationResult(ErrorMessage, new string[] { context.MemberName! }));
+ }
+ }
+}