From 07469936352ab99a93508b45e452bd5028a06a99 Mon Sep 17 00:00:00 2001 From: Argo-MacBookPro Date: Sun, 26 Aug 2018 19:40:21 +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=A2=9E=E5=8A=A0=E6=96=B0=E7=94=A8=E6=88=B7=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=EF=BC=8CNotification=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Api/NotificationsController.cs | 6 +- .../Views/Admin/Notifications.cshtml | 29 ++++++--- Bootstrap.Admin/Views/Shared/_Login.cshtml | 4 +- Bootstrap.Admin/wwwroot/css/site.css | 2 +- Bootstrap.Admin/wwwroot/css/theme.css | 2 +- Bootstrap.Admin/wwwroot/js/Settings.js | 2 +- Bootstrap.Admin/wwwroot/js/noti.js | 59 +++++++++---------- 7 files changed, 55 insertions(+), 49 deletions(-) diff --git a/Bootstrap.Admin/Controllers/Api/NotificationsController.cs b/Bootstrap.Admin/Controllers/Api/NotificationsController.cs index 79ca3f03..878d8661 100644 --- a/Bootstrap.Admin/Controllers/Api/NotificationsController.cs +++ b/Bootstrap.Admin/Controllers/Api/NotificationsController.cs @@ -78,10 +78,10 @@ namespace Bootstrap.Admin.Controllers.Api /// /// [HttpGet("{id}")] - public Notifications Get(string id) + public object Get(string id) { - var ret = new Notifications(); - if (id == "newusers" || id == "all") ret.Users = UserHelper.RetrieveNewUsers().OrderByDescending(u => u.RegisterTime).ToList(); + var ret = new object(); + if (id == "newusers") ret = UserHelper.RetrieveNewUsers().ToList(); return ret; } diff --git a/Bootstrap.Admin/Views/Admin/Notifications.cshtml b/Bootstrap.Admin/Views/Admin/Notifications.cshtml index 280672a6..ca33456f 100644 --- a/Bootstrap.Admin/Views/Admin/Notifications.cshtml +++ b/Bootstrap.Admin/Views/Admin/Notifications.cshtml @@ -1,19 +1,30 @@ -@model Bootstrap.Admin.Models.NavigatorBarModel +@model NavigatorBarModel @{ ViewBag.Title = "通知管理"; Layout = "~/Views/Shared/_Admin.cshtml"; } -@section Javascript { - -} @section css { - + + + + + + +} +@section Javascript { + + + + + + + + + }
用户注册
-
-
-
    -
    +
    +
    diff --git a/Bootstrap.Admin/Views/Shared/_Login.cshtml b/Bootstrap.Admin/Views/Shared/_Login.cshtml index 0a145f06..6fb4d433 100644 --- a/Bootstrap.Admin/Views/Shared/_Login.cshtml +++ b/Bootstrap.Admin/Views/Shared/_Login.cshtml @@ -51,7 +51,7 @@
    - +
    @@ -62,7 +62,7 @@
    - +
    diff --git a/Bootstrap.Admin/wwwroot/css/site.css b/Bootstrap.Admin/wwwroot/css/site.css index c6d0e2fa..4c01fb82 100644 --- a/Bootstrap.Admin/wwwroot/css/site.css +++ b/Bootstrap.Admin/wwwroot/css/site.css @@ -339,7 +339,7 @@ label.dropdown-item:first-child { line-height: normal; } - .cache-item .btn { + .cache-item .btn, td .btn:not(.btn-lg) { margin-left: 5px; font-size: 0.75rem; padding: 1px 5px; diff --git a/Bootstrap.Admin/wwwroot/css/theme.css b/Bootstrap.Admin/wwwroot/css/theme.css index b3e91cff..49c47269 100644 --- a/Bootstrap.Admin/wwwroot/css/theme.css +++ b/Bootstrap.Admin/wwwroot/css/theme.css @@ -108,7 +108,7 @@ input.pending { } /*Bootstrap Table BUG */ -.fixed-table-container { +.bootstrap-table .table thead > tr > th { border-top: none; } diff --git a/Bootstrap.Admin/wwwroot/js/Settings.js b/Bootstrap.Admin/wwwroot/js/Settings.js index 53ae899c..ebe39fe6 100644 --- a/Bootstrap.Admin/wwwroot/js/Settings.js +++ b/Bootstrap.Admin/wwwroot/js/Settings.js @@ -72,7 +72,7 @@ swal: false, callback: function (result) { if ($.isArray(result)) { - var html = '
    {2}{0}
    {3}
    {7}
    '; + var html = '
    {2}{0}
    {3}
    {7}
    '; var content = result.sort(function (x, y) { return x.Key > y.Key ? 1 : -1; }).map(function (ele) { diff --git a/Bootstrap.Admin/wwwroot/js/noti.js b/Bootstrap.Admin/wwwroot/js/noti.js index 40f1d2ed..5e4325fb 100644 --- a/Bootstrap.Admin/wwwroot/js/noti.js +++ b/Bootstrap.Admin/wwwroot/js/noti.js @@ -1,40 +1,35 @@ $(function () { - var $btnRefreshUser = $('#refreshUsers'); - var htmlNewUsersHeader = '
  • 登陆名称显示名称/备注注册时间
    操作
  • '; - var htmlNewUsers = '
  • {0}{4}:{1}{2}
  • '; - - function listData() { - $btnRefreshUser.toggleClass('fa-spin'); - var $taskUsers = $('#tasks-users'); - $taskUsers.html(htmlNewUsersHeader); - $.bc({ - Id: 'newusers', url: Notifications.url, method: 'GET', swal: false, - callback: function (result) { - if (result) { - var content = result.Users.map(function (noti) { - return $.format(htmlNewUsers, noti.UserName, noti.Description, noti.RegisterTime, noti.Id, noti.DisplayName); - }).join(''); - $taskUsers.append(content); - $('#tasks-users').find('[data-toggle="tooltip"]').tooltip(); + var $table = $('table').smartTable({ + url: Notifications.url + "newusers", + sidePagination: "client", + showToggle: false, + showRefresh: false, + showColumns: false, + columns: [ + { title: "登陆名称", field: "UserName" }, + { title: "显示名称", field: "DisplayName" }, + { title: "说明信息", field: "Description" }, + { title: "注册时间", field: "RegisterTime" }, + { + title: "操作", field: "Id", formatter: function (value, row, index, field) { + return $.format(' ', value); } - $btnRefreshUser.toggleClass('fa-spin'); + } + ] + }).on('click', 'button[data-id]', function () { + var $this = $(this); + var id = $this.attr('data-id'); + var result = $this.attr('data-result'); + $.bc({ + id: id, url: User.url, method: "PUT", data: { type: "user", userIds: result }, title: result == "1" ? "授权用户" : "拒绝用户", + callback: function (result) { + $table.bootstrapTable('refresh'); + $.pullNotification($('.header .nav').reloadWidget()); } }); - } - listData(); - - $btnRefreshUser.tooltip().on('click', function () { - listData(); }); - $('#tasks-users').on('click', 'button', function () { - var id = $(this).attr('data-id'); - var result = $(this).attr('data-result'); - $.bc({ - Id: id, url: User.url, method: "PUT", data: { type: "user", userIds: result }, title: result == "1" ? "授权用户" : "拒绝用户", - callback: function (result) { - listData({ ctl: $('#refreshUsers') }); - } - }); + $('#refreshUsers').tooltip().on('click', function () { + $table.bootstrapTable('refresh'); }); }); \ No newline at end of file