var basic=""
|
jQuery(document).ready(function($) {
|
lfetmenus()
|
});
|
|
//退出登录
|
function logout(){
|
$.ajax({
|
url: "/homepage/logout.htm",
|
async: false,
|
success:function(result){
|
location.href = "/login.jsf";
|
}
|
});
|
}
|
|
function lfetmenus(){
|
var path=window.document.location.pathname;
|
jQuery.post(basic+'/admin/menucon/ftmenu.htm', {title:'lftmenus'}, function(data, textStatus, xhr) {
|
if(data==null)
|
return;
|
var navlist=$('ul.nav-list');
|
navlist.empty();
|
var li_parent=null;
|
var ul_child=null;
|
var li_child=null;
|
var li_parent_lft=0;
|
var li_parent_rgt=0;
|
jQuery.each(data, function(index, val) {
|
var lft=val.lft;
|
var rgt=val.rgt;
|
if(lft<li_parent_rgt)
|
{
|
if(val.trget!=null&&val.trget!='')
|
li_child=jQuery('<li> <a href="'+val.url+'"> <i class="icon-double-angle-right"></i> '+val.title+' </a> </li>').appendTo(ul_child);
|
else
|
li_child=jQuery('<li> <a href="'+val.url+'" target="'+val.trget+'"> <i class="icon-double-angle-right"></i> '+val.title+' </a> </li>').appendTo(ul_child);
|
}else{
|
li_parent=jQuery('<li></li>').appendTo(navlist);
|
ul_child=null;
|
var a=jQuery('<a href="javascript:void(0);" class="dropdown-toggle"></a>').appendTo(li_parent);
|
var i=jQuery('<i class="'+val.icon+'"></i>').appendTo(a);
|
var span=jQuery('<span class="menu-text">'+val.title+'</span>').appendTo(a);
|
var b=jQuery('<b class="arrow icon-angle-down"></b>').appendTo(a);
|
li_parent_lft=lft;
|
li_parent_rgt=rgt;
|
if(rgt-lft>1)
|
{
|
ul_child=jQuery('<ul class="submenu"></ul>').appendTo(li_parent);
|
}else{
|
a.removeClass('dropdown-toggle');
|
if(val.url!=null&&val.url!='')
|
{
|
a.attr('href',val.url);
|
}
|
}
|
}
|
if(val.url!=null&&val.url.indexOf(path)>=0)
|
{
|
li_parent.addClass('active');
|
li_parent.addClass('open');
|
if(li_child!=null)
|
li_child.addClass('active');
|
}
|
});
|
},'json');
|
}
|
|
function isItems(items) {
|
return ($.isArray(items) && items.length > 0) ? true : false;
|
}
|