修改BUG:修复网站头任务通知栏样式与后台代码

This commit is contained in:
Argo-Lenovo 2016-11-18 15:37:48 +08:00
parent 82d967f776
commit d6a95e238d
6 changed files with 140 additions and 125 deletions

View File

@ -396,9 +396,39 @@ a, a:hover, a:focus {
-webkit-border-radius: 4px 4px 0px 0px; -webkit-border-radius: 4px 4px 0px 0px;
} }
.notify-row .dropdown-menu .content {
position: absolute;
left: 36px;
right: 44px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: inline-block;
}
.notify-row .dropdown-menu .label {
display: inline-block;
height: 18px;
width: 20px;
padding: 5px;
margin-right: 5px;
}
.notify-row .dropdown-menu .small {
font-size: 10px;
font-style: italic;
font-weight: bold;
float: right;
padding-top: 2px;
}
.notify-row .dropdown-menu.tasks-bar .desc { .notify-row .dropdown-menu.tasks-bar .desc {
font-size: 13px; font-size: 13px;
font-weight: normal; font-weight: normal;
display: block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
} }
.notify-row .dropdown-menu.tasks-bar .percent { .notify-row .dropdown-menu.tasks-bar .percent {
@ -406,13 +436,13 @@ a, a:hover, a:focus {
float: right; float: right;
font-size: 13px; font-size: 13px;
font-weight: 600; font-weight: 600;
padding-left: 10px;
margin-top: -4px;
} }
.notify-row .dropdown-menu.tasks-bar .progress { .notify-row .dropdown-menu.tasks-bar .progress {
margin-bottom: 0 !important; margin-top: 4px;
height: 10px; height: 10px;
margin-right: 34px;
margin-bottom: 0;
} }
.notify-row .dropdown-menu.inbox .photo img { .notify-row .dropdown-menu.inbox .photo img {
@ -451,33 +481,6 @@ a, a:hover, a:focus {
margin-top: 2px; margin-top: 2px;
} }
.notify-row .dropdown-menu .label {
display: inline-block;
height: 18px;
width: 20px;
padding: 5px;
margin-right: 5px;
}
.notify-row .dropdown-menu .small {
font-size: 10px;
font-style: italic;
font-weight: bold;
float: right;
padding-top: 2px;
}
.notify-row .dropdown-menu li a div {
position: absolute;
left: 36px;
right: 44px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: inline-block;
}
.dropdown-menu.menu { .dropdown-menu.menu {
top: 50px; top: 50px;
left: 6px; left: 6px;

View File

@ -54,11 +54,21 @@
callback: function (result) { callback: function (result) {
$('#logoutNoti').text(result.NewUsersCount); $('#logoutNoti').text(result.NewUsersCount);
// tasks
// new users
$('#msgHeaderTask').text(result.NewUsersCount);
$('#msgHeaderTaskBadge').text(result.NewUsersCount);
var htmlUserTemplate = '<li><a href="../Admin/Tasks?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></li>';
var html = result.Tasks.map(function (u) {
return $.format(htmlUserTemplate, u.TaskName, u.TaskProgress, u.AssignDisplayName, u.ID);
}).join('');
$(html).insertAfter($('#msgHeaderTaskContent'));
// new users // new users
$('#msgHeaderUser').text(result.NewUsersCount); $('#msgHeaderUser').text(result.NewUsersCount);
$('#msgHeaderUserBadge').text(result.NewUsersCount); $('#msgHeaderUserBadge').text(result.NewUsersCount);
var htmlUserTemplate = '<li><a href="../Admin/Notifications"><span class="label label-success"><i class="fa fa-plus"></i></span><div title="{2}">{1}({0})</div><span class="small italic">{3}</span></a></li>'; htmlUserTemplate = '<li><a href="../Admin/Notifications"><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></li>';
var html = result.Users.map(function (u) { html = result.Users.map(function (u) {
return $.format(htmlUserTemplate, u.UserName, u.DisplayName, u.Description, u.Period); return $.format(htmlUserTemplate, u.UserName, u.DisplayName, u.Description, u.Period);
}).join(''); }).join('');
$(html).insertAfter($('#msgHeaderUserContent')); $(html).insertAfter($('#msgHeaderUserContent'));
@ -66,7 +76,7 @@
// apps // apps
$('#msgHeaderApp').text(result.AppExceptionsCount); $('#msgHeaderApp').text(result.AppExceptionsCount);
$('#msgHeaderAppBadge').text(result.AppExceptionsCount); $('#msgHeaderAppBadge').text(result.AppExceptionsCount);
htmlUserTemplate = '<li><a href="../Admin/Exceptions"><span class="label label-warning"><i class="fa fa-bug"></i></span><div title="{1}">{0}</div><span class="small italic">{2}</span></a></li>'; htmlUserTemplate = '<li><a href="../Admin/Exceptions"><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></li>';
html = result.Apps.map(function (u) { html = result.Apps.map(function (u) {
return $.format(htmlUserTemplate, u.ExceptionType, u.Message, u.Period); return $.format(htmlUserTemplate, u.ExceptionType, u.Message, u.Period);
}).join(''); }).join('');
@ -75,7 +85,7 @@
// dbs // dbs
$('#msgHeaderDb').text(result.DbExceptionsCount); $('#msgHeaderDb').text(result.DbExceptionsCount);
$('#msgHeaderDbBadge').text(result.DbExceptionsCount); $('#msgHeaderDbBadge').text(result.DbExceptionsCount);
htmlUserTemplate = '<li><a href="../Admin/Exceptions"><span class="label label-danger"><i class="fa fa-bolt"></i></span><div title="{1}">{0}</div><span class="small italic">{2}</span></a></li>'; htmlUserTemplate = '<li><a href="../Admin/Exceptions"><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></li>';
html = result.Dbs.map(function (u) { html = result.Dbs.map(function (u) {
return $.format(htmlUserTemplate, u.ErrorPage, u.Message, u.Period); return $.format(htmlUserTemplate, u.ErrorPage, u.Message, u.Period);
}).join(''); }).join('');

View File

@ -66,7 +66,6 @@ namespace Bootstrap.Admin.Controllers
else if (ts.Minutes > 0) n.Period = string.Format("{0}分钟", ts.Minutes); else if (ts.Minutes > 0) n.Period = string.Format("{0}分钟", ts.Minutes);
}); });
ret.DbExceptionsCount = dbs.Count(); ret.DbExceptionsCount = dbs.Count();
return ret; return ret;
} }
/// <summary> /// <summary>

