using AntDesign; using AntDesign.TableModels; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage; using Microsoft.AspNetCore.DataProtection.KeyManagement; using Microsoft.AspNetCore.Mvc; using SqlSugar; using System.Linq.Expressions; using System.Threading.Tasks; using VideoAnalysisCore.Common; using VideoAnalysisCore.Model.Enum; using VideoAnalysisCore.Model; using VideoAnalysisCore.Model.Dto; namespace Learn.VideoAnalysis.Components.Pages { public partial class Login : ComponentBase { [Inject] IHttpContextAccessor HttpContextAccessor { get; set; } = default!; [Inject] private Repository taskDB { get; set; } = default!; [Inject] private NavigationManager NavigationManager { get; set; } = default!; [Inject] private INotificationService _notice { get; set; } = default!; [Inject] private ProtectedSessionStorage session { get; set; } = default!; /// /// 输入的账号 /// public string InputAccount = string.Empty; /// /// 输入的密码 /// public string InputPassword= string.Empty; /// /// 初始化 /// protected override void OnInitialized() { } /// /// 登录函数 /// public async Task LoginFunAsync() { if (string.IsNullOrEmpty(InputAccount) || string.IsNullOrEmpty(InputPassword)) { await _notice.Open(new NotificationConfig() { Message = "提示", Description = "账号/密码必填", NotificationType = NotificationType.Warning }); } if (InputAccount ==AppCommon.Config.Admin.Account && InputPassword == AppCommon.Config.Admin.Password) { await session.SetAsync("Login", true); NavigationManager.NavigateTo("/"); } else { await _notice.Open(new NotificationConfig() { Message = "提示", Description = "账号/密码输入错误", NotificationType = NotificationType.Warning }); } } } }