Setting.razor.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using EasyTemplate.Tool;
  2. using Microsoft.JSInterop;
  3. namespace EasyTemplate.Blazor.Web.Components.Pages.Account.Setting;
  4. public partial class Setting
  5. {
  6. private void SelectKey(MenuItem item)
  7. {
  8. TSelectKey = item.Key;
  9. }
  10. protected override async Task OnInitializedAsync()
  11. {
  12. await base.OnInitializedAsync();
  13. }
  14. protected override async Task OnAfterRenderAsync(bool firstRender)
  15. {
  16. if (firstRender)
  17. {
  18. await NavigationManager.RedirectLogin(IJSRuntime);
  19. Global.CurrentUser = User.GetFirst(x => x.Id == Global.CurrentUser.Id);
  20. }
  21. }
  22. private readonly Dictionary<string, string> _menuMap = new Dictionary<string, string>
  23. {
  24. {"base", "基本设置"},
  25. //{"security", "安全设置"},
  26. {"binding", "账号绑定"},
  27. //{"notification", "消息提示"},
  28. };
  29. private string TSelectKey = "base";
  30. /// <summary>
  31. ///
  32. /// </summary>
  33. [Inject] private SqlSugarRepository<SystemUser> User { get; set; }
  34. /// <summary>
  35. ///
  36. /// </summary>
  37. [Inject] NavigationManager NavigationManager { get; set; }
  38. /// <summary>
  39. ///
  40. /// </summary>
  41. [Inject] IJSRuntime IJSRuntime { get; set; }
  42. }