Compare commits
5 Commits
Author | SHA1 | Date |
---|---|---|
Argo Zhang | 80207415bd | |
Argo Zhang | ad77b84859 | |
Argo Zhang | e37836f1b4 | |
Argo Zhang | 369023b0bc | |
Argo Zhang | 95eabfd1a0 |
|
@ -3,7 +3,7 @@
|
||||||
# (note that '\' need to be escaped).
|
# (note that '\' need to be escaped).
|
||||||
|
|
||||||
[issuetracker "Gitee-Issue"]
|
[issuetracker "Gitee-Issue"]
|
||||||
regex = " #([^\\s]{5})"
|
regex = "#((?!.*Issue|issue|Comme|comme).{5})"
|
||||||
url = "https://gitee.com/LongbowEnterprise/BootstrapAdmin/issues/$1?from=project-issue"
|
url = "https://gitee.com/LongbowEnterprise/BootstrapAdmin/issues/$1?from=project-issue"
|
||||||
|
|
||||||
[issuetracker "Gitee-Url"]
|
[issuetracker "Gitee-Url"]
|
||||||
|
|
|
@ -1,96 +1,96 @@
|
||||||
using Bootstrap.Admin.Models;
|
using Bootstrap.Admin.Models;
|
||||||
using Bootstrap.DataAccess;
|
using Bootstrap.DataAccess;
|
||||||
using Longbow.Web;
|
using Longbow.Web;
|
||||||
using Microsoft.AspNetCore.Authentication;
|
using Microsoft.AspNetCore.Authentication;
|
||||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Bootstrap.Admin.Controllers
|
namespace Bootstrap.Admin.Controllers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Account controller.
|
/// Account controller.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[AutoValidateAntiforgeryToken]
|
[AutoValidateAntiforgeryToken]
|
||||||
public class AccountController : Controller
|
public class AccountController : Controller
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public ActionResult Login()
|
public ActionResult Login()
|
||||||
{
|
{
|
||||||
if (DictHelper.RetrieveSystemModel())
|
if (DictHelper.RetrieveSystemModel())
|
||||||
{
|
{
|
||||||
ViewBag.UserName = "Admin";
|
ViewBag.UserName = "Admin";
|
||||||
ViewBag.Password = "123789";
|
ViewBag.Password = "123789";
|
||||||
}
|
|
||||||
return User.Identity.IsAuthenticated ? (ActionResult)Redirect("~/Home/Index") : View("Login", new LoginModel());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Login the specified userName, password and remember.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>The login.</returns>
|
|
||||||
/// <param name="onlineUserSvr"></param>
|
|
||||||
/// <param name="ipLocator"></param>
|
|
||||||
/// <param name="userName">User name.</param>
|
|
||||||
/// <param name="password">Password.</param>
|
|
||||||
/// <param name="remember">Remember.</param>
|
|
||||||
[HttpPost]
|
|
||||||
public async Task<IActionResult> Login([FromServices]IOnlineUsers onlineUserSvr, [FromServices]IIPLocatorProvider ipLocator, string userName, string password, string remember)
|
|
||||||
{
|
|
||||||
if (UserHelper.Authenticate(userName, password, loginUser => CreateLoginUser(onlineUserSvr, ipLocator, HttpContext, loginUser)))
|
|
||||||
{
|
|
||||||
var identity = new ClaimsIdentity(CookieAuthenticationDefaults.AuthenticationScheme);
|
|
||||||
identity.AddClaim(new Claim(ClaimTypes.Name, userName));
|
|
||||||
await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(identity), new AuthenticationProperties { ExpiresUtc = DateTimeOffset.Now.AddDays(DictHelper.RetrieveCookieExpiresPeriod()), IsPersistent = remember == "true" });
|
|
||||||
// redirect origin url
|
|
||||||
var originUrl = Request.Query[CookieAuthenticationDefaults.ReturnUrlParameter].FirstOrDefault() ?? "~/Home/Index";
|
|
||||||
return Redirect(originUrl);
|
|
||||||
}
|
}
|
||||||
return View("Login", new LoginModel());
|
return User.Identity.IsAuthenticated ? (ActionResult)Redirect("~/Home/Index") : View("Login", new LoginModel());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Login the specified userName, password and remember.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="onlineUserSvr"></param>
|
/// <returns>The login.</returns>
|
||||||
/// <param name="ipLocator"></param>
|
/// <param name="onlineUserSvr"></param>
|
||||||
/// <param name="context"></param>
|
/// <param name="ipLocator"></param>
|
||||||
/// <param name="loginUser"></param>
|
/// <param name="userName">User name.</param>
|
||||||
internal static void CreateLoginUser(IOnlineUsers onlineUserSvr, IIPLocatorProvider ipLocator, HttpContext context, LoginUser loginUser)
|
/// <param name="password">Password.</param>
|
||||||
{
|
/// <param name="remember">Remember.</param>
|
||||||
var agent = new UserAgent(context.Request.Headers["User-Agent"]);
|
[HttpPost]
|
||||||
loginUser.Ip = (context.Connection.RemoteIpAddress ?? IPAddress.IPv6Loopback).ToString();
|
public async Task<IActionResult> Login([FromServices]IOnlineUsers onlineUserSvr, [FromServices]IIPLocatorProvider ipLocator, string userName, string password, string remember)
|
||||||
loginUser.City = ipLocator.Locate(loginUser.Ip);
|
{
|
||||||
loginUser.Browser = $"{agent.Browser.Name} {agent.Browser.Version}";
|
if (UserHelper.Authenticate(userName, password, loginUser => CreateLoginUser(onlineUserSvr, ipLocator, HttpContext, loginUser)))
|
||||||
loginUser.OS = $"{agent.OS.Name} {agent.OS.Version}";
|
{
|
||||||
}
|
var identity = new ClaimsIdentity(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||||
|
identity.AddClaim(new Claim(ClaimTypes.Name, userName));
|
||||||
/// <summary>
|
await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(identity), new AuthenticationProperties { ExpiresUtc = DateTimeOffset.Now.AddDays(DictHelper.RetrieveCookieExpiresPeriod()), IsPersistent = remember == "true" });
|
||||||
/// Logout this instance.
|
// redirect origin url
|
||||||
/// </summary>
|
var originUrl = Request.Query[CookieAuthenticationDefaults.ReturnUrlParameter].FirstOrDefault() ?? "~/Home/Index";
|
||||||
/// <returns>The logout.</returns>
|
return Redirect(originUrl);
|
||||||
public async Task<IActionResult> Logout()
|
}
|
||||||
{
|
return View("Login", new LoginModel());
|
||||||
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
}
|
||||||
return Redirect("~" + CookieAuthenticationDefaults.LoginPath);
|
|
||||||
}
|
/// <summary>
|
||||||
|
///
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// Accesses the denied.
|
/// <param name="onlineUserSvr"></param>
|
||||||
/// </summary>
|
/// <param name="ipLocator"></param>
|
||||||
/// <returns>The denied.</returns>
|
/// <param name="context"></param>
|
||||||
[ResponseCache(Duration = 600)]
|
/// <param name="loginUser"></param>
|
||||||
public ActionResult AccessDenied() => View("Error", ErrorModel.CreateById(403));
|
internal static void CreateLoginUser(IOnlineUsers onlineUserSvr, IIPLocatorProvider ipLocator, HttpContext context, LoginUser loginUser)
|
||||||
}
|
{
|
||||||
|
var agent = new UserAgent(context.Request.Headers["User-Agent"]);
|
||||||
|
loginUser.Ip = (context.Connection.RemoteIpAddress ?? IPAddress.IPv6Loopback).ToString();
|
||||||
|
loginUser.City = ipLocator.Locate(loginUser.Ip);
|
||||||
|
loginUser.Browser = $"{agent.Browser.Name} {agent.Browser.Version}";
|
||||||
|
loginUser.OS = $"{agent.OS.Name} {agent.OS.Version}";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Logout this instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The logout.</returns>
|
||||||
|
public async Task<IActionResult> Logout()
|
||||||
|
{
|
||||||
|
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||||
|
return Redirect("~" + CookieAuthenticationDefaults.LoginPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Accesses the denied.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The denied.</returns>
|
||||||
|
[ResponseCache(Duration = 600)]
|
||||||
|
public ActionResult AccessDenied() => View("Error", ErrorModel.CreateById(403));
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -17,7 +17,7 @@ namespace Bootstrap.Admin.Controllers
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
{
|
{
|
||||||
var model = new HeaderBarModel(User.Identity);
|
var model = new NavigatorBarModel(this);
|
||||||
var url = DictHelper.RetrieveHomeUrl(model.AppCode);
|
var url = DictHelper.RetrieveHomeUrl(model.AppCode);
|
||||||
return url.Equals("~/Home/Index", System.StringComparison.OrdinalIgnoreCase) ? (IActionResult)View(model) : Redirect(url);
|
return url.Equals("~/Home/Index", System.StringComparison.OrdinalIgnoreCase) ? (IActionResult)View(model) : Redirect(url);
|
||||||
}
|
}
|
||||||
|
@ -30,12 +30,12 @@ namespace Bootstrap.Admin.Controllers
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public IActionResult Error(int id)
|
public IActionResult Error(int id)
|
||||||
{
|
{
|
||||||
var model = ErrorModel.CreateById(id);
|
var model = ErrorModel.CreateById(id);
|
||||||
if (id != 403)
|
if (id != 403)
|
||||||
{
|
{
|
||||||
var returnUrl = Request.Query[CookieAuthenticationDefaults.ReturnUrlParameter].ToString();
|
var returnUrl = Request.Query[CookieAuthenticationDefaults.ReturnUrlParameter].ToString();
|
||||||
if (!string.IsNullOrEmpty(returnUrl)) model.ReturnUrl = returnUrl;
|
if (!string.IsNullOrEmpty(returnUrl)) model.ReturnUrl = returnUrl;
|
||||||
}
|
}
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,5 @@
|
||||||
@model ModelBase
|
@model ModelBase
|
||||||
@{
|
@{
|
||||||
ViewBag.Title = "后台管理";
|
ViewBag.Title = "后台管理";
|
||||||
|
Layout = "_Frame";
|
||||||
}
|
}
|
||||||
@section css {
|
|
||||||
<style>
|
|
||||||
.main-content {
|
|
||||||
position: fixed;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main-content h4 {
|
|
||||||
color: #fff;
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
}
|
|
||||||
@section javascript {
|
|
||||||
<script>
|
|
||||||
$(function () {
|
|
||||||
$('#main-content').addClass('welcome-bg');
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
}
|
|
||||||
<h4>欢迎使用后台管理</h4>
|
|
|
@ -1,18 +1,4 @@
|
||||||
@{
|
@{
|
||||||
ViewBag.Title = "首页";
|
ViewBag.Title = "首页";
|
||||||
Layout = "_Bootstrap";
|
Layout = "_Frame";
|
||||||
}
|
}
|
||||||
@section css {
|
|
||||||
<style type="text/css">
|
|
||||||
.content-body {
|
|
||||||
position: fixed;
|
|
||||||
left: 0;
|
|
||||||
bottom: 40px;
|
|
||||||
right: 0;
|
|
||||||
top: 96px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
}
|
|
||||||
<div class="content-body welcome-bg">
|
|
||||||
</div>
|
|
|
@ -1,5 +1,5 @@
|
||||||
@model ModelBase
|
@model ModelBase
|
||||||
<footer class="position-fixed">
|
<footer>
|
||||||
<div><span id="websiteFooter">@Model.Footer</span><span asp-condition="@Model.IsDemo">(演示系统)</span></div>
|
<div><span id="websiteFooter">@Model.Footer</span><span asp-condition="@Model.IsDemo">(演示系统)</span></div>
|
||||||
<a id="gotoTop" href="#" class="go-top" title="返回顶部" data-toggle="tooltip" data-placement="left">
|
<a id="gotoTop" href="#" class="go-top" title="返回顶部" data-toggle="tooltip" data-placement="left">
|
||||||
<i class="fa fa-angle-up"></i>
|
<i class="fa fa-angle-up"></i>
|
||||||
|
|
|
@ -1,48 +1,44 @@
|
||||||
@{
|
@{
|
||||||
Layout = "_Bootstrap";
|
Layout = "_Bootstrap";
|
||||||
}
|
}
|
||||||
@section css {
|
@section css {
|
||||||
<environment include="Development">
|
<environment include="Development">
|
||||||
<link href="~/lib/toastr.js/toastr.css" rel="stylesheet" />
|
<link href="~/lib/toastr.js/toastr.css" rel="stylesheet" />
|
||||||
<link href="~/lib/nprogress/nprogress.css" rel="stylesheet" />
|
<link href="~/lib/bootstrap-sweetalert/sweetalert.css" rel="stylesheet" />
|
||||||
<link href="~/lib/bootstrap-sweetalert/sweetalert.css" rel="stylesheet" />
|
<link href="~/lib/scrollbar/jquery.mCustomScrollbar.css" rel="stylesheet" />
|
||||||
<link href="~/lib/scrollbar/jquery.mCustomScrollbar.css" rel="stylesheet" />
|
</environment>
|
||||||
</environment>
|
<environment exclude="Development">
|
||||||
<environment exclude="Development">
|
<link href="~/lib/toastr.js/toastr.min.css" rel="stylesheet" />
|
||||||
<link href="~/lib/toastr.js/toastr.min.css" rel="stylesheet" />
|
<link href="~/lib/bootstrap-sweetalert/sweetalert.min.css" rel="stylesheet" />
|
||||||
<link href="~/lib/nprogress/nprogress.min.css" rel="stylesheet" />
|
<link href="~/lib/scrollbar/jquery.mCustomScrollbar.min.css" rel="stylesheet" />
|
||||||
<link href="~/lib/bootstrap-sweetalert/sweetalert.min.css" rel="stylesheet" />
|
</environment>
|
||||||
<link href="~/lib/scrollbar/jquery.mCustomScrollbar.min.css" rel="stylesheet" />
|
@RenderSection("css", false)
|
||||||
</environment>
|
}
|
||||||
@RenderSection("css", false)
|
@section javascript {
|
||||||
}
|
<environment include="Development">
|
||||||
@section javascript {
|
<script src="~/lib/scrollbar/jquery.mousewheel.js"></script>
|
||||||
<environment include="Development">
|
<script src="~/lib/scrollbar/jquery.mCustomScrollbar.js"></script>
|
||||||
<script src="~/lib/scrollbar/jquery.mousewheel.js"></script>
|
<script src="~/lib/signalr/dist/browser/signalr.js"></script>
|
||||||
<script src="~/lib/scrollbar/jquery.mCustomScrollbar.js"></script>
|
<script src="~/lib/dcjqaccordion/js/jquery.dcjqaccordion.2.7.js"></script>
|
||||||
<script src="~/lib/signalr/dist/browser/signalr.js"></script>
|
<script src="~/lib/bootstrap-sweetalert/sweetalert.js"></script>
|
||||||
<script src="~/lib/dcjqaccordion/js/jquery.dcjqaccordion.2.7.js"></script>
|
</environment>
|
||||||
<script src="~/lib/bootstrap-sweetalert/sweetalert.js"></script>
|
<environment exclude="Development">
|
||||||
<script src="~/lib/nprogress/nprogress.js"></script>
|
<script src="~/lib/scrollbar/jquery.mousewheel.min.js"></script>
|
||||||
</environment>
|
<script src="~/lib/scrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
|
||||||
<environment exclude="Development">
|
<script src="~/lib/signalr/dist/browser/signalr.min.js"></script>
|
||||||
<script src="~/lib/scrollbar/jquery.mousewheel.min.js"></script>
|
<script src="~/lib/dcjqaccordion/js/jquery.dcjqaccordion.2.7.min.js"></script>
|
||||||
<script src="~/lib/scrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
|
<script src="~/lib/bootstrap-sweetalert/sweetalert.min.js"></script>
|
||||||
<script src="~/lib/signalr/dist/browser/signalr.min.js"></script>
|
</environment>
|
||||||
<script src="~/lib/dcjqaccordion/js/jquery.dcjqaccordion.2.7.min.js"></script>
|
<script src="~/lib/toastr.js/toastr.min.js"></script>
|
||||||
<script src="~/lib/bootstrap-sweetalert/sweetalert.min.js"></script>
|
<script src="~/lib/dcjqaccordion/js/jquery.cookie.js"></script>
|
||||||
<script src="~/lib/nprogress/nprogress.min.js"></script>
|
<script src="~/js/common-scripts.js" asp-append-version="true"></script>
|
||||||
</environment>
|
@RenderSection("javascript", false)
|
||||||
<script src="~/lib/toastr.js/toastr.min.js"></script>
|
<script src="~/js/log.js" asp-append-version="true"></script>
|
||||||
<script src="~/lib/dcjqaccordion/js/jquery.cookie.js"></script>
|
}
|
||||||
<script src="~/js/common-scripts.js" asp-append-version="true"></script>
|
<section id="main-content" class="main-content">
|
||||||
@RenderSection("javascript", false)
|
@RenderBody()
|
||||||
<script src="~/js/log.js" asp-append-version="true"></script>
|
</section>
|
||||||
}
|
@await Html.PartialAsync("Footer")
|
||||||
@await Html.PartialAsync("navigator")
|
@section modal {
|
||||||
<section id="main-content" class="main-content">
|
@RenderSection("modal", false)
|
||||||
@RenderBody()
|
|
||||||
</section>
|
|
||||||
@section modal {
|
|
||||||
@RenderSection("modal", false)
|
|
||||||
}
|
}
|
|
@ -31,7 +31,5 @@
|
||||||
<script src="~/lib/longbow/longbow.common.js" asp-append-version="true"></script>
|
<script src="~/lib/longbow/longbow.common.js" asp-append-version="true"></script>
|
||||||
@RenderSection("javascript", false)
|
@RenderSection("javascript", false)
|
||||||
}
|
}
|
||||||
@await Html.PartialAsync("Header")
|
|
||||||
@RenderBody()
|
@RenderBody()
|
||||||
@await Html.PartialAsync("Footer")
|
|
||||||
@RenderSection("modal", false)
|
@RenderSection("modal", false)
|
|
@ -0,0 +1,85 @@
|
||||||
|
@{
|
||||||
|
Layout = "_Layout";
|
||||||
|
ViewBag.Frame = "frame";
|
||||||
|
}
|
||||||
|
@section css {
|
||||||
|
<environment include="Development">
|
||||||
|
<link href="~/lib/twitter-bootstrap/css/bootstrap.css" rel="stylesheet" />
|
||||||
|
<link href="~/lib/font-awesome/css/font-awesome.css" rel="stylesheet" />
|
||||||
|
<link href="~/lib/toastr.js/toastr.css" rel="stylesheet" />
|
||||||
|
<link href="~/lib/nprogress/nprogress.css" rel="stylesheet" />
|
||||||
|
<link href="~/lib/bootstrap-sweetalert/sweetalert.css" rel="stylesheet" />
|
||||||
|
<link href="~/lib/scrollbar/jquery.mCustomScrollbar.css" rel="stylesheet" />
|
||||||
|
</environment>
|
||||||
|
<environment exclude="Development">
|
||||||
|
<link href="~/lib/twitter-bootstrap/css/bootstrap.min.css" rel="stylesheet" />
|
||||||
|
<link href="~/lib/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
|
||||||
|
<link href="~/lib/toastr.js/toastr.min.css" rel="stylesheet" />
|
||||||
|
<link href="~/lib/nprogress/nprogress.min.css" rel="stylesheet" />
|
||||||
|
<link href="~/lib/bootstrap-sweetalert/sweetalert.min.css" rel="stylesheet" />
|
||||||
|
<link href="~/lib/scrollbar/jquery.mCustomScrollbar.min.css" rel="stylesheet" />
|
||||||
|
</environment>
|
||||||
|
@RenderSection("css", false)
|
||||||
|
<link href="~/css/theme.css" rel="stylesheet" asp-append-version="true" />
|
||||||
|
<link href="~/css/theme-responsive.css" rel="stylesheet" asp-append-version="true" />
|
||||||
|
<link href="~/css/site.css" rel="stylesheet" asp-append-version="true" />
|
||||||
|
<link href="~/css/site-responsive.css" rel="stylesheet" asp-append-version="true" />
|
||||||
|
@if (!string.IsNullOrEmpty(Model.ActiveCss))
|
||||||
|
{
|
||||||
|
<link href="~/css/@Model.ActiveCss" rel="stylesheet" asp-append-version="true" />
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@section javascript {
|
||||||
|
<environment include="Development">
|
||||||
|
<script src="~/lib/twitter-bootstrap/js/bootstrap.bundle.js"></script>
|
||||||
|
<script src="~/lib/scrollbar/jquery.mousewheel.js"></script>
|
||||||
|
<script src="~/lib/scrollbar/jquery.mCustomScrollbar.js"></script>
|
||||||
|
<script src="~/lib/signalr/dist/browser/signalr.js"></script>
|
||||||
|
<script src="~/lib/dcjqaccordion/js/jquery.dcjqaccordion.2.7.js"></script>
|
||||||
|
<script src="~/lib/bootstrap-sweetalert/sweetalert.js"></script>
|
||||||
|
<script src="~/lib/nprogress/nprogress.js"></script>
|
||||||
|
</environment>
|
||||||
|
<environment exclude="Development">
|
||||||
|
<script src="~/lib/twitter-bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="~/lib/scrollbar/jquery.mousewheel.min.js"></script>
|
||||||
|
<script src="~/lib/scrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
|
||||||
|
<script src="~/lib/signalr/dist/browser/signalr.min.js"></script>
|
||||||
|
<script src="~/lib/dcjqaccordion/js/jquery.dcjqaccordion.2.7.min.js"></script>
|
||||||
|
<script src="~/lib/bootstrap-sweetalert/sweetalert.min.js"></script>
|
||||||
|
<script src="~/lib/nprogress/nprogress.min.js"></script>
|
||||||
|
</environment>
|
||||||
|
<script src="~/lib/toastr.js/toastr.min.js"></script>
|
||||||
|
<script src="~/lib/dcjqaccordion/js/jquery.cookie.js"></script>
|
||||||
|
<script src="~/lib/longbow/longbow.common.js" asp-append-version="true"></script>
|
||||||
|
<script src="~/js/common-scripts.js" asp-append-version="true"></script>
|
||||||
|
@RenderSection("javascript", false)
|
||||||
|
<script src="~/js/log.js" asp-append-version="true"></script>
|
||||||
|
}
|
||||||
|
@await Html.PartialAsync("Header")
|
||||||
|
@await Html.PartialAsync("navigator")
|
||||||
|
<section class="main-content">
|
||||||
|
<div class="nav-ba">
|
||||||
|
<div class="nav-prev" data-method="prev">
|
||||||
|
<a class="nav-link" href="#"><i class="fa fa-chevron-circle-left"></i></a>
|
||||||
|
</div>
|
||||||
|
<div class="flex-fill" style="overflow: hidden;">
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" href="~/html/index.html">
|
||||||
|
<span>后台管理</span>
|
||||||
|
</a>
|
||||||
|
<i class="nav-close fa fa-times-circle-o"></i>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item flex-fill">
|
||||||
|
<a class="nav-link flex-fill" href="#"> </a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="nav-next" data-method="next">
|
||||||
|
<a class="nav-link" href="#"><i class="fa fa-chevron-circle-right"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<iframe frameborder="0" height="100%" width="100%" class="active" src="~/html/index.html"></iframe>
|
||||||
|
@RenderBody()
|
||||||
|
</section>
|
||||||
|
@await Html.PartialAsync("Footer")
|
|
@ -13,7 +13,7 @@
|
||||||
<link href="../css/IE8.css" rel="stylesheet" />
|
<link href="../css/IE8.css" rel="stylesheet" />
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="@ViewBag.Frame">
|
||||||
<!--[if lt IE 10 ]>
|
<!--[if lt IE 10 ]>
|
||||||
<div id="ieAlert" class="alert alert-danger alert-dismissible">
|
<div id="ieAlert" class="alert alert-danger alert-dismissible">
|
||||||
<div>当前浏览器版本太低,不支持本系统,请升级到至少IE10 <a href="../browser/IE10.exe" target="_blank">本地下载</a> <a href="https://support.microsoft.com/zh-cn/help/17621/internet-explorer-downloads" target="_blank">微软下载</a>,或者使用Chrome浏览器 <a href="../browser/ChromeSetup.exe" target="_blank">本地下载</a></div>
|
<div>当前浏览器版本太低,不支持本系统,请升级到至少IE10 <a href="../browser/IE10.exe" target="_blank">本地下载</a> <a href="https://support.microsoft.com/zh-cn/help/17621/internet-explorer-downloads" target="_blank">微软下载</a>,或者使用Chrome浏览器 <a href="../browser/ChromeSetup.exe" target="_blank">本地下载</a></div>
|
||||||
|
|
|
@ -1,83 +1,115 @@
|
||||||
@media (min-width: 568px) {
|
@media (min-width: 568px) {
|
||||||
.cache-item > :nth-child(2) {
|
.cache-item > :nth-child(2) {
|
||||||
flex: 0 0 144px;
|
flex: 0 0 144px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cache-item > :nth-child(4) {
|
.cache-item > :nth-child(4) {
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
display: block;
|
display: block;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bootstrap-table .bs-bars .gear {
|
.bootstrap-table .bs-bars .gear {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bootstrap-table .bs-bars .toolbar {
|
.bootstrap-table .bs-bars .toolbar {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 667px) {
|
@media (min-width: 667px) {
|
||||||
.header .nav {
|
.header .nav {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-toggle-box {
|
.sidebar-toggle-box {
|
||||||
flex: 0 1 auto;
|
flex: 0 1 auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
@media (min-width: 768px) {
|
||||||
html {
|
html {
|
||||||
-ms-overflow-style: none;
|
-ms-overflow-style: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-content {
|
.main-content {
|
||||||
position: fixed;
|
overflow: auto;
|
||||||
overflow: auto;
|
-ms-overflow-style: auto;
|
||||||
-ms-overflow-style: auto;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.header, footer {
|
@media (min-width: 769px) {
|
||||||
position: fixed;
|
.sidebar-open aside {
|
||||||
}
|
transform: translate(-100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 769px) {
|
footer {
|
||||||
.sidebar-open aside {
|
display: none;
|
||||||
transform: translate(-100%);
|
}
|
||||||
}
|
|
||||||
|
.sidebar-open footer {
|
||||||
.sidebar-open footer {
|
display: flex;
|
||||||
display: flex;
|
}
|
||||||
}
|
|
||||||
|
aside {
|
||||||
aside {
|
transition: none;
|
||||||
transition: none;
|
transform: translate(0);
|
||||||
transform: translate(0);
|
width: 210px;
|
||||||
width: 210px;
|
overflow: hidden;
|
||||||
overflow: hidden;
|
}
|
||||||
bottom: 40px;
|
|
||||||
}
|
.sidebar-open .main-content, .sidebar-open.frame .main-content {
|
||||||
|
margin-left: 0;
|
||||||
.sidebar-open .main-content {
|
display: block;
|
||||||
margin-left: 0;
|
}
|
||||||
display: block;
|
|
||||||
}
|
.main-content {
|
||||||
|
transition: none;
|
||||||
.main-content {
|
top: 0;
|
||||||
margin-left: 210px;
|
}
|
||||||
transition: none;
|
|
||||||
}
|
.frame .main-content {
|
||||||
}
|
overflow: hidden;
|
||||||
|
margin-left: 210px;
|
||||||
@media (min-width: 1077px) {
|
}
|
||||||
.bootstrap-table .bs-bars .btn span:last-child {
|
|
||||||
display: inline;
|
.frame .breadcrumb {
|
||||||
}
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.frame .nav-ba {
|
||||||
|
display: flex;
|
||||||
|
position: absolute;
|
||||||
|
top: 6px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.frame aside, .frame .main-content {
|
||||||
|
top: 58px;
|
||||||
|
bottom: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.frame footer {
|
||||||
|
position: fixed;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.frame iframe {
|
||||||
|
padding-top: 45px;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 1077px) {
|
||||||
|
.bootstrap-table .bs-bars .btn span:last-child {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,43 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-cn">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
<link rel="icon" href="~/favicon.ico" type="image/x-icon" />
|
||||||
|
<link rel="shortcut icon" href="~/favicon.ico" type="image/x-icon" />
|
||||||
|
<link rel="apple-touch-icon" href="~/favicon.png" />
|
||||||
|
<title>后台管理</title>
|
||||||
|
<style>
|
||||||
|
.main-content {
|
||||||
|
background-image: url('../images/bg.jpg');
|
||||||
|
background-size: 100% 100%;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-content h4 {
|
||||||
|
color: #fff;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<!--[if lt IE 10 ]>
|
||||||
|
<link href="../css/IE8.css" rel="stylesheet" />
|
||||||
|
<![endif]-->
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!--[if lt IE 10 ]>
|
||||||
|
<div id="ieAlert" class="alert alert-danger alert-dismissible">
|
||||||
|
<div>当前浏览器版本太低,不支持本系统,请升级到至少IE10 <a href="../browser/IE10.exe" target="_blank">本地下载</a> <a href="https://support.microsoft.com/zh-cn/help/17621/internet-explorer-downloads" target="_blank">微软下载</a>,或者使用Chrome浏览器 <a href="../browser/ChromeSetup.exe" target="_blank">本地下载</a></div>
|
||||||
|
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">关闭</span></button>
|
||||||
|
</div>
|
||||||
|
<![endif]-->
|
||||||
|
<div class="main-content">
|
||||||
|
<h4>欢迎使用后台管理</h4>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -1,290 +1,401 @@
|
||||||
(function ($) {
|
(function ($) {
|
||||||
var formatCategoryName = function(menu) {
|
var formatCategoryName = function (menu) {
|
||||||
var ret = "";
|
var ret = "";
|
||||||
if (menu.IsResource === 2) ret = "按钮";
|
if (menu.IsResource === 2) ret = "按钮";
|
||||||
else if (menu.IsResource === 1) ret = "资源";
|
else if (menu.IsResource === 1) ret = "资源";
|
||||||
else ret = menu.CategoryName;
|
else ret = menu.CategoryName;
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
var cascadeMenu = function (menus) {
|
var cascadeMenu = function (menus) {
|
||||||
var html = "";
|
var html = "";
|
||||||
$.each(menus, function (index, menu) {
|
$.each(menus, function (index, menu) {
|
||||||
if (menu.Menus.length === 0) {
|
if (menu.Menus.length === 0) {
|
||||||
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{4}" data-category="{3}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><div class="checkbox"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><div class="radio"><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><span class="menuType">{5}</span><span class="menuOrder">{4}</span></div></li>', menu.Id, menu.Icon, menu.Name, menu.Category, menu.Order, formatCategoryName(menu));
|
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{4}" data-category="{3}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><div class="checkbox"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><div class="radio"><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><span class="menuType">{5}</span><span class="menuOrder">{4}</span></div></li>', menu.Id, menu.Icon, menu.Name, menu.Category, menu.Order, formatCategoryName(menu));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{5}" data-category="{3}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><div class="checkbox"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><div class="radio"><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><span class="menuType">{6}</span><span class="menuOrder">{5}</span></div><ol class="dd-list">{4}</ol></li>', menu.Id, menu.Icon, menu.Name, menu.Category, cascadeSubMenu(menu.Menus), menu.Order, formatCategoryName(menu));
|
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{5}" data-category="{3}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><div class="checkbox"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><div class="radio"><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><span class="menuType">{6}</span><span class="menuOrder">{5}</span></div><ol class="dd-list">{4}</ol></li>', menu.Id, menu.Icon, menu.Name, menu.Category, cascadeSubMenu(menu.Menus), menu.Order, formatCategoryName(menu));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return html;
|
return html;
|
||||||
};
|
};
|
||||||
|
|
||||||
var cascadeSubMenu = function (menus) {
|
var cascadeSubMenu = function (menus) {
|
||||||
var html = "";
|
var html = "";
|
||||||
$.each(menus, function (index, menu) {
|
$.each(menus, function (index, menu) {
|
||||||
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{4}" data-category="{3}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><div class="checkbox"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><div class="radio"><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><span class="menuType">{5}</span><span class="menuOrder">{4}</span></div></li>', menu.Id, menu.Icon, menu.Name, menu.Category, menu.Order, formatCategoryName(menu));
|
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{4}" data-category="{3}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><div class="checkbox"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><div class="radio"><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><span class="menuType">{5}</span><span class="menuOrder">{4}</span></div></li>', menu.Id, menu.Icon, menu.Name, menu.Category, menu.Order, formatCategoryName(menu));
|
||||||
});
|
});
|
||||||
return html;
|
return html;
|
||||||
};
|
};
|
||||||
|
|
||||||
var setBadge = function (source) {
|
var setBadge = function (source) {
|
||||||
var data = $.extend({
|
var data = $.extend({
|
||||||
TasksCount: 0,
|
TasksCount: 0,
|
||||||
AppExceptionsCount: 0,
|
AppExceptionsCount: 0,
|
||||||
DbExceptionsCount: 0,
|
DbExceptionsCount: 0,
|
||||||
MessagesCount: 0,
|
MessagesCount: 0,
|
||||||
NewUsersCount: 0
|
NewUsersCount: 0
|
||||||
}, source);
|
}, source);
|
||||||
$('#msgHeaderTaskBadge').text(data.TasksCount === 0 ? "" : data.TasksCount);
|
$('#msgHeaderTaskBadge').text(data.TasksCount === 0 ? "" : data.TasksCount);
|
||||||
$('#msgHeaderUserBadge').text(data.NewUsersCount === 0 ? "" : data.NewUsersCount);
|
$('#msgHeaderUserBadge').text(data.NewUsersCount === 0 ? "" : data.NewUsersCount);
|
||||||
$('#msgHeaderAppBadge').text(data.AppExceptionsCount === 0 ? "" : data.AppExceptionsCount);
|
$('#msgHeaderAppBadge').text(data.AppExceptionsCount === 0 ? "" : data.AppExceptionsCount);
|
||||||
$('#msgHeaderDbBadge').text(data.DbExceptionsCount === 0 ? "" : data.DbExceptionsCount);
|
$('#msgHeaderDbBadge').text(data.DbExceptionsCount === 0 ? "" : data.DbExceptionsCount);
|
||||||
$('#msgHeaderMsgBadge').text(data.MessagesCount === 0 ? "" : data.MessagesCount);
|
$('#msgHeaderMsgBadge').text(data.MessagesCount === 0 ? "" : data.MessagesCount);
|
||||||
$('#logoutNoti').text(data.NewUsersCount === 0 ? "" : data.NewUsersCount);
|
$('#logoutNoti').text(data.NewUsersCount === 0 ? "" : data.NewUsersCount);
|
||||||
};
|
};
|
||||||
|
|
||||||
$.fn.extend({
|
$.fn.extend({
|
||||||
nestMenu: function (callback) {
|
nestMenu: function (callback) {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
$.bc({
|
$.bc({
|
||||||
id: 0, url: Menu.url, query: { type: "user" }, method: "post",
|
id: 0, url: Menu.url, query: { type: "user" }, method: "post",
|
||||||
callback: function (result) {
|
callback: function (result) {
|
||||||
var html = "";
|
var html = "";
|
||||||
if ($.isArray(result)) html = cascadeMenu(result);
|
if ($.isArray(result)) html = cascadeMenu(result);
|
||||||
$this.find('ol:first').html(html);
|
$this.find('ol:first').html(html);
|
||||||
$this.nestable();
|
$this.nestable();
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
clearWidgetItems: function () {
|
clearWidgetItems: function () {
|
||||||
setBadge(false);
|
setBadge(false);
|
||||||
this.children('.dropdown').each(function () {
|
this.children('.dropdown').each(function () {
|
||||||
$(this).children('.dropdown-menu').each(function () {
|
$(this).children('.dropdown-menu').each(function () {
|
||||||
$(this).children('a').remove();
|
$(this).children('a').remove();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
reloadWidget: function () {
|
reloadWidget: function () {
|
||||||
if (this.length === 0) return this;
|
if (this.length === 0) return this;
|
||||||
var that = this;
|
var that = this;
|
||||||
$.bc({
|
$.bc({
|
||||||
url: Notifications.url,
|
url: Notifications.url,
|
||||||
callback: function (result) {
|
callback: function (result) {
|
||||||
that.clearWidgetItems();
|
that.clearWidgetItems();
|
||||||
if (!result) return;
|
if (!result) return;
|
||||||
|
|
||||||
setBadge(result);
|
setBadge(result);
|
||||||
|
|
||||||
// tasks
|
// tasks
|
||||||
$('#msgHeaderTask').text(result.TasksCount);
|
$('#msgHeaderTask').text(result.TasksCount);
|
||||||
var htmlUserTemplate = '<a class="dropdown-item" href="{4}?id={3}"><span class="desc">{0}-{2}</span><span class="percent">{1}%</span></span><div class="progress progress-striped"><div class="progress-bar" role="progressbar" aria-valuenow="{1}" aria-valuemin="0" aria-valuemax="100" style="width: {1}%"><span class="sr-only">{1}% 完成</span></div></div></a>';
|
var htmlUserTemplate = '<a class="dropdown-item" href="{4}?id={3}"><span class="desc">{0}-{2}</span><span class="percent">{1}%</span></span><div class="progress progress-striped"><div class="progress-bar" role="progressbar" aria-valuenow="{1}" aria-valuemin="0" aria-valuemax="100" style="width: {1}%"><span class="sr-only">{1}% 完成</span></div></div></a>';
|
||||||
var html = result.Tasks.map(function (u) {
|
var html = result.Tasks.map(function (u) {
|
||||||
return $.format(htmlUserTemplate, u.TaskName, u.TaskProgress, u.AssignDisplayName, u.Id, $.formatUrl('Admin/Tasks'));
|
return $.format(htmlUserTemplate, u.TaskName, u.TaskProgress, u.AssignDisplayName, u.Id, $.formatUrl('Admin/Tasks'));
|
||||||
}).join('');
|
}).join('');
|
||||||
$(html).insertAfter($('#msgHeaderTaskContent'));
|
$(html).insertAfter($('#msgHeaderTaskContent'));
|
||||||
|
|
||||||
// new users
|
// new users
|
||||||
$('#msgHeaderUser').text(result.NewUsersCount);
|
$('#msgHeaderUser').text(result.NewUsersCount);
|
||||||
htmlUserTemplate = '<a class="dropdown-item" href="{4}"><span class="label label-success"><i class="fa fa-plus"></i></span><div title="{2}" class="content">{1}({0})</div><span class="small italic">{3}</span></a>';
|
htmlUserTemplate = '<a class="dropdown-item" href="{4}"><span class="label label-success"><i class="fa fa-plus"></i></span><div title="{2}" class="content">{1}({0})</div><span class="small italic">{3}</span></a>';
|
||||||
html = result.Users.map(function (u) {
|
html = result.Users.map(function (u) {
|
||||||
return $.format(htmlUserTemplate, $.safeHtml(u.UserName), $.safeHtml(u.DisplayName), $.safeHtml(u.Description), u.Period, $.formatUrl('Admin/Notifications'));
|
return $.format(htmlUserTemplate, $.safeHtml(u.UserName), $.safeHtml(u.DisplayName), $.safeHtml(u.Description), u.Period, $.formatUrl('Admin/Notifications'));
|
||||||
}).join('');
|
}).join('');
|
||||||
$(html).insertAfter($('#msgHeaderUserContent'));
|
$(html).insertAfter($('#msgHeaderUserContent'));
|
||||||
|
|
||||||
// apps
|
// apps
|
||||||
$('#msgHeaderApp').text(result.AppExceptionsCount);
|
$('#msgHeaderApp').text(result.AppExceptionsCount);
|
||||||
htmlUserTemplate = '<a class="dropdown-item" href="{3}"><span class="label label-warning"><i class="fa fa-bug"></i></span><div title="{1}" class="content">{0}</div><span class="small italic">{2}</span></a>';
|
htmlUserTemplate = '<a class="dropdown-item" href="{3}"><span class="label label-warning"><i class="fa fa-bug"></i></span><div title="{1}" class="content">{0}</div><span class="small italic">{2}</span></a>';
|
||||||
html = result.Apps.map(function (u) {
|
html = result.Apps.map(function (u) {
|
||||||
return $.format(htmlUserTemplate, u.ExceptionType, u.Message, u.Period, $.formatUrl('Admin/Exceptions'));
|
return $.format(htmlUserTemplate, u.ExceptionType, u.Message, u.Period, $.formatUrl('Admin/Exceptions'));
|
||||||
}).join('');
|
}).join('');
|
||||||
$(html).insertAfter($('#msgHeaderAppContent'));
|
$(html).insertAfter($('#msgHeaderAppContent'));
|
||||||
|
|
||||||
// dbs
|
// dbs
|
||||||
$('#msgHeaderDb').text(result.DbExceptionsCount);
|
$('#msgHeaderDb').text(result.DbExceptionsCount);
|
||||||
htmlUserTemplate = '<a class="dropdown-item" href="{3}"><span class="label label-danger"><i class="fa fa-bolt"></i></span><div title="{1}" class="content">{0}</div><span class="small italic">{2}</span></a>';
|
htmlUserTemplate = '<a class="dropdown-item" href="{3}"><span class="label label-danger"><i class="fa fa-bolt"></i></span><div title="{1}" class="content">{0}</div><span class="small italic">{2}</span></a>';
|
||||||
html = result.Dbs.map(function (u) {
|
html = result.Dbs.map(function (u) {
|
||||||
return $.format(htmlUserTemplate, u.ErrorPage, u.Message, u.Period, $.formatUrl('Admin/Exceptions'));
|
return $.format(htmlUserTemplate, u.ErrorPage, u.Message, u.Period, $.formatUrl('Admin/Exceptions'));
|
||||||
}).join('');
|
}).join('');
|
||||||
$(html).insertAfter($('#msgHeaderDbContent'));
|
$(html).insertAfter($('#msgHeaderDbContent'));
|
||||||
|
|
||||||
// messages
|
// messages
|
||||||
$('#msgHeaderMsg').text(result.MessagesCount);
|
$('#msgHeaderMsg').text(result.MessagesCount);
|
||||||
htmlUserTemplate = '<a class="dropdown-item" href="{6}?id={0}"><span class="photo"><img alt="avatar" src="{1}"></span><span class="subject"><span class="from">{2}</span><span class="time">{4}</span></span><span class="message" title="{5}">{3}</span></a>';
|
htmlUserTemplate = '<a class="dropdown-item" href="{6}?id={0}"><span class="photo"><img alt="avatar" src="{1}"></span><span class="subject"><span class="from">{2}</span><span class="time">{4}</span></span><span class="message" title="{5}">{3}</span></a>';
|
||||||
html = result.Messages.map(function (u) {
|
html = result.Messages.map(function (u) {
|
||||||
return $.format(htmlUserTemplate, u.Id, u.FromIcon, $.safeHtml(u.FromDisplayName), $.safeHtml(u.Title), u.Period, $.safeHtml(u.Content), $.formatUrl('Admin/Messages'));
|
return $.format(htmlUserTemplate, u.Id, u.FromIcon, $.safeHtml(u.FromDisplayName), $.safeHtml(u.Title), u.Period, $.safeHtml(u.Content), $.formatUrl('Admin/Messages'));
|
||||||
}).join('');
|
}).join('');
|
||||||
$(html).insertAfter($('#msgHeaderMsgContent'));
|
$(html).insertAfter($('#msgHeaderMsgContent'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
var $sideMenu = $(".sidebar");
|
var $sideMenu = $(".sidebar");
|
||||||
$sideMenu.dcAccordion({
|
$sideMenu.dcAccordion({
|
||||||
autoExpand: true,
|
autoExpand: true,
|
||||||
saveState: false
|
saveState: false
|
||||||
});
|
});
|
||||||
|
|
||||||
// breadcrumb
|
// breadcrumb
|
||||||
var $breadNav = $('#breadNav');
|
var $breadNav = $('#breadNav');
|
||||||
var arch = $sideMenu.find('a.active').last();
|
var arch = $sideMenu.find('a.active').last();
|
||||||
$breadNav.removeClass('d-none').text(arch.text() || $('title').text());
|
$breadNav.removeClass('d-none').text(arch.text() || $('title').text());
|
||||||
|
|
||||||
$.fn.extend({
|
var resizeFrame = function () {
|
||||||
autoScrollSidebar: function (options) {
|
var $nav = $('.main-content .nav');
|
||||||
var option = $.extend({ target: null, offsetTop: 0 }, options);
|
var parentWidth = $nav.parent().width();
|
||||||
var $navItem = option.target;
|
var width = 0;
|
||||||
if ($navItem === null) return this;
|
$nav.children().each(function (index, ele) {
|
||||||
|
if ($(ele).hasClass('flex-fill')) return true;
|
||||||
// sidebar scroll animate
|
width = width + $(ele).width();
|
||||||
var middle = this.outerHeight() / 2;
|
if ($(ele).find('.nav-link').hasClass('active')) {
|
||||||
var top = 0;
|
if (index === 0) width = 0;
|
||||||
if (this.hasClass('mCustomScrollbar')) {
|
return false;
|
||||||
top = $navItem.offset().top - $('header').outerHeight() + option.offsetTop;
|
}
|
||||||
if (top > middle) {
|
});
|
||||||
this.mCustomScrollbar('scrollTo', top - middle);
|
if (width > parentWidth) {
|
||||||
}
|
$nav.css({
|
||||||
}
|
"margin-left": parentWidth - width
|
||||||
else {
|
});
|
||||||
top = $navItem.offset().top + option.offsetTop;
|
}
|
||||||
if (top > middle)
|
else if (width === 0) {
|
||||||
this.animate({
|
$nav.css({
|
||||||
scrollTop: top - middle
|
"margin-left": 0
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return this;
|
};
|
||||||
},
|
|
||||||
addNiceScroll: function () {
|
$.fn.extend({
|
||||||
if ($.browser.versions.ios && $(window).width() > 768) {
|
autoScrollSidebar: function (options) {
|
||||||
this.css('overflow', 'auto');
|
var option = $.extend({ target: null, offsetTop: 0 }, options);
|
||||||
}
|
var $navItem = option.target;
|
||||||
else if (!$.browser.versions.ios && $(window).width() > 768) {
|
if ($navItem === null || $navItem.length === 0) return this;
|
||||||
this.mCustomScrollbar({ theme: 'minimal', mouseWheel: { scrollAmount: 60 } });
|
|
||||||
}
|
// sidebar scroll animate
|
||||||
else {
|
var middle = this.outerHeight() / 2;
|
||||||
this.mCustomScrollbar('destroy');
|
var top = 0;
|
||||||
}
|
if (this.hasClass('mCustomScrollbar')) {
|
||||||
return this;
|
top = $navItem.offset().top - $('header').outerHeight() + option.offsetTop;
|
||||||
}
|
if (top > middle) {
|
||||||
});
|
this.mCustomScrollbar('scrollTo', top - middle);
|
||||||
|
}
|
||||||
// custom scrollbar
|
}
|
||||||
var $sidebar = $('aside').addNiceScroll().autoScrollSidebar({ target: arch.parent(), offsetTop: arch.parent().innerHeight() / 2 });
|
else {
|
||||||
|
top = $navItem.offset().top + option.offsetTop;
|
||||||
$sideMenu.on('click', 'a.dcjq-parent', function () {
|
if (top > middle)
|
||||||
var $this = $(this);
|
this.animate({
|
||||||
if (!$.browser.versions.ios && $(window).width() > 768) {
|
scrollTop: top - middle
|
||||||
setTimeout(function () {
|
});
|
||||||
var offsetScroll = parseInt($this.parents('.mCSB_container').css('top').replace('px', ''));
|
}
|
||||||
$sidebar.autoScrollSidebar({ target: $this.parent(), offsetTop: 25.5 - offsetScroll });
|
return this;
|
||||||
}, 600);
|
},
|
||||||
}
|
addNiceScroll: function () {
|
||||||
else if ($.browser.versions.ios && $(window).width() > 768) {
|
if ($.browser.versions.ios && $(window).width() > 768) {
|
||||||
var offsetScroll = parseInt($this.parents('aside').scrollTop());
|
this.css('overflow', 'auto');
|
||||||
$sidebar.autoScrollSidebar({ target: $this.parent(), offsetTop: 25.5 + offsetScroll });
|
}
|
||||||
}
|
else if (!$.browser.versions.ios && $(window).width() > 768) {
|
||||||
});
|
this.mCustomScrollbar({ theme: 'minimal', mouseWheel: { scrollAmount: 60 } });
|
||||||
|
}
|
||||||
$('.sidebar-toggle-box').on('click', function () {
|
else {
|
||||||
$('body').toggleClass('sidebar-open');
|
this.mCustomScrollbar('destroy');
|
||||||
});
|
}
|
||||||
|
return this;
|
||||||
// Apps
|
},
|
||||||
window.App = {
|
addFrame: function (options) {
|
||||||
url: 'api/Apps',
|
var op = $.extend({ element: null, nav: '.main-content .nav' }, options);
|
||||||
title: "分配应用"
|
var $element = op.element;
|
||||||
};
|
|
||||||
|
// find tab
|
||||||
// Roles
|
var tab = $(op.nav).find('.nav-link').filter(function (index, el) {
|
||||||
window.Role = {
|
return $(el).attr('href') === $element.attr('href');
|
||||||
url: 'api/Roles',
|
});
|
||||||
title: "分配角色"
|
|
||||||
};
|
if (tab && tab.length === 1) {
|
||||||
|
tab.trigger('click');
|
||||||
// Users
|
resizeFrame();
|
||||||
window.User = {
|
return;
|
||||||
url: 'api/Users',
|
}
|
||||||
title: "分配用户"
|
|
||||||
};
|
var li = $.format('<li class="nav-item"><a class="nav-link active" href="{1}"><span>{0}</span></a><i class="nav-close fa fa-times-circle-o"></i></li>', $element.text(), $element.attr('href'));
|
||||||
|
var $nav = $(op.nav);
|
||||||
// Groups
|
$nav.find('.nav-link').removeClass('active');
|
||||||
window.Group = {
|
$(li).insertBefore($nav.find(':last').parent());
|
||||||
url: 'api/Groups',
|
$(this).find('iframe').removeClass('active');
|
||||||
title: "分配部门"
|
$('<iframe frameborder="0" height="100%" width="100%" src="~/Admin/Index"></iframe>').attr('src', $element.attr('href')).addClass('active').appendTo($(this));
|
||||||
};
|
resizeFrame();
|
||||||
|
},
|
||||||
// Menus
|
removeFrame: function (options) {
|
||||||
window.Menu = {
|
var op = $.extend({ element: null, nav: '.main-content .nav' }, options);
|
||||||
url: 'api/Menus',
|
var $element = op.element;
|
||||||
iconView: 'Admin/IconView',
|
var frame = $(this).find('iframe').filter(function (index, el) {
|
||||||
title: "分配菜单"
|
return $(el).attr('src') === $element.attr('href');
|
||||||
};
|
});
|
||||||
|
frame.remove();
|
||||||
// Exceptions
|
|
||||||
window.Exceptions = {
|
var $nav = $(op.nav);
|
||||||
url: 'api/Exceptions',
|
var nav = $nav.find('.nav-link').filter(function (index, el) {
|
||||||
title: "程序异常日志"
|
return $(el).attr('href') === $element.attr('href');
|
||||||
};
|
});
|
||||||
|
|
||||||
// Dicts
|
// active other tab
|
||||||
window.Dicts = {
|
var tab = null;
|
||||||
url: 'api/Dicts'
|
if (nav.hasClass('active')) {
|
||||||
};
|
tab = nav.parent().prev();
|
||||||
|
if (tab.length === 0) {
|
||||||
// Profiles
|
tab = nav.parent().next();
|
||||||
window.Profiles = {
|
}
|
||||||
url: 'api/Profiles',
|
}
|
||||||
del: 'api/Profiles/Delete'
|
nav.parent().remove();
|
||||||
};
|
if (tab && tab.length === 1) {
|
||||||
|
tab.find('.nav-link').trigger('click');
|
||||||
// Settings
|
return;
|
||||||
window.Settings = {
|
}
|
||||||
url: 'api/Settings'
|
resizeFrame();
|
||||||
};
|
},
|
||||||
|
moveFrame: function (method) {
|
||||||
// Messages
|
var $ele = $(this).find('.nav-tabs .nav-link.active');
|
||||||
window.Messages = {
|
if ($ele.length === 1) {
|
||||||
url: 'api/Messages'
|
var target = $ele.parent()[method]();
|
||||||
};
|
if (target.length === 1) {
|
||||||
|
if (target.hasClass('flex-fill')) return;
|
||||||
// Tasks
|
target.find('.nav-link').trigger('click');
|
||||||
window.Tasks = {
|
resizeFrame();
|
||||||
url: 'api/Tasks'
|
}
|
||||||
};
|
}
|
||||||
|
}
|
||||||
// Notifications
|
});
|
||||||
window.Notifications = {
|
|
||||||
url: 'api/Notifications'
|
// custom scrollbar
|
||||||
};
|
var $sidebar = $('aside').addNiceScroll().autoScrollSidebar({ target: arch.parent(), offsetTop: arch.parent().innerHeight() / 2 });
|
||||||
|
|
||||||
// load widget data
|
$sideMenu.on('click', 'a.dcjq-parent', function () {
|
||||||
$('.header .nav').reloadWidget().notifi({
|
var $this = $(this);
|
||||||
url: 'NotiHub',
|
if (!$.browser.versions.ios && $(window).width() > 768) {
|
||||||
callback: function (result) {
|
setTimeout(function () {
|
||||||
var cate = result.Category;
|
var offsetScroll = parseInt($this.parents('.mCSB_container').css('top').replace('px', ''));
|
||||||
var msg = result.Message;
|
$sidebar.autoScrollSidebar({ target: $this.parent(), offsetTop: 25.5 - offsetScroll });
|
||||||
switch (cate) {
|
}, 600);
|
||||||
case "DB":
|
}
|
||||||
toastr.error(msg, "数据库操作发生异常");
|
else if ($.browser.versions.ios && $(window).width() > 768) {
|
||||||
break;
|
var offsetScroll = parseInt($this.parents('aside').scrollTop());
|
||||||
case "Users":
|
$sidebar.autoScrollSidebar({ target: $this.parent(), offsetTop: 25.5 + offsetScroll });
|
||||||
toastr.success(msg, "新用户注册");
|
}
|
||||||
break;
|
});
|
||||||
case "App":
|
|
||||||
toastr.warning(msg, "应用程序发生异常");
|
$('.sidebar-toggle-box').on('click', function () {
|
||||||
break;
|
$('body').toggleClass('sidebar-open');
|
||||||
}
|
});
|
||||||
if (result) this.reloadWidget();
|
|
||||||
}
|
$('.frame .sidebar').on('click', 'a', function (e) {
|
||||||
});
|
e.preventDefault();
|
||||||
|
$('.main-content').addFrame({ element: $(this) });
|
||||||
$(window).on('resize', function () {
|
$('body').removeClass('sidebar-open');
|
||||||
$sidebar.addNiceScroll();
|
});
|
||||||
});
|
|
||||||
|
$('.nav-tabs').on('click', 'a', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
if ($(this).hasClass('flex-fill')) return;
|
||||||
|
|
||||||
|
$('.nav-tabs').find('.nav-link').removeClass('active');
|
||||||
|
$(this).addClass('active');
|
||||||
|
var that = this;
|
||||||
|
$('.main-content iframe').removeClass('active').filter(function (index, ele) {
|
||||||
|
if ($(ele).attr('src') === $(that).attr('href')) $(ele).addClass('active');
|
||||||
|
});
|
||||||
|
}).on('click', '.nav-close', function (e) {
|
||||||
|
$('.main-content').removeFrame({ element: $(this).prev() });
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.nav-prev, .nav-next').on('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
$('.main-content').moveFrame($(this).attr('data-method'));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Apps
|
||||||
|
window.App = {
|
||||||
|
url: 'api/Apps',
|
||||||
|
title: "分配应用"
|
||||||
|
};
|
||||||
|
|
||||||
|
// Roles
|
||||||
|
window.Role = {
|
||||||
|
url: 'api/Roles',
|
||||||
|
title: "分配角色"
|
||||||
|
};
|
||||||
|
|
||||||
|
// Users
|
||||||
|
window.User = {
|
||||||
|
url: 'api/Users',
|
||||||
|
title: "分配用户"
|
||||||
|
};
|
||||||
|
|
||||||
|
// Groups
|
||||||
|
window.Group = {
|
||||||
|
url: 'api/Groups',
|
||||||
|
title: "分配部门"
|
||||||
|
};
|
||||||
|
|
||||||
|
// Menus
|
||||||
|
window.Menu = {
|
||||||
|
url: 'api/Menus',
|
||||||
|
iconView: 'Admin/IconView',
|
||||||
|
title: "分配菜单"
|
||||||
|
};
|
||||||
|
|
||||||
|
// Exceptions
|
||||||
|
window.Exceptions = {
|
||||||
|
url: 'api/Exceptions',
|
||||||
|
title: "程序异常日志"
|
||||||
|
};
|
||||||
|
|
||||||
|
// Dicts
|
||||||
|
window.Dicts = {
|
||||||
|
url: 'api/Dicts'
|
||||||
|
};
|
||||||
|
|
||||||
|
// Profiles
|
||||||
|
window.Profiles = {
|
||||||
|
url: 'api/Profiles',
|
||||||
|
del: 'api/Profiles/Delete'
|
||||||
|
};
|
||||||
|
|
||||||
|
// Settings
|
||||||
|
window.Settings = {
|
||||||
|
url: 'api/Settings'
|
||||||
|
};
|
||||||
|
|
||||||
|
// Messages
|
||||||
|
window.Messages = {
|
||||||
|
url: 'api/Messages'
|
||||||
|
};
|
||||||
|
|
||||||
|
// Tasks
|
||||||
|
window.Tasks = {
|
||||||
|
url: 'api/Tasks'
|
||||||
|
};
|
||||||
|
|
||||||
|
// Notifications
|
||||||
|
window.Notifications = {
|
||||||
|
url: 'api/Notifications'
|
||||||
|
};
|
||||||
|
|
||||||
|
// load widget data
|
||||||
|
$('.header .nav').reloadWidget().notifi({
|
||||||
|
url: 'NotiHub',
|
||||||
|
callback: function (result) {
|
||||||
|
var cate = result.Category;
|
||||||
|
var msg = result.Message;
|
||||||
|
switch (cate) {
|
||||||
|
case "DB":
|
||||||
|
toastr.error(msg, "数据库操作发生异常");
|
||||||
|
break;
|
||||||
|
case "Users":
|
||||||
|
toastr.success(msg, "新用户注册");
|
||||||
|
break;
|
||||||
|
case "App":
|
||||||
|
toastr.warning(msg, "应用程序发生异常");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (result) this.reloadWidget();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(window).on('resize', function () {
|
||||||
|
$sidebar.addNiceScroll();
|
||||||
|
});
|
||||||
});
|
});
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue