修改BUG:由于通知方式的更改,消息这里重新写

This commit is contained in:
Argo-Lenovo 2016-11-18 16:00:25 +08:00
parent 9a11d0a186
commit 1c17bb7362
6 changed files with 55 additions and 60 deletions

View File

@ -205,6 +205,7 @@
<Content Include="Scripts\Login.js" />
<Content Include="Scripts\Logs.js" />
<Content Include="Scripts\Menus.js" />
<Content Include="Scripts\message.js" />
<Content Include="Scripts\noti.js" />
<Content Include="Scripts\Profiles.js" />
<Content Include="Scripts\register.js" />

View File

@ -1,35 +1,23 @@
using Bootstrap.Admin.Models;
using Bootstrap.DataAccess;
using System.Web.Mvc;
namespace Bootstrap.Admin.Controllers
{
public class MessagesController : Controller
{
public ActionResult Inbox()
{
var v = new NavigatorBarModel("~/Admin/Messages/Inbox");
v.MessageList = MessageHelper.Inbox(User.Identity.Name);
return View(v);
}
public ActionResult SendMail()
{
var v = new NavigatorBarModel("~/Admin/Messages/SendMail");
v.MessageList = MessageHelper.SendMail(User.Identity.Name);
return View(v);
}
public ActionResult Mark()
{
var v = new NavigatorBarModel("~/Admin/Messages/Mark");
v.MessageList = MessageHelper.Mark(User.Identity.Name);
return View(v);
}
public ActionResult Trash()
{
var v = new NavigatorBarModel("~/Admin/Messages/Trash");
v.MessageList = MessageHelper.Trash(User.Identity.Name);
return View(v);
}
}
using Bootstrap.DataAccess;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
namespace Bootstrap.Admin.Controllers
{
public class MessagesController : ApiController
{
/// <summary>
///
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
[HttpGet]
public IEnumerable<Message> Get(string id)
{
var ret = new List<Message>();
if (id == "inbox") ret = MessageHelper.Inbox(User.Identity.Name).ToList();
return ret;
}
}
}

View File

@ -41,10 +41,6 @@ namespace Bootstrap.Admin.Models
/// </summary>
public IEnumerable<Menu> Menus { get; private set; }
/// <summary>
/// 获得/设置 消息列表
/// </summary>
public IEnumerable<Message> MessageList { get; set; }
/// <summary>
/// 获得/设置 用户头像地址
/// </summary>
public string Icon { get; set; }

View File

@ -0,0 +1,22 @@
$(function () {
var html = '<tr><td class="inbox-small-cells"><input type="checkbox" class="mail-checkbox"></td><td class="inbox-small-cells"><i class="fa fa-star"></i></td><td class="view-message dont-show">{0}</td><td class="view-message dont-show">{1}</td><td class="view-message ">{2}</td><td class="view-message text-right">{3}</td></tr>';
function listData() {
bd({
Id: 'inbox',
url: '../api/Messages/',
method: 'GET',
swal: false,
callback: function (result) {
if (result) {
var content = result.map(function (mail) {
return $.format(html, mail.FromDisplayName, mail.Title, mail.Content, mail.SendTime);
}).join('');
$('#tbMsg').html(content);
}
console.log(result);
}
});
}
listData();
});

View File

@ -3,7 +3,9 @@
ViewBag.Title = "站内消息";
Layout = "~/Views/Shared/_Admin.cshtml";
}
@section Javascript {
<script src="~/Scripts/message.js"></script>
}
@section header {
@Html.Partial("Header", Model)
}
@ -38,30 +40,16 @@
</li>
</ul>
</aside>
<aside class="lg-side">
<div class="inbox-head">
<h3>消息列表</h3>
</div>
<div class="inbox-body">
<table class="table table-inbox table-hover">
<tbody>
@foreach (var mess in Model.MessageList)
{
<tr >
<td class="inbox-small-cells"><input type="checkbox" class="mail-checkbox"></td>
@if(mess.Mark==0)
{ <td class="inbox-small-cells"><i class="fa fa-star"></i></td> }
else
{ <td class="inbox-small-cells"><i class="fa fa-star inbox-started"></i></td> }
<td class="view-message dont-show">@mess.From</td>
<td class="view-message dont-show">@mess.To</td>
<td class="view-message ">@mess.Title</td>
<td class="view-message text-right">@mess.SendTime</td>
</tr>
}
</tbody>
</table>
</div>
</aside>
</div>
<tbody id="tbMsg">
</tbody>
</table>
</div>
</aside>
</div>