// ============================================================= // ============================================================= //全局变量 var globalVals = { // 顶部导航高度 用于导航滚动状态下合理active topBannerHeight: null, //配合topbannerheight 根据每个页面不同进行补偿 默认100 topBHeightMP: 280, }; // ============================================================= // ============================================================= // ============================================================= // ============================================================= //全局方法 var handleEvns = { setHeaderState: function () { if ($(document).scrollTop() + globalVals.topBHeightMP >= globalVals.topBannerHeight) { $('header').addClass('active'); } else { $('header').removeClass('active'); } }, // 为banner高度这个全局变量设置高度 传入banner对象筛选 setTBHeight: function (str) { globalVals.topBannerHeight = $(str).height(); handleEvns.setHeaderState(); $(window).resize(function () { globalVals.topBannerHeight = $(str).height(); handleEvns.setHeaderState(); }) }, getQueryVariable (variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); if (pair[0] == variable) { return pair[1]; } } return (false); }, // 页面全局方法 pageLayoutFunc: function () { $(document).scroll(function () { handleEvns.setHeaderState(); }) $(".public-open-contact").click(function (e) { e.stopPropagation() $('.contact-box').removeClass('hide') }) $(".contact-box").click(function (e) { e.stopPropagation() }) $('.close-contact').click(function () { $('.contact-box').addClass('hide') }) $('body,html').click(function () { $('.contact-box').addClass('hide') }) }, // 导航处理 handleNavs: function () { $('body header .my-container .right-nav').on('mouseenter', '.item', function () { if ($(this).has('ul').length > 0) { var height = $(this).children('ul').height(); console.log(height); $('header .mask').show().height(height); } else { $('header .mask').hide(); } }); $('body header .my-container .right-nav').on('mouseleave', '.item', function () { if ($(this).has('ul').length > 0) { $('header .mask').hide(); } }); }, // 点击百度商桥 clickBaidu () { $(".open_shangqiao").click(function (event) { if ($('#nb_invite_ok').length > 0) { $('#nb_invite_ok').click(); } }); } }; // ============================================================= // ============================================================= // ============================================================= // ============================================================= // 异步方法请写在这个全局变量中 var MyApi = { } // ============================================================= // ============================================================= // ============================================================= // ============================================================= // 页面管理 var PageManage = { // 首页 homeIndex: function () { handleEvns.setTBHeight('.home-banner'); handleEvns.pageLayoutFunc(); // banner 轮播 var swiper = new Swiper('.home-banner .swiper-container', { loop: true, autoplay: { delay: 5000, disableOnInteraction: false, }, pagination: { el: '.swiper-pagination', clickable: true, }, navigation: { nextEl: '.home-banner .swiper-button-next', prevEl: '.home-banner .swiper-button-prev', }, }); // 解决方案 点击效果 $(".part-two .tab-group .item").each(function (index, val) { $(this).click(function () { if ($(this).hasClass("active")) { } else { $(this).addClass("active") $(this).siblings().removeClass("active") $(".content-group .item").eq(index).addClass("show") $(".content-group .item").eq(index).siblings().removeClass("show") } }) }) $(".part-two .tab-group .item").eq(0).addClass("active") $(".part-two .content-group .item").eq(0).addClass("show") // 产品tab 点击效果 $(".part-three .tab-group .item").each(function (index, val) { $(this).click(function () { var typeId = $(this).attr("data-id"); if ($(this).hasClass("active")) { } else { $(this).addClass("active") $(this).siblings().removeClass("active") $(".carousel-group .carousel-item").eq(index).addClass("show") $(".carousel-group .carousel-item").eq(index).siblings().removeClass("show") getProductList(typeId) } }) function getProductList (typeId) { $.ajax({ url: '/api/homed/productlist', data: { "typeId": typeId }, type: 'get', dataType: 'json', success: function (data) { if (data.errcode == 0) { $('.carousel-item .swiper-wrapper').html("") var str = ''; for (var i = 0; i < data.list.length; i++) { str += ''; if (data.list[i].PropId == 1) { str += ''; } str += '
'; str += ''; str += '
'; str += '

' + data.list[i].MainTitle + '

'; str += '

' + data.list[i].Introduction + '

'; str += '
'; str += '

' + data.list[i].MainTitle + '

'; str += '

' + data.list[i].Introduction + '

