function initbody(){ objcont = $('#content_allmainview'); objtabs = $('#tabs_title'); menubadge = hongbadge = menutopid = {};//角标数组 resizewh(); $(window).resize(resizewh); clickhome(); if(show_key!='')jm.setJmstr(jm.base64decode(show_key)); var a = $("li[pmenuid]"); a.click(function(){ if(js.ajaxbool)return; a.removeClass(); loadmenu(this); }); loadmenu($("li[pmenuid]")[0]); if(typeof(FormData)=='undefined'){ js.msg('msg','您的浏览器太低了无法达到想要的预览效果
建议使用IE10+,Firefox,Chrome等高级点的',60); } if(get('indexuserl')){ var ddsata=[{ name:' 个人设置',num:'grcog','icon':'cog',url:'system,geren,cog',names:'个人设置' },{ name:' 提醒信息',num:'todo','icon':'bell',url:'system,geren,todo',names:'提醒信息' },{ name:' 修改头像',num:'face','icon':'picture' },{ name:' 切换主题',num:'theme','icon':'adjust' },{ name:' 背景首页',num:'jiu','icon':'laptop' },{ name:' 列表首页',num:'jiu2','icon':'laptop' },{ name:' 帐号('+adminuser+')',num:'user' }]; if(js.request('afrom')=='')ddsata.push({name:' 退出',num:'exit'}); $('#indexuserl').rockmenu({ width:150,top:get('topheaderid').offsetHeight, data:ddsata, itemsclick:function(d){ if(d.num=='exit'){ js.confirm('确定要退出系统吗?',function(bn){ if(bn=='yes')js.location('?m=login&a=exit'); }); return; } if(d.num=='face'){ editfacechang(adminid, adminname); return; } if(d.num=='jiu'){ js.location('?a=home'); return; } if(d.num=='jiu2'){ js.location('?a=new'); return; } if(d.num=='theme'){ changetheme(); return; } if(d.num=='user')return; addtabs({num:d.num,url:d.url,name:d.names,icons:d.icon}); } }); } $('#reordershla').click(function(){ $('#indexmenu').hide(); $('#indexmenuss').show(); resizewh(); }); $('#indexmenuss').click(function(){ $('#indexmenu').show(); $('#indexmenuss').hide(); resizewh(); }); _addbodykey(); $('#indesearchmenu').click(function(){ _searchmenus(); }); function _loadjsurl(){ js.importjs('web/res/mode/echarts/echarts.common.min.js'); } setTimeout(_loadjsurl,100); //禁止后退 $(document.body).keydown(function(e){ var lxs = e.target.nodeName.toLowerCase(); var bo = (lxs=='input' || lxs=='textarea'); if(e.keyCode==8 && !bo)return false; }); try{ history.pushState(null, null, document.URL); window.addEventListener('popstate', function (){ history.pushState(null, null, document.URL); }); }catch(e){} } function changetheme(){ var zys = ['#1389D3','#99cc66','#003366','#6666CC','#CC3333','#009966','#333333','#990066','#333300','#333366','#99CC99','#663366','#003399','#338899']; var h = '
'; var nst = ''; for(var i=0;i'+nst+''; } h+='
'; js.tanbody('color','切换主题',310,200,{ html:h }); } function _searchmenus(){ js.prompt('搜索菜单','请输入搜索菜单名:',function(jg,txt){ if(jg=='yes' && txt){ $('#menulisttop').html('搜索结果'); $('#menulist').html('
'+js.ling(30)+'
'); js.ajax(js.getajaxurl('getmenusou','index'),{key:txt}, function(da){ showmenula(da); },'post,json'); } }); } var loadmenuci=0; function loadmenu(o){ var o1 = $(o),id,s1,ico; o1.addClass('active');id = o1.attr('pmenuid');ico = o1.attr('icon'); if(!id)return; loadmenuci++; s1 = o.title; if(ico)s1=' '+s1+''; $('#menulisttop').html(s1); showmenupid = id; $('#menulist').html('
'+js.ling(30)+'
'); js.ajax(js.getajaxurl('getmenu','index'),{pid:id,loadci:loadmenuci}, function(da){ if(da.menutopid)menutopid=da.menutopid; showmenula(da.menuarr); },'get,json'); } function showmenula(a){ menuarr = a; var i,s='',j,k,child,hhild,css1,to,sid,o; hongbadge={}; for(i=0; i '+o.name+''; if(o.bh && o.stotal==0)s+=' '; if(o.stotal>0)s+=''; s+=''; if(o.stotal>0){ child = o.children; s+='
' for(j=0; j '+o.name+''; if(o.bh){ hongbadge[o.bh]=a[i].num; s+=' '; } if(o.stotal>0)s+=''; s+='
'; if(o.stotal>0){ hhild = o.children; s+='
' for(k=0; k '+o.name+'
'; } s+=''; } } s+=''; } } if(s=='')s='
暂无
'; $('#menulist').html(s); showmenubadge(); } //显示角标处理 function showmenubadge(){ var o,sid,to,tnu,tid,o1; $('li[pmenuid] font').remove(); for(sid in menubadge){ to = menubadge[sid]; o = $('span[badge="'+sid+'"]'); tnu= hongbadge[sid]; if(o){if(to<=0){ o.hide(); if(tnu)$('#hongdian_'+tnu+'').hide(); }else{ o.show();o.html(to); if(tnu)$('#hongdian_'+tnu+'').show(); tid= menutopid[sid]; if(tid){ o1 = $('li[pmenuid="'+tid+'"]'); o1.find('font').remove(); o1.find('a').append(''); } }} } } function removetadge(num){ if(typeof(menubadge[num])=='undefined')return; $('span[badge="'+num+'"]').hide(); menubadge[num]=0; showmenubadge(); } function opentixiang(){ addtabs({num:'todo',url:'system,geren,todo',icons:'bell',name:'提醒信息'}); return false; } function clickhome(){ var ad = {num:'home',url:'home,index',icons:'home',name:'首页',hideclose:true}; if(homeurl!='')ad.url= homeurl; if(homename!='')ad.name= homename; addtabs(ad); return false; } var fistwk=0; function resizewh(){ var _lw = 0; if(get('indexmenu')){ _lw = $('#indexmenu').width()+5; if(get('indexmenu').style.display=='none'){ _lw = $('#indexmenuss').width()+5; } } var w = winWb()-_lw; var h = winHb(),_ht=0; if(get('topheaderid'))_ht=get('topheaderid').offsetHeight; viewwidth = w; viewheight = h-_ht-50; $('#indexcontent').css({width:''+viewwidth+'px',height:''+(viewheight)+'px'}); $('#tabsindexm').css({width:''+viewwidth+'px'}); var nh = h-_ht; $('#indexmenu').css({height:''+nh+'px'}); $('#indexsplit').css({height:''+nh+'px'}); $('#indexmenuss').css({height:''+nh+'px'}); $('#menulist').css({height:''+(viewheight)+'px'}); _pdleftirng(); if(fistwk==0){ $('#topmenudiv span[pmenuid]').each(function(){ fistwk+=$(this).width()+30; }); } var lw=$('#logodiv').width(); var rw = $('#topheaderright').width(); var kj = winWb()-lw-rw; $('#topmenudiv').css('width',''+kj+'px'); var o1 = $('#donwrigthw').css('right',''+rw+'px'); o1.hide(); if(fistwk>kj){ o1.show(); $('#topmenudiv').css('width',''+(kj-20)+'px'); } } function clickmenu(o, i, j,k){ var a = menuarr[i]; if(j>-1)a=a.children[j]; if(k>-1)a=a.children[k]; var oi = a.stotal,dxu=''+i+'_'; if(oi>0){ $('#hongdian_'+a.num+'').hide();//隐藏红点 if(j>-1){ dxu+=''+j+'_'; $('div[downmenu^="'+dxu+'"]').toggle(); } var o1 = get('menu_down_isons_'+a.num+''); if(o1.className.indexOf('down')>0){ o1.className='icon-caret-up'; if(j==-1)$('div[downmenu^="'+dxu+'"]').show(); }else{ o1.className='icon-caret-down'; if(j==-1)$('div[downmenu^="'+dxu+'"]').hide(); } }else{ addtabs(a); } } var coloebool = false; function closetabs(num){ tabsarr[num] = false; $('#content_'+num+'').remove(); $('#tabs_'+num+'').remove(); if(num == nowtabs.num){ var now ='home',i,noux; for(i=opentabs.length-1;i>=0;i--){ noux= opentabs[i]; if(get('content_'+noux+'')){ now = noux; break; } } changetabs(now); } coloebool = true; _pdleftirng(); setTimeout('coloebool=false',10); } function closenowtabs(){ var nu=nowtabs.num; if(nu=='home')return; closetabs(nu); } function nowtabssettext(srt,icos){ var num=nowtabs.num; var txt = srt; tabsarr[num].name = srt; nowtabs.name = srt; if(!icos)icos=nowtabs.icons; if(icos)txt=' '+txt+''; $('#tabs_'+num+' font').html(txt); } function changetabs(num,lx){ if(coloebool)return; if(!lx)lx=0; $("div[temp='content']").hide(); $("[temp='tabs']").removeClass(); var bo = false; if(get('content_'+num+'')){ $('#content_'+num+'').show(); $('#tabs_'+num+'').addClass('active'); nowtabs = tabsarr[num]; if(typeof(nowtabs.onshow)=='function')nowtabs.onshow(); bo = true; } opentabs.push(num); if(lx==0)_changhhhsv(num); return bo; } function _changhhhsv(num){ var o=$("[temp='tabs']"),i,w1=0; for(i=0;iviewwidth){$('.jtcls').show();}else{$('.jtcls').hide();} } function addiframe(a){ a.url = 'index,iframe,url='+jm.base64encode(a.url)+''; addtabs(a); } //选择卡右键 function tabsright(num,e){ function _closeother(nu){ var nus,d1; for(nus in tabsarr){ d1 = tabsarr[nus]; if(d1 && !d1.hideclose && nus!=nu)closetabs(nus); } } if(typeof(tabsrights)=='undefined')tabsrights=$.rockmenu({ width:150, data:[], itemsclick:function(d){ var lx = d.lx,num=d.num; if(lx==0)closetabs(num); if(lx==1){ var d1 = tabsarr[num],s1=''+PROJECT+'/'+d1.urlpath+''; var s = '['+d1.name+']页面地址是:'+s1+'
,在[系统→基础管理→菜单管理]设置URL地址为:'+d1.url+''; if(HOST=='127.0.0.1' || HOST=='localhost')s+=' [打开]'; s+='
'; js.alert(s); } if(lx==2)_closeother(num); if(lx==3)location.reload(); if(lx==4)_opentabls(d.tobj); } }); var to= tabsarr[num],d = []; if(!to.hideclose)d.push({'name':'关闭','num':num,lx:0}); if(num==nowtabs.num)d.push({'name':'关闭其它页面','num':num,lx:2}); if(admintype==1)d.push({'name':'查看页面地址','num':num,lx:1}); if(homeurl=='' && to.id)d.push({'name':'新窗口打开',tobj:to,'num':num,lx:4}); d.push({'name':'全部刷新','num':num,lx:3}); tabsrights.setData(d); tabsrights.showAt(e.clientX,e.clientY+5); } function _opentabls(d){ var url = '?homeurl='+jm.base64encode(d.url)+'&homename='+jm.base64encode(d.name)+'&menuid='+jm.base64encode(d.id)+''; window.open(url); } //开发时打开文件 function _openfile(s){ js.ajax(js.getajaxurl('openfile','index'),{file:s},function(ds){ if(ds!='ok')js.msg('msg', ds); },'get'); } /** * 添加选择卡 */ function addtabs(a){ var url = a.url, num = a.num; if(isempt(url))return false; removetadge(num); if(url.indexOf('add,')==0){openinput(a.name,url.substr(4));return;} if(url.indexOf('open:')==0){window.open(url.substr(5));return;} if(url.indexOf('http')==0 || url.substr(0,1)=='?'){addiframe(a);return;} if(nowtabs && nowtabs.id && !a.id)a.id=nowtabs.id; nowtabs = a; if(changetabs(num))return true; var s = ''; if(a.icons)s+=' '; s+=a.name+''; if(!a.hideclose)s+='x'; s+=''; objtabs.append(s); _changhhhsv(num); _pdleftirng(); var rand = js.getrand(),i,oi=2, ura = url.split(','), dir = ura[0], mode= ura[1]; url =''+dir+'/'+mode+'/rock_'+mode+''; if(ura[2]){ if(ura[2].indexOf('=')<0){ oi=3; url+='_'+ura[2]+''; } } var urlpms= ''; for(i=oi;i'+js.ling(30)+' 加载中...'; $('#indexcontent').append(bgs); a.urlpath = url+'.php'; objcont.append('
'); $.ajax({ url:'?m=index&a=getshtml&surl='+jm.base64encode(url)+'&num='+num+'&menuname='+jm.base64encode(a.name)+'&urlpms='+jm.base64encode(urlpms)+'', type:'get', success: function(da){ $('#mainloaddiv').remove(); var s = da; s = s.replace(/\{rand\}/gi, rand); s = s.replace(/\{adminid\}/gi, adminid); s = s.replace(/\{adminname\}/gi, adminname); s = s.replace(/\{mode\}/gi, mode); s = s.replace(/\{dir\}/gi, dir); s = s.replace(/\{params\}/gi, "var params={"+urlpms+"};"); var obja = $('#content_'+num+''); if(num!='home')s='
'+s+'
'; obja.html(s); }, error:function(){ $('#mainloaddiv').remove(); var s = 'Error:加载出错喽,'+url+''; $('#content_'+num+'').html(s); } }); tabsarr[num] = a; return false; }