宝臣 王 3 mesiacov pred
rodič
commit
87356d5ade

+ 7 - 2
UniformMaterialManagementSystem/ViewModels/RegisterPageViewModel.cs

@@ -46,6 +46,11 @@ namespace UniformMaterialManagementSystem.ViewModels
         [CustomValidation(typeof(RegisterPageViewModel), nameof(ValidateUserName))]
         private string _userName = string.Empty;
 
+        [ObservableProperty]
+        [Required(ErrorMessage = "登录名不能为空")]
+        [CustomValidation(typeof(RegisterPageViewModel), nameof(ValidateUserName))]
+        private string _loginName = string.Empty;
+
         [ObservableProperty]
         [Required(ErrorMessage = "密码不能为空")]
         [CustomValidation(typeof(RegisterPageViewModel), nameof(ValidatePassword))]
@@ -74,7 +79,7 @@ namespace UniformMaterialManagementSystem.ViewModels
         }
 
         [RelayCommand]
-        private async void CreateUser(Window window)
+        private async Task CreateUser(Window window)
         {
             ValidateAllProperties();
 
@@ -86,7 +91,7 @@ namespace UniformMaterialManagementSystem.ViewModels
                 Salt = salt,
                 Password = PasswordHashing.GenerateSaltedHash(Password, salt),
                 UserName = UserName,
-                LoginName = UserName,
+                LoginName = LoginName,
                 CompanyGuid = SelectedCompany?.Guid,
                 Company = SelectedCompany,
                 CompanyName = SelectedCompany?.Name,

+ 2 - 2
UniformMaterialManagementSystem/Views/LoginAndRegister/LoginPage.xaml

@@ -5,7 +5,7 @@
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:utils="clr-namespace:UniformMaterialManagementSystem.Utils"
-    d:DesignHeight="500"
+    d:DesignHeight="600"
     d:DesignWidth="800"
     mc:Ignorable="d">
 
@@ -111,7 +111,7 @@
                 </LinearGradientBrush>
             </Grid.Background>
 
-            <Grid Width="500" Margin="0,5">
+            <Grid Width="500" Margin="0,50">
                 <Grid.RowDefinitions>
                     <RowDefinition Height="*" />
                     <RowDefinition Height="*" />

+ 25 - 1
UniformMaterialManagementSystem/Views/LoginAndRegister/RegisterPage.xaml

@@ -7,7 +7,7 @@
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:sys="clr-namespace:System.Collections.Generic;assembly=System.Runtime"
     xmlns:utils="clr-namespace:UniformMaterialManagementSystem.Utils"
-    d:DesignHeight="500"
+    d:DesignHeight="600"
     d:DesignWidth="800"
     mc:Ignorable="d">
 
@@ -187,6 +187,30 @@
                         </TextBox.Resources>
                     </TextBox>
 
+                    <Label
+                        Grid.Row="6"
+                        Grid.Column="0"
+                        HorizontalContentAlignment="Left"
+                        VerticalContentAlignment="Center"
+                        Content="登 录 名:"
+                        FontFamily="黑体"
+                        FontSize="12"
+                        Foreground="#0c9ea1" />
+
+                    <TextBox
+                        Grid.Row="7"
+                        HorizontalContentAlignment="Center"
+                        VerticalContentAlignment="Center"
+                        BorderBrush="#019b9b"
+                        FontSize="14"
+                        Text="{Binding LoginName, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True}">
+                        <TextBox.Resources>
+                            <Style TargetType="{x:Type Border}">
+                                <Setter Property="CornerRadius" Value="5" />
+                            </Style>
+                        </TextBox.Resources>
+                    </TextBox>
+
                     <Label
                         Grid.Row="8"
                         Grid.Column="0"

+ 1 - 1
UniformMaterialManagementSystem/Views/LoginAndRegisterWindow.xaml

@@ -5,7 +5,7 @@
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     Width="800"
-    Height="500"
+    Height="600"
     Background="Transparent"
     ResizeMode="NoResize"
     WindowStartupLocation="CenterScreen"