增加通知管理前台与后台数据绑定

This commit is contained in:
Argo-Lenovo 2016-11-10 18:16:21 +08:00
parent 208cb9bede
commit 7c6acfd1f9
11 changed files with 166 additions and 42 deletions

View File

@ -179,6 +179,7 @@
<Content Include="Scripts\Login.js" />
<Content Include="Scripts\Logs.js" />
<Content Include="Scripts\Menus.js" />
<Content Include="Scripts\News.js" />
<Content Include="Scripts\Profiles.js" />
<Content Include="Scripts\register.js" />
<Content Include="Scripts\Roles.js" />

View File

@ -202,11 +202,11 @@ ul.sidebar-menu {
}
/*cache*/
a.cf {
.panel a.fa-refresh {
font-size: 15px;
}
a.cf:hover {
.panel a.fa-refresh:hover {
-webkit-animation: fa-spin 2s infinite linear;
animation: fa-spin 2s infinite linear;
}

View File

@ -61,6 +61,10 @@
padding-left: 16px;
}
.tasks-widget .task-list li > .task-title .task-wrapper.notifi {
right: 70px;
}
.tasks-widget .task-list li > .task-title .task-wrapper span {
display: inline-block;
white-space: nowrap;

View File

@ -17,6 +17,7 @@ namespace Bootstrap.Admin.Models
UserID = user.ID;
HomeUrl = "~/";
Menus = MenuHelper.RetrieveLinksByUserName(UserName);
Notifications = NotificationsHelper.RetrieveNotifications();
}
public string UserName { get; protected set; }
/// <summary>
@ -39,5 +40,9 @@ namespace Bootstrap.Admin.Models
/// 获得/设置 前台菜单
/// </summary>
public IEnumerable<Menu> Menus { get; private set; }
/// <summary>
///
/// </summary>
public IEnumerable<Notifications> Notifications { get; set; }
}
}

View File

@ -0,0 +1,3 @@
$(function () {
$('.tooltips').tooltip();
});

View File