'; str += '
'; str += '
'; } $('.carousel-item .swiper-wrapper').append(str); } else { alert(data.errmsg); } // 产品 轮播 var swiper1 = new Swiper('.carousel-item .swiper-container', { slidesPerView: 4, spaceBetween: 30, freeMode: true, navigation: { nextEl: '.swiper-button-next1', prevEl: '.swiper-button-prev1', }, }); } }); } $(".part-three .tab-group .item").eq(0).addClass("active") getProductList() }) // 产品 轮播 var swiper1 = new Swiper('.carousel-item .swiper-container', { slidesPerView: 4, spaceBetween: 30, freeMode: true, navigation: { nextEl: '.swiper-button-next1', prevEl: '.swiper-button-prev1', }, }); // 合作伙伴 轮播 var swiper2 = new Swiper('.partner-container', { slidesPerView: 5, spaceBetween: 30, // slidesPerView: 'auto', freeMode: true, navigation: { nextEl: '.swiper-button-next2', prevEl: '.swiper-button-prev2', }, }); // 合作伙伴 触发效果 $(".partner-container .swiper-slide").each(function () { $(this).mouseenter(function () { $(this).children(".partnet-img").addClass("partner-active") $(this).siblings().children(".partnet-img").removeClass("partner-active") }); $(this).mouseleave(function () { $(this).children(".partnet-img").addClass("partner-active") $(this).siblings().children(".partnet-img").removeClass("partner-active") }); }) // 我们的优势全景图弹框 $('.part-five .five-top .five-top-right').click(function () { $('.our-advantage-pop').addClass('show'); }) $('.our-advantage-pop .pop-content .close-btn').click(function () { $('.our-advantage-pop').removeClass('show'); }) }, // 走进星空足球app-发展历程 aboutDevelop: function () { handleEvns.setTBHeight('.banner'); handleEvns.pageLayoutFunc(); var developSwiper = new Swiper('.develop-detail .develop-swiper-container', { direction: 'vertical', slidesPerView: 5, }); // map/index页面进入锚点到具体位置 if (handleEvns.getQueryVariable('mapgo')) { var map = handleEvns.getQueryVariable('mapgo'); var top = 0; switch (map) { case '1': { //企业简介 top = $('.title-container').eq(0).offset().top; break; } } $('body,html').animate({ scrollTop: top - 120 }, 0) } }, // 走进星空足球app-我们的优势 aboutIndex: function () { handleEvns.setTBHeight('.banner'); handleEvns.pageLayoutFunc(); var mySwiper = new Swiper('.swiper-container', { navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, observer: true, observeParents: true }); // 点击切换对应的证书 $('.info-left .name-list .name-item').click(function () { var index = $(this).index(); $('.info-left .name-list .name-item').removeClass('active'); $(this).addClass('active'); $('.info-right .patent-list .patent-item').hide(); $('.info-right .patent-list').find('.patent-item').eq(index).show(); }); // map/index页面进入锚点到具体位置 if (handleEvns.getQueryVariable('mapgo')) { var map = handleEvns.getQueryVariable('mapgo'); var top = 0; switch (map) { case '1': { //企业简介 top = $('.title-container').eq(0).offset().top; break; } case '2': { //专业团队 top = $('.title-container').eq(2).offset().top; break; } case '3': { //经营理念 top = $('.title-container').eq(1).offset().top; break; } case '4': { //阻止架构 top = $('.title-container').eq(3).offset().top; break; } case '5': { // 科技专利 top = $('.title-container').eq(4).offset().top; break; } case '6': { // 免责声明 top = $('.declare-container').eq(0).offset().top; break; } } $('body,html').animate({ scrollTop: top - 120 }, 0) } }, // 走进星空足球app-星空足球app在全球 aboutGlobal: function () { handleEvns.setTBHeight('.banner'); handleEvns.pageLayoutFunc(); var activeId = $('.map-box .map-list .list-item.active').data('id'); var list = $(".unit-list-container ul.unit-list li.unit-item[id=" + activeId + "]").find('p').text(); $('.map-box .map-list .list-item.active').find('.country-list').text(list); // 点击切换地图对应内容 // $('.map-box .map-list .list-item p.item-txt').click(function () { // $('.map-box .map-list .list-item').removeClass('active'); // $(this).parents('.list-item').addClass('active'); // var id = $(this).parents('.list-item').data('id'); // var clickList = $(".unit-list-container ul.unit-list li.unit-item[id=" + id + "]").find('p').text(); // $(this).siblings('.item-popup').find('.country-list').text(clickList); // }); // 欧洲热区触发 $('.about-global .map-box ul.map-list .hot.europe').click(function () { $('.about-global .map-box ul.map-list li.list-item').removeClass('active'); var item = $('.about-global .map-box ul.map-list li.list-item.europe'); item.addClass('active'); var id = item.data('id'); var clickList = $(".unit-list-container ul.unit-list li.unit-item[id=" + id + "]").find('p').text(); item.find('.item-popup .country-list').text(clickList); }) // 非洲热区触发 $('.about-global .map-box ul.map-list .hot.africa').click(function () { $('.about-global .map-box ul.map-list li.list-item').removeClass('active'); var item = $('.about-global .map-box ul.map-list li.list-item.africa'); item.addClass('active'); var id = item.data('id'); var clickList = $(".unit-list-container ul.unit-list li.unit-item[id=" + id + "]").find('p').text(); item.find('.item-popup .country-list').text(clickList); }) // 亚洲热区触发 $('.about-global .map-box ul.map-list .hot.asia').click(function () { $('.about-global .map-box ul.map-list li.list-item').removeClass('active'); var item = $('.about-global .map-box ul.map-list li.list-item.asia'); item.addClass('active'); var id = item.data('id'); var clickList = $(".unit-list-container ul.unit-list li.unit-item[id=" + id + "]").find('p').text(); item.find('.item-popup .country-list').text(clickList); }) // 大西洋热区触发 $('.about-global .map-box ul.map-list .hot.atlantic').click(function () { $('.about-global .map-box ul.map-list li.list-item').removeClass('active'); var item = $('.about-global .map-box ul.map-list li.list-item.atlantic'); item.addClass('active'); var id = item.data('id'); var clickList = $(".unit-list-container ul.unit-list li.unit-item[id=" + id + "]").find('p').text(); item.find('.item-popup .country-list').text(clickList); }) // 北美热区触发 $('.about-global .map-box ul.map-list .hot.north').click(function () { $('.about-global .map-box ul.map-list li.list-item').removeClass('active'); var item = $('.about-global .map-box ul.map-list li.list-item.north'); item.addClass('active'); var id = item.data('id'); var clickList = $(".unit-list-container ul.unit-list li.unit-item[id=" + id + "]").find('p').text(); item.find('.item-popup .country-list').text(clickList); }) // 南美热区触发 $('.about-global .map-box ul.map-list .hot.south').click(function () { $('.about-global .map-box ul.map-list li.list-item').removeClass('active'); var item = $('.about-global .map-box ul.map-list li.list-item.south'); item.addClass('active'); var id = item.data('id'); var clickList = $(".unit-list-container ul.unit-list li.unit-item[id=" + id + "]").find('p').text(); item.find('.item-popup .country-list').text(clickList); }) // map/index页面进入锚点到具体位置 if (handleEvns.getQueryVariable('mapgo')) { var map = handleEvns.getQueryVariable('mapgo'); var top = 0; switch (map) { case '1': { //星空足球app在全球 top = $('.title-container').eq(0).offset().top; break; } } $('body,html').animate({ scrollTop: top - 120 }, 0) } }, // 联系我们 contactIndex: function () { handleEvns.setTBHeight('.banner'); handleEvns.pageLayoutFunc(); var top = 0; $('.talent-main table .talent-list').click(function () { var id = $(this).attr("data-id"); top = $(window).scrollTop(); $(this).addClass('tr-active') $('body').addClass("no-scroll") .css('top', -top + 'px'); $(".mask").show(); $(".mask-popup").show(); $.ajax({ url: '/api/contactes/infolist', data: { "id": id }, type: 'get', dataType: 'json', success: function (data) { if (data.errcode == 0) { $('.mask-popup').html(''); var strs = ''; //for (var i = 0; i < data.infomodel; i++) { strs += ''; strs += ''; if (data.infomodel.Introduction != null) { strs += '

