hjg
2023-11-18 bb48edb3d9faaaeab0088151c86fc24137acdb08
提交 | 用户 | 时间
58d006 1 var basic=""
A 2 jQuery(document).ready(function($) {
3     lfetmenus()
4 });
5
6 //退出登录
7 function logout(){
8     $.ajax({
9         url: "/homepage/logout.htm",
10         async: false,
11         success:function(result){
12             location.href = "/login.jsf";
13         }
14     });
15 }
16
17 function lfetmenus(){
18     var path=window.document.location.pathname;
19     jQuery.post(basic+'/admin/menucon/ftmenu.htm', {title:'lftmenus'}, function(data, textStatus, xhr) {
20         if(data==null)
21             return;
22         var navlist=$('ul.nav-list');
23         navlist.empty();
24         var li_parent=null;
25         var ul_child=null;
26         var li_child=null;
27         var li_parent_lft=0;
28         var li_parent_rgt=0;
29         jQuery.each(data, function(index, val) {
30           var lft=val.lft;
31           var rgt=val.rgt;
32           if(lft<li_parent_rgt)
33           {
34               if(val.trget!=null&&val.trget!='')
35                   li_child=jQuery('<li> <a href="'+val.url+'"> <i class="icon-double-angle-right"></i> '+val.title+' </a> </li>').appendTo(ul_child); 
36               else
37                   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); 
38           }else{
39               li_parent=jQuery('<li></li>').appendTo(navlist);
40               ul_child=null;
41               var a=jQuery('<a href="javascript:void(0);" class="dropdown-toggle"></a>').appendTo(li_parent);
42               var i=jQuery('<i class="'+val.icon+'"></i>').appendTo(a);
43               var span=jQuery('<span class="menu-text">'+val.title+'</span>').appendTo(a);
44               var b=jQuery('<b class="arrow icon-angle-down"></b>').appendTo(a);
45               li_parent_lft=lft;
46               li_parent_rgt=rgt;
47               if(rgt-lft>1)
48               {
49                   ul_child=jQuery('<ul class="submenu"></ul>').appendTo(li_parent);
50               }else{
51                   a.removeClass('dropdown-toggle');
52                   if(val.url!=null&&val.url!='')
53                   {
54                       a.attr('href',val.url);
55                   }
56               }
57           }
58           if(val.url!=null&&val.url.indexOf(path)>=0)
59           {
60               li_parent.addClass('active');
61               li_parent.addClass('open');
62               if(li_child!=null)
63                   li_child.addClass('active');
64           }
65         });
66     },'json');
67 }
68
69 function isItems(items) {
70     return ($.isArray(items) && items.length > 0) ? true : false;
71 }