Kaynağa Gözat

消息提示

master
ebeveyn
işleme
308a6a3f4c
3 değiştirilmiş dosya ile 327 ekleme ve 1 silme
  1. +187
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/MessageRindController.cs
  2. +139
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/UnreadIndex.cshtml
  3. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-layer.js

+ 187
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/MessageRindController.cs Dosyayı Görüntüle

@@ -0,0 +1,187 @@
using Learun.Util;
using System.Data;
using Learun.Application.TwoDevelopment.LR_Desktop;
using System.Web.Mvc;
using System.Collections.Generic;
using System.Collections;

namespace Learun.Application.Web.Areas.LR_Desktop.Controllers
{
/// <summary>
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
/// 创 建:超级管理员
/// 日 期:2021-04-23 16:58
/// 描 述:消息提醒
/// </summary>
public class MessageRindController : MvcControllerBase
{
private MessageRindIBLL messageRindIBLL = new MessageRindBLL();

#region 视图功能

/// <summary>
/// 主页面
/// <summary>
/// <returns></returns>
[HttpGet]
public ActionResult Index()
{
return View();
}
/// <summary>
/// 未读消息页面
/// <summary>
/// <returns></returns>
[HttpGet]
public ActionResult UnreadIndex()
{
return View();
}
/// <summary>
/// 表单页
/// <summary>
/// <returns></returns>
[HttpGet]
public ActionResult Form()
{
return View();
}
#endregion

#region 获取数据

/// <summary>
/// 获取页面显示列表数据
/// </summary>
/// <param name="pagination">分页参数</param>
/// <param name="queryJson">查询参数</param>
/// <returns></returns>
[HttpGet]
[AjaxOnly]
public ActionResult GetPageList(string pagination, string queryJson)
{
Pagination paginationobj = pagination.ToObject<Pagination>();
var data = messageRindIBLL.GetPageList(paginationobj, queryJson);
var jsonData = new
{
rows = data,
total = paginationobj.total,
page = paginationobj.page,
records = paginationobj.records
};
return Success(jsonData);
}

/// <summary>
/// 获取未读的消息的数量
/// </summary>
/// <param name="pagination">分页参数</param>
/// <param name="queryJson">查询参数</param>
/// <returns></returns>
[HttpGet]
[AjaxOnly]
public ActionResult GetCountForUnread()
{
var count = messageRindIBLL.GetCountForUnread();

return Success(count);
}
/// <summary>
/// 获取未读的消息
/// </summary>
/// <param name="pagination">分页参数</param>
/// <param name="queryJson">查询参数</param>
/// <returns></returns>
[HttpGet]
[AjaxOnly]
public ActionResult GetListForUnread()
{
var data = messageRindIBLL.GetListForUnread();
List<Hashtable> list = new List<Hashtable>();
foreach (var entity in data)
{
Hashtable ht = new Hashtable();
ht["MessageId"] = entity.MessageId;
ht["SenderName"] = entity.SenderName;
ht["TheTitle"] = entity.TheTitle;
ht["TheContent"] = entity.TheContent;
ht["ConnectionUrl"] = entity.ConnectionUrl;
ht["InstanceId"] = entity.InstanceId;
list.Add(ht);
}
return ToJsonResult(list);
}

/// <summary>
/// 获取表单数据
/// </summary>
/// <param name="keyValue">主键</param>
/// <returns></returns>
[HttpGet]
[AjaxOnly]
public ActionResult GetFormData(string keyValue)
{
var MessageRemindData = messageRindIBLL.GetMessageRemindEntity(keyValue);
var jsonData = new
{
MessageRemind = MessageRemindData,
};
return Success(jsonData);
}
#endregion

#region 提交数据

/// <summary>
/// 删除实体数据
/// </summary>
/// <param name="keyValue">主键</param>
/// <returns></returns>
[HttpPost]
[AjaxOnly]
public ActionResult DeleteForm(string keyValue)
{
messageRindIBLL.DeleteEntity(keyValue);
return Success("删除成功!");
}
/// <summary>
/// 保存实体数据(新增、修改)
/// </summary>
/// <param name="keyValue">主键</param>
/// <param name="strEntity">实体</param>
/// <returns></returns>
[HttpPost]
[ValidateAntiForgeryToken]
[AjaxOnly]
public ActionResult SaveForm(string keyValue, string strEntity)
{
MessageRemindEntity entity = strEntity.ToObject<MessageRemindEntity>();
messageRindIBLL.SaveEntity(keyValue, entity);
if (string.IsNullOrEmpty(keyValue))
{
}
return Success("保存成功!");
}

/// <summary>
/// 更改状态为已读
/// </summary>
/// <param name="keyValue">主键</param>
/// <param name="strEntity">实体</param>
/// <returns></returns>
[HttpPost]
[AjaxOnly]
public ActionResult SaveReadSigns(string keyValue)
{
if (!string.IsNullOrEmpty(keyValue))
{
messageRindIBLL.SaveReadSigns(keyValue);
}
return Success("保存成功!");
}

#endregion

}
}