' + data.infomodel.Introduction + '

'; } else { strs += '

'; } strs += '
'; strs += '
'; strs += '职责描述:'; strs += '
'; if (data.infomodel.ResponsibilityFamil != null) { strs += '

' + data.infomodel.ResponsibilityFamil + '

'; } else { strs += '

'; } strs += '
'; strs += '
'; strs += '
'; strs += '任职资格:'; strs += '
'; if (data.infomodel.QualificationFamil != null) { strs += '

' + data.infomodel.QualificationFamil + '

'; } else { strs += '

'; } strs += '
'; strs += '

'; strs += '请将简历发送至:info@china-shjy.com'; strs += '

'; //} $('.mask-popup').html(''); $('.mask-popup').append(strs); } else { alert(data.errmsg); } $(".mask-popup .close").click(function () { $('.talent-main table .talent-list').removeClass('tr-active') $('body').removeClass("no-scroll") $(window).scrollTop(top) $(".mask").hide(); $(".mask-popup").hide(); }) } }); }) $(document).keydown(function (e) { if (e.keyCode == 13) { $('#page .page-box .page-sure').click(); } }) }, // 业务中心-固废处理 businessIndex () { handleEvns.setTBHeight('.banner'); handleEvns.pageLayoutFunc(); // 点击切换页面类型 $('.procedure-list .procedure-item').click(function () { var index = $(this).index(); $(this).addClass('active').siblings().removeClass('active'); $('.procedure-detail').find('.detail-item').eq(index).show().siblings().hide(); }); }, // 业务中心-物料解析 businessMaterial () { handleEvns.setTBHeight('.banner'); handleEvns.pageLayoutFunc(); $(document).keydown(function (e) { if (e.keyCode == 13) { $('#page .page-box .page-sure').click(); } }) }, // 业务中心-物料解析-详情 businessMaterialDetail () { handleEvns.setTBHeight('.banner'); handleEvns.pageLayoutFunc(); var produceSwiper = new Swiper('.material-detail-box .produce-swiper', { navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, }); }, // 业务中心-零配件专区 businessComponent () { handleEvns.setTBHeight('.banner'); handleEvns.pageLayoutFunc(); if (handleEvns.getQueryVariable('type')) { var top = $('.title-container').eq(0).offset().top; $('html,body').animate({ 'scrollTop': top - 120 }, 0); } $(document).keydown(function (e) { if (e.keyCode == 13) { $('#page .page-box .page-sure').click(); } }) }, // 业务中心-设备专区 businessEquipment () { handleEvns.setTBHeight('.banner'); handleEvns.pageLayoutFunc(); for (var i = 0; i < 4; i++) { var equipmentSwiper = new Swiper('.right-bottom .swiper-container-' + i, { slidesPerView: 3, observer: true, observeSlideChildren: true, navigation: { prevEl: '.right-bottom .prev-' + i, nextEl: '.right-bottom .next-' + i, }, }); } // 有参数就滚动 if (handleEvns.getQueryVariable('type')) { var typeVal = handleEvns.getQueryVariable('type'); // var topHeight=$('.business-equipment .equipment-type-list .type-list-box ul.type-list li.type-item .type-left .type-name').scrollTop(); var topHeight = $('.business-equipment .equipment-type-list .type-list-box ul.type-list li.type-item .type-left .type-name[data-type=' + typeVal + ']').offset().top; $('html,body').animate({ 'scrollTop': topHeight }, 1000); } }, // 业务中心-设备专区详情 businessEquipmentDetail () { handleEvns.setTBHeight('.banner'); handleEvns.pageLayoutFunc(); var galleryThumbs = new Swiper('.equipment-detail-container .gallery-thumbs', { spaceBetween: 10, slidesPerView: 5, loop: false, freeMode: false, watchSlidesVisibility: true, watchSlidesProgress: true, }); var galleryTop = new Swiper('.equipment-detail-container .gallery-top', { // spaceBetween: 10, loop: false, navigation: { nextEl: '.equipment-detail-container .gallery-top .swiper-button-next', prevEl: '.equipment-detail-container .gallery-top .swiper-button-prev', }, thumbs: { swiper: galleryThumbs, }, }); }, // 解决方案 businessSolution () { handleEvns.setTBHeight('.banner'); handleEvns.pageLayoutFunc(); if (handleEvns.getQueryVariable('type')) { var topVal = $('.solution-container .title-container').eq(0).offset().top; $('body,html').animate({ scrollTop: topVal - 150 }, 0); // console.log(topVal); } $(document).keydown(function (e) { if (e.keyCode == 13) { $('#page .page-box .page-sure').click(); } }) }, // 解决方案详情 businessSolutionDetail () { handleEvns.setTBHeight('.banner'); handleEvns.pageLayoutFunc(); var galleryThumbs = new Swiper('.params-gallery-box .gallery-thumbs', { spaceBetween: 10, slidesPerView: 5, loop: false, freeMode: false, watchSlidesVisibility: true, watchSlidesProgress: true, }); var galleryTop = new Swiper('.material-produce .gallery-top', { // spaceBetween: 10, loop: false, navigation: { nextEl: '.material-produce .gallery-top .swiper-button-next', prevEl: '.material-produce .gallery-top .swiper-button-prev', }, thumbs: { swiper: galleryThumbs, }, }); }, // 服务与支持 businessService () { handleEvns.setTBHeight('.banner'); handleEvns.pageLayoutFunc(); $('body .question-list').on('click', '.question-text', function () { // $('.question-list .question-item').removeClass('active'); // $('.question-list .question-item .question-text p').text('+'); // $('.question-list .question-item .question-answer').slideUp(500); if ($(this).parent().hasClass('active')) { $(this).parent().removeClass('active').siblings().removeClass('active'); $(this).parent().children('.question-answer').slideUp(500); $(this).parent().siblings().children('.question-answer').slideUp(500); $(this).parent().children('.question-text').find('p').text('+'); $(this).parent().siblings().children('.question-text').find('p').text('+') } else { $(this).parent().addClass('active').siblings().removeClass('active'); $(this).parent().children('.question-text').find('p').text('-'); $(this).parent().siblings().children('.question-text').find('p').text('+'); $(this).parent().children('.question-answer').slideDown(500); $(this).parent().siblings().children('.question-answer').slideUp(500) } }); // map/index页面进入锚点到具体位置 if (handleEvns.getQueryVariable('mapgo')) { var map = handleEvns.getQueryVariable('mapgo'); var top = 0; switch (map) { case '1': { //服务与支持 top = $('.title-container').eq(0).offset().top; break; } case '2': { //常见问答 top = $('.title-container').eq(1).offset().top; break; } } $('body,html').animate({ scrollTop: top - 120 }, 0) } }, //资讯 newsIndex: function () { handleEvns.setTBHeight('.banner'); handleEvns.pageLayoutFunc(); $(document).keydown(function (e) { if (e.keyCode == 13) { $('#page .page-box .page-sure').click(); } }) }, //资讯 webMap: function () { handleEvns.setTBHeight('.banner'); handleEvns.pageLayoutFunc(); }, // // 产品详情 // productDetail: function () { // handleEvns.pageLayoutFunc(); // }, // // 联系信息 // contactIndex: function () { // handleEvns.pageLayoutFunc(); // }, // // 留言 // contactMessage: function () { // handleEvns.pageLayoutFunc(); // }, // // 行业 // industryIndex: function () { // handleEvns.pageLayoutFunc(); // }, // //资讯 // newsIndex: function () { // handleEvns.pageLayoutFunc(); // }, // // 资讯详情 // newsDetail: function () { // handleEvns.pageLayoutFunc(); // } } // ============================================================= // ============================================================= // 路由设置 $(function () { var pathname = window.location.pathname; var r_base = pathname.split('/')[1]; var r_page = pathname.split('/')[2]; // home if (r_base == '/' || r_base == "") { PageManage.homeIndex(); console.log("首页"); } // about if (r_base == 'about') { if (r_page == 'develop') { PageManage.aboutDevelop(); console.log("走进星空足球app-发展历程"); return false; } if (r_page == 'global') { PageManage.aboutGlobal(); console.log("走进星空足球app-全球"); return false; } // index页面放在最底 if (r_page == 'index' || typeof (r_page === 'undefined')) { PageManage.aboutIndex(); console.log("走进星空足球app-我们的优势"); } } // business if (r_base == 'business') { if (r_page == 'material') { PageManage.businessMaterial(); console.log("业务中心-物料解析"); return false; } if (r_page == 'materialdetail') { PageManage.businessMaterialDetail(); console.log("业务中心-物料解析-详情"); return false; } if (r_page == 'component') { PageManage.businessComponent(); console.log("业务中心-零配件专区"); return false; } if (r_page == 'equipment') { PageManage.businessEquipment(); console.log("业务中心-设备专区"); return false; } if (r_page == 'equipmentdetail') { PageManage.businessEquipmentDetail(); console.log("业务中心-设备专区-详情"); return false; } if (r_page == 'solution') { PageManage.businessSolution(); console.log("业务中心-解决方案"); return false; } if (r_page == 'solutiondetail') { PageManage.businessSolutionDetail(); console.log("业务中心-解决方案-详情"); return false; } if (r_page == 'service') { PageManage.businessService(); console.log("业务中心-服务与支持"); return false; } // index页面放在最底 if (r_page == 'index' || typeof (r_page === 'undefined')) { PageManage.businessIndex(); console.log("业务中心-固废处理"); } } // contact if (r_base == 'contact') { PageManage.contactIndex(); console.log("联系我们"); } // news if (r_base == 'news') { PageManage.newsIndex(); console.log("新闻资讯"); } // map if (r_base == 'map') { PageManage.webMap(); console.log("网站地图"); } });