From 889eb15032190cdbbffb6b8cab67ad4e73e4da84 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Mon, 10 May 2021 12:15:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A1=8C=E9=9D=A2=E6=B6=88=E6=81=AF=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/MessageRindController.cs | 14 +++ .../LR_Desktop/Views/MessageRind/Index.js | 23 +--- .../Views/MessageRind/UnreadIndex.cshtml | 106 ++++++++++-------- .../Views/Home/AdminDesktop.cshtml | 6 +- .../Views/Home/AdminDesktop/Index.js | 34 +++++- .../Views/LR_Content/script/lr-layer.js | 5 +- .../LR_Desktop/MessageRind/MessageRindBLL.cs | 24 ++++ .../LR_Desktop/MessageRind/MessageRindIBLL.cs | 5 + .../MessageRind/MessageRindService.cs | 28 +++++ 9 files changed, 172 insertions(+), 73 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/MessageRindController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/MessageRindController.cs index 80bc359df..19bd02828 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/MessageRindController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/MessageRindController.cs @@ -73,6 +73,20 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers return Success(jsonData); } + /// + /// 获取未读的消息的数量 + /// + /// 分页参数 + /// 查询参数 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetCountForUnread() + { + var count = messageRindIBLL.GetCountForUnread(); + + return Success(count); + } /// /// 获取未读的消息 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/Index.js index eab7de93b..2f79e8e57 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/Index.js @@ -129,26 +129,5 @@ var bootstrap = function ($, learun) { $('#gridtable').jfGridSet('reload'); }; page.init(); - funopen(); - - function funopen() { - learun.layeropen({ - //id: 'form', - type: 2, - title: "消息提示", - closeBtn: 0, //不显示关闭按钮 - shade: [0], - area: ['340px', '215px'], - offset: 'rb', //右下角弹出 - anim: 2, - content: top.$.rootUrl + '/LR_Desktop/MessageRind/UnreadIndex', - callBack: function (id) { - return top[id].acceptClick(refreshGirdData); - } - }); - }; - - function onload() { - $('#gridtable').jfGridSet('reload'); - } + } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/UnreadIndex.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/UnreadIndex.cshtml index 6119861ba..fb0603873 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/UnreadIndex.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/UnreadIndex.cshtml @@ -85,58 +85,74 @@ //更改状态为已读 var MessageId = params[2]; if (top.learun.checkrow(MessageId)) { - $.ajax({ - url: top.$.rootUrl + '/LR_Desktop/MessageRind/SaveReadSigns', - type: "post", - data: { keyValue: MessageId }, - dataType: "json", - async: false, - success: function (data) { - //console.log(data); - //弹窗查看详情 - var keyValue = params[1]; - var ConnectionUrl = params[3]; - var title = params[0]; - if (top.learun.checkrow(keyValue)) { - top.learun.layerForm({ - id: 'formview', - title: title, - url: top.$.rootUrl + ConnectionUrl + keyValue, - width: 1000, - height: 650, - maxmin: true, - btn: null, - callBack: function (id) { - return top[id].acceptClick(onload()); - } - }); - - } + top.learun.deleteForm(top.$.rootUrl + '/LR_Desktop/MessageRind/SaveReadSigns', { keyValue: MessageId }, function () { + //弹窗查看详情 + var keyValue = params[1]; + var ConnectionUrl = params[3]; + var title = params[0]; + if (top.learun.checkrow(keyValue)) { + top.learun.layerForm({ + id: 'formview', + title: title, + url: top.$.rootUrl + ConnectionUrl + keyValue, + width: 1000, + height: 650, + maxmin: true, + btn: null, + }); + } - }) + }); + + + //$.ajax({ + // url: top.$.rootUrl + '/LR_Desktop/MessageRind/SaveReadSigns', + // type: "post", + // data: { keyValue: MessageId }, + // dataType: "json", + // async: false, + // success: function (data) { + // //弹窗查看详情 + // var keyValue = params[1]; + // var ConnectionUrl = params[3]; + // var title = params[0]; + // if (top.learun.checkrow(keyValue)) { + // top.learun.layerForm({ + // id: 'formview', + // title: title, + // url: top.$.rootUrl + ConnectionUrl + keyValue, + // width: 1000, + // height: 650, + // maxmin: true, + // btn: null, + // }); + + // } + // } + //}) } }); }); - //function funLook(param) { - - // var id = "433d5658-40b0-4e2d-b736-c4e8561d017e";//$obj.attr('id'); - // var _module = top.learun.clientdata.get(['modulesMap', id]); - // switch (_module.F_Target) { - // case 'iframe':// 窗口 - // if (top.learun.validator.isNotNull(_module.F_UrlAddress).code) { - // top.learun.frameTab.open(_module); - // } - // break; - // case 'open':// 窗口 - // var newWin = window.open(_module.F_UrlAddress); - // newWin.location.replace(_module.F_UrlAddress); - // break; - // } - - //} + //function funLook(param) { + + // var id = "433d5658-40b0-4e2d-b736-c4e8561d017e";//$obj.attr('id'); + // var _module = top.learun.clientdata.get(['modulesMap', id]); + // switch (_module.F_Target) { + // case 'iframe':// 窗口 + // if (top.learun.validator.isNotNull(_module.F_UrlAddress).code) { + // top.learun.frameTab.open(_module); + // } + // break; + // case 'open':// 窗口 + // var newWin = window.open(_module.F_UrlAddress); + // newWin.location.replace(_module.F_UrlAddress); + // break; + // } + + //} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktop.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktop.cshtml index 5148cec5d..b290a13ee 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktop.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktop.cshtml @@ -31,11 +31,13 @@
  统计指标