+ 139
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Views/MessageRind/UnreadIndex.cshtml Dosyayı Görüntüle

@@ -0,0 +1,139 @@
@*@{
ViewBag.Title = "未读消息";
Layout = "~/Views/Shared/_Index.cshtml";
}
<div class="lr-layout " >
<div class="lr-layout-center">
<div class="lr-layout-wrap lr-layout-wrap-notitle ">

<div class="lr-layout-body" id="content"></div>
</div>
</div>
</div>*@
<!DOCTYPE html>

<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>未读消息提醒</title>
<script src="~/Content/jquery/plugin/fullcalendar/js/jquery-1.7.2.min.js"></script>
<script src="~/Content/jquery/plugin/jquery-ui/jquery-ui.min.js"></script>
<script src="~/Content/jquery/plugin/fullcalendar/js/fullcalendar.min.js"></script>
<link href="~/Content/jquery/plugin/fullcalendar/css/fullcalendar.css" rel="stylesheet" />
@Html.AppendCssFile(
"/Views/LR_Content/style/lr-common.css",
"/Views/LR_Content/style/lr-iframe-index.css",
"~/Content/jquery/plugin/toastr/toastr.css"
)

</head>
<body>
<div id='content'>

</div>
@Html.AppendJsFile(
"~/Content/jquery/plugin/toastr/toastr.min.js",
"~/Views/LR_Content/script/lr-admin.js",
"~/Views/LR_Content/script/lr-clientdata.js",
"~/Content/jquery/plugin/fullcalendar/js/jquery-1.7.2.min.js",
"~/Areas/LR_Desktop/Views/MessageRind/Index.js"
)

<script type='text/javascript'>
$(document).ready(function () {
getdata();

function getdata() {
$.ajax({
url: top.$.rootUrl + '/LR_Desktop/MessageRind/GetListForUnread',
type: "get",
dataType: "json",
async: false,
success: function (data) {
var content = "";
if (data.length > 0) {
content += "<ul id='uldata'>";
for (var i = 0; i < data.length; i++) {
content += "<li>" + "&nbsp;&nbsp;&nbsp;" + data[i]["SenderName"] + "的消息:" + "</li>";
var theContent = data[i]["TheContent"];
//可显示的最长长度
var maxlen = 50;
if (theContent.length > maxlen) {
theContent = theContent.substring(0, maxlen - 3) + "...";
}
var param = data[i]["TheTitle"] + "、" + data[i]["InstanceId"] + "、" + data[i]["MessageId"] + "、" + data[i]["ConnectionUrl"];
content += "<li>";
content += "&nbsp;&nbsp;&nbsp;&nbsp;【" + data[i]["TheTitle"] + "】" + theContent + "&nbsp;&nbsp;";
content += '<a id="' + param + '" href="javascript:void(0);" class="lr-item" style="color:blue;textDecoration:underline">点击查看>>';
content += "</a>";
content += "</li>";
}
content += "</ul>";
}
else {
content = "暂无未读消息";
}
$("#content").html(content);
}
});
}

$('#uldata .lr-item').on('click', function () {
var $obj = $(this);
var params = ($obj.attr('id')).split('、');

//更改状态为已读
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) {
//弹窗查看详情
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;
// }

//}

</script>
</body>
</html>

+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-layer.js Dosyayı Görüntüle

@@ -70,7 +70,7 @@
dfop.width = dfop.width > $(window).width() ? $(window).width() - 10 : dfop.width;
dfop.height = dfop.height > $(window).height() ? $(window).height() - 10 : dfop.height;
var r = 0;
r=top.layer.open({
r = top.layer.open({
id: dfop.id,
maxmin: dfop.maxmin,
type: 2, //0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层)


Yükleniyor…
İptal
Kaydet