增加功能,网站Title、Footer都可以通过字典表配置
This commit is contained in:
parent
3befbf327b
commit
4529655248
|
@ -187,4 +187,6 @@ $(function () {
|
||||||
parent.prev('input.hide').val($(this).attr("data-val"));
|
parent.prev('input.hide').val($(this).attr("data-val"));
|
||||||
parent.children('button:first').text($(this).text());
|
parent.children('button:first').text($(this).text());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.site-footer div span').text($('#footer').val());
|
||||||
});
|
});
|
|
@ -1,10 +1,22 @@
|
||||||
namespace Bootstrap.Admin.Models
|
using Bootstrap.DataAccess;
|
||||||
{
|
|
||||||
/// <summary>
|
namespace Bootstrap.Admin.Models
|
||||||
///
|
{
|
||||||
/// </summary>
|
/// <summary>
|
||||||
public class ModelBase
|
///
|
||||||
{
|
/// </summary>
|
||||||
|
public class ModelBase
|
||||||
}
|
{
|
||||||
|
public ModelBase()
|
||||||
|
{
|
||||||
|
Title = DictHelper.RetrieveWebTitle();
|
||||||
|
Footer = DictHelper.RetrieveWebFooter();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string Title { get; set; }
|
||||||
|
|
||||||
|
public string Footer { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
<!--footer start-->
|
<!--footer start-->
|
||||||
<footer class="site-footer">
|
<footer class="site-footer">
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<span>2016 © 通用后台管理系统</span>
|
<span></span>
|
||||||
<a href="#" class="go-top tooltips" data-placement="left" data-original-title="返回顶部">
|
<a href="#" class="go-top tooltips" data-placement="left" data-original-title="返回顶部">
|
||||||
<i class="fa fa-angle-up"></i>
|
<i class="fa fa-angle-up"></i>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<div class="fa fa-bars tooltips" data-placement="right" data-original-title="展开/收起 导航条"></div>
|
<div class="fa fa-bars tooltips" data-placement="right" data-original-title="展开/收起 导航条"></div>
|
||||||
</div>
|
</div>
|
||||||
<!--logo start-->
|
<!--logo start-->
|
||||||
<a href="#" class="logo">后台管理系统</a>
|
<a href="#" class="logo">@Model.Title</a>
|
||||||
<!--logo end-->
|
<!--logo end-->
|
||||||
<nav class="navbar lgbMenu @Model.ShowMenu">
|
<nav class="navbar lgbMenu @Model.ShowMenu">
|
||||||
<div id="navbar" class="navbar-collapse collapse">
|
<div id="navbar" class="navbar-collapse collapse">
|
||||||
|
@ -252,5 +252,6 @@
|
||||||
<li></li>
|
<li></li>
|
||||||
</ul>
|
</ul>
|
||||||
<!--breadcrumbs end -->
|
<!--breadcrumbs end -->
|
||||||
|
<input id="footer" type="text" class="hide" value="@Model.Footer" />
|
||||||
</header>
|
</header>
|
||||||
<!--header end-->
|
<!--header end-->
|
||||||
|
|
|
@ -39,7 +39,8 @@
|
||||||
<add key="GroupHelper-RetrieveGroupsByUserId" interval="600" desc="指定用户的组数据缓存"/>
|
<add key="GroupHelper-RetrieveGroupsByUserId" interval="600" desc="指定用户的组数据缓存"/>
|
||||||
<add key="GroupHelper-RetrieveGroupsByRoleId" interval="600" desc="指定角色的组数据缓存"/>
|
<add key="GroupHelper-RetrieveGroupsByRoleId" interval="600" desc="指定角色的组数据缓存"/>
|
||||||
<add key="LogHelper-RetrieveLogs" interval="600" desc="所有日志数据缓存"/>
|
<add key="LogHelper-RetrieveLogs" interval="600" desc="所有日志数据缓存"/>
|
||||||
<add key="DictHelper-RetrieveDicts" interval="600" desc="所有日志数据缓存"/>
|
<add key="DictHelper-RetrieveDicts" interval="600" desc="所有字典数据缓存"/>
|
||||||
|
<add key="DictHelper-RetrieveDictsWebSettings" interval="600" desc="网站配置数据缓存"/>
|
||||||
</cacheManager>
|
</cacheManager>
|
||||||
|
|
||||||
<cacheManagerList>
|
<cacheManagerList>
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace Bootstrap.DataAccess
|
||||||
public static class DictHelper
|
public static class DictHelper
|
||||||
{
|
{
|
||||||
internal const string RetrieveDictsDataKey = "DictHelper-RetrieveDicts";
|
internal const string RetrieveDictsDataKey = "DictHelper-RetrieveDicts";
|
||||||
|
internal const string RetrieveWebSettingsDataKey = "DictHelper-RetrieveDictsWebSettings";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询所有字典信息
|
/// 查询所有字典信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -87,7 +88,7 @@ namespace Bootstrap.DataAccess
|
||||||
if (p.Code.Length > 50) p.Code.Substring(0, 50);
|
if (p.Code.Length > 50) p.Code.Substring(0, 50);
|
||||||
string sql = p.ID == 0 ?
|
string sql = p.ID == 0 ?
|
||||||
"Insert Into Dicts (Category, Name, Code ,Define) Values (@Category, @Name, @Code, @Define)" :
|
"Insert Into Dicts (Category, Name, Code ,Define) Values (@Category, @Name, @Code, @Define)" :
|
||||||
"Update Dicts set Category = @Category, Name = @Name, @Code = Code ,@Define = Define where ID = @ID";
|
"Update Dicts set Category = @Category, Name = @Name, Code = @Code, Define = @Define where ID = @ID";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql))
|
using (DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql))
|
||||||
|
@ -108,5 +109,52 @@ namespace Bootstrap.DataAccess
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
public static IEnumerable<Dict> RetrieveWebSettings()
|
||||||
|
{
|
||||||
|
return CacheManager.GetOrAdd(RetrieveWebSettingsDataKey, CacheSection.RetrieveIntervalByKey(RetrieveWebSettingsDataKey), key =>
|
||||||
|
{
|
||||||
|
string sql = "select ID, Category, Name, Code, Define, case Define when 0 then '系统使用' else '用户自定义' end DefineName from Dicts where Category = N'网站设置' and Define = 0";
|
||||||
|
List<Dict> Dicts = new List<Dict>();
|
||||||
|
DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (DbDataReader reader = DBAccessManager.SqlDBAccess.ExecuteReader(cmd))
|
||||||
|
{
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
Dicts.Add(new Dict()
|
||||||
|
{
|
||||||
|
ID = (int)reader[0],
|
||||||
|
Category = (string)reader[1],
|
||||||
|
Name = (string)reader[2],
|
||||||
|
Code = (string)reader[3],
|
||||||
|
Define = (int)reader[4],
|
||||||
|
DefineName = (string)reader[5]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex) { ExceptionManager.Publish(ex); }
|
||||||
|
return Dicts;
|
||||||
|
}, CacheSection.RetrieveDescByKey(RetrieveWebSettingsDataKey));
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string RetrieveWebTitle()
|
||||||
|
{
|
||||||
|
var settings = DictHelper.RetrieveWebSettings();
|
||||||
|
return (settings.FirstOrDefault(d => d.Name == "网站标题") ?? new Dict() { Code = "后台管理系统" }).Code;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string RetrieveWebFooter()
|
||||||
|
{
|
||||||
|
var settings = DictHelper.RetrieveWebSettings();
|
||||||
|
return (settings.FirstOrDefault(d => d.Name == "网站页脚") ?? new Dict() { Code = "2016 © 通用后台管理系统" }).Code;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,12 @@ SET IDENTITY_INSERT [dbo].[Users] ON
|
||||||
insert into Users (ID, UserName, Password, PassSalt, DisplayName) values (1, 'Admin', 'Es7WVgNsJuELwWK8daCqufUBknCsSC0IYDphQZAiGOo=', 'W5vpBEOYRGHkQXatN0t+ECM/U8cHDuEgrq56+zZBk4J481xH', 'Administrator')
|
insert into Users (ID, UserName, Password, PassSalt, DisplayName) values (1, 'Admin', 'Es7WVgNsJuELwWK8daCqufUBknCsSC0IYDphQZAiGOo=', 'W5vpBEOYRGHkQXatN0t+ECM/U8cHDuEgrq56+zZBk4J481xH', 'Administrator')
|
||||||
SET IDENTITY_INSERT [dbo].[Users] OFF
|
SET IDENTITY_INSERT [dbo].[Users] OFF
|
||||||
|
|
||||||
DELETE From Dicts where ID in (1, 2)
|
DELETE From Dicts where ID in (1, 2, 3, 4)
|
||||||
SET IDENTITY_INSERT [dbo].[Dicts] ON
|
SET IDENTITY_INSERT [dbo].[Dicts] ON
|
||||||
INSERT [dbo].[Dicts] ([ID], [Category], [Name], [Code], [Define]) VALUES (1, N'菜单', N'系统菜单', N'0', 0)
|
INSERT [dbo].[Dicts] ([ID], [Category], [Name], [Code], [Define]) VALUES (1, N'菜单', N'系统菜单', N'0', 0)
|
||||||
INSERT [dbo].[Dicts] ([ID], [Category], [Name], [Code], [Define]) VALUES (2, N'菜单', N'外部菜单', N'1', 0)
|
INSERT [dbo].[Dicts] ([ID], [Category], [Name], [Code], [Define]) VALUES (2, N'菜单', N'外部菜单', N'1', 0)
|
||||||
|
INSERT [dbo].[Dicts] ([ID], [Category], [Name], [Code], [Define]) VALUES (3, N'网站设置', N'网站标题', N'后台管理系统', 0)
|
||||||
|
INSERT [dbo].[Dicts] ([ID], [Category], [Name], [Code], [Define]) VALUES (4, N'网站设置', N'网站页脚', N'2016 © 通用后台管理系统', 0)
|
||||||
SET IDENTITY_INSERT [dbo].[Dicts] OFF
|
SET IDENTITY_INSERT [dbo].[Dicts] OFF
|
||||||
|
|
||||||
DELETE FROM Navigations where ID in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
|
DELETE FROM Navigations where ID in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
|
||||||
|
|
Loading…
Reference in New Issue