增加网站设置前台首页系统配置项,保证前台未登录用户,调用后台登陆后直接跳转回前台页面
This commit is contained in:
parent
b166e8fff0
commit
0a7d3cd489
|
@ -1,7 +1,6 @@
|
|||
using Bootstrap.Admin.Models;
|
||||
using Bootstrap.DataAccess;
|
||||
using Longbow.Security.Principal;
|
||||
using System;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Security;
|
||||
|
||||
|
@ -19,8 +18,10 @@ namespace Bootstrap.Admin.Controllers
|
|||
public ActionResult Index()
|
||||
{
|
||||
var v = new HeaderBarModel();
|
||||
v.HomeUrl = DictHelper.RetrieveHomeUrl();
|
||||
v.ShowMenu = true;
|
||||
return View(v);
|
||||
if (v.HomeUrl.StartsWith("~/")) return View(v);
|
||||
else return Redirect(v.HomeUrl);
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
|
|
|
@ -16,7 +16,6 @@ namespace Bootstrap.Admin.Models
|
|||
DisplayName = user.DisplayName;
|
||||
UserName = user.UserName;
|
||||
UserID = user.ID;
|
||||
HomeUrl = "~/";
|
||||
Menus = MenuHelper.RetrieveLinksByUserName(UserName);
|
||||
}
|
||||
public string UserName { get; protected set; }
|
||||
|
@ -35,7 +34,7 @@ namespace Bootstrap.Admin.Models
|
|||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string HomeUrl { get; protected set; }
|
||||
public string HomeUrl { get; set; }
|
||||
/// <summary>
|
||||
/// 获得/设置 前台菜单
|
||||
/// </summary>
|
||||
|
|
|
@ -206,5 +206,14 @@ namespace Bootstrap.DataAccess
|
|||
var data = RetrieveDicts();
|
||||
return data.FirstOrDefault(d => d.Name == "头像路径" && d.Category == "头像地址" && d.Define == 0) ?? new Dict() { Code = "~/Content/images/uploader/" };
|
||||
}
|
||||
/// <summary>
|
||||
/// 获得默认的前台首页地址,默认为~/Home/Index
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string RetrieveHomeUrl()
|
||||
{
|
||||
var settings = RetrieveDicts();
|
||||
return (settings.FirstOrDefault(d => d.Name == "前台首页" && d.Category == "网站设置" && d.Define == 0) ?? new Dict() { Code = "~/Home/Index" }).Code;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ INSERT [dbo].[Dicts] ([ID], [Category], [Name], [Code], [Define]) VALUES (16, N'
|
|||
INSERT [dbo].[Dicts] ([ID], [Category], [Name], [Code], [Define]) VALUES (17, N'网站样式', N'默认样式', N'site.css', 0)
|
||||
INSERT [dbo].[Dicts] ([ID], [Category], [Name], [Code], [Define]) VALUES (18, N'网站样式', N'蓝色样式', N'blue.css', 0)
|
||||
INSERT [dbo].[Dicts] ([ID], [Category], [Name], [Code], [Define]) VALUES (19, N'当前样式', N'使用样式', N'site.css', 0)
|
||||
INSERT [dbo].[Dicts] ([ID], [Category], [Name], [Code], [Define]) VALUES (20, N'网站设置', N'前台首页', N'~/Home/Index', 0)
|
||||
SET IDENTITY_INSERT [dbo].[Dicts] OFF
|
||||
|
||||
DELETE FROM Navigations
|
||||
|
|
Loading…
Reference in New Issue