console.log({"secondCatId":10667,"threeCatId":null,"secondCatName":"中外项目","threeCatName":null,"menu":[{"@type":"WixinHeaderCatMenuModel","catId":10544,"flag":1,"name":"普通文理","icon":"icon-no-border-g2","imgUrl":"","specType":null,"englishName":null,"subHead":null,"children":[]},{"@type":"WixinHeaderCatMenuModel","catId":731,"flag":1,"name":"专升本","icon":"icon-solid-no-border-d5","imgUrl":"","specType":null,"englishName":null,"subHead":null,"children":[]},{"@type":"WixinHeaderCatMenuModel","catId":10667,"flag":1,"name":"中外项目","icon":"icon-no-border-a17","imgUrl":"","specType":null,"englishName":null,"subHead":null,"children":[]},{"@type":"WixinHeaderCatMenuModel","catId":1148,"flag":1,"name":"艺术类","icon":"icon-no-border-a24","imgUrl":"","specType":null,"englishName":null,"subHead":null,"children":[]},{"@type":"WixinHeaderCatMenuModel","catId":732,"flag":1,"name":"高水平运动队","icon":"icon-solid-no-border-f11","imgUrl":"","specType":null,"englishName":null,"subHead":null,"children":[]}],"firstCatId":10647,"firstCatName":"招生政策","secondCatIcon":"icon-no-border-a17","secondCatImg":"","threeCatIcon":null,"threeCatImg":null,"firstCatIcon":"icon-no-border-g1","firstCatImg":"","firstEnglishName":null,"firstSubHead":null,"secondEnglishName":null,"secondSubHead":null,"threeEnglishName":null,"threeSubHead":null}) $(function(){ //特色页面按钮添加 var sCode = 'SFYEFV'; function getSpecTypeBtn(type, box) { var url = 'https://admin.zhinengdayi.com' + '/front/template/getInfoContentBySptype?sCode='+ sCode +'&specType=' + type; $.get(url, function(res) { if(res && res.code == '000000') { var data = res.data; var html = '
'+ data.title +'
' $('.specTypeBtns' + box).append(html); } }) } getSpecTypeBtn(8, ' .one'); getSpecTypeBtn(10, ' .two'); getSpecTypeBtn(11, ' .three'); $('.specTypeBtns').on('click', '.specBtn', function() { var url = getAppServer() + '/page/detail/' + sCode + "/" + $(this).attr('catid') + "/" + $(this).attr('infoid'); location.href= url; }) var sideBar = $('.noticeList0753958526930578 .sideBar'); var sideBarLi = sideBar.find('.level1>li'); var sideBarAllLi = sideBar.find('li'); var url = window.location.pathname; var urlLen = window.location.pathname.lastIndexOf('/'); var catId = '10667'; var titleBok = false; //控制三级列表展开关闭 //- function levelShow(obj,count) { //- if (count % 2 == 1) { //- obj.find('.iconBefore').css({ //- display: "none" //- }); //- obj.find('.iconAfter').css({ //- display: "table-cell" //- }) //- obj.find('ul').show(); //- } else { //- obj.find('.iconBefore').css({ //- display: "table-cell" //- }); //- obj.find('.iconAfter').css({ //- display: "none" //- }); //- obj.find('ul').hide(); //- } //- }; //控制三级列表展开关闭 function levelShow(obj,count) { //cy if (count % 2 == 1) { obj.find('i').attr({ class: "i_con-jian i_con" }); obj.find('ul').show(); } else { obj.find('i').attr({ class: "i_con-jia i_con" }); obj.find('ul').hide(); } }; //一级列表是否选中 if ($('.hotTitle span').attr('firstcatid') == catId) { titleBok = true; } else{ titleBok = false } sideBarLi.each(function(index,ele){ var count = 0; if(!titleBok){ //一级列表没有选中 //sideBar当前选中 console.log(catId); if ($(ele).attr('catId') == catId) { //二级列表选中 if ($(ele).find('ul').length == 0) { //二级列表没有三级 $(ele).addClass('current'); } else { //二级列表有三级,三级列表展开,同时三级列表第一个激活 $(ele).find('ul li:eq(0)').addClass('current'); $(ele).addClass('current'); count = 1; levelShow($(ele), count); } } else { //三级列表选中 $(ele).find('ul li').each(function (index2, ele2) { if ($(ele2).attr('catId') == catId) { $(ele2).addClass('current'); $(ele2).parents('li').addClass('current'); count = 1; levelShow($(ele), count); } }) } }else{ //一级列表选中 if (sideBarLi.eq(0).find('ul').length == 0) { //二级列表没有三级 sideBarLi.eq(0).addClass('current'); } else { //二级列表有三级,三级列表展开,同时三级列表第一个激活 sideBarLi.eq(0).addClass('current'); sideBarLi.eq(0).find('ul li:eq(0)').addClass('current'); if(index == 0){//循环第一个的count为1 count = 1; levelShow(sideBarLi.eq(0), count); } } } $(ele).find('.iconBlock').on('click',function(ev){ count++; levelShow($(ele),count); ev.preventDefault(); return false; }); }); //二级三级跳转 sideBarAllLi.each(function(index,ele){ //二级里面没有三级,二级才可以点击跳转 if($(ele).find('ul').length==0){ $(ele).find('a').on('click', function () { var ntype = $(this).parent().attr('ntype') || 0; //视频在线ntype=5 if($(this).parents('.cg_sideBar').attr('ntype')){ ntype = $(this).parents('.cg_sideBar').attr('ntype'); } var catId = $(this).parent().attr('catId'); var refUrl = $(this).parent().attr('refUrl') || 0; var infoId = 0; var openType = 0; jumpToPage({ ntype: ntype, parentId: catId, infoId: infoId, refUrl: refUrl, openType: 0, pageSize: PageSize }); }) } }); //二级主标题限制个数 $('.hotTitle span').html(interception($('.hotTitle span').html(), 6, '...')); });