View File

@ -29,12 +29,12 @@
<li class="dropdown"> <li class="dropdown">
<a data-toggle="dropdown" class="dropdown-toggle" href="#"> <a data-toggle="dropdown" class="dropdown-toggle" href="#">
<i class="fa fa-tasks"></i> <i class="fa fa-tasks"></i>
<span class="badge bg-success"></span> <span id="msgHeaderTaskBadge" class="badge bg-success"></span>
</a> </a>
<ul class="dropdown-menu tasks-bar"> <ul class="dropdown-menu tasks-bar">
<div class="notify-arrow notify-arrow-green"></div> <div class="notify-arrow notify-arrow-green"></div>
<li> <li id="msgHeaderTaskContent">
<p>您有 0 个未完成的任务</p> <p>您有 <span id="msgHeaderTask">0</span> 个未完成的任务</p>
</li> </li>
<li> <li>
<a href="~/Admin/Tasks">查看所有任务</a> <a href="~/Admin/Tasks">查看所有任务</a>

View File

@ -17,6 +17,10 @@ namespace Bootstrap.DataAccess
/// </summary> /// </summary>
public string AssignName { get; set; } public string AssignName { get; set; }
/// <summary> /// <summary>
/// 获得/设置 分配人昵称
/// </summary>
public string AssignDisplayName { get; set; }
/// <summary>
/// 获取/设置 完成任务人 /// 获取/设置 完成任务人
/// </summary> /// </summary>
public string UserName { get; set; } public string UserName { get; set; }

View File

@ -1,5 +1,4 @@
using Longbow; using Longbow.Caching;
using Longbow.Caching;
using Longbow.Caching.Configuration; using Longbow.Caching.Configuration;
using Longbow.ExceptionManagement; using Longbow.ExceptionManagement;
using System; using System;
@ -18,9 +17,9 @@ namespace Bootstrap.DataAccess
/// <returns></returns> /// <returns></returns>
public static IEnumerable<Task> RetrieveTasks() public static IEnumerable<Task> RetrieveTasks()
{ {
var ret = CacheManager.GetOrAdd(RetrieveTasksDataKey, CacheSection.RetrieveIntervalByKey(RetrieveTasksDataKey), key => return CacheManager.GetOrAdd(RetrieveTasksDataKey, CacheSection.RetrieveIntervalByKey(RetrieveTasksDataKey), key =>
{ {
string sql = "select * from Tasks"; string sql = "select t.*, u.DisplayName from Tasks t inner join Users u on t.UserName = u.UserName";
List<Task> tasks = new List<Task>(); List<Task> tasks = new List<Task>();
DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql); DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql);
try try
@ -37,7 +36,8 @@ namespace Bootstrap.DataAccess
UserName = (string)reader[3], UserName = (string)reader[3],
TaskTime = (int)reader[4], TaskTime = (int)reader[4],
TaskProgress = (double)reader[5], TaskProgress = (double)reader[5],
AssignTime = LgbConvert.ReadValue(reader[6], DateTime.MinValue) AssignTime = (DateTime)reader[6],
AssignDisplayName = (string)reader[7]
}); });
} }
} }
@ -45,7 +45,6 @@ namespace Bootstrap.DataAccess
catch (Exception ex) { ExceptionManager.Publish(ex); } catch (Exception ex) { ExceptionManager.Publish(ex); }
return tasks; return tasks;
}, CacheSection.RetrieveDescByKey(RetrieveTasksDataKey)); }, CacheSection.RetrieveDescByKey(RetrieveTasksDataKey));
return ret;
} }
} }
} }