

// <!--内容-->
// fn.getUserName();
console.log(fn.getUserName());
if(fn.getUserName()==''|| fn.getUserName()==undefined||fn.getUserName()==null){
    fn.loginOut();
    $('#topbar_userMsg').hide();
    $('#topbar_tologin').show();
}else if(fn.getUserName()=='燕松梅赤峰测试'){

    $('#topbar_tologin').hide();
    $('#topbar_userMsg').show().find('#userId').text(fn.getUserName());
    $('#onlyInterLogin').attr('data-link','http://www.rnting.com/api/index.html');
    console.log($('#onlyInterLogin').html());
}else if(fn.getUserName()=='财务汇报'){
    $('#topbar_tologin').hide();
    $('#topbar_userMsg').show().find('#userId').text(fn.getUserName());
    //monPlat 监控平台
    $('#monPlat').attr('data-link','');
    //cfgov_data 数据平台
    $('#cfgov_data').attr('data-link','');
    //onlyInterLogin 接口平台
    $('#onlyInterLogin').attr('data-link','');
    //gprmxc 备案
    $('#gprmxc').attr('data-link','');
    //caruser_msg 车主平台
    $('#caruser_msg').attr('data-link','');

}
else{
    $('#topbar_tologin').hide();
    $('#topbar_userMsg').show().find('#userId').text(fn.getUserName());
}
// 获取页面可显示的系统菜单以及目录样式  sysOpProjectDTOList
var fun={
    init:function(){
        //content 图片内容 清空
        $('#box').empty();
        //nav 菜单 清空
        $('#controls').empty();
        //加载 菜单 以及 各系统简介图片内容
        fun.menuInit();
        //用户退出登录
        fun.loginOut();
    },
    menuInit:function () {
        //nav 菜单
        var menuList='';
        //content 图片内容s
        var imgList='';
        var sysOpList=sessionStorage.getItem("sysOpProjectDTOList");
        if(sysOpList=='' ||sysOpList==null ||sysOpList==undefined ||sysOpList=='[]'){
            menuList+='<li class="parking-nav active" data-slideindex="6">任你停官网</li>';
            imgList='<li class="parking-wrap" data-link="https://www.renniting.cn"></li>';
            // menuList+='<li class="clearfix"></li>';
            $('#box').append(imgList);
            $('#controls').append(menuList);
        }else {
            var sysOpProList=JSON.parse(sysOpList);

            console.log(sysOpProList)
            var arrlist = [];
            var arrnewList = [];
            $.each(sysOpProList,function (index,item) {
                if(item.projectCode==="BUSINESS_PLATFORM"){
                  arrlist.push(item)
                }else{
                  arrnewList.push(item)
                }
            })
          // console.log(arrlist)
          var sysOpProList = arrlist.concat(arrnewList)
          console.log(sysOpProList)
            for(var i=0;i<sysOpProList.length;i++){
                if(sysOpProList[i].projectCode=='BUSINESS_PLATFORM'){

                    menuList+='<li class="parking-nav " data-slideindex="'+i+'">'+sysOpProList[i].projectName+'</li>';
                    imgList+='<li class="parking-wrap swiper-slide" data-link="'+sysOpProList[i].projectUrl+'"><div class="guide-way">进入平台</div></li>';

                }
                else if(sysOpProList[i].projectCode=='GOVERNMENT_PLATFORM'){

                    menuList+='<li class="platform-nav " data-slideindex="'+i+'">'+sysOpProList[i].projectName+'</li>';
                    imgList+='<li class="platform-wrap swiper-slide" data-link="'+sysOpProList[i].projectUrl+'"><div class="guide-way">进入平台</div></li>';
                }
                else if(sysOpProList[i].projectCode=='INTERFACE_PLATFORM'){

                    menuList+='<li class="api-nav " data-slideindex="'+i+'">'+sysOpProList[i].projectName+'</li>';
                    imgList+='<li class="api-wrap swiper-slide"  data-link="'+sysOpProList[i].projectUrl+'"><div class="guide-way">进入平台</div></li>';
                }
                else if(sysOpProList[i].projectCode=='CAR_USER_PLATFORM'){

                    menuList+='<li class="caruser-nav " data-slideindex="'+i+'">'+sysOpProList[i].projectName+'</li>';
                    imgList+='<li class="caruser-wrap swiper-slide"  data-link="'+sysOpProList[i].projectUrl+'"><div class="guide-way">进入平台</div></li>';
                }
                else if(sysOpProList[i].projectCode=='BEIAN_PLATFORM'){

                    menuList+='<li class="gprmxc-nav " data-slideindex="'+i+'">'+sysOpProList[i].projectName+'</li>';
                    imgList+='<li class="gprmxc-wrap swiper-slide"  data-link="'+sysOpProList[i].projectUrl+'"><div class="guide-way">进入平台</div></li>';
                }


            }

            menuList+='<div class="clearfix"></div>';
            $('#box').append(imgList);
            $('#controls').append(menuList);
          $('#controls').find('li').eq(0).addClass('active')
        }


    },
    //用户退出登录
    loginOut:function () {
        $('#login_out_btn').on('click', function () {
            // console.log("token:" + fn.getToken());
            fn.loginOut();
        });
    }

};
fun.init();
// <!--底部-->


$(document).on('click','#box li',function () {
        var link = $(this).attr('data-link');
       if(link.indexOf("monitoringPlatform")>0){
        	  link+=("?token="+sessionStorage.getItem("token"));
        } else if(link.indexOf("SubMenus/index.html")>0){
        	  link+=("?token="+sessionStorage.getItem("token"));
        }
        window.open(link)
})


var tabsSwiper = new Swiper('.swiper-container',{
    autoplay:false,
  speed:1000,

})
$("#controls li").on('touchstart mousedown',function(e){
    var that=$(this);
  // e.preventDefault()
  $("#controls li").removeClass('active')
  $(this).addClass('active')
  tabsSwiper.slideTo( that.index() )
})


$("controls li").click(function(e){
  e.preventDefault()
})



