layui.use(['element', 'flow', 'util'], function () { let element = layui.element; setTimeout(()=>{ window.NotificationUtil = notification.init(); // 轮询查询系统未读通知 NotificationUtil.getUnreadNotifications(); },1500) // 右侧用户导航栏不显示点击状态样式 element.on('nav(user-nav)', function(elem){ $('#user-nav li').removeClass('layui-this') if(elem.data('id') === 'unread'){ layer.open({ type:2, title: '系统通知', area:['550px', `${frameHeight+40}px`], shadeClose : true, btn:[], closeBtn: 0, move:false, offset: 'r', //右侧弹出 anim: 5, content: `${ctx}/sys/notification/`, }); } }); /** * 水平导航栏监听 */ element.on('nav(navbar-top)', function (elem) { let menuId = $(elem).data("id") let url = $(elem).data('url'); let hasChild = $(elem).data("childrenLength") > 0; if(hasChild){ sideNavRender(getMenuChildren(menuId, menuList)); element.render("nav"); // 默认点击第一个 $("#navbar-side li:first a:first").click(); navToggle(hasChild); }else{ navToggle(hasChild); $("#containerFrame").attr("src", url) } }); /** * 侧边导航栏监听 */ element.on('nav(navbar-side)', function (elem) { const url = $(elem).data('url'); const hasChild = $(elem).data('childLength') > 0; if(hasChild){ }else{ $("#containerFrame").attr("src", url) } }) /** * 水平导航栏默认点击第一个 */ const navbarInit = function () { } /** * 设置侧边导航栏菜单 * @param menus */ const sideNavRender = function (menus) { let htm = ``; if(menus && Array.isArray(menus)) { for (let menu of menus) { htm += `