181 lines
8.8 KiB
XML
181 lines
8.8 KiB
XML
<hc:Window x:Class="YY.Admin.Views.LoginWindow"
|
||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||
xmlns:prism="http://prismlibrary.com/"
|
||
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||
xmlns:consts="clr-namespace:YY.Admin.Core.Const;assembly=YY.Admin.Core"
|
||
xmlns:ctls="clr-namespace:YY.Admin.Core.Controls;assembly=YY.Admin.Core"
|
||
xmlns:shell="clr-namespace:System.Windows.Shell;assembly=PresentationFramework"
|
||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||
Icon="/Resources/Icon/logo.ico"
|
||
Title="{Binding Title}"
|
||
Width="650"
|
||
Height="500"
|
||
WindowStartupLocation="CenterScreen"
|
||
ResizeMode="CanMinimize"
|
||
ShowInTaskbar="True"
|
||
KeyDown="Window_KeyDown"
|
||
FontSize="{StaticResource FontSize }">
|
||
|
||
<hc:Window.NonClientAreaContent>
|
||
<!-- 与最小化/关闭同一标题栏行,靠右紧贴系统按钮左侧 -->
|
||
<Grid HorizontalAlignment="Stretch">
|
||
<Button
|
||
HorizontalAlignment="Right"
|
||
VerticalAlignment="Center"
|
||
Margin="0,0,2,0"
|
||
Width="34"
|
||
Height="26"
|
||
Padding="0"
|
||
Background="Transparent"
|
||
BorderThickness="0"
|
||
Cursor="Hand"
|
||
Focusable="False"
|
||
shell:WindowChrome.IsHitTestVisibleInChrome="True"
|
||
Command="{Binding OpenServerSettingsCommand}"
|
||
ToolTip="服务器设置">
|
||
<ctls:FontAwesomeIcon Icon="" IconFamily="Solid" Foreground="{DynamicResource PrimaryTextBrush}"/>
|
||
</Button>
|
||
</Grid>
|
||
</hc:Window.NonClientAreaContent>
|
||
|
||
<Window.Resources>
|
||
<ResourceDictionary>
|
||
<ResourceDictionary.MergedDictionaries>
|
||
<!-- 使用独立的HandyControl主题资源,不受主题切换影响 -->
|
||
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
|
||
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
|
||
</ResourceDictionary.MergedDictionaries>
|
||
</ResourceDictionary>
|
||
</Window.Resources>
|
||
<Grid Background="{DynamicResource RegionBrush}">
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition Width="260"/>
|
||
<ColumnDefinition Width="*"/>
|
||
</Grid.ColumnDefinitions>
|
||
|
||
<Image
|
||
Source="/Resources/Icon/login.png"
|
||
Stretch="Uniform"/>
|
||
|
||
<Border Grid.Column="1">
|
||
<Grid>
|
||
<StackPanel Margin="20 0 20 20">
|
||
<!-- Logo和标题 -->
|
||
<StackPanel HorizontalAlignment="Center" Margin="0,20,0,40">
|
||
<TextBlock
|
||
Text="{x:Static consts:CommonConst.SystemName}"
|
||
FontSize="24"
|
||
FontWeight="Bold"
|
||
HorizontalAlignment="Center"
|
||
Margin="0,15,0,0"/>
|
||
</StackPanel>
|
||
|
||
<!-- 登录表单 -->
|
||
<StackPanel x:Name="LoginForm">
|
||
<!-- 用户名 -->
|
||
<Grid VerticalAlignment="Center">
|
||
<hc:TextBox
|
||
Text="{Binding LoginInput.Username, UpdateSourceTrigger=PropertyChanged}"
|
||
hc:InfoElement.Placeholder="请输入用户名"
|
||
hc:InfoElement.Title="用户名"
|
||
hc:InfoElement.ShowClearButton="True"
|
||
hc:InfoElement.ContentHeight="32"
|
||
Margin="0,0,0,20"
|
||
Padding="30 0 8 0 "/>
|
||
|
||
<ctls:FontAwesomeIcon
|
||
Icon=""
|
||
IconFamily="Solid"
|
||
Foreground="#c0c4cc"
|
||
VerticalAlignment="Center"
|
||
HorizontalAlignment="Left"
|
||
Margin="8,4,0,0"/>
|
||
</Grid>
|
||
|
||
<Grid VerticalAlignment="Center">
|
||
<hc:PasswordBox
|
||
UnsafePassword="{Binding LoginInput.Password, UpdateSourceTrigger=PropertyChanged}"
|
||
hc:InfoElement.Placeholder="请输入密码"
|
||
hc:InfoElement.Title="密码"
|
||
hc:InfoElement.ShowClearButton="True"
|
||
hc:InfoElement.ContentHeight="32"
|
||
IsSafeEnabled="False"
|
||
VerticalAlignment="Center"
|
||
Margin="0,0,0,20"
|
||
Padding="30,0,8,0"/>
|
||
|
||
<ctls:FontAwesomeIcon
|
||
Icon=""
|
||
IconFamily="Solid"
|
||
Foreground="#c0c4cc"
|
||
VerticalAlignment="Center"
|
||
HorizontalAlignment="Left"
|
||
Margin="8,4,0,0"/>
|
||
</Grid>
|
||
|
||
<!-- 记住我 -->
|
||
<CheckBox
|
||
Content="记住我"
|
||
IsChecked="{Binding LoginInput.RememberMe}"
|
||
Margin="0,0,0,20"
|
||
HorizontalAlignment="Left"
|
||
FontSize="{StaticResource FontSize}"/>
|
||
|
||
<!-- 错误信息 -->
|
||
<TextBlock
|
||
Text="{Binding LoginMessage}"
|
||
Foreground="Red"
|
||
TextWrapping="Wrap"
|
||
Margin="0,0,0,10"
|
||
Visibility="{Binding LoginMessage, Converter={StaticResource String2VisibilityConverter}}"/>
|
||
|
||
<!-- 登录按钮 -->
|
||
<Button
|
||
x:Name="LoginButton"
|
||
Click="Submit_Click"
|
||
Style="{StaticResource ButtonPrimary}"
|
||
Height="32"
|
||
FontSize="{StaticResource FontSize}"
|
||
HorizontalAlignment="Stretch"
|
||
IsEnabled="{Binding CanInteractWithLogin}"
|
||
Margin="0,10,0,8">
|
||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||
<ctls:FontAwesomeIcon Icon="" Spin="True" Margin="0 0 10 0" Visibility="{Binding IsLoading, Converter={StaticResource Boolean2VisibilityConverter}}"/>
|
||
<TextBlock Text="{Binding LoginButtonText}"/>
|
||
</StackPanel>
|
||
</Button>
|
||
|
||
<!-- 一键同步 Jeecg 用户到本地库(SCADA 免登录接口) -->
|
||
<Button
|
||
Command="{Binding SyncJeecgUsersCommand}"
|
||
Style="{StaticResource ButtonDefault}"
|
||
Height="32"
|
||
FontSize="{StaticResource FontSize}"
|
||
HorizontalAlignment="Stretch"
|
||
Margin="0,0,0,20"
|
||
ToolTip="无需登录,从 Jeecg SCADA 接口拉取用户写入 SQLite(需在配置中启用 Jeecg 且 UserListPath 为 scada/queryUser)">
|
||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||
<ctls:FontAwesomeIcon Icon="" Margin="0 0 8 0" Spin="{Binding IsSyncingJeecgUsers}"/>
|
||
<TextBlock Text="{Binding SyncJeecgUsersButtonText}"/>
|
||
</StackPanel>
|
||
</Button>
|
||
|
||
<!-- 后端连接状态指示器 -->
|
||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,0,0,8">
|
||
<Ellipse Width="10" Height="10" Fill="{Binding BackendConnectionStatusBrush}" VerticalAlignment="Center" Margin="0,0,6,0"/>
|
||
<TextBlock Text="{Binding BackendConnectionStatusText}" Foreground="#666666" FontSize="12" VerticalAlignment="Center"/>
|
||
</StackPanel>
|
||
|
||
<!-- 其他链接 -->
|
||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||
<TextBlock Text="忘记密码?" Foreground="#1890ff" Cursor="Hand" Margin="0,0,20,0"/>
|
||
<TextBlock Text="注册账号" Foreground="#1890ff" Cursor="Hand"/>
|
||
</StackPanel>
|
||
</StackPanel>
|
||
</StackPanel>
|
||
</Grid>
|
||
</Border>
|
||
</Grid>
|
||
</hc:Window> |