@ -17,21 +17,76 @@
@Html.Partial("Navigator", Model)
}
<div class="panel panel-default">
<div class="panel-heading">用户注册未授权通知<span class="pull-right"><a href="javascript:;" class="tooltips fa fa-refresh" data-placement="left" data-original-title="点击刷新"></a></span></div>
<div class="panel-heading">用户注册<span class="pull-right"><a href="javascript:;" class="tooltips fa fa-refresh" data-placement="left" data-original-title="点击刷新"></a></span></div>
<div class="panel-body">
<div class="tasks-widget">
<ul id="sortable" class="task-list ui-sortable">
<li class="list-primary" >
<div class="task-title">
<span class="task-title-sp">注册名:测试小王</span>
<span class="task-title-sp">注册时间20016-9-18</span>
<span class="task-title-sp">注册描述:某某部门新入职员工</span>
<div class="pull-right hidden-phone">
<button class="btn btn-danger btn-xs fa fa-trash-o tooltips" data-placement="left" data-original-title="同意授权"></button>
<button class="btn btn-danger btn-xs fa fa-trash-o tooltips" data-placement="left" data-original-title="拒绝授权"></button>
@foreach (var nofi in Model.Notifications)
{
<li class="list-primary">
<i class="fa fa-ellipsis-v"></i>
<div class="task-title">
<span class="task-title-sp">@nofi.Title</span>
<div class="task-wrapper notifi">
<span class="task-value tooltips" data-placement="top" data-original-title="@nofi.Content">@nofi.Content</span>
</div>
<div class="pull-right hidden-phone">
<button class="btn btn-success btn-xs fa fa-check tooltips" data-placement="left" data-original-title="同意授权"></button>
<button class="btn btn-danger btn-xs fa fa-remove tooltips" data-placement="left" data-original-title="拒绝授权"></button>
</div>
</div>
</div>
</li>
</li>
}
</ul>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">程序错误<a href="javascript:;" class="pull-right tooltips fa fa-refresh" data-placement="left" data-original-title="点击刷新"></a></div>
<div class="panel-body">
<div class="tasks-widget">
<ul id="sortable" class="task-list ui-sortable">
@foreach (var nofi in Model.Notifications)
{
<li class="list-warning">
<i class="fa fa-ellipsis-v"></i>
<div class="task-title">
<span class="task-title-sp">@nofi.Title</span>
<div class="task-wrapper notifi">
<span class="task-value tooltips" data-placement="top" data-original-title="@nofi.Content">@nofi.Content</span>
</div>
<div class="pull-right hidden-phone">
<button class="btn btn-success btn-xs fa fa-check tooltips" data-placement="left" data-original-title="同意授权"></button>
<button class="btn btn-danger btn-xs fa fa-remove tooltips" data-placement="left" data-original-title="拒绝授权"></button>
</div>
</div>
</li>
}
</ul>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">数据库报警<span class="pull-right"><a href="javascript:;" class="tooltips fa fa-refresh" data-placement="left" data-original-title="点击刷新"></a></span></div>
<div class="panel-body">
<div class="tasks-widget">
<ul id="sortable" class="task-list ui-sortable">
@foreach (var nofi in Model.Notifications)
{
<li class="list-danger">
<i class="fa fa-ellipsis-v"></i>
<div class="task-title">
<span class="task-title-sp">@nofi.Title</span>
<div class="task-wrapper notifi">
<span class="task-value tooltips" data-placement="top" data-original-title="@nofi.Content">@nofi.Content</span>
</div>
<div class="pull-right hidden-phone">
<button class="btn btn-success btn-xs fa fa-check tooltips" data-placement="left" data-original-title="同意授权"></button>
<button class="btn btn-danger btn-xs fa fa-remove tooltips" data-placement="left" data-original-title="拒绝授权"></button>
</div>
</div>
</li>
}
</ul>
</div>
</div>

View File

@ -43,7 +43,7 @@
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">网站缓存<a href="javascript:;" class="cf pull-right tooltips fa fa-refresh" data-placement="left" data-original-title="点击刷新"></a></div>
<div class="panel-heading">网站缓存<a href="javascript:;" class="pull-right tooltips fa fa-refresh" data-placement="left" data-original-title="点击刷新"></a></div>
<div class="panel-body">
<div class="tasks-widget">
<ul id="sortable" class="task-list ui-sortable"></ul>

View File

@ -67,6 +67,8 @@
<Compile Include="LogHelper.cs" />
<Compile Include="Menu.cs" />
<Compile Include="MenuHelper.cs" />
<Compile Include="Notifications.cs" />
<Compile Include="NotificationsHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Role.cs" />
<Compile Include="RoleHelper.cs" />

View File

@ -0,0 +1,31 @@
using System;
namespace Bootstrap.DataAccess
{
/// <summary>
///
/// </summary>
public class Notifications
{
/// <summary>
///
/// </summary>
public string Category { get; set; }
/// <summary>
///
/// </summary>
public string Title { get; set; }
/// <summary>
///
/// </summary>
public string Content { get; set; }
/// <summary>
///
/// </summary>
public DateTime RegisterTime { get; set; }
/// <summary>
///
/// </summary>
public string Status { get; set; }
}
}

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
namespace Bootstrap.DataAccess
{
/// <summary>
///
/// </summary>
public static class NotificationsHelper
{
/// <summary>
///
/// </summary>
/// <returns></returns>
public static IEnumerable<Notifications> RetrieveNotifications()
{
var ret = new List<Notifications>();
ret.Add(new Notifications() { Title = "测试消息1", Content = "用户注册", RegisterTime = DateTime.Now });
ret.Add(new Notifications() { Title = "测试消息2", Content = "用户注册", RegisterTime = DateTime.Now });
return ret;
}
}
}