diff --git a/Bootstrap.Admin/Bootstrap.Admin.csproj b/Bootstrap.Admin/Bootstrap.Admin.csproj
index a03282c9..cd440b69 100644
--- a/Bootstrap.Admin/Bootstrap.Admin.csproj
+++ b/Bootstrap.Admin/Bootstrap.Admin.csproj
@@ -262,6 +262,7 @@
+
diff --git a/Bootstrap.Admin/Controllers/MessagesController.cs b/Bootstrap.Admin/Controllers/MessagesController.cs
index 16bed46e..b3536fc1 100644
--- a/Bootstrap.Admin/Controllers/MessagesController.cs
+++ b/Bootstrap.Admin/Controllers/MessagesController.cs
@@ -1,14 +1,16 @@
-using Bootstrap.DataAccess;
+using Bootstrap.Admin.Models;
+using Bootstrap.DataAccess;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
+
namespace Bootstrap.Admin.Controllers
{
public class MessagesController : ApiController
{
///
- ///
+ /// 根据Id返回不同的消息列表
///
///
///
@@ -16,8 +18,8 @@ namespace Bootstrap.Admin.Controllers
public IEnumerable Get(string id)
{
var ret = new List();
- switch(id)
- {
+ switch (id)
+ {
case "inbox": ret = MessageHelper.Inbox(User.Identity.Name).ToList();
break;
case "sendmail": ret = MessageHelper.SendMail(User.Identity.Name).ToList();
@@ -26,8 +28,24 @@ namespace Bootstrap.Admin.Controllers
break;
case "trash": ret = MessageHelper.Trash(User.Identity.Name).ToList();
break;
- }
+ }
return ret;
}
+
+ ///
+ /// 返回各个消息列表的文件个数
+ ///
+ ///
+ ///
+ [HttpGet]
+ public MessageCountModel Get()
+ {
+ MessageCountModel mcm = new MessageCountModel();
+ mcm.inboxCount = MessageHelper.Inbox(User.Identity.Name).Count();
+ mcm.sendmailCount = MessageHelper.SendMail(User.Identity.Name).Count();
+ mcm.markCount = MessageHelper.Mark(User.Identity.Name).Count();
+ mcm.trashCount = MessageHelper.Trash(User.Identity.Name).Count();
+ return mcm;
+ }
}
}
\ No newline at end of file
diff --git a/Bootstrap.Admin/Models/MessageCountModel.cs b/Bootstrap.Admin/Models/MessageCountModel.cs
new file mode 100644
index 00000000..24f1c628
--- /dev/null
+++ b/Bootstrap.Admin/Models/MessageCountModel.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace Bootstrap.Admin.Models
+{
+ public class MessageCountModel
+ {
+ public int inboxCount { get; set; }
+ public int sendmailCount { get; set; }
+ public int markCount { get; set; }
+ public int trashCount { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Bootstrap.Admin/Scripts/message.js b/Bootstrap.Admin/Scripts/message.js
index 2c57e163..1311acaf 100644
--- a/Bootstrap.Admin/Scripts/message.js
+++ b/Bootstrap.Admin/Scripts/message.js
@@ -1,5 +1,20 @@
$(function () {
- var html = ' | | {2} | {3} | {4} | {5} |
';
+
+ function loadData() {
+ $.bc({
+ url: Messages.url, method: 'GET', swal: false,
+ callback: function (result) {
+ if (result) {
+ $('#s_inbox').text(result.inboxCount);
+ $('#s_sendmail').text(result.sendmailCount);
+ $('#s_mark').text(result.markCount);
+ $('#s_trash').text(result.trashCount);
+ }
+ }
+ });
+ }
+
+ var html = ' | | {2}{4} | {5} | {6} | {7} |
';
function listData(options) {
@@ -16,7 +31,11 @@
mailMark = "inbox-started";
else
mailMark = " ";
- return $.format(html, mailStatus, mailMark, mail.FromDisplayName, mail.Title, mail.Content, mail.SendTime);
+ if (mail.Label == '0')
+ mailLabel = 'label-success';
+ else
+ mailLabel = 'label-warning';
+ return $.format(html, mailStatus, mailMark, mail.FromDisplayName, mailLabel, mail.LabelName, mail.Title, mail.Content, mail.SendTime);
}).join('');
$('#tbMsg').html(content);
}
@@ -25,6 +44,7 @@
}
listData({ Id: 'inbox' });
+ loadData();
$('#mailBox').on('click', 'a', function () {
listData({ Id: $(this).attr('data-id') });
diff --git a/Bootstrap.Admin/Views/Admin/Messages.cshtml b/Bootstrap.Admin/Views/Admin/Messages.cshtml
index 5e084206..4821dd6c 100644
--- a/Bootstrap.Admin/Views/Admin/Messages.cshtml
+++ b/Bootstrap.Admin/Views/Admin/Messages.cshtml
@@ -27,16 +27,16 @@