feat: Blazor 登录日志增加登录结果格式化

This commit is contained in:
Argo Zhang 2020-02-03 18:19:43 +08:00
parent 79175dcbe2
commit a9dd132586
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
2 changed files with 11 additions and 1 deletions

View File

@ -22,7 +22,7 @@
<td>@context.City</td>
<td>@context.Browser</td>
<td>@context.OS</td>
<td>@context.Result</td>
<td>@FormatResult(context.Result)</td>
</RowTemplate>
<SearchTemplate>
<LgbInputText ColumnClass="col-12" @bind-Value="@context.Ip" maxlength="50" />

View File

@ -42,6 +42,16 @@ namespace Bootstrap.Admin.Pages.Views.Admin.Components
return data.ToQueryData();
}
/// <summary>
/// 格式化登录结果方法
/// </summary>
protected MarkupString FormatResult(string result)
{
var css = result == "登录成功" ? "success" : "danger";
var icon = css == "success" ? "check" : "remove";
return new MarkupString($"<span class=\"badge badge-md badge-{css}\"><i class=\"fa fa-{icon}\"></i>{result}</span>");
}
/// <summary>
/// 重置搜索方法
/// </summary>