var mainPlatform = { init: function(){ this.bindEvent(); this._createTopMenu(); }, bindEvent: function(){ var self = this; // 顶部大菜单单击事件 $(document).on('click', '.pf-nav-item', function() { $('.pf-nav-item').removeClass('current'); $(this).addClass('current'); // 渲染对应侧边菜单 var m = $(this).data('sort'); self._createSiderMenu(SystemMenu[m], m); }); $(document).on('click', '.sider-nav .pf-menu-title', function() { $(this).closest('.pf-sider').find('.sider-nav li').removeClass('current'); $(this).closest('li').addClass('current'); // if is no-child if($(this).closest('.no-child').size() > 0) { var index = $(this).closest('.pf-sider').attr('arrindex'); if($('.easyui-tabs1[arrindex='+ index +']').tabs('exists', $(this).find('.sider-nav-title').text())){ $('.easyui-tabs1[arrindex='+ index +']').tabs('select', $(this).find('.sider-nav-title').text()) return false; } $('.easyui-tabs1[arrindex='+ index +']').tabs('add',{ title: $(this).find('.sider-nav-title').text(), content: '', closable: true }); } //$('iframe').attr('src', $(this).data('src')); }); $(document).on('click', '.sider-nav-s > li', function(e){ var index = $(this).closest('.pf-sider').attr('arrindex'); var titleName = $(this).find('a').eq(0).text(); var url = $(this).data('href'); var $this = $(this); var $target = $(e.target); if($target.closest('ul').hasClass('sider-nav-t')) { return; } $(this).closest('.pf-sider').find('.active').removeClass('active'); $(this).addClass('active'); if(!url) { $this.toggleClass('no-child'); return; } if($('.easyui-tabs1[arrindex='+ index +']').tabs('exists', titleName)){ $('.easyui-tabs1[arrindex='+ index +']').tabs('select', titleName) return; } $('.easyui-tabs1[arrindex='+ index +']').tabs('add',{ title: titleName, content: '', closable: true }); }); $(document).on('click', '.sider-nav-t > li', function(e){ var index = $(this).closest('.pf-sider').attr('arrindex'); var titleName = $(this).find('a').eq(0).text(); var url = $(this).data('href'); var $this = $(this); $(this).closest('.pf-sider').find('.active').removeClass('active'); $(this).addClass('active'); if(!url) { return; } if($('.easyui-tabs1[arrindex='+ index +']').tabs('exists', titleName)){ $('.easyui-tabs1[arrindex='+ index +']').tabs('select', titleName) $(this).parent().closest('li').addClass('active'); return; } $('.easyui-tabs1[arrindex='+ index +']').tabs('add',{ title: titleName, content: '', closable: true }); $(this).parent().closest('li').addClass('active'); e.stopPropagation(); }); //左侧菜单收起 $(document).on('click', '.toggle-icon', function() { $(this).closest("#pf-bd").toggleClass("toggle"); $(window).resize(); }); $('.pf-logout a').on('click', function() { $.messager.confirm({ title: '对话框', ok: '确定', cancel: '取消', msg: '你确定要退出系统吗?', fn: function(r) { if(r) { window.location.href = 'login.html'; } } }); $('.messager-window').find('.l-btn-small').eq(0).addClass('l-btn-selected'); }) //关闭当前 $('#mm-tabclose').click(function(){ var currtab_title = $('#mm').data("currtab"); $(".easyui-tabs1:visible").tabs('close',currtab_title); }) //全部关闭 $('#mm-tabcloseall').click(function(){ $(".easyui-tabs1:visible").find('.tabs li').each(function(i,n){ $(".easyui-tabs1:visible").tabs('close', $(n).text()); }); }); //关闭除当前之外的TAB $('#mm-tabcloseother').click(function(){ var currtab_title = $('#mm').data("currtab"); $('.tabs-inner span').each(function(i,n){ if($(n).text() !== currtab_title) $(".easyui-tabs1:visible").tabs('close',$(n).text()); }); }); // $(document).on('click', '.pf-modify-pwd', function() { // $('#pf-page').find('iframe').eq(0).attr('src', 'backend/modify_pwd.html') // }); // $(document).on('click', '.pf-notice-item', function() { // $('#pf-page').find('iframe').eq(0).attr('src', 'backend/notice.html') // }); }, // renderTopMenu _createTopMenu: function(){ var menuStr = '', currentIndex = 0; for(var i = 0, len = SystemMenu.length; i < len; i++) { menuStr += '