(function(s,o){typeof s.layui=="object"&&layui.define?layui.define(["layer"],function(t){t("jsanNotice",o(layui.layer))}):o(s.layer)})(this,function(s){return layui.link(layui.cache.base+"mods/extend/jsan-notice.css?v="+new Date().getTime()),s.noticeMarker=function(o){const t=layui.$,i={},w=typeof o.positionX=="undefined"||o.positionX==="right"?"right: 1px;":o.positionX+" 1px;",m=typeof o.positionY=="undefined"?"top: 0;":"top: "+o.positionY+";",y="lay-jsan-notice-marker",h="lay-jsan-notice-marker-box",d="lay-jsan-notice-marker-news",u="layui-icon layui-icon-speaker lay-jsan-notice-marker-icon",W="lay-jsan-notice-marker-btn",c="layui-icon layui-icon-"+(typeof o.positionX=="undefined"||o.positionX==="right"?"right":"left"),l="layui-icon layui-icon-"+(typeof o.positionX=="undefined"||o.positionX==="right"?"left":"right");if(i.properties={},t(o.elem).hide(),i.properties.index=NOTICE_MARKER_INDEX++,i.properties.isOpen=o.lowKey,i.properties.option=o,i.properties.option.positionX=typeof o.positionX=="undefined"?"right":o.positionX,i.properties.option.positionY=typeof o.positionY=="undefined"?"right":o.positionY,i.properties.marker=t("
"),i.properties.markerBoxBtn=t(""),i.properties.markerBoxBtnIcon=t(""),i.properties.markerBox=t(""),i.properties.markerBoxIcon=t(""),i.remind=function(n){n.lowKey&&i.properties.isOpen?this.hideBox():!n.lowKey&&!i.properties.isOpen&&this.showBox(),this.properties.markerBox.addClass(d),this.properties.markerBoxBtn.addClass(d)},i.hideBox=function(){this.properties.isOpen&&(this.properties.markerBox.hide(),this.properties.markerBoxBtnIcon.removeClass(c),this.properties.markerBoxBtnIcon.addClass(l),this.properties.isOpen=!1)},i.showBox=function(){this.properties.isOpen||(this.properties.markerBox.show(),this.properties.markerBoxBtnIcon.removeClass(l),this.properties.markerBoxBtnIcon.addClass(c),this.properties.isOpen=!0)},i.properties.markerBoxBtn.html(i.properties.markerBoxBtnIcon),i.properties.markerBox.html(i.properties.markerBoxIcon),i.properties.marker.html(i.properties.option.positionX==="left"?i.properties.markerBox:i.properties.markerBoxBtn),i.properties.marker.append(i.properties.option.positionX==="left"?i.properties.markerBoxBtn:i.properties.markerBox),t("body").append(i.properties.marker),i.properties.markerBoxBtn.unbind().on("click",i,function(n){n.data.properties.isOpen?n.data.hideBox():n.data.showBox()}),typeof i.properties.option.noticeWindow=="object"&&i.properties.option.noticeWindow.type!==2){i.noticeWindow={},i.noticeWindow.index=i.properties.index,i.noticeWindow.width=typeof i.properties.option.noticeWindow.width=="string"?i.properties.option.noticeWindow.width:"150px",i.noticeWindow.height=typeof i.properties.option.noticeWindow.height=="string"?i.properties.option.noticeWindow.height:"560px",i.noticeWindow.contentWidth=typeof i.properties.option.noticeWindow.contentWidth=="string"?i.properties.option.noticeWindow.contentWidth:"650px",i.noticeWindow.contentHeight=typeof i.properties.option.noticeWindow.contentHeight=="string"?i.properties.option.noticeWindow.contentHeight:"560px",i.noticeWindow.window=t(""),i.noticeWindow.tabTitle=t(""),i.noticeWindow.tabContent=t("");const n={};if(typeof i.properties.option.noticeWindow.classType=="object")for(let e in i.properties.option.noticeWindow.classType)n[e]=[""+i.properties.option.noticeWindow.classType[e]+"",""];else n.notice=["消息",``];i.noticeWindow.classType=n,i.noticeWindow.window.html(i.noticeWindow.tabTitle),i.noticeWindow.window.append(i.noticeWindow.tabContent);for(let e in i.noticeWindow.classType)i.noticeWindow.tabTitle.append(i.noticeWindow.classType[e][0]),i.noticeWindow.tabContent.append(i.noticeWindow.classType[e][1]);i.noticeWindow.window.hide(),i.noticeWindow.tabTitle.find("li").eq(0).addClass("layui-this"),i.noticeWindow.tabContent.find(".layui-tab-item").eq(0).addClass("layui-show"),t("body").append(i.noticeWindow.window),layui.use("element",function(){}),i.properties.markerBox.unbind().on("click",i,function(e){e.data.hideBox(),s.open({type:1,id:"notice-marker-window-layer-"+i.noticeWindow.index,title:typeof e.data.properties.option.noticeWindow.title=="string"?e.data.properties.option.noticeWindow.title:"",area:[e.data.noticeWindow.width-12,e.data.noticeWindow.height],offset:[e.data.properties.option.positionY,i.properties.option.positionX==="right"?t("body").width()-16-Number(i.noticeWindow.width.replace("px",""))+"px":"16px"],shade:0,maxmin:!0,content:t("#"+e.data.noticeWindow.window.attr("id")),cancel:function(){i.noticeWindow.window.hide()}}),e.data.properties.markerBox.removeClass(d),e.data.properties.markerBoxBtn.removeClass(d)}),i.addNews=function(e){for(let r in e.content){const p=t("");p.append(""+(e.content[r].title.length>28?e.content[r].title.substring(0,25)+"...":e.content[r].title)+"
"),p.append(""+e.content[r].date+"
"),p.append(""+(e.content[r].content.length>45?e.content[r].content.substring(0,43)+"...":e.content[r].content)+"
"),t("#notice-marker-window-content-"+e.classTypeId).prepend(p)}t("#notice-marker-window-title-"+e.classTypeId).find(".layui-badge-dot").removeClass("layui-hide"),f(e,this);const a=typeof e.lowKey=="undefined"?!1:e.lowKey;this.remind({lowKey:a})};var f=function(e,a){t("#notice-marker-window-content-"+e.classTypeId+" .lay-jsan-notice-marker-item").unbind().on("click",function(r){t(this).find(".lay-jsan-notice-marker-item-title").eq(0).removeClass("lay-jsan-notice-marker-item-title-new"),t("#notice-marker-window-content-"+e.classTypeId).find(".lay-jsan-notice-marker-item-title-new").length===0&&t("#notice-marker-window-title-"+e.classTypeId).find(".layui-badge-dot").addClass("layui-hide"),t(this).attr("notice-url"),s.open({type:2,title:a.properties.option.noticeWindow.title,area:[a.noticeWindow.contentWidth,a.noticeWindow.contentHeight],shade:0,maxmin:!0,content:t(this).attr("notice-url")})})}}else typeof i.properties.option.noticeWindow=="object"&&i.properties.option.noticeWindow.type===2&&(i.noticeWindow={},i.noticeWindow.index=i.properties.index,i.noticeWindow.url=i.properties.option.noticeWindow.url,i.noticeWindow.width=typeof i.properties.option.noticeWindow.width=="string"?i.properties.option.noticeWindow.width:"150px",i.noticeWindow.height=typeof i.properties.option.noticeWindow.height=="string"?i.properties.option.noticeWindow.height:"560px",i.properties.markerBox.unbind().on("click",i,function(n){n.data.hideBox(),s.open({type:2,id:"notice-marker-window-layer-"+i.noticeWindow.index,title:typeof n.data.properties.option.noticeWindow.title=="string"?n.data.properties.option.noticeWindow.title:"",area:[n.data.noticeWindow.width,n.data.noticeWindow.height],offset:[n.data.properties.option.positionY,i.properties.option.positionX==="right"?t("body").width()-16-Number(i.noticeWindow.width.replace("px",""))+"px":"16px"],shade:0,maxmin:!0,content:n.data.noticeWindow.url})}));return i.properties.isOpen?i.hideBox():i.showBox(),i},{mod:"jsanNotice",v:"1.0.11"}}),NOTICE_MARKER_INDEX=1;