From 1c17bb73626a3e2f0b9ed2cb5f53ab6241688cc9 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Fri, 18 Nov 2016 16:00:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9BUG=EF=BC=9A=E7=94=B1?= =?UTF-8?q?=E4=BA=8E=E9=80=9A=E7=9F=A5=E6=96=B9=E5=BC=8F=E7=9A=84=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=EF=BC=8C=E6=B6=88=E6=81=AF=E8=BF=99=E9=87=8C=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bootstrap.Admin/Bootstrap.Admin.csproj | 1 + .../Controllers/MessagesController.cs | 56 +++++++----------- Bootstrap.Admin/Models/HeaderBarModel.cs | 4 -- Bootstrap.Admin/Scripts/_references.js | Bin 4114 -> 4188 bytes Bootstrap.Admin/Scripts/message.js | 22 +++++++ Bootstrap.Admin/Views/Admin/Messages.cshtml | 32 ++++------ 6 files changed, 55 insertions(+), 60 deletions(-) create mode 100644 Bootstrap.Admin/Scripts/message.js diff --git a/Bootstrap.Admin/Bootstrap.Admin.csproj b/Bootstrap.Admin/Bootstrap.Admin.csproj index 2775bba0..80a1792d 100644 --- a/Bootstrap.Admin/Bootstrap.Admin.csproj +++ b/Bootstrap.Admin/Bootstrap.Admin.csproj @@ -205,6 +205,7 @@ + diff --git a/Bootstrap.Admin/Controllers/MessagesController.cs b/Bootstrap.Admin/Controllers/MessagesController.cs index 5a116c43..fc7d7d71 100644 --- a/Bootstrap.Admin/Controllers/MessagesController.cs +++ b/Bootstrap.Admin/Controllers/MessagesController.cs @@ -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 + { + /// + /// + /// + /// + /// + [HttpGet] + public IEnumerable Get(string id) + { + var ret = new List(); + if (id == "inbox") ret = MessageHelper.Inbox(User.Identity.Name).ToList(); + return ret; + } + } } \ No newline at end of file diff --git a/Bootstrap.Admin/Models/HeaderBarModel.cs b/Bootstrap.Admin/Models/HeaderBarModel.cs index 520fc7f3..3b927c29 100644 --- a/Bootstrap.Admin/Models/HeaderBarModel.cs +++ b/Bootstrap.Admin/Models/HeaderBarModel.cs @@ -41,10 +41,6 @@ namespace Bootstrap.Admin.Models /// public IEnumerable Menus { get; private set; } /// - /// 获得/设置 消息列表 - /// - public IEnumerable MessageList { get; set; } - /// /// 获得/设置 用户头像地址 /// public string Icon { get; set; } diff --git a/Bootstrap.Admin/Scripts/_references.js b/Bootstrap.Admin/Scripts/_references.js index 0a1c01edb13852ab590205d0adbefba2bc793e0d..c6947c298ddc1c094f4b8c90e37bd13c28a9d29c 100644 GIT binary patch delta 28 icmbQFa7ST-7aw;nLn=ct5GFFDPu|aFzuAlL1S0@{00^xB delta 12 TcmcbkFiBy97vJV7d?y$IA@l^* diff --git a/Bootstrap.Admin/Scripts/message.js b/Bootstrap.Admin/Scripts/message.js new file mode 100644 index 00000000..beccbd0a --- /dev/null +++ b/Bootstrap.Admin/Scripts/message.js @@ -0,0 +1,22 @@ +$(function () { + var html = '{0}{1}{2}{3}'; + + 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(); +}); \ No newline at end of file diff --git a/Bootstrap.Admin/Views/Admin/Messages.cshtml b/Bootstrap.Admin/Views/Admin/Messages.cshtml index 4066445d..d554232a 100644 --- a/Bootstrap.Admin/Views/Admin/Messages.cshtml +++ b/Bootstrap.Admin/Views/Admin/Messages.cshtml @@ -3,7 +3,9 @@ ViewBag.Title = "站内消息"; Layout = "~/Views/Shared/_Admin.cshtml"; } - +@section Javascript { + +} @section header { @Html.Partial("Header", Model) } @@ -38,30 +40,16 @@ - + - \ No newline at end of file + + + + + + \ No newline at end of file