-
+
- + @*
*@ + + @Html.AppendJsFile("/Views/Home/AdminDesktop/Index.js") \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktop/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktop/Index.js index 1653c3c83..b3dd24b04 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktop/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktop/Index.js @@ -87,7 +87,7 @@ $(function () { var l = g.find('[data-value="' + m.Id + '"]'); $.each(m.value, function (p, q) { - console.log(q.rnewsid); + //console.log(q.rnewsid); if (q.rnewsid) { if (q.rnewsid === '0') { var o = '
' + q.f_title + "
"; @@ -304,6 +304,36 @@ $(function () { } }) - + funopen(); + window.setInterval(funopen, 60000); + //window.clearInterval(t1); + //消息提醒 + function funopen() { + $.ajax({ + url: top.$.rootUrl + '/LR_Desktop/MessageRind/GetCountForUnread', + type: "get", + dataType: "json", + async: false, + success: function (data) { + if (data.data != 0) { + document.getElementById("sound").src = '/Resource/wav/收到新消息.wav'; + top.learun.layeropen({ + //id: 'form', + type: 2, + title: "消息提示", + closeBtn: 0, //不显示关闭按钮 + shade: [0], + area: ['340px', '215px'], + offset: 'rb', //右下角弹出 + anim: 2, + content: top.$.rootUrl + '/LR_Desktop/MessageRind/UnreadIndex', + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + } + } + }); + }; }); \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-layer.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-layer.js index c6f7a4b79..91d496ea3 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-layer.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-layer.js @@ -241,8 +241,9 @@ btn: dfop.btn, offset: 'rb', //右下角弹出 closeBtn: 1, //显示关闭按钮 - shade: [0], - content: [op.content, 'yes'],//op.url, + shade: false,//[0], + time: 60000, //60秒后自动关闭 + content: op.content,//op.url, //skin: dfop.btn == null ? 'lr-layer-nobtn' : 'lr-layer', success: function (layero, index) { top['layer_' + dfop.id] = learun.iframe($(layero).find('iframe').attr('id'), top.frames); diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindBLL.cs index 233fc162d..0b332ac33 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindBLL.cs @@ -66,6 +66,30 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop } } + + /// + /// 未读消息的数量 + /// + /// + public int GetCountForUnread() + { + try + { + return messageRindService.GetCountForUnread(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + /// /// 获取MessageRemind表实体数据 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindIBLL.cs index bce83c965..ea552d6ee 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindIBLL.cs @@ -27,6 +27,11 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop /// IEnumerable GetListForUnread(); /// + /// 获取未读的消息的数量 + /// + /// + int GetCountForUnread(); + /// /// 获取MessageRemind表实体数据 /// /// 主键 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindService.cs index a68915eab..616697343 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/MessageRind/MessageRindService.cs @@ -91,6 +91,34 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop } } + /// + /// 获取MessageRemind表未读消息的数量 + /// + /// + public int GetCountForUnread() + { + try + { + string sql = "select count(1) from MessageRemind where ReadSigns=0"; + var obj = this.BaseRepository().FindObject(sql); + if (obj == null) + return 0; + else + return Convert.ToInt32(obj); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + /// /// 获取MessageRemind表实体数据 ///