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