模块

(function(window){  
    var module_index = 0;
    //var userMgr = new GeoESB.User();
    var loginUser = new GeoESB.LoginUser(GeoESB.ServiceConfig,"");
    $(document).ready(function(){

   
   


        loginUser.getUserInfo(function(data){
            if(data == null || data ==""){
                return;
            }
            GeoESB.userInfo = data;

            //获取用户有权限的模块
            getPriModule();
        });

    });
    function getPriModule(){
        var url = _.str.sprintf(NavAssistance.ServiceConfig.CurrUserModule, GeoESB.userInfo.pkid);
        new GeoESB.AjaxCRUD(NavAssistance.ServiceConfig, NavAssistance.RootPath).get(url,function(result){
            var modules = result.data.modules[0];
            for(var i=0;i<modules.children.length;i++){
                if(NavAssistance.RootPkid == modules.children[i].pkid){  //第一个pkid来自配置文件app-config
                    var modules_arr=modules.children[i].children;//共享平台下面的子模块  数组
                }
            }


            var sidOrder = modules_arr.sort(
                function(a, b)
                {
                    if(a.orderindex < b.orderindex) return -1;
                    if(a.orderindex >= b.orderindex) return 1;
                    return 0;
                }
            );
            $.each(sidOrder,
                function(idx, value)
                {
                    addModule(idx, value);
                }
            );
        });
    }



    //展示导航模块
    function addModule(idx, module){
        var name = module.name;
        var checked = module.checked;
        var href = module.href+"?t="+Math.random();
        var css = module.css;

        if(null == css){css = "nav_default";}
        var htm = "<li";
        //if(idx >8){htm = "<li><div class='nav_pic_div hide'>";}

        htm+=" id='navId_"+css+"'>";
        htm +=name+"</li>";
        $("#navigation_div ul").append(htm);
        //if(checked == "0"){return;}
        $("#navId_"+css).click(function(){
            // window.open(href);
            window.location.href=href;
        });
    }
})(window);

posted @ 2017-08-15 13:53  轻溟雨殇  阅读(129)  评论(0编辑  收藏  举报