feat: Blazor 网站设置增加开启关闭演示模式开关
This commit is contained in:
parent
31d4c3d38e
commit
feb1b3b90c
|
@ -253,6 +253,26 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ConditionComponent>
|
</ConditionComponent>
|
||||||
|
<div class="card" asp-auth="demo">
|
||||||
|
<div class="card-header">演示系统设置</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="form-inline">
|
||||||
|
<div class="row">
|
||||||
|
<div class="form-group col-6">
|
||||||
|
<label class="control-label" data-toggle="lgbinfo" data-content="开启此功能网站切换至演示系统">演示系统</label>
|
||||||
|
<Toggle @bind-Value="@Model.EnableDemo" OnText="开启" OffText="关闭"></Toggle>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-6">
|
||||||
|
<label class="control-label" for="authKey">授权码</label>
|
||||||
|
<input type="password" autocomplete="off" class="form-control" @bind-value="@Model.AuthKey" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer text-right">
|
||||||
|
<button class="btn btn-secondary" type="button" @onclick="SaveSystemModel"><i class="fa fa-save"></i><span>保存</span></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<span>网站缓存</span>
|
<span>网站缓存</span>
|
||||||
|
|
|
@ -41,6 +41,12 @@ namespace Bootstrap.Admin.Pages.Views.Admin.Components
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected Toast? Toast { get; set; }
|
protected Toast? Toast { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// NavigationManager 实例
|
||||||
|
/// </summary>
|
||||||
|
[Inject]
|
||||||
|
public NavigationManager? NavigationManager { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 显示提示信息
|
/// 显示提示信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -88,6 +94,7 @@ namespace Bootstrap.Admin.Pages.Views.Admin.Components
|
||||||
Model.TraceLog = DictHelper.RetrieveAccessLogPeriod();
|
Model.TraceLog = DictHelper.RetrieveAccessLogPeriod();
|
||||||
Model.CookiePeriod = DictHelper.RetrieveCookieExpiresPeriod();
|
Model.CookiePeriod = DictHelper.RetrieveCookieExpiresPeriod();
|
||||||
Model.IPCachePeriod = DictHelper.RetrieveLocaleIPSvrCachePeriod();
|
Model.IPCachePeriod = DictHelper.RetrieveLocaleIPSvrCachePeriod();
|
||||||
|
Model.EnableDemo = DictHelper.RetrieveSystemModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -216,6 +223,20 @@ namespace Bootstrap.Admin.Pages.Views.Admin.Components
|
||||||
ShowMessage("保存日志缓存设置", ret);
|
ShowMessage("保存日志缓存设置", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存网站是否为演示模式
|
||||||
|
/// </summary>
|
||||||
|
protected async System.Threading.Tasks.Task SaveSystemModel()
|
||||||
|
{
|
||||||
|
var ret = DictHelper.UpdateSystemModel(Model.EnableDemo, Model.AuthKey);
|
||||||
|
ShowMessage("保存演示系统设置", ret);
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
await System.Threading.Tasks.Task.Delay(500);
|
||||||
|
NavigationManager?.NavigateTo($"{RootLayout?.HomeUrl}/Admin/Settings", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 网站设置编辑模型实体类
|
/// 网站设置编辑模型实体类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -325,6 +346,16 @@ namespace Bootstrap.Admin.Pages.Views.Admin.Components
|
||||||
/// IP请求缓存时长
|
/// IP请求缓存时长
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int IPCachePeriod { get; set; }
|
public int IPCachePeriod { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获得/设置 授权码
|
||||||
|
/// </summary>
|
||||||
|
public string AuthKey { get; set; } = "";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获得 系统是否为演示模式
|
||||||
|
/// </summary>
|
||||||
|
public bool EnableDemo { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue