Former-commit-id: 98e04bc3ffeb3f5f8ac8750b0fe6106024e986ba
TangShanKaiPing
wanggang 5 years ago
parent e6a1b4e49e
commit 01bcf422b9

@ -12,7 +12,7 @@ using System.Linq;
namespace Infrastructure.Web.Mvc
{
[ApiExplorerSettings(IgnoreApi = true)]
[ApiExplorerSettings(IgnoreApi = false)]
[ApiController]
[Route("Admin/[controller]/[action]")]
public class CrudController<TEntity, TSearchModel, TDisplayModel, TEditModel> : BaseController

@ -35,12 +35,14 @@ namespace IoT.Shared.Areas.Admin.Controlls
return query.Include(o => o.Device).ThenInclude(o => o.Node).Include(o => o.Api);
}
[HttpGet]
public IActionResult Api(Guid apiId, Guid deviceId)
{
var model = this.GetParameters(apiId, deviceId, null);
return PartialView("_Api", model);
}
[HttpGet]
public IActionResult Code(string name, int type, int code, Guid deviceId)
{
var model = new EditIRCodeViewModel

@ -64,6 +64,7 @@ namespace IoT.Shared.Areas.Admin.Controlls
return this._nodeRepo.ReadOnlyTable().Where(o => o.Id == model.NodeId).Select(o => o.Number).FirstOrDefault();
}
[HttpGet]
public IActionResult DataHistory(Guid id, SearchDataHistoryModel model)
{
var data = this._repo.ReadOnlyTable()

@ -109,6 +109,7 @@ namespace IoT.Shared.Areas.Admin.Controlls
return RedirectTo();
}
[ApiExplorerSettings(IgnoreApi = true)]
public virtual string GetNodeNumber(TEditModel model)
{
throw new NotImplementedException();

@ -40,6 +40,7 @@ namespace IoT.Shared.Areas.Admin.Controllers
this.ViewData.Add(entity.CategoryId, entity.Category.Name);
}
[ApiExplorerSettings(IgnoreApi = true)]
public SelectList GetPermissionCategorySelectList(Guid? selected)
{
var list = this._permissionCategoryRepo.ReadOnlyTable()
@ -48,6 +49,7 @@ namespace IoT.Shared.Areas.Admin.Controllers
return new SelectList(list, "Id", "Name", selected);
}
[ApiExplorerSettings(IgnoreApi = true)]
public MultiSelectList GetPermissionMultiSelectList(IEnumerable<Guid> selectedValues)
{
if (selectedValues == null)

@ -63,6 +63,7 @@ namespace IoT.Shared.Areas.Admin.Controllers
}
}
[ApiExplorerSettings(IgnoreApi = true)]
public MultiSelectList GetRoleMultiSelectList(IEnumerable<Guid> selected)
{
if (selected == null)

@ -1,37 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using WebMVC.Models;
namespace WebMVC.Controllers
{
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
}
public IActionResult Index()
{
return View();
}
public IActionResult Privacy()
{
return View();
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}

@ -1,11 +0,0 @@
using System;
namespace WebMVC.Models
{
public class ErrorViewModel
{
public string RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
}
}

@ -18,6 +18,10 @@ namespace WebMVC
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.AddSpaStaticFiles(configuration =>
{
configuration.RootPath = "wwwroot";
});
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
@ -33,6 +37,8 @@ namespace WebMVC
app.UseStaticFiles();
app.UseSpaStaticFiles();
app.UseRouting();
app.UseAuthorization();

@ -1,8 +0,0 @@
@{
ViewData["Title"] = "Home Page";
}
<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
</div>

@ -1,6 +0,0 @@
@{
ViewData["Title"] = "Privacy Policy";
}
<h1>@ViewData["Title"]</h1>
<p>Use this page to detail your site's privacy policy.</p>

@ -1,25 +0,0 @@
@model ErrorViewModel
@{
ViewData["Title"] = "Error";
}
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>

@ -1,48 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - WebMVC</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" />
</head>
<body>
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container">
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">WebMVC</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="container">
<main role="main" class="pb-3">
@RenderBody()
</main>
</div>
<footer class="border-top footer text-muted">
<div class="container">
&copy; 2020 - WebMVC - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
</div>
</footer>
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
@RenderSection("Scripts", required: false)
</body>
</html>

@ -1,2 +0,0 @@
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>

@ -1,3 +0,0 @@
@using WebMVC
@using WebMVC.Models
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

@ -1,3 +0,0 @@
@{
Layout = "_Layout";
}

@ -4,6 +4,7 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="3.1.2" />
</ItemGroup>
</Project>

@ -18,6 +18,10 @@ namespace WebSPA
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.AddSpaStaticFiles(configuration =>
{
configuration.RootPath = "wwwroot";
});
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
@ -34,6 +38,8 @@ namespace WebSPA
app.UseFileServer();
app.UseSpaStaticFiles();
app.UseRouting();
app.UseAuthorization();

@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="3.1.2" />
</ItemGroup>
</Project>

@ -1,8 +1,8 @@
var config = (function(global){
global.apigateway = 'http://192.168.3.118'; // 设置通过API网关访问
//global.resourceUrl = 'http://192.168.3.118'; // 媒体文件资源
global.iotCenterUrl = 'http://192.168.3.118/IoTCenter'; // IoT服务API
global.hubUrl = 'ws://192.168.3.118/IoTCenter/hub?group=page'; // 设备WebSocket访问地址
global.apigateway = 'http://localhost'; // 设置通过API网关访问
//global.resourceUrl = 'http://localhost'; // 媒体文件资源
global.iotCenterUrl = 'http://localhost/IoTCenter'; // IoT服务API
global.hubUrl = 'ws://localhost/IoTCenter/hub?group=page'; // 设备WebSocket访问地址
return global;
})(window.config||{});
console.log('config init');
Loading…
Cancel
Save