فهرست منبع

优化注册逻辑

宝臣 王 3 ماه پیش
والد
کامیت
4276088efe
1فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 3 3
      UniformMaterialManagementSystem/ViewModels/RegisterPageViewModel.cs

+ 3 - 3
UniformMaterialManagementSystem/ViewModels/RegisterPageViewModel.cs

@@ -39,7 +39,7 @@ namespace UniformMaterialManagementSystem.ViewModels
         private ICollection<Company> _companyList = [];
 
         [ObservableProperty]
-        private Company _selectedCompany = null!;
+        private Company? _selectedCompany;
 
         [ObservableProperty]
         [Required(ErrorMessage = "用户名不能为空")]
@@ -87,9 +87,9 @@ namespace UniformMaterialManagementSystem.ViewModels
                 Password = PasswordHashing.GenerateSaltedHash(Password, salt),
                 UserName = UserName,
                 LoginName = UserName,
-                CompanyGuid = SelectedCompany.Guid,
+                CompanyGuid = SelectedCompany?.Guid,
                 Company = SelectedCompany,
-                CompanyName = SelectedCompany.Name,
+                CompanyName = SelectedCompany?.Name,
                 IsEnabled = true,
                 RegisterDate = DateTime.Now,
                 Roles = [_roles[SelectedUnitType]],