From 1af42a61d2ca642364724202ce2d4c701a47666c Mon Sep 17 00:00:00 2001 From: Argo-MacBookPro Date: Sun, 16 Sep 2018 01:24:51 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E4=BB=A3=E7=A0=81=EF=BC=9A?= =?UTF-8?q?=E7=A7=BB=E9=99=A4HeaderBarModel=E7=9A=84HomeUrl=E5=B1=9E?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bootstrap.Admin/Controllers/HomeController.cs | 9 +++------ Bootstrap.Admin/Models/HeaderBarModel.cs | 4 ---- Bootstrap.Admin/Models/NavigatorBarModel.cs | 1 - Bootstrap.Admin/Views/Home/Index.cshtml | 3 +-- Bootstrap.Admin/Views/Shared/Header.cshtml | 2 +- 5 files changed, 5 insertions(+), 14 deletions(-) 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 @@