feat: 增加自动锁屏设置

This commit is contained in:
zhangpeihang 2022-01-14 10:53:15 +08:00
parent 2a52d139a6
commit cdeee4b3b2
3 changed files with 38 additions and 1 deletions

View File

@ -92,6 +92,18 @@ public class AppInfo
[Display(Name = "OAuth认证")]
public bool OAuthLogin { get; set; }
/// <summary>
///
/// </summary>
[Display(Name = "自动锁屏")]
public bool AutoLock { get; set; }
/// <summary>
///
/// </summary>
[Display(Name = "时长间隔(秒)")]
public int Interval { get; set; }
/// <summary>
///
/// </summary>

View File

@ -102,6 +102,22 @@
</ValidateForm>
</AdminCard>
<AdminCard HeaderText="自动锁屏设置" AuthorizeKey="SaveAppLockScreen">
<ValidateForm OnValidSubmit="OnSaveAppLockScreen" Model="AppInfo">
<div class="row g-3 form-inline">
<div class="col-6 col-sm-6">
<Toggle @bind-Value="AppInfo.AutoLock" OnText="启用" OffText="关闭"></Toggle>
</div>
<div class="col-6 col-sm-6">
<BootstrapInputNumber @bind-Value="AppInfo.Interval"></BootstrapInputNumber>
</div>
<div class="col-12 col-sm-12 text-end">
<Button ButtonType="ButtonType.Submit" Icon="fa fa-save" Text="保存" />
</div>
</div>
</ValidateForm>
</AdminCard>
<AdminCard HeaderText="默认应用设置" AuthorizeKey="DefaultApp">
<AdminAlert Text="开启本功能后登录成功时自动导航到第一个已授权前台应用" Color="Color.Info" />
<ValidateForm OnValidSubmit="OnSaveApp" Model="AppInfo">

View File

@ -55,7 +55,9 @@ public partial class Settings
FixHeaderSetting = DictService.GetAppFixHeader(),
HealthCheckSetting = DictService.GetAppHealthCheck(),
MobileLogin = DictService.GetAppMobileLogin(),
OAuthLogin = DictService.GetAppOAuthLogin()
OAuthLogin = DictService.GetAppOAuthLogin(),
AutoLock = DictService.GetAutoLockScreen(),
Interval = Convert.ToInt32(DictService.GetAutoLockScreenInterval())
};
}
@ -128,4 +130,11 @@ public partial class Settings
DictService.SaveAppOAuthLogin(AppInfo.TitleSetting);
await ShowToast(ret, "网站登录");
}
private async Task OnSaveAppLockScreen(EditContext context)
{
var ret = DictService.SaveAutoLockScreen(AppInfo.AutoLock);
DictService.SaveAutoLockScreenInterval(AppInfo.Interval.ToString());
await ShowToast(ret, "自动锁屏");
}
}