diff --git a/Bootstrap.Admin/Controllers/AccountController.cs b/Bootstrap.Admin/Controllers/AccountController.cs index ff4b7af6..b1848642 100644 --- a/Bootstrap.Admin/Controllers/AccountController.cs +++ b/Bootstrap.Admin/Controllers/AccountController.cs @@ -21,8 +21,24 @@ namespace Bootstrap.Admin.Controllers [AutoValidateAntiforgeryToken] public class AccountController : Controller { + /// - /// + /// 系统锁屏界面 + /// + /// + public ActionResult Lock() + { + var user = UserHelper.RetrieveUserByUserName(User.Identity.Name); + //await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); + var urlReferrer = Request.Headers["Referer"].FirstOrDefault(); + return View(new LockModel(this) + { + ReturnUrl = WebUtility.UrlEncode(string.IsNullOrEmpty(urlReferrer) ? CookieAuthenticationDefaults.LoginPath.Value : urlReferrer) + }); + } + + /// + /// 系统登录方法 /// /// [HttpGet] @@ -61,7 +77,7 @@ namespace Bootstrap.Admin.Controllers } /// - /// + /// 创建登录用户信息 /// /// /// diff --git a/Bootstrap.Admin/Models/LockModel.cs b/Bootstrap.Admin/Models/LockModel.cs new file mode 100644 index 00000000..fa90973a --- /dev/null +++ b/Bootstrap.Admin/Models/LockModel.cs @@ -0,0 +1,24 @@ +using Microsoft.AspNetCore.Mvc; + +namespace Bootstrap.Admin.Models +{ + /// + /// 系统锁屏数据模型 + /// + public class LockModel : HeaderBarModel + { + /// + /// 构造函数 + /// + /// + public LockModel(ControllerBase controller) : base(controller.User.Identity) + { + + } + + /// + /// 获得/设置 返回路径 + /// + public string ReturnUrl { get; set; } + } +} diff --git a/Bootstrap.Admin/Views/Account/Lock.cshtml b/Bootstrap.Admin/Views/Account/Lock.cshtml new file mode 100644 index 00000000..34bb4eb6 --- /dev/null +++ b/Bootstrap.Admin/Views/Account/Lock.cshtml @@ -0,0 +1,56 @@ +@model LockModel +@{ + ViewBag.Title = "系统登陆"; + Layout = "~/Views/Shared/_Layout.cshtml"; +} +@section css { + + + + + + + + + + +} +@section javascript { + + + + + + + + + + + + + + + + +} +
+
+
+ lock avatar +

@Model.DisplayName

+ 系统已锁定 +
+ +
+
+ +
+ +
+
+
+
+
+
diff --git a/Bootstrap.Admin/wwwroot/css/lock.css b/Bootstrap.Admin/wwwroot/css/lock.css new file mode 100644 index 00000000..046792a0 --- /dev/null +++ b/Bootstrap.Admin/wwwroot/css/lock.css @@ -0,0 +1,113 @@ +.lock-screen { + background: #02bac6 url("images/lock-bg.jpg"); + background-size: cover; + background-repeat: repeat; +} + +.lock-wrapper { + margin: 6% auto; + max-width: 330px; +} + +.lock-box { + background: rgba(255,255,255,.3); + padding: 20px; + border-radius: 10px; + -webkit-border-radius: 10px; + position: relative; +} + + .lock-box .form-group { + float: inherit !important; + } + +.lock-wrapper img { + border-radius: 50%; + -webkit-border-radius: 50%; + border: 5px solid #28a745; + width: 250px; + height: 250px; +} + +.lock-wrapper h1 { + text-align: center; + color: #fff; + font-size: 18px; + text-transform: uppercase; + padding: 20px 0 0 0; +} + +.lock-wrapper .locked { + margin-bottom: 20px; + display: inline-block; + color: #026f7a; +} + +.btn-lock, .btn-lock:hover { + background: #02b5c2; + color: #fff; +} + +.lock-input { + width: 83%; + border: none; + float: left; + margin-right: 3px; +} + +#time { + width: 100%; + color: #fff; + font-size: 60px; + display: inline-block; + text-align: center; + font-family: 'Open Sans', sans-serif; + font-weight: 300; +} + +.btn-lock, .btn-lock:hover { + background: #02b5c2; + color: #fff; + outline: none !important; + border-left: none; +} + +.has-error .btn-lock { + color: #a94442; + background-color: #f2dede; + border-color: #a94442; +} + +.has-success .btn-lock { + color: #3c763d; + background-color: #dff0d8; + border-color: #3c763d; +} + +div.input-group span { + top: 0; + background: #02b5c2; + border-color: #2e6da4; + color: #fff; +} + +.form-inline .input-group input:focus { + z-index: auto; +} + +div.input-group input, div.input-group input:hover, .btn-lock { + border-color: #1d9238; +} + +div.input-group input:focus { + box-shadow: none; +} + +div.input-group input, div.input-group input:hover, div.input-group input:focus { + border-right: none; +} + + div.input-group input.error { + background-color: #dcc4c4; + border-color: #e21717; + } \ No newline at end of file diff --git a/Bootstrap.Admin/wwwroot/js/lock.js b/Bootstrap.Admin/wwwroot/js/lock.js new file mode 100644 index 00000000..ca02b45d --- /dev/null +++ b/Bootstrap.Admin/wwwroot/js/lock.js @@ -0,0 +1,12 @@ +$(function () { + $('body').addClass('lock-screen'); + $('#time').text((new Date()).format('HH:mm:ss')); + + setInterval(function () { + $('#time').text((new Date()).format('HH:mm:ss')); + }, 500); + + $.extend($.validator.messages, { required: "请输入密码" }); + + $(".lock-wrapper").autoCenter(); +});