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', '.pf-logout', function() { layer.confirm('您确定要退出吗?', { icon: 4, title: '确定退出' //按钮 }, function(){ location.href= 'login.html'; }); }); $(document).on('click', '.sider-nav-s li', function(e){ var index = $(this).closest('.pf-sider').attr('arrindex'); $(this).closest('.pf-sider').find('.active').removeClass('active'); $(this).addClass('active'); if($('.easyui-tabs1[arrindex='+ index +']').tabs('exists', $(this).text())){ $('.easyui-tabs1[arrindex='+ index +']').tabs('select', $(this).text()) return false; } $('.easyui-tabs1[arrindex='+ index +']').tabs('add',{ title: $(this).text(), content: '', closable: true }); }); //左侧菜单收起 $(document).on('click', '.toggle-icon', function() { $(this).closest("#pf-bd").toggleClass("toggle"); $(window).resize(); }); //关闭当前 $('#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 += '