var sto_nav; var $win = $(window).width(); var $hei = $(window).height(); var shareModel = { sinaWeiBo: function (title, pic) { var param = { url: window.location.href, type: '3', count: '1', appkey: '2890110694', title: title || '', pic: pic || '', ralateUid: '', rnd: new Date().valueOf() } var temp = ''; for (var p in param) { if (p) { temp += p + "=" + encodeURIComponent(param[p]) || '' temp += "&" } } var targetUrl = 'http://service.weibo.com/share/share.php?' + temp; window.open(targetUrl, 'sinaweibo', 'height=430, width=400'); }, linkUrl: function () { //拿到想要复制的值 let url = window.location.href; //创建input元素 let copyInput = document.createElement('input'); copyInput.setAttribute('class', 'copyinput') //向页面底部追加输入框 document.body.appendChild(copyInput); //添加属性,将url赋值给input元素的value属性 copyInput.setAttribute('value', url); //选择input元素 copyInput.select(); //执行复制命令 document.execCommand("Copy"); //弹出提示信息,不同组件可能存在写法不同 // this.$message.success("链接已复制!"); // event.preventDefault(); // event.stopPropagation(); //复制之后再删除元素,否则无法成功赋值 //删除动态创建的节点 copyInput.remove(); return $.growl.notice({ title: "", message: "链接已复制!" }); } } var tools = { _debounce: function (func, wait, immediate) { var timeout; return function () { clearTimeout(timeout); timeout = setTimeout(func, wait) } }, scrollDiy: function (tar, _w) { if (tar && tar.length != 0) { if (_w) { tar.mCustomScrollbar({ scrollButtons: { enable: false } }); } else { $(".hr_scroll_move").removeClass("hr_scroll") tar.mCustomScrollbar({ scrollButtons: { enable: false } }); } } }, htmlsize: function () { var dw = 750; var ww = $(window).width(); console.log("w", ww) var maxw = 1920; var minw = 320; if ($(window).width() > maxw) { ww = maxw; } else if ($(window).width() < minw) { ww = minw; } $("html").css({ fontSize: Math.floor((ww / dw) * 100) }); }, fHeader: function (tar) { if (tar && tar != "") { $(tar).mousewheel(function (event, delta, deltaX, deltaY) { if (delta > 0 && $(tar).scrollTop() >= 0) { $(".body_page").addClass("showdiv") } else { $(".body_page").removeClass("showdiv") } }); } }, navHover: function (tar) { if (!$(tar)) { return } $(tar).hover(function () { if ($(this).index() == 0) { return; } clearTimeout(sto_nav); $(".ejnav_child .item").removeClass("active"); $(tar).removeClass("active"); var ol = $(this).parents(".deMenu").offset().left; var al = $(this).offset().left + $(this).outerWidth() * 0.5; var fl = al - ol; var c = $(this).parents(".deMenu").find(".ejnav_child").find(".item").eq($(this).index()); var cl = fl - c.outerWidth() * 0.5; // if (c.find("").size() == 0) { // c.hide(); // } if (cl < 0) { c.css("left", 0); } else if (cl + c.outerWidth() > $(this).parents(".deMenu").outerWidth()) { c.css("right", 0); } else { c.css("left", cl); } $(this).addClass("active"); c.addClass("active"); $(".ejnav_child").css({ "height": "320px" }) }, function () { sto_nav = setTimeout(function () { $(".ejnav_child .item").removeClass("active"); $(tar).removeClass("active"); $(".ejnav_child").css({ "height": "0px" }) }, 100); }); }, childHover: function (tar) { $(tar).hover( function () { clearTimeout(sto_nav); $(".ejnav_child").css({ "height": "320px" }) window.addEventListener("scroll", function () { if (tools.handleScroll() > 10) { $(tar).removeClass("active"); $(".ejMenuBox a").removeClass("active"); $(".ejnav_child").css({ "height": "0px" }) } }) }, function () { $(tar).removeClass("active"); $(".ejMenuBox a").removeClass("active"); $(".ejnav_child").css({ "height": "0px" }) } ); }, handleScroll: function () { // 获取滚动位置 var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop; return scrollTop }, viewMap: function (tar, target, type) { if (tar && tar != "") { $(tar).on(type, function () { if (tar == ".ybSearchClose") { tools.iconTap(true) } if ($(target).hasClass("active")) { $(target).removeClass("active") if (target == ".ybSearchBox") { $(".topHeader").removeClass("whiteBg") } } else { $(target).addClass("active") if (target == ".ybSearchBox") { $(".topHeader").addClass("whiteBg") } } }) } }, showActive: function (tar) { if (tar && tar != "") { $(".mNavBox .m_a3").each(function () { if ($(this).hasClass("active")) { $(this).parents(".mItem").find(".m_a2").addClass("active") } }) } }, removeClass: function (tar, target, type) { if (tar && tar != "") { $(tar).on(type, function () { $(target).removeClass("active") }) } }, // 搜索方法 singleSearch: function (tar) { if (tar && tar.length != 0) { var defHref = tar.attr("href"); tar.on("click", function (e) { if ($("#textfield").val() == "" || $("#textfield").val() == null) { $("#textfield").val(""); } //核心代码,拼接参数 var args = "siteIds=" + window.btoa(tar.attr("data-siteIds")) + "&excludeCategoryId=" + window.btoa(tar.attr("data-excludeCategoryId")) + "&dataUrl=" + window.btoa(tar.attr("data-url")) + "&keyword=" + encodeURI(encodeURI($.trim($("#textfield").val()))); //核心代码,拼接参数 end tar.attr("href", defHref + '#' + args); $("#searchword").val(""); // window.open(tar.attr("href")); $(".rqSearchBox,.closeSearchBox").hide(); $(".showSearchBox").css("display", "inline-block") // $(".hr-search-mask").show(); $("#textfield").val(""); }); $("#textfield").keyup(function (e) { if (e.keyCode == 13) { if ($("#textfield").val() == "" || $("#textfield").val() == null) { $("#textfield").val(""); } else { tar.trigger("click"); window.open(tar.attr("href")); } } }); } }, fLink: function (tar) { if (tar && tar != "") { $(tar).hover(function () { $(".flinkListBox").addClass("active") }, function () { $(".flinkListBox").removeClass("active") }) } }, mNavBox: function (tar, t2, fl) { if (tar && tar != "") { tar.on("click", function () { if (fl) { t2.addClass("active") } else { t2.removeClass("active") } }) } }, mNavClick: function (tar) { if (tar && tar != "") { tar.each(function () { $(this).on("click", function () { if ($(this).hasClass("active")) { $(this).removeClass("active") } else { tar.removeClass("active") $(this).addClass("active") } }) }) } }, mHandleNav: function (tar) { if (tar && tar != "") { tar.on("click", function () { var pTop = tar.offset().top - $(window).scrollTop() if ($(".mNavList").hasClass("active")) { $(".mNavList,.ejpupBpx").removeClass("active") $(".ejpupBpx").css({ "top": 0 }) $("html,body").css({ "height": "auto", "overflow": "auto" }) } else { $(".mNavList,.ejpupBpx").addClass("active") $(".ejpupBpx").css({ "top": pTop + 40 }) $("html,body").css({ "height": "100%", "overflow": "hidden" }) } }) } }, /* 搜索icon切换 */ iconTap: function (bl) { var bg = "url(" + $(".mSearchBtn").attr("data-imgbg") + ")" if (bl) { $(".mSearchBtn i").removeClass("icon-gongjulan-tubiao-guanbi02").addClass("icon-gongjulan-tubiao-sousuo") $(".mSearchBtn").css("background-image", "none") } else { $(".mSearchBtn i").removeClass("icon-gongjulan-tubiao-sousuo").addClass("icon-gongjulan-tubiao-guanbi02") $(".mSearchBtn").css("background-image", bg) } }, // 适配导航显示与隐藏 mtopBtn: function () { $(".ybmHeader .ybmHeader_in .mSearchBtn").click(function (e) { e.stopPropagation() if ($(".ybSearchBox").hasClass("active")) { $(".ybSearchBox").removeClass("active") $(".topHeader").removeClass("whiteBg") tools.iconTap(true) return false } else { $(".ybSearchBox").addClass("active") $(".topHeader").addClass("whiteBg") tools.iconTap(false) return false } }) $(".ybmHeader .mNavBtn").click(function () { var $win = $(window).width(); if ($win > 860) { $(".pubMap").addClass("active") } else { $(".mNavBox").addClass("active") } }) }, ybSwiperHistory: function (tar) { // 发展历程 if (tar && tar != "") { try { var proSwiper = new Swiper('.pro-swiper', { slidesPerView: 4, watchSlidesVisibility: true, }); } catch (e) { console.log(e) } var mySwiper = new Swiper('.ybHistory_swiper', { slidesPerView: 1, spaceBetween: 40, simulateTouch: false, thumbs: { swiper: proSwiper }, breakpoints: { 640: { slidesPerView: 1, spaceBetween: 30 }, 750: { slidesPerView: 2, spaceBetween: 30 }, 860: { slidesPerView: 3, spaceBetween: 30 }, 1000: { slidesPerView: 4, spaceBetween: 20 }, 1200: { slidesPerView: 4, spaceBetween: 40 } } }); var swiper = new Swiper('.imgs_swiper', { slidesPerView: 1, spaceBetween: 0, autoplay: true, pagination: { el: '.swiper-pagination', clickable: true, }, }); var num = 0; $(".bb-wrap").removeClass("bb-sel"); $(".bb-wrap").eq(num).addClass("bb-sel"); if (num == 0) { $(".h_prev").addClass("bb-dis"); } $(".h_prev").on("click", function () { $(".h_next").removeClass("bb-dis"); if (num <= 0) { num = 0; $(".h_prev").addClass("bb-dis"); mySwiper.slideTo(0); return false; } else { if (num == 1) { $(".h_prev").addClass("bb-dis"); } mySwiper.slidePrev(); } num--; $(".bb-wrap").removeClass("bb-sel"); $(".bb-wrap").eq(num).addClass("bb-sel"); }); $(".h_next").on("click", function () { $(".h_prev").removeClass("bb-dis"); if (num >= $(".bb-wrap").length - 1) { $(".h_next").addClass("bb-dis"); return false; } else { if (num >= $(".bb-wrap").length - 2) { $(".h_next").addClass("bb-dis"); } mySwiper.slideNext(); } num++; $(".bb-wrap").removeClass("bb-sel"); $(".bb-wrap").eq(num).addClass("bb-sel"); }); $(".bb-wrap").each(function (index) { $(this).on("click", function () { $(".bb-wrap").removeClass("bb-sel"); $(".bb-wrap").eq(index).addClass("bb-sel"); num = index; if (index == 0) { $(".h_next").removeClass("bb-dis"); $(".h_prev").addClass("bb-dis"); } else if (index == $(".bb-wrap").length - 1) { $(".h_prev").removeClass("bb-dis"); $(".h_next").addClass("bb-dis"); } else { $(".h_prev").removeClass("bb-dis"); $(".h_next").removeClass("bb-dis"); } }); }); } // 发展历程 END }, tabHandle: function (tar, type, topDom, o) { if (tar && tar.length != 0) { tar.find(".li").on(type, function () { var num = $(this).index() if (o && o.length != 0) { var dataUrl = $(this).attr("data-href") o.find("a").attr("href", dataUrl) } $(this).siblings().removeClass("active") $(this).addClass("active") $(this).parents(topDom).find(".ulBox .liBox").hide().eq(num).show() }) } }, mscollFn: function () { $win = $(window).width() console.log($win) if ($win <= 1025) { if ($(".hr_scroll_move1025") && $(".hr_scroll_move1025").length != 0) { CU.scrollDiy($(".hr_scroll"), false) } } else if ($win <= 750) { if ($(".hr_scroll_move750") && $(".hr_scroll_move750").length != 0) { CU.scrollDiy($(".hr_scroll"), false) } } else {} }, //主营业务 mainBusinessBoxFn: function (tar) { var _w if (tar && tar.length != 0) { $(".mainBusinessBox .list .item").hover(function () { _w = $(".mainBusinessBox").width() - 220 $(".mainBusinessBox .list .item").removeClass("active") $(this).addClass("active") }) } }, mainBusinessSvFn: function (tar) { if (tar && tar.length != 0) { var swiper = new Swiper('.mainBusinessBox .swiper-container', { slidesPerView: 1.2, spaceBetween: 12, }); } }, //人才培养 tabTxtPicFn: function (tar) { if (tar && tar.length != 0) { tar.find(".item").hover(function () { var _this = $(this).index() tar.find(".item").removeClass("active") $(this).addClass("active") }) } }, //底部导航 fNav: function (tar) { if (tar && tar.length != 0) { $(".fmenuList .item_a").each(function () { var n = $(this).find("a").length if (n > 5) { $(this).siblings(".fBtn").find("i.down").click(function () { $(this).hide().siblings("i.up").show() $(this).parents(".itemOut").find(".item_a").css("transform", "translateY(-168px)") // $(this).parents(".itemOut").css("height", "208px") }) $(this).siblings(".fBtn").find("i.up").click(function () { $(this).hide().siblings("i.down").show() $(this).parents(".itemOut").find(".item_a").css("transform", "none") // $(this).parents(".itemOut").css("height", "175px") }) } else { $(this).siblings(".fBtn").hide() } }) } }, pubSWiper: function (tar) { if (tar && tar.length != 0) { var swiper = new Swiper('.materialFlowList .swiper-container', { slidesPerView: 1.3, spaceBetween: 12, loop: false, // loopFillGroupWithBlank: true, pagination: { el: '.flistPage', clickable: true, }, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, breakpoints: { 640: { slidesPerView: 1.4, spaceBetween: 20 }, 750: { slidesPerView: 2, spaceBetween: 30 }, 860: { slidesPerView: 2.5, spaceBetween: 30 }, 1000: { slidesPerView: 3, spaceBetween: 20 } } }); } }, talentConceptBox: function (tar) { if (tar && tar.length != 0) { var swiper = new Swiper('.talentConceptBox .materialFlowList .swiper-container', { slidesPerView: 1.4, spaceBetween: 12, loop: false, pagination: { el: '.flistPage', clickable: true, }, breakpoints: { 640: { slidesPerView: 1.6, spaceBetween: 20 }, 750: { slidesPerView: 1.8, spaceBetween: 30 }, 860: { slidesPerView: 2.2, spaceBetween: 30 }, 960: { slidesPerView: 2.4, spaceBetween: 20 }, 1000: { slidesPerView: 2.6, spaceBetween: 20 }, 1100: { slidesPerView: 3, spaceBetween: 20 } } }); } } } var tool750 = { fCodeFn: function (c, t) { c.hover(function () { c.find(t).css({ "opacity": 1, "transform": "none", "visibility": "visible" }) }, function () { c.find(t).css({ "opacity": 0, "transform": "translateY(-50px)", "visibility": "hidden" }) }) }, footerNav: function () { $(".fmenuList .item h3").on("click", function () { $(this).siblings(".item_a").toggle() }) }, fCodeHover: function () { $(".fFollowUs .list .item").each(function () { tool750.fCodeFn($(this), ".imgs") }) }, mNavSwiperFn: function (tar) { var mNavSwiper = new Swiper('.mNavSwiper', { // slidesPerView: 4.2, slidesPerView: "auto", spaceBetween: 0, initialSlide: $(".ybmNav .mshow .swiper-slide.active").attr("data-num"), }); }, mReportSwiperFn: function (tar) { var mReportSwiper = new Swiper('.mReportSwiper', { slidesPerView: 5, spaceBetween: 0, initialSlide: $(".mReportSwiper .swiper-slide.active").attr("data-num"), }); } } tools.htmlsize(); $(window).resize(tools.htmlsize); $(function () { $(".counter").each(function () { $(this).numberRock({ lastNumber: $(this).text(), duration: 5000, easing: 'swing', }) }) tools.htmlsize(); tools.navHover(".ejMenuBox a") tools.childHover(".ejnav_child .item") tools.viewMap(".pcMenuBtn i", ".pubMap", "click") tools.viewMap(".searchBtn", ".ybSearchBox", "click") tools.viewMap(".ybSearchClose", ".ybSearchBox", "click") tools.showActive($(".mNavBox")) tools.removeClass(".ybClose i", ".pubMap", "click") tools.singleSearch($("#submitbuttom")) tools.fLink(".flinkList") tools.fHeader(".pageBody") tools.mNavClick($(".mNavBox .m_a1")) tools.mNavClick($(".mNavBox .m_a2")) tools.mNavBox($(".mheader .icon-tubiao-shezhi"), $(".mNavBox"), true) tools.mNavBox($(".mCloseNavBtn"), $(".mNavBox"), false) tools.mtopBtn() tools.ybSwiperHistory($(".ybHistoryList")) window.addEventListener('resize', tools._debounce(tools.mscollFn, 300)) tools.scrollDiy($(".hr_scroll"), true) tools.tabHandle($(".litab"), "click", ".indexItem", $(".varLink")) tools.mainBusinessBoxFn($(".mainBusinessBox")) tools.tabTxtPicFn($(".tabTxtPic")) tools.fNav($(".fmenuList")) tool750.mNavSwiperFn() tool750.mReportSwiperFn() tools.mainBusinessSvFn($(".mainBusinessBox")) tools.pubSWiper($(".materialFlowList"), $(".materialFlowList").attr("data-bl")) tools.talentConceptBox($("talentConceptBox .materialFlowList"), $(".materialFlowList").attr("data-bl")) if ($win <= 750) { tool750.footerNav() tools.mHandleNav($(".mPageName")) tool750.fCodeHover() tool750.fCodeFn($(".ejShare .list .item").eq(0), ".codeBox") } })