feat: 增加主题 UI
This commit is contained in:
parent
1e95e722f9
commit
99b6da65af
|
@ -31,7 +31,7 @@ namespace BootstrapAdmin.DataAccess.Models
|
|||
/// 获得/设置 用户设置样式表名称
|
||||
/// </summary>
|
||||
[Display(Name = "主题")]
|
||||
public string? Css { get; set; }
|
||||
public string? Theme { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获得/设置 用户默认登陆 App 标识
|
||||
|
|
|
@ -49,30 +49,26 @@
|
|||
</div>
|
||||
</div>
|
||||
</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 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-header">网站样式</div>
|
||||
<div class="card-header"></div>
|
||||
<div class="card-body">
|
||||
<div class="alert alert-info" role="alert">
|
||||
<span>注意:本设置将覆盖<b><a class="badge-pill" href="./Settings">网站设置</a></b>中设置的网站样式</span>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using BootstrapAdmin.Web.Core;
|
||||
using BootstrapAdmin.Web.Extensions;
|
||||
using BootstrapAdmin.Web.Services;
|
||||
using BootstrapAdmin.Web.Utils;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
|
||||
namespace BootstrapAdmin.Web.Pages.Admin;
|
||||
|
@ -23,6 +22,9 @@ public partial class Profiles
|
|||
[NotNull]
|
||||
private List<SelectedItem>? Apps { get; set; }
|
||||
|
||||
[NotNull]
|
||||
private List<SelectedItem>? Themes { get; set; }
|
||||
|
||||
[Inject]
|
||||
[NotNull]
|
||||
private IDict? DictService { get; set; }
|
||||
|
@ -41,6 +43,7 @@ public partial class Profiles
|
|||
DisplayName = AppContext.DisplayName
|
||||
};
|
||||
Apps = DictService.GetApps().ToSelectedItemList();
|
||||
Themes = DictService.GetThemes().ToSelectedItemList();
|
||||
}
|
||||
|
||||
private Task OnSaveDisplayName(EditContext context)
|
||||
|
@ -57,4 +60,9 @@ public partial class Profiles
|
|||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task OnSaveTheme()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue