From b1234c997805132e6b8afb58cf7be875ae4bd84d Mon Sep 17 00:00:00 2001 From: Argo-MacBookPro Date: Sun, 26 Aug 2018 17:14:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8A=9F=E8=83=BD=EF=BC=9A?= =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=96=B0=E7=94=A8=E6=88=B7=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=88=A0=E9=99=A4=E5=8E=9F=E6=9C=89?= =?UTF-8?q?Register=E7=9B=B8=E5=85=B3=E9=A1=B5=E9=9D=A2=E4=B8=8E=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/AccountController.cs | 10 - .../Controllers/Api/NewController.cs | 8 + Bootstrap.Admin/Views/Account/Register.cshtml | 112 ----------- Bootstrap.Admin/Views/Account/SignIn.cshtml | 58 +++--- Bootstrap.Admin/Views/Shared/_Login.cshtml | 81 +++++++- Bootstrap.Admin/wwwroot/css/login.css | 16 +- Bootstrap.Admin/wwwroot/css/loginm.css | 14 +- Bootstrap.Admin/wwwroot/css/register.css | 174 ------------------ Bootstrap.Admin/wwwroot/js/Login.js | 24 +++ Bootstrap.Admin/wwwroot/js/Longbow.Common.js | 2 +- Bootstrap.Admin/wwwroot/js/common-scripts.js | 5 +- Bootstrap.Admin/wwwroot/js/register.js | 19 -- 12 files changed, 152 insertions(+), 371 deletions(-) delete mode 100644 Bootstrap.Admin/Views/Account/Register.cshtml delete mode 100644 Bootstrap.Admin/wwwroot/css/register.css delete mode 100644 Bootstrap.Admin/wwwroot/js/register.js diff --git a/Bootstrap.Admin/Controllers/AccountController.cs b/Bootstrap.Admin/Controllers/AccountController.cs index 632145ef..8de99fcd 100644 --- a/Bootstrap.Admin/Controllers/AccountController.cs +++ b/Bootstrap.Admin/Controllers/AccountController.cs @@ -58,16 +58,6 @@ namespace Bootstrap.Admin.Controllers /// /// /// - public ActionResult Register(User p) - { - if (string.IsNullOrEmpty(p.UserName) || string.IsNullOrEmpty(p.Password) || string.IsNullOrEmpty(p.DisplayName) || string.IsNullOrEmpty(p.Description)) return View(); - p.UserStatus = 1; - return UserHelper.SaveUser(p) ? (ActionResult)Redirect("~/html/RegResult.html") : View(); - } - /// - /// - /// - /// public ActionResult Mobile() { return View(); diff --git a/Bootstrap.Admin/Controllers/Api/NewController.cs b/Bootstrap.Admin/Controllers/Api/NewController.cs index feb3dca0..41855f05 100644 --- a/Bootstrap.Admin/Controllers/Api/NewController.cs +++ b/Bootstrap.Admin/Controllers/Api/NewController.cs @@ -23,5 +23,13 @@ namespace Bootstrap.Admin.Controllers { return BootstrapUser.RetrieveUserByUserName(userName) == null && !UserHelper.RetrieveNewUsers().Any(u => u.UserName == userName); } + [HttpPost] + [AllowAnonymous] + public bool Post([FromBody] User user) + { + var ret = false; + if (string.IsNullOrEmpty(user.UserName) || string.IsNullOrEmpty(user.Password) || string.IsNullOrEmpty(user.DisplayName) || string.IsNullOrEmpty(user.Description)) return ret; + return UserHelper.SaveUser(user); + } } } \ No newline at end of file diff --git a/Bootstrap.Admin/Views/Account/Register.cshtml b/Bootstrap.Admin/Views/Account/Register.cshtml deleted file mode 100644 index 75a7bae7..00000000 --- a/Bootstrap.Admin/Views/Account/Register.cshtml +++ /dev/null @@ -1,112 +0,0 @@ -@{ - ViewBag.Title = "注册新用户"; - Layout = "~/Views/Shared/_Root.cshtml"; -} -@section css { - - - - -} -@section javascript { - - - - - - -} -
-
-

新用户注册

-
-
    -
  1. - 步骤 1:创建一个账号 -
  2. -
  3. - 步骤 2:确认信息 -
  4. -
-
-
-
-
-

- 创建您的账号 -

-
- -
- @@ - -
-
-
- -
- - -
-
-
- -
- - -
-
-
- -
- - -
-
-
- -
- - -
-
-
- -
-
-
-
-

您注册的信息如下:

-
- -
-
- -
-
- -
-
- - -
-
-
-
-
-

欢迎加入本系统

-
    -
  • Unlimited 特性一
  • -
  • Unlimited 特性二
  • -
  • Unlimited 特性三
  • -
  • Unlimited 特性四
  • -
  • -
  • 优点一
  • -
  • 优点二
  • -
  • 优点三
  • -
  • 优点四
  • -
-
-
-
-
\ No newline at end of file diff --git a/Bootstrap.Admin/Views/Account/SignIn.cshtml b/Bootstrap.Admin/Views/Account/SignIn.cshtml index 8a29c3a8..18e24a30 100644 --- a/Bootstrap.Admin/Views/Account/SignIn.cshtml +++ b/Bootstrap.Admin/Views/Account/SignIn.cshtml @@ -1,30 +1,38 @@ @model ModelBase -

@Model.Title

-
-
-
-
- +
+
-
-
-
- +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ + -
-
-
-
- -
-
- - +
diff --git a/Bootstrap.Admin/Views/Shared/_Login.cshtml b/Bootstrap.Admin/Views/Shared/_Login.cshtml index 5c999664..0a145f06 100644 --- a/Bootstrap.Admin/Views/Shared/_Login.cshtml +++ b/Bootstrap.Admin/Views/Shared/_Login.cshtml @@ -12,26 +12,99 @@ + @RenderSection("css", false) + @if (!string.IsNullOrEmpty(Model.Theme)) + { + + } } @section javascript { + + } -
- +@await Html.PartialAsync("SignIn") + diff --git a/Bootstrap.Admin/wwwroot/css/login.css b/Bootstrap.Admin/wwwroot/css/login.css index 1bb855e9..02f5001c 100644 --- a/Bootstrap.Admin/wwwroot/css/login.css +++ b/Bootstrap.Admin/wwwroot/css/login.css @@ -19,22 +19,14 @@ } .login-wrap { - margin: 22px 0 0 370px; + margin: 36px 0 0 370px; width: 280px; height: 200px; } - .login-wrap .login-footer { - padding-bottom: 15px; - } - - .login-wrap .login-footer .login-create { - float: left; - } - - .login-wrap .login-footer .login-reset { - float: right; - } +.login-footer a:last-child { + float: right; +} .btn-login { background: #f67a6e; diff --git a/Bootstrap.Admin/wwwroot/css/loginm.css b/Bootstrap.Admin/wwwroot/css/loginm.css index 67f84448..3b2a0705 100644 --- a/Bootstrap.Admin/wwwroot/css/loginm.css +++ b/Bootstrap.Admin/wwwroot/css/loginm.css @@ -25,17 +25,9 @@ padding: 20px; } - .login-wrap .login-footer { - padding-bottom: 15px; - } - - .login-wrap .login-footer .login-create { - float: left; - } - - .login-wrap .login-footer .login-reset { - float: right; - } +.login-footer a:last-child { + float: right; +} .btn-login { background: #f67a6e; diff --git a/Bootstrap.Admin/wwwroot/css/register.css b/Bootstrap.Admin/wwwroot/css/register.css deleted file mode 100644 index e141a1a2..00000000 --- a/Bootstrap.Admin/wwwroot/css/register.css +++ /dev/null @@ -1,174 +0,0 @@ -header h2 { - text-align: center; -} - -h3 { - margin-bottom: 20px; -} - -ol { - display: block; - list-style-type: decimal; - -webkit-margin-before: 1em; - -webkit-margin-after: 1em; - -webkit-margin-start: 0px; - -webkit-margin-end: 0px; - -webkit-padding-start: 40px; -} - -input.is-invalid { - background-repeat: no-repeat; - background-image: url('../images/error.png'); - background-position: right 8px center; -} - -input.is-valid { - background-repeat: no-repeat; - background-image: url('../images/success.png'); - background-position: right 8px center; -} - -.setup-wrapper { - margin: 0 auto; -} - -form input { - padding-right: 30px !important; -} - -.setup-header { - margin: 0 auto; - text-align: left; -} - -.setup-main, .setup-confirm { - float: left; - width: 450px; -} - -.setup-confirm { - display: none; -} - - .setup-confirm h4 { - padding: 6px 0; - } - -.setup-main span { - top: 0; -} - -.setup-main .input-group { - margin-bottom: 15px; -} - -.setup-secondary { - display: inline-block; - float: right; - width: 250px; - margin-top: 70px; -} - -.setup-info-module { - margin-bottom: 30px; - background-color: #fff; - border: 1px solid #ccc; - border-radius: 3px; - box-shadow: 0 1px 3px rgba(0,0,0,0.075); -} - - .setup-info-module h4 { - padding: 15px; - margin-bottom: 15px; - overflow: hidden; - border-bottom: 1px solid #ddd; - margin-top: 0; - background-color: #5cb85c; - color: #000; - border-top-left-radius: 3px; - border-top-right-radius: 3px; - } - -.features-list { - padding: 0 15px 15px; - margin: 0; - font-size: 14px; - list-style: none; -} - - .features-list li:first-child { - margin-top: 0; - } - - .features-list li { - margin-top: 10px; - } - - .features-list li strong { - font-weight: 600; - } - - .features-list li i { - margin-right: 5px; - color: #60b044; - } - - .features-list .list-divider { - margin: 15px -15px; - border-top: 1px solid #eee; - } - -.steps { - display: table; - width: 100%; - padding: 0; - margin: 30px auto 0; - overflow: hidden; - list-style: none; - border: 1px solid #ddd; - border-radius: 3px; - box-shadow: 0 1px 3px rgba(0,0,0,0.05); -} - - .steps li:first-child { - border-left: 0; - } - - .steps li.current { - color: #000; - background-color: #5cb85c; - } - - .steps li { - display: table-cell; - width: 50%; - padding: 10px 15px; - color: #ccc; - cursor: default; - background-color: #fafafa; - border-left: 1px solid #ddd; - } - - .steps li .step { - display: block; - } - -@media (max-width: 767px) { - .steps { - display: inherit; - } - - .steps li { - display: inherit; - width: inherit; - } - - .setup-secondary { - display: none; - } - - .setup-main, .setup-confirm { - float: inherit; - width: inherit; - } -} diff --git a/Bootstrap.Admin/wwwroot/js/Login.js b/Bootstrap.Admin/wwwroot/js/Login.js index 8c248041..43d1a2a3 100644 --- a/Bootstrap.Admin/wwwroot/js/Login.js +++ b/Bootstrap.Admin/wwwroot/js/Login.js @@ -1,3 +1,27 @@ $(function () { $(".container").autoCenter(); + + $("a[data-method]").on('click', function () { + var $this = $(this); + switch ($this.attr("data-method")) { + case "register": + $("#dialogNew").modal('show'); + break; + case "forgot": + break; + } + }); + + $('#btnSubmit').on('click', function () { + $.bc({ + url: 'api/New', + data: { UserName: $('#userName').val(), Password: $('#password').val(), DisplayName: $('#displayName').val(), Description: $('#description').val() }, + modal: '#dialogNew', + swal: false, + callback: function (result) { + var title = result ? "提交成功
等待管理员审批" : "提交失败"; + swal({ html: true, showConfirmButton: false, showCancelButton: false, timer: 1500, title: title, type: result ? "success" : "error" }); + } + }); + }); }) \ No newline at end of file diff --git a/Bootstrap.Admin/wwwroot/js/Longbow.Common.js b/Bootstrap.Admin/wwwroot/js/Longbow.Common.js index b1d6ac1a..ceaf417c 100644 --- a/Bootstrap.Admin/wwwroot/js/Longbow.Common.js +++ b/Bootstrap.Admin/wwwroot/js/Longbow.Common.js @@ -189,7 +189,7 @@ }, lgbSwal: function (options) { if ($.isFunction(swal)) { - swal($.extend({ showConfirmButton: false, showCancelButton: false, timer: 1000, title: '未设置', type: "success" }, options)); + swal($.extend({ html: true, showConfirmButton: false, showCancelButton: false, timer: 1000, title: '未设置', type: "success" }, options)); } }, getUID: function (prefix) { diff --git a/Bootstrap.Admin/wwwroot/js/common-scripts.js b/Bootstrap.Admin/wwwroot/js/common-scripts.js index a1d8540d..80bb3efc 100644 --- a/Bootstrap.Admin/wwwroot/js/common-scripts.js +++ b/Bootstrap.Admin/wwwroot/js/common-scripts.js @@ -84,7 +84,6 @@ $('#logoutNoti').text(result.NewUsersCount); that.resetWidget(); // tasks - // new users $('#msgHeaderTask').text(result.TasksCount); $('#msgHeaderTaskBadge').text(result.TasksCount); var htmlUserTemplate = '{0}-{2}{1}%
{1}% 完成
'; @@ -96,7 +95,7 @@ // new users $('#msgHeaderUser').text(result.NewUsersCount); $('#msgHeaderUserBadge').text(result.NewUsersCount); - htmlUserTemplate = '
  • {1}({0})
    {3}
  • '; + htmlUserTemplate = '
    {1}({0})
    {3}
    '; html = result.Users.map(function (u) { return $.format(htmlUserTemplate, u.UserName, u.DisplayName, u.Description, u.Period, $.formatUrl()); }).join(''); @@ -123,7 +122,7 @@ // messages $('#msgHeaderMsg').text(result.MessagesCount); $('#msgHeaderMsgBadge').text(result.MessagesCount); - htmlUserTemplate = '
  • avatar{2}{4}{3}
  • '; + htmlUserTemplate = 'avatar{2}{4}{3}'; html = result.Messages.map(function (u) { return $.format(htmlUserTemplate, u.Id, u.FromIcon, u.FromDisplayName, u.Title, u.Period, u.Content, $.formatUrl()); }).join(''); diff --git a/Bootstrap.Admin/wwwroot/js/register.js b/Bootstrap.Admin/wwwroot/js/register.js deleted file mode 100644 index 807c20ed..00000000 --- a/Bootstrap.Admin/wwwroot/js/register.js +++ /dev/null @@ -1,19 +0,0 @@ -$(function () { - $('#btnAccount').click(function () { - var valid = $('form').valid(); - if (valid) { - $('.setup-main').hide(); - $('.steps li').toggleClass('current'); - $('#loginID').text($('#userName').val()); - $('#loginName').text($('#displayName').val()); - $('#loginDesc').text($('#description').val()); - $('.setup-confirm').show(); - } - }); - - $('#btnPrev').click(function () { - $('.steps li').toggleClass('current'); - $('.setup-main').show(); - $('.setup-confirm').hide(); - }); -}); \ No newline at end of file