diff --git a/Bootstrap.Admin/Controllers/HomeController.cs b/Bootstrap.Admin/Controllers/HomeController.cs index 1962ec77..926c9d90 100644 --- a/Bootstrap.Admin/Controllers/HomeController.cs +++ b/Bootstrap.Admin/Controllers/HomeController.cs @@ -1,10 +1,7 @@ using Bootstrap.Admin.Models; using Bootstrap.DataAccess; -using Longbow.Web.WebSockets; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using System; -using System.Collections.Generic; namespace Bootstrap.Admin.Controllers { @@ -17,10 +14,10 @@ namespace Bootstrap.Admin.Controllers /// /// /// - public ActionResult Index() + public IActionResult Index() { - var v = new HeaderBarModel(User.Identity) { HomeUrl = DictHelper.RetrieveHomeUrl() }; - return v.HomeUrl.StartsWith("~/") ? (ActionResult)View(v) : Redirect(v.HomeUrl); + var url = DictHelper.RetrieveHomeUrl(); + return url.Equals("~/Home/Index", System.StringComparison.OrdinalIgnoreCase) ? (IActionResult)View(new HeaderBarModel(User.Identity)) : Redirect(url); } /// /// diff --git a/Bootstrap.Admin/Models/HeaderBarModel.cs b/Bootstrap.Admin/Models/HeaderBarModel.cs index 1cb556a7..5a9076fb 100644 --- a/Bootstrap.Admin/Models/HeaderBarModel.cs +++ b/Bootstrap.Admin/Models/HeaderBarModel.cs @@ -22,10 +22,6 @@ namespace Bootstrap.Admin.Models /// public string DisplayName { get; } /// - /// - /// - public string HomeUrl { get; set; } - /// /// 获得/设置 用户头像地址 /// public string Icon { get; } diff --git a/Bootstrap.Admin/Models/NavigatorBarModel.cs b/Bootstrap.Admin/Models/NavigatorBarModel.cs index deaa4c45..277cf876 100644 --- a/Bootstrap.Admin/Models/NavigatorBarModel.cs +++ b/Bootstrap.Admin/Models/NavigatorBarModel.cs @@ -11,7 +11,6 @@ namespace Bootstrap.Admin.Models { Navigations = BootstrapMenu.RetrieveSystemMenus(UserName, $"~{controller.HttpContext.Request.Path}"); Applications = DictHelper.RetrieveApps(); - HomeUrl = "~/Admin/Index"; } /// /// diff --git a/Bootstrap.Admin/Views/Home/Index.cshtml b/Bootstrap.Admin/Views/Home/Index.cshtml index 8f891ed0..ab749e44 100644 --- a/Bootstrap.Admin/Views/Home/Index.cshtml +++ b/Bootstrap.Admin/Views/Home/Index.cshtml @@ -1,5 +1,4 @@ -@model HeaderBarModel -@{ +@{ ViewBag.Title = "首页"; Layout = "~/Views/Shared/_Bootstrap.cshtml"; } diff --git a/Bootstrap.Admin/Views/Shared/Header.cshtml b/Bootstrap.Admin/Views/Shared/Header.cshtml index 0b4a13c0..6eba5e63 100644 --- a/Bootstrap.Admin/Views/Shared/Header.cshtml +++ b/Bootstrap.Admin/Views/Shared/Header.cshtml @@ -105,7 +105,7 @@