window.isProd = /www\.renlijia\.com$/.test(location.hostname); window.isPre = /renlijia\.com$/.test(location.hostname); window.reqPreUrl = "https://pre-zeus.renlijia.com"; // 语法地址 window.reqProdUrl = "https://zeus.renlijia.com"; // 线上地址 window.reqHost = isProd ? window.reqProdUrl : window.reqPreUrl; // ================================================================ $(function () { var $modal = $(".modal"); // bootstrap modal 居中 $modal.on("show.bs.modal", function () { var $this = $(this); var $modal_dialog = $this.find(".modal-dialog"); // 关键代码,如没将modal设置为 block,则$modala_dialog.height() 为零 $this.css("display", "block"); $modal_dialog.css({ "margin-top": Math.max( 0, ($(window).height() - $modal_dialog.height()) / 2 ), }); }); $(".navbar_container").removeClass("navbar_black"); // 菜单悬浮下拉 // $(".dropdownClassForWeb").hover(function() { // $(this) // .find(".dropdown-menu") // .slideToggle("fast"); // }); // 微信二维码 if (isMobile()) { $(".wechat").click(function () { $(".dingding-qrcode").toggle(); }); $(".wechat").click(function () { $(".wechat").toggleClass("wechat-highlight"); }); $(".weblog").click(function () { $(".weblog").addClass("weblog-highlight"); setTimeout(() => { $(".weblog").removeClass("weblog-highlight"); }, 100); }); } else { $(".wechat").hover( function () { $(".dingding-qrcode").show(); }, function () { $(".dingding-qrcode").hide(); } ); } if ($(".product-price-mob-swiper-container")) { var indexMobSwiper = new Swiper(".product-price-mob-swiper-container", { loop: true, autoplay: { delay: 2000, }, pagination: { el: ".index-mob-swiper-pagination", }, }); } if ($(".salary-pro-hr-swiper-container")) { var salaryProHrSwiper = new Swiper(".salary-pro-hr-swiper-container", { loop: true, autoplay: { delay: 3000, disableOnInteraction: false, }, on: { slideChange: function () { setTimeout(() => { var index = $(".salary-pro-hr-swiper-container .swiper-slide-active") .eq(0) .attr("data-swiper-slide-index") || 0; $(".salary-pro-hr-tabs div") .removeClass("active") .eq(+index) .addClass("active"); }, 0); }, }, }); $(".salary-pro-hr-tabs div").click(function () { salaryProHrSwiper.slideTo($(this).index() + 1, 300, false); }); } if ($(".salary-pro-swiper-container")) { var salaryProSwiper = new Swiper(".salary-pro-swiper-container", { loop: true, autoplay: { delay: 3000, disableOnInteraction: false, }, on: { slideChange: function () { setTimeout(() => { var index = $(".salary-pro-swiper-container .swiper-slide-active") .eq(0) .attr("data-swiper-slide-index") || 0; $(".salary-pro-tabs div") .removeClass("active") .eq(+index) .addClass("active"); }, 0); }, }, }); $(".salary-pro-tabs div").click(function () { salaryProSwiper.slideTo($(this).index() + 1, 300, false); }); } // 移动端菜单展开(右上角按钮) $(".top-menu-btn").click(function () { $("#navbarCollapse").slideToggle(); $(".menuFive").toggleClass("clickMenuFive"); }); // 回到顶部 $(".goto-top").click(function () { $("html , body").animate({ scrollTop: 0 }, "slow"); }); // 关于我们,底部滚动,左侧菜单适配样式处理 $(window).scroll(function () { // console.log($(window).scrollTop()); if ($(window).scrollTop() > 1926) { $(".about_menu_list").css("display", "none"); } else { $(".about_menu_list").css("display", "block"); } if ($(window).scrollTop() > 730) { $(".goto-top").show(); } else { $(".goto-top").hide(); } }); // 开放平台文档切换 $(".open_menu_list a").click(function () { $(".open_menu_list a").removeClass("active"); $(this).addClass("active"); setTimeout(() => { $(".open-api-doc .about_item").hide(); $($(this).data("id")).show(); }, 0); }); $("input").click(function () { $(this).focus(); }); // 社保页直接弹出表单 if (getQueryString("showForm") === "true") { $("#experience-now").modal("show"); } // 社保页 联系我们 $("#applyBtn").click(function (e) { // console.log($("#name").val(), 88) // username:姓名(必填), // mobileNumber:手机号码(必填), // corpName:公司名称(必填), // corpScale:公司规模, // type;1(固定写死,代表从官网进来的) if (!$("#name").val()) { alert("请输入姓名"); return; } else if ( !$("#phone").val() || !/^1[23456789]\d{9}$/.test($("#phone").val()) ) { alert("请输入正确的手机号"); return; } else if (!$("#companyname").val()) { alert("请输入企业名称"); return; } else if (!$("#size").val()) { alert("请选择企业规模"); return; } var __type = getQueryString("type"); var params = { username: $("#name").val(), mobileNumber: $("#phone").val(), corpName: $("#companyname").val(), corpScale: $("#size").val(), type: __type ? __type : 1, }; $.ajax({ type: "POST", url: window.reqHost + "/home/open/saveSSDeployInfo", data: JSON.stringify(params), contentType: "application/json", success: function (res) { $("#experience-now").modal("toggle"); $("#name").val(""); $("#phone").val(""); $("#companyname").val(""); $("#size").val(null); if (res.success) $("#successModal").modal("show"); else alert(res.errorMsg); }, }); }); var currentButton = 2; $(".apply-salary-box").on("click", ".button", function (e) { var index = $(".button").index(this); if (index === 0) return; $(".button")[currentButton].className = "button"; e.currentTarget.className += " active"; currentButton = index; }); // 智能薪酬专业版 申请表单 $("#salaryProApplyBtn").click(function (e) { if (!$("#name").val()) { alert("请输入姓名"); return; } else if ( !$("#phone").val() || !/^1[23456789]\d{9}$/.test($("#phone").val()) ) { alert("请输入正确的手机号"); return; } else if (!$("#companyname").val()) { alert("请输入企业名称"); return; } var params = { userName: $("#name").val(), mobileNumber: $("#phone").val(), corpName: $("#companyname").val(), corpScale: $(".button")[currentButton].innerHTML, type: 1, }; $.ajax({ type: "POST", url: window.reqHost + "/home/open/saveVipInfo", data: JSON.stringify(params), contentType: "application/json", success: function (res) { $("#salaryProFormModal").modal("toggle"); $("#name").val(""); $("#phone").val(""); $("#companyname").val(""); $("#size").val(null); if (res.success) $("#salaryProSuccessModal").modal("show"); else alert(res.errorMsg); }, }); }); if ($(".salary_compare_mobile").length > 0) { var mySwiper = new Swiper(".compare-swiper-container", { loop: true, autoplay: { delay: 3000, }, pagination: { el: ".swiper-pagination", }, }); for (var i = 0; i < mySwiper.length; i++) { const sw = mySwiper[i]; sw.on("slideChange", function () { var parent = $(this.$el).parents(".salary_compare_mobile"); $(".compare_switch>span", parent).removeClass("active"); $(".compare_item", parent).removeClass("active"); if (this.realIndex === 0) { $(".compare_switch>span.before", parent).addClass("active"); $(".compare_item.before", parent).addClass("active"); } else { $(".compare_switch>span.now", parent).addClass("active"); $(".compare_item.now", parent).addClass("active"); } }); } } // 移动端底部立即体验按钮显隐 // if ($(".fixed_try_btn").length > 0) { // $(window).scroll(function () { // if ($(window).scrollTop() > 300) { // $(".fixed_try_btn").show(); // } else { // $(".fixed_try_btn").hide(); // } // }); // } if (location.href.indexOf("/service") >= 0) { var logList = sessionStorage.getItem("updateLog"); if (logList) { try { logList = JSON.parse(logList); renderLog(logList); } catch (e) { getLog(); } } else { getLog(); } } function getLog() { $.ajax({ url: window.reqHost + "/home/open/deploylog", success: function (res) { sessionStorage.setItem("updateLog", JSON.stringify(res)); renderLog(res); }, }); } function renderLog(list) { $(".log-content").append(getLogHtml(list)); $(".timeline span").css( "height", $(".log-content").height() - $(".log-item:last").height() - 68 ); } function getLogHtml(list) { var html = ""; for (var i = 0; i < list.length; i++) { var item = list[i]; html += '

' + item.date + "

"; for (var n = 0; n < item.content.length; n++) { var con = item.content[n]; var style = n > 0 ? 'style="margin-top: 14px;"' : ""; html += "
【" + con.title + "】
"; html += "

" + con.desc.replace(/\r\n/g, "
").replace(/\n/g, "
") + "

"; } html += "
"; } return html; } // 顶部导航客服热线气泡 var navQrcodeTimer; $(".navbar-footer .try_btn,.navbar-footer .group-qrcode") .mouseover(function () { clearTimeout(navQrcodeTimer); navQrcodeTimer = setTimeout(() => { $(".navbar-footer .phone-arrow").addClass("rotate"); $(".navbar-footer .group-qrcode").fadeIn(300); }, 20); }) .mouseleave(function () { clearTimeout(navQrcodeTimer); navQrcodeTimer = setTimeout(() => { $(".navbar-footer .phone-arrow").removeClass("rotate"); $(".navbar-footer .group-qrcode").fadeOut(300); }, 20); }); // 关闭二维码弹窗-全局 $("#contact-close").click(function () { $("#contactQrcode").modal("hide"); }); $("#contact-close210518").click(function () { $("#contactQrcode210518").modal("hide"); }); // 版权当前年份设置 $(".copyright-current-year").html(new Date().getFullYear()); }); // 新闻页更多新闻切换,TODO:按接口返回为佳 function newsSwitch(index) { $(".news-content").hide().eq(index).show(); } function isMobile() { var u = navigator.userAgent; return ( !!u.match(/AppleWebKit.*Mobile/i) || !!u.match( /MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/ ) ); } // 获取url参数 function getQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); //search,查询?后面的参数,并匹配正则 if (r != null) { return unescape(r[2]); } else { return ""; } } function spm(point) { var spmPvUrl = "https://salary.renlijia.com/spmForOther?spm="; var img = document.createElement("img"); img.src = spmPvUrl + point; } window.spm = spm; // header- 点击预约演示 按钮 和 点击弹窗关闭叉叉 $(function () { $(".getLeadsWithScene-modal-close").click(function () { $("#getLeadsWithSceneModal").modal("hide"); }); }); // header- 点击预约演示 按钮 和 点击弹窗关闭叉叉 $(function () { $(".getLeadsForWhitePaper-modal-close").click(function () { $("#getLeadsForWhitePaperModal").modal("hide"); }); });