feat: Blazor 网站页脚保存成功
This commit is contained in:
parent
488ac6be60
commit
5d141b3b78
|
@ -87,6 +87,11 @@ namespace Bootstrap.Admin.Pages.Components
|
|||
/// </summary>
|
||||
protected SideBar? SideBar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Footer 组件引用实例
|
||||
/// </summary>
|
||||
protected Footer? Footer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// OnInitializedAsync 方法
|
||||
/// </summary>
|
||||
|
@ -128,6 +133,7 @@ namespace Bootstrap.Admin.Pages.Components
|
|||
Model = new NavigatorBarModel(UserName, RequestUrl.ToMvcMenuUrl());
|
||||
DisplayName = Model.DisplayName;
|
||||
WebTitle = Model.Title;
|
||||
WebFooter = Model.Footer;
|
||||
if (HomeUrl.StartsWith("/")) HomeUrl = NavigationManager.ToBlazorLink(HomeUrl);
|
||||
}
|
||||
}
|
||||
|
@ -152,6 +158,18 @@ namespace Bootstrap.Admin.Pages.Components
|
|||
SideBar?.WebTitleChanged.InvokeAsync(title);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得/设置 网站页脚文字
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string WebFooter { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 网站页脚文字变化是触发此方法
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
public void OnWebFooterChanged(string text) => Footer?.TextChanged.InvokeAsync(text);
|
||||
|
||||
/// <summary>
|
||||
/// OnAfterRender 方法
|
||||
/// </summary>
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
<Header @ref="Header" Icon="@Model.Icon" @bind-DisplayName="DisplayName" @bind-WebTitle="WebTitle"/>
|
||||
<SideBar @ref="SideBar" Model=@Model @bind-DisplayName="DisplayName" @bind-WebTitle="WebTitle" />
|
||||
@Body
|
||||
<Footer Text="@Model.Footer" IsDemo=@Model.IsDemo></Footer>
|
||||
<Footer @ref="Footer" IsDemo=@Model.IsDemo @bind-Text="WebFooter"></Footer>
|
||||
</CascadingValue>
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
[Parameter]
|
||||
public string Text { get; set; } = "未设置";
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<string> TextChanged { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public bool IsDemo { get; set; }
|
||||
}
|
|
@ -33,10 +33,10 @@
|
|||
</ConditionComponent>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="sysFoot" placeholder="请输入网站页脚,50字以内" value="@Model.Footer" />
|
||||
<input type="text" class="form-control" id="sysFoot" placeholder="请输入网站页脚,50字以内" @bind-value="@Model.Footer" />
|
||||
<ConditionComponent Inverse="true">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-secondary" type="button">保存</button>
|
||||
<button class="btn btn-secondary" type="button" @onclick="SaveWebFooter">保存</button>
|
||||
</div>
|
||||
</ConditionComponent>
|
||||
</div>
|
||||
|
|
|
@ -170,6 +170,16 @@ namespace Bootstrap.Admin.Pages.Views.Admin.Components
|
|||
ShowMessage("保存网站标题", ret);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存网站页脚
|
||||
/// </summary>
|
||||
protected void SaveWebFooter()
|
||||
{
|
||||
var ret = DictHelper.SaveWebFooter(Model.Footer);
|
||||
RootLayout?.OnWebFooterChanged(Model.Footer);
|
||||
ShowMessage("保存网站页脚", ret);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 网站设置编辑模型实体类
|
||||
/// </summary>
|
||||
|
|
|
@ -129,6 +129,20 @@ namespace Bootstrap.DataAccess
|
|||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存网站页脚
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
public static bool SaveWebFooter(string code)
|
||||
{
|
||||
var ret = DictHelper.SaveSettings(new BootstrapDict[]
|
||||
{
|
||||
new BootstrapDict() { Category = "网站设置", Name = "网站页脚", Code = code }
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取字典分类名称
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue