From d80834dfdfe2c2d9060c9079814a081aa2676d4c Mon Sep 17 00:00:00 2001
From: wanggang <76527413@qq.com>
Date: Wed, 2 Dec 2020 17:12:21 +0800
Subject: [PATCH] update
Former-commit-id: ce046cc20f076db08e271504b69bb715b161ab13
Former-commit-id: 7d789c80e13b7397c00dcf7b00d3d67ed250eca5
---
.../Areas/Settings/Views/Shared/_Menu.cshtml | 2 +-
.../Views/Shared/_Layout.cshtml | 21 ++++
.../Infrastructure/Views/Shared/_Menu.cshtml | 2 +-
.../Views/Shared/_TopMenu.cshtml | 25 +----
.../Web/Mvc/Razor/MyRazorPage.cs | 11 ++-
.../Areas/Admin/Controllers/HomeController.cs | 44 ---------
.../Areas/Admin/Views/Home/Index.cshtml | 4 -
.../Areas/Admin/Views/Shared/_Menu.cshtml | 97 -------------------
.../Areas/Admin/Views/Shared/_Script.cshtml | 24 -----
.../Areas/IoTCenter/Views/Shared/_Menu.cshtml | 46 +++++++++
.../Views/_ViewImports.cshtml | 1 +
.../Views/_ViewStart.cshtml | 0
.../Controllers/PermissionController.cs | 6 +-
.../Controllers/RoleController.cs | 6 +-
.../Controllers/UserController.cs | 6 +-
.../UserCenter/Views/Shared/_Menu.cshtml | 18 ++++
.../UserCenter/Views/_ViewImports.cshtml | 8 ++
projects/IoTNode/DbConfig.cs | 2 +-
projects/IoTNode/Views/Account/_Menu.cshtml | 35 +++----
projects/IoTNode/Views/Shared/_Menu.cshtml | 29 +-----
projects/IoTNode/Views/Shared/_TopMenu.cshtml | 17 ++++
projects/Platform/Views/Shared/_Menu.cshtml | 18 +---
.../Platform/Views/Shared/_TopMenu.cshtml | 38 ++------
projects/projects.sln | 4 +-
24 files changed, 159 insertions(+), 305 deletions(-)
delete mode 100644 projects/IoTNode/Areas/Admin/Controllers/HomeController.cs
delete mode 100644 projects/IoTNode/Areas/Admin/Views/Home/Index.cshtml
delete mode 100644 projects/IoTNode/Areas/Admin/Views/Shared/_Menu.cshtml
delete mode 100644 projects/IoTNode/Areas/Admin/Views/Shared/_Script.cshtml
create mode 100644 projects/IoTNode/Areas/IoTCenter/Views/Shared/_Menu.cshtml
rename projects/IoTNode/Areas/{Admin => IoTCenter}/Views/_ViewImports.cshtml (70%)
rename projects/IoTNode/Areas/{Admin => IoTCenter}/Views/_ViewStart.cshtml (100%)
rename projects/IoTNode/Areas/{Admin => UserCenter}/Controllers/PermissionController.cs (97%)
rename projects/IoTNode/Areas/{Admin => UserCenter}/Controllers/RoleController.cs (97%)
rename projects/IoTNode/Areas/{Admin => UserCenter}/Controllers/UserController.cs (96%)
create mode 100644 projects/IoTNode/Areas/UserCenter/Views/Shared/_Menu.cshtml
create mode 100644 projects/IoTNode/Areas/UserCenter/Views/_ViewImports.cshtml
create mode 100644 projects/IoTNode/Views/Shared/_TopMenu.cshtml
diff --git a/projects/Infrastructure/Areas/Settings/Views/Shared/_Menu.cshtml b/projects/Infrastructure/Areas/Settings/Views/Shared/_Menu.cshtml
index 108c0b8e..07e4199d 100644
--- a/projects/Infrastructure/Areas/Settings/Views/Shared/_Menu.cshtml
+++ b/projects/Infrastructure/Areas/Settings/Views/Shared/_Menu.cshtml
@@ -1,6 +1,6 @@
\ No newline at end of file
diff --git a/projects/Infrastructure/Views/Shared/_Layout.cshtml b/projects/Infrastructure/Views/Shared/_Layout.cshtml
index ce789b46..54677a82 100644
--- a/projects/Infrastructure/Views/Shared/_Layout.cshtml
+++ b/projects/Infrastructure/Views/Shared/_Layout.cshtml
@@ -35,6 +35,27 @@
@await Html.PartialAsync("_TopMenu")
+
diff --git a/projects/Infrastructure/Views/Shared/_Menu.cshtml b/projects/Infrastructure/Views/Shared/_Menu.cshtml
index b13086c7..c8801fd3 100644
--- a/projects/Infrastructure/Views/Shared/_Menu.cshtml
+++ b/projects/Infrastructure/Views/Shared/_Menu.cshtml
@@ -1,5 +1,5 @@
\ No newline at end of file
diff --git a/projects/Infrastructure/Views/Shared/_TopMenu.cshtml b/projects/Infrastructure/Views/Shared/_TopMenu.cshtml
index 9df189a9..c332921f 100644
--- a/projects/Infrastructure/Views/Shared/_TopMenu.cshtml
+++ b/projects/Infrastructure/Views/Shared/_TopMenu.cshtml
@@ -8,30 +8,9 @@
- 首页
+ 首页
- 配置中心
+ 配置中心
-
diff --git a/projects/Infrastructure/Web/Mvc/Razor/MyRazorPage.cs b/projects/Infrastructure/Web/Mvc/Razor/MyRazorPage.cs
index c90e8416..761bf81e 100644
--- a/projects/Infrastructure/Web/Mvc/Razor/MyRazorPage.cs
+++ b/projects/Infrastructure/Web/Mvc/Razor/MyRazorPage.cs
@@ -52,18 +52,21 @@ namespace Infrastructure.Web.Mvc.Razor
return result;
}
- public string GetLinkClass(string controller = "Home", string action = null, string area = null)
+ public string GetLinkClass(string controller = null, string action = null, string area = null)
{
- var currentArea = ViewContext.RouteData.Values["area"]?.ToString();
+ var currentArea = ViewContext.RouteData.Values["area"]?.ToString() ?? "";
var currentController = ViewContext.RouteData.Values["controller"]?.ToString();
var currentAction = ViewContext.RouteData.Values["action"]?.ToString();
var cls = "nav-link";
- var match = controller == currentController;
-
+ var match = true;
if (area != null)
{
match = match && area == currentArea;
}
+ if (controller != null)
+ {
+ match = match && controller == currentController;
+ }
if (action != null)
{
match = match && action == currentAction;
diff --git a/projects/IoTNode/Areas/Admin/Controllers/HomeController.cs b/projects/IoTNode/Areas/Admin/Controllers/HomeController.cs
deleted file mode 100644
index e921a51d..00000000
--- a/projects/IoTNode/Areas/Admin/Controllers/HomeController.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using Infrastructure.Extensions;
-using IoTNode.Services;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using System;
-
-namespace IoTNode.Areas.Admin.Controllers
-{
- [Authorize]
- [Area(nameof(Admin))]
- public class HomeController : Controller
- {
- private readonly IoTNodeEventHandler _iotNodeEventHandler;
-
- public HomeController(IoTNodeEventHandler iotNodeEventHandler)
- {
- this._iotNodeEventHandler = iotNodeEventHandler;
- }
-
- public IActionResult Index()
- {
- return View();
- }
-
- public IActionResult UpdateTimer()
- {
- try
- {
- this._iotNodeEventHandler.UpdateTimer();
- }
- catch (Exception ex)
- {
- ex.PrintStack();
- return Problem(ex.ToString());
- }
- return Ok();
- }
-
- public void Handle(object id)
- {
- throw new NotImplementedException();
- }
- }
-}
\ No newline at end of file
diff --git a/projects/IoTNode/Areas/Admin/Views/Home/Index.cshtml b/projects/IoTNode/Areas/Admin/Views/Home/Index.cshtml
deleted file mode 100644
index f551b40e..00000000
--- a/projects/IoTNode/Areas/Admin/Views/Home/Index.cshtml
+++ /dev/null
@@ -1,4 +0,0 @@
-@{
- ViewData["IsHomePage"] = true;
-}
-首页
\ No newline at end of file
diff --git a/projects/IoTNode/Areas/Admin/Views/Shared/_Menu.cshtml b/projects/IoTNode/Areas/Admin/Views/Shared/_Menu.cshtml
deleted file mode 100644
index ce9a97b5..00000000
--- a/projects/IoTNode/Areas/Admin/Views/Shared/_Menu.cshtml
+++ /dev/null
@@ -1,97 +0,0 @@
-
\ No newline at end of file
diff --git a/projects/IoTNode/Areas/Admin/Views/Shared/_Script.cshtml b/projects/IoTNode/Areas/Admin/Views/Shared/_Script.cshtml
deleted file mode 100644
index 33c931f6..00000000
--- a/projects/IoTNode/Areas/Admin/Views/Shared/_Script.cshtml
+++ /dev/null
@@ -1,24 +0,0 @@
-
\ No newline at end of file
diff --git a/projects/IoTNode/Areas/IoTCenter/Views/Shared/_Menu.cshtml b/projects/IoTNode/Areas/IoTCenter/Views/Shared/_Menu.cshtml
new file mode 100644
index 00000000..67e6cbda
--- /dev/null
+++ b/projects/IoTNode/Areas/IoTCenter/Views/Shared/_Menu.cshtml
@@ -0,0 +1,46 @@
+
\ No newline at end of file
diff --git a/projects/IoTNode/Areas/Admin/Views/_ViewImports.cshtml b/projects/IoTNode/Areas/IoTCenter/Views/_ViewImports.cshtml
similarity index 70%
rename from projects/IoTNode/Areas/Admin/Views/_ViewImports.cshtml
rename to projects/IoTNode/Areas/IoTCenter/Views/_ViewImports.cshtml
index f99ab108..eb280b3b 100644
--- a/projects/IoTNode/Areas/Admin/Views/_ViewImports.cshtml
+++ b/projects/IoTNode/Areas/IoTCenter/Views/_ViewImports.cshtml
@@ -1,4 +1,5 @@
@inherits Infrastructure.Web.Mvc.Razor.MyRazorPage
+@using Microsoft.Extensions.Hosting
@using Infrastructure.Application
@using Infrastructure.Extensions
@using Infrastructure.Data
diff --git a/projects/IoTNode/Areas/Admin/Views/_ViewStart.cshtml b/projects/IoTNode/Areas/IoTCenter/Views/_ViewStart.cshtml
similarity index 100%
rename from projects/IoTNode/Areas/Admin/Views/_ViewStart.cshtml
rename to projects/IoTNode/Areas/IoTCenter/Views/_ViewStart.cshtml
diff --git a/projects/IoTNode/Areas/Admin/Controllers/PermissionController.cs b/projects/IoTNode/Areas/UserCenter/Controllers/PermissionController.cs
similarity index 97%
rename from projects/IoTNode/Areas/Admin/Controllers/PermissionController.cs
rename to projects/IoTNode/Areas/UserCenter/Controllers/PermissionController.cs
index f825fbbf..013eaa82 100644
--- a/projects/IoTNode/Areas/Admin/Controllers/PermissionController.cs
+++ b/projects/IoTNode/Areas/UserCenter/Controllers/PermissionController.cs
@@ -12,10 +12,10 @@ using System;
using System.Collections.Generic;
using System.Linq;
-namespace IoT.Shared.Areas.IoTCenter.Controllers
+namespace IoT.Shared.Areas.UserCenter.Controllers
{
[Authorize]
- [Area(nameof(IoTCenter))]
+ [Area(nameof(UserCenter))]
public class PermissionController : CrudController
{
private readonly IRepository _permissionCategoryRepo;
@@ -79,4 +79,4 @@ namespace IoT.Shared.Areas.IoTCenter.Controllers
return new MultiSelectList(list, "Id", "Name", selectedValues, "Group");
}
}
-}
\ No newline at end of file
+}
diff --git a/projects/IoTNode/Areas/Admin/Controllers/RoleController.cs b/projects/IoTNode/Areas/UserCenter/Controllers/RoleController.cs
similarity index 97%
rename from projects/IoTNode/Areas/Admin/Controllers/RoleController.cs
rename to projects/IoTNode/Areas/UserCenter/Controllers/RoleController.cs
index aba87d93..7ce2dd67 100644
--- a/projects/IoTNode/Areas/Admin/Controllers/RoleController.cs
+++ b/projects/IoTNode/Areas/UserCenter/Controllers/RoleController.cs
@@ -12,10 +12,10 @@ using System;
using System.Collections.Generic;
using System.Linq;
-namespace IoT.Shared.Areas.IoTCenter.Controllers
+namespace IoT.Shared.Areas.UserCenter.Controllers
{
[Authorize]
- [Area(nameof(IoTCenter))]
+ [Area(nameof(UserCenter))]
public class RoleController : CrudController
{
private readonly PermissionController _ajax;
@@ -83,4 +83,4 @@ namespace IoT.Shared.Areas.IoTCenter.Controllers
return new MultiSelectList(list, "Id", "Name", selected);
}
}
-}
\ No newline at end of file
+}
diff --git a/projects/IoTNode/Areas/Admin/Controllers/UserController.cs b/projects/IoTNode/Areas/UserCenter/Controllers/UserController.cs
similarity index 96%
rename from projects/IoTNode/Areas/Admin/Controllers/UserController.cs
rename to projects/IoTNode/Areas/UserCenter/Controllers/UserController.cs
index 9339371c..7df3e593 100644
--- a/projects/IoTNode/Areas/Admin/Controllers/UserController.cs
+++ b/projects/IoTNode/Areas/UserCenter/Controllers/UserController.cs
@@ -9,11 +9,11 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System.Linq;
-namespace IoT.Shared.Areas.IoTCenter.Controllers
+namespace IoT.Shared.Areas.UserCenter.Controllers
{
[ApiExplorerSettings(IgnoreApi = false)]
[Authorize]
- [Area(nameof(IoTCenter))]
+ [Area(nameof(UserCenter))]
public class UserController : CrudController
{
private readonly RoleController _ajax;
@@ -68,4 +68,4 @@ namespace IoT.Shared.Areas.IoTCenter.Controllers
}
}
}
-}
\ No newline at end of file
+}
diff --git a/projects/IoTNode/Areas/UserCenter/Views/Shared/_Menu.cshtml b/projects/IoTNode/Areas/UserCenter/Views/Shared/_Menu.cshtml
new file mode 100644
index 00000000..40a1f4a8
--- /dev/null
+++ b/projects/IoTNode/Areas/UserCenter/Views/Shared/_Menu.cshtml
@@ -0,0 +1,18 @@
+
\ No newline at end of file
diff --git a/projects/IoTNode/Areas/UserCenter/Views/_ViewImports.cshtml b/projects/IoTNode/Areas/UserCenter/Views/_ViewImports.cshtml
new file mode 100644
index 00000000..eb280b3b
--- /dev/null
+++ b/projects/IoTNode/Areas/UserCenter/Views/_ViewImports.cshtml
@@ -0,0 +1,8 @@
+@inherits Infrastructure.Web.Mvc.Razor.MyRazorPage
+@using Microsoft.Extensions.Hosting
+@using Infrastructure.Application
+@using Infrastructure.Extensions
+@using Infrastructure.Data
+@using Application.Domain.Entities
+@using Application.Models
+@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
\ No newline at end of file
diff --git a/projects/IoTNode/DbConfig.cs b/projects/IoTNode/DbConfig.cs
index e24a9fce..54fefa0c 100644
--- a/projects/IoTNode/DbConfig.cs
+++ b/projects/IoTNode/DbConfig.cs
@@ -129,7 +129,7 @@ namespace IoTNode
db.Set().Add(new Node
{
Id = $"nodeid-{macAddress}".ToGuid(),
- Name = $"{organ}-节点-{macAddress}",
+ Name = $"节点({macAddress})",
Number = macAddress,
IsOnline = true,
Version = Helper.Instance.GetVersion(),
diff --git a/projects/IoTNode/Views/Account/_Menu.cshtml b/projects/IoTNode/Views/Account/_Menu.cshtml
index c57a0694..379a586e 100644
--- a/projects/IoTNode/Views/Account/_Menu.cshtml
+++ b/projects/IoTNode/Views/Account/_Menu.cshtml
@@ -1,21 +1,14 @@
-
-
-@functions{
- public string GetClass(params string[] controllers)
- {
- if (controllers.Select(o => o.ToLower()).Contains(this.ViewContext.RouteData.Values["controller"].ToString().ToLower()))
- {
- if (controllers.Length > 1)
- {
- return "active open";
- }
- return "active";
- }
- return "";
- }
-}
\ No newline at end of file
+
\ No newline at end of file
diff --git a/projects/IoTNode/Views/Shared/_Menu.cshtml b/projects/IoTNode/Views/Shared/_Menu.cshtml
index 93b858fc..38391d15 100644
--- a/projects/IoTNode/Views/Shared/_Menu.cshtml
+++ b/projects/IoTNode/Views/Shared/_Menu.cshtml
@@ -1,26 +1,3 @@
-
-@functions{
- public string getLinkClass(string controller = "Home",string action = null)
- {
- var currentController = ViewContext.RouteData.Values["controller"]?.ToString();
- var currentAction = ViewContext.RouteData.Values["action"]?.ToString();
- var cls = "nav-link";
- if(controller==currentController)
- {
- if(action==null||action==currentAction)
- {
- cls+=" active";
- }
- }
- return cls;
- }
-}
\ No newline at end of file
+
\ No newline at end of file
diff --git a/projects/IoTNode/Views/Shared/_TopMenu.cshtml b/projects/IoTNode/Views/Shared/_TopMenu.cshtml
new file mode 100644
index 00000000..3b8ceda0
--- /dev/null
+++ b/projects/IoTNode/Views/Shared/_TopMenu.cshtml
@@ -0,0 +1,17 @@
+
+
diff --git a/projects/Platform/Views/Shared/_Menu.cshtml b/projects/Platform/Views/Shared/_Menu.cshtml
index 9f4543dd..f549a361 100644
--- a/projects/Platform/Views/Shared/_Menu.cshtml
+++ b/projects/Platform/Views/Shared/_Menu.cshtml
@@ -1,18 +1,4 @@
diff --git a/projects/Platform/Views/Shared/_TopMenu.cshtml b/projects/Platform/Views/Shared/_TopMenu.cshtml
index abf593ee..75b773c0 100644
--- a/projects/Platform/Views/Shared/_TopMenu.cshtml
+++ b/projects/Platform/Views/Shared/_TopMenu.cshtml
@@ -1,43 +1,17 @@
-@{
- var area = ViewContext.RouteData.Values["area"] as string;
- var controller = ViewContext.RouteData.Values["controller"] as string;
- var action = ViewContext.RouteData.Values["action"] as string;
-}
-
\ No newline at end of file
diff --git a/projects/projects.sln b/projects/projects.sln
index a5e60ff3..b5930eb6 100644
--- a/projects/projects.sln
+++ b/projects/projects.sln
@@ -137,13 +137,13 @@ Global
{264A3E6B-80A1-488D-841D-930B810B85D2} = {6044D20E-13BA-47BF-BD42-CCC5267ACCEF}
{216F0A25-9F20-4235-9316-632AB94E854A} = {AE34E06D-C5C7-44BC-B168-85808318516C}
{F48CA65D-B2D6-4DB8-A396-A3FE913804FB} = {AE34E06D-C5C7-44BC-B168-85808318516C}
- {BE6DEBC5-004F-4811-8BDC-67C74D9E8C2F} = {6044D20E-13BA-47BF-BD42-CCC5267ACCEF}
+ {BE6DEBC5-004F-4811-8BDC-67C74D9E8C2F} = {AE34E06D-C5C7-44BC-B168-85808318516C}
{C66B39B3-D863-4651-99CD-74104CA65C47} = {11BCB5F9-0020-463A-92FB-BC25E2A0BF75}
{6F839910-580D-4CD1-A0C0-6FAF542B4480} = {11BCB5F9-0020-463A-92FB-BC25E2A0BF75}
{60596088-3C4E-4EA2-933A-B66CD269845B} = {AE34E06D-C5C7-44BC-B168-85808318516C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {0B7095FB-5E70-4EF8-805A-CB4A91AE4B0A}
BuildVersion_StartDate = 2000/1/1
+ SolutionGuid = {0B7095FB-5E70-4EF8-805A-CB4A91AE4B0A}
EndGlobalSection
EndGlobal