feat: 增加主题 UI

This commit is contained in:
Argo-Tianyi 2021-12-25 15:47:14 +08:00
parent 1e95e722f9
commit 99b6da65af
3 changed files with 26 additions and 22 deletions

View File

@ -31,7 +31,7 @@ namespace BootstrapAdmin.DataAccess.Models
/// 获得/设置 用户设置样式表名称 /// 获得/设置 用户设置样式表名称
/// </summary> /// </summary>
[Display(Name = "主题")] [Display(Name = "主题")]
public string? Css { get; set; } public string? Theme { get; set; }
/// <summary> /// <summary>
/// 获得/设置 用户默认登陆 App 标识 /// 获得/设置 用户默认登陆 App 标识

View File

@ -49,30 +49,26 @@
</div> </div>
</div> </div>
</AdminCard> </AdminCard>
<AdminCard HeaderText="网站样式" AuthorizeKey="SaveApp">
<AdminAlert Color="Color.Info">
<span>注意:本设置将覆盖 <b><a class="badge-pill" href="./Settings">网站设置</a></b> 中设置的网站样式</span>
</AdminAlert>
<div class="row g-3 form-inline">
<div class="col-12 col-sm-6">
<Dropdown Items="Themes" @bind-Value="CurrentUser.Theme" />
</div>
<div class="col-12 col-sm-6 text-end">
<Button Icon="fa fa-save" Text="保存" OnClickWithoutRender="OnSaveTheme" />
</div>
</div>
</AdminCard>
</div> </div>
@* @*
<div class="card" asp-auth="saveApp">
<div class="card-header">默认应用</div>
<div class="card-body">
<div class="form-group">
<div class="btn-group" role="group">
<button id="app" class="btn btn-success dropdown-select dropdown-toggle" data-toggle="dropdown" value="@Model.AppId">@Model.AppName</button>
<div class="dropdown-menu">
@foreach (var app in Model.Applications)
{
<a href="#" data-val="@app.Key">@app.Value</a>
}
</div>
</div>
</div>
<div class="modal-footer">
<button id="btnSaveApp" data-method="app" class="btn btn-secondary" type="button"><i class="fa fa-save"></i><span>保存</span></button>
</div>
</div>
</div>
<div class="card" asp-auth="saveTheme"> <div class="card" asp-auth="saveTheme">
<div class="card-header">网站样式</div> <div class="card-header"></div>
<div class="card-body"> <div class="card-body">
<div class="alert alert-info" role="alert"> <div class="alert alert-info" role="alert">
<span>注意:本设置将覆盖<b><a class="badge-pill" href="./Settings">网站设置</a></b>中设置的网站样式</span> <span>注意:本设置将覆盖<b><a class="badge-pill" href="./Settings">网站设置</a></b>中设置的网站样式</span>

View File

@ -2,7 +2,6 @@
using BootstrapAdmin.Web.Core; using BootstrapAdmin.Web.Core;
using BootstrapAdmin.Web.Extensions; using BootstrapAdmin.Web.Extensions;
using BootstrapAdmin.Web.Services; using BootstrapAdmin.Web.Services;
using BootstrapAdmin.Web.Utils;
using Microsoft.AspNetCore.Components.Forms; using Microsoft.AspNetCore.Components.Forms;
namespace BootstrapAdmin.Web.Pages.Admin; namespace BootstrapAdmin.Web.Pages.Admin;
@ -23,6 +22,9 @@ public partial class Profiles
[NotNull] [NotNull]
private List<SelectedItem>? Apps { get; set; } private List<SelectedItem>? Apps { get; set; }
[NotNull]
private List<SelectedItem>? Themes { get; set; }
[Inject] [Inject]
[NotNull] [NotNull]
private IDict? DictService { get; set; } private IDict? DictService { get; set; }
@ -41,6 +43,7 @@ public partial class Profiles
DisplayName = AppContext.DisplayName DisplayName = AppContext.DisplayName
}; };
Apps = DictService.GetApps().ToSelectedItemList(); Apps = DictService.GetApps().ToSelectedItemList();
Themes = DictService.GetThemes().ToSelectedItemList();
} }
private Task OnSaveDisplayName(EditContext context) private Task OnSaveDisplayName(EditContext context)
@ -57,4 +60,9 @@ public partial class Profiles
{ {
return Task.CompletedTask; return Task.CompletedTask;
} }
private Task OnSaveTheme()
{
return Task.CompletedTask;
}
} }