$.extend($.validator.messages, { required: "不能为空,请输入。", remote: "请修正该字段。", email: "不是正确的电子邮箱格式。", url: "不是正确的网址格式。", date: "不是正确的日期格式。", dateISO: "不是正确的日期(ISO)格式。", number: "为数字。", zNumber: "为大于0的数字。", zzNumber: "为大于等于0的数字。", digits: "为整数。", zDigits: "为大于0的整数。", phone: "请输入11位手机号码。", creditcard: "请输入正确的信用卡号。", equalTo: "输入不一致。", urlname: "只能包含数字和字母。", accept: "请输入拥有合法后缀名的字符串。", maxlength: $.validator.format("长度不要超过 {0} 个字。"), minlength: $.validator.format("长度不少于 {0} 个字。"), rangelength: $.validator.format("长度范围为[{0} ,{1}] 个字。"), range: $.validator.format("为在 {0} 和 {1} 之间的值。"), max: $.validator.format("最大值为 {0} 。"), min: $.validator.format("最小值为 {0} 。") }); (function ($) { $.fn.extend({ refreshCode: function () { var now = new Date(); $(this).attr("src", "/cp/ValidateCode.aspx?" + now.getTime()); } }) $.extend({ validatorMsg: function (errorMap, errorList,offset) { if (errorList.length > 0) { var element = $(errorList[0].element); var tagName = element.attr('tag') || ''; if (errorList[0].method == "phone") { tagName = ''; } if (element.is('select')) { showNoticeBox("信息有误", '请选择' + tagName + '。', offset) } else { showNoticeBox("信息有误", tagName + errorList[0].message, offset) } } }, //是否为空 isEmpty: function (value) { return $.trim(value) == ''; }, //是否为空 isNullEmpty: function (value) { return value == null || value == 'undefined' || value == [] || $.trim(value) == ''; }, //表单请求 FormRequest: function (form, successFun, errorFun, completeFun) { form = $(form); var postData = form.serializeArray(); $.BaseRequest(form.attr('action'), postData, successFun, errorFun, completeFun); }, //请求方式 BaseRequest: function (url, postData, successFun, errorFun, completeFun) { jQuery.ajax({ url: url, type: "post", data: postData, dataType: "json", success: function (data) { if (typeof successFun == 'function') { successFun(data); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { if (typeof errorFun == 'function') { errorFun(); } else { alert('请求失败。'); } }, complete: function (XMLHttpRequest, textStatus) { if (typeof completeFun == 'function') completeFun(); } }); }, }) })(jQuery); $(function () { if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))) { new WOW().init(); }; $('.tps').click(function () { $('html,body').animate( { scrollTop: $('html,body').offset().top }, 500); }); $('.header .rts .form .btn').click(function () { $(".header .rts .rt li").hide(); if ($(window).width() <= 800) { } else { $('.header .rts .naver').hide(); } $('.ushide').show(); $('.header').addClass('webbg'); }) $('.header .rts .form .adela').click(function () { if ($(window).width() <= 800) { $(".header .rts .rt li.webbl").show(); } else { $(".header .rts .rt li").show(); $('.header .rts .naver').show(); } $('.ushide').hide(); $('.header').removeClass('webbg'); }) //通用 $('.gh').click(function () { $('.layout').toggleClass('selected'); }) $(".wrap").on("click", "a", function (e) { if ($(this).attr("href") == "#") { e.preventDefault(); } }) $(".fixrt li.c1 a").click(function (e) { e.preventDefault(); }) $(".banner .bta a").eq(1).click(function (e) { if ($(this).attr("href") == "#") { showFeedbackWin(3, '头部'); } }) $("a.feedback").each(function () { if ($(this).attr("href") == "#") { $(this).click(function (e) { let type = $(this).data("type") ? parseInt($(this).data("type")) : 3 if ($(this).data("title")) { showFeedbackWin(type, $(this).data("msg"), $(this).data("title")); } else { showFeedbackWin(type, $(this).data("msg")); } }) } }) $(".banner a.fb_act").each(function () { if ($(this).attr("href") == "#") { $(this).click(function (e) { e.preventDefault(); showActivityWin($(this).data("title"),$(this).data("path")) }) } }) $(".ebookdisp a.fb_ebooks").each(function () { if ($(this).attr("href") == "#") { $(this).click(function (e) { e.preventDefault(); showEbooksWin($(this).data("title"), $(this).data("path")) }) } }) $(".experience .item-code img").click(function () { $(this).refreshCode() syncCodeImg(".experience") }) $("#jobForm .item-code img").click(function () { $(this).refreshCode() syncCodeImg("#jobForm") }) $("#topFeedbackForm .item-code img").click(function () { $(this).refreshCode() syncCodeImg("#topFeedbackForm") }) if ($(window).width() > 1000) { $('.header .rts .naver li').hover(function () { $('.nli').stop().slideUp(200); $(this).find('.nli').stop().slideDown(200); }, function () { $('.nli').stop().slideUp(200); }) } else { let mobileSwiperList = $('.swiper-mobile') mobileSwiperList.each(function () { let swiperUl = $(this).children("ul") let swiperLi = swiperUl.children("li") if (!swiperUl.length) { swiperUl = $(this).children("dl") swiperLi = swiperUl.children("dd") } swiperUl.addClass("swiper-wrapper") swiperLi.addClass("swiper-slide") let swiperParent = $(this).parents(".swiper-box").eq(0) let swiperHeaderLi = swiperParent.find(".swiper-header li") swiperHeaderLi.eq(0).addClass("on") swiperLi.show() let mobileSwiper = new Swiper('#' + $(this).attr("id"), { speed: 500, calculateHeight: true, pagination: "#" + swiperParent.attr("id") + ' .swiper-footer', paginationClickable: true, onSlideChangeStart: function () { swiperHeaderLi.removeClass('on') swiperHeaderLi.eq(mobileSwiper.activeIndex).addClass('on') if (mobileSwiper.activeIndex == swiperHeaderLi.length - 2) { if ($(".swiper-header .uumore").length) { $(".swiper-header .uumore")[0].scrollIntoViewIfNeeded() } else { swiperHeaderLi.eq(mobileSwiper.activeIndex)[0].scrollIntoViewIfNeeded() } } else { swiperHeaderLi.eq(mobileSwiper.activeIndex)[0].scrollIntoViewIfNeeded() } } }) swiperHeaderLi.parent().on("click", function (e) { let targetLi = $(e.target).parent() if (targetLi.hasClass("no-swiper")) return swiperHeaderLi.removeClass('on') targetLi.addClass('on') mobileSwiper.swipeTo(targetLi.index()) }) }) $('.header .cen .logo img').attr('src', '/images/logo.png') $('.header .rts .naver li i').click(function () { $(this).parents('li').siblings('li').removeClass('line'); $(this).parents('li').siblings('li').find('i').removeClass('actives'); $(this).parents('li').toggleClass('line'); $(this).toggleClass('actives'); $(this).parents('li').siblings('li').find('.nli').slideUp(); $(this).parents('li').find('.nli').slideToggle(); }) $(window).on('scroll', function () { if ($(window).scrollTop() > 1) { $('.layout').addClass('active5') } else { $('.layout').removeClass('active5') } }) $(".header .cen .logo img").attr('src', '/images/logo.png') } if ($("#feedbackForm").length > 0) { initFeedbackForm($("#feedbackForm"), $("#btnFeedback"), "立即免费体验"); } if ($("#feedbackFormM2").length > 0) { initFeedbackForm($("#feedbackFormM2"), $("#btnFeedback"), "立即提交"); } if ($("#topFeedbackForm").length > 0) { initFeedbackForm($("#topFeedbackForm"), $("#btnTopFeedback"), "提交"); } if ($("#jobForm").length > 0) { initJobForm(); } if ($("#citySearch").length) { createCityLi() createHotCityLi() cityLi = $("#cityList li") $("#citySearch").on("focus", function () { $("#cityBox").addClass("isShow") }).on("blur", function (e) { let that = this setTimeout(function () { $("#cityBox").removeClass("isShow") let inputVal = $(that).val() let flag = false for (let key in _cityMap) { if (inputVal == _cityMap[key]) { flag = true } } if (!flag) { $(that).val("") filterCity(e) } }, 100) }).on("input", filterCity) } }) let cityLi function showNoticeBox(title, message, offset) { let noticeDiv if ($('.notice-mask').length) { noticeDiv = document.querySelector(".notice-mask") $(noticeDiv).find(".notice-title h4").text(title) $(noticeDiv).find(".notice-msg p").text(message) } else { let template = "
" + "
" + "

" + title + "

" + "
" + "
" + "

" + message + "

" + "
" + "
" + "确定" + "
" + "
" noticeDiv = document.createElement("div") $(noticeDiv).addClass("notice-mask") $(noticeDiv).html(template) document.body.appendChild(noticeDiv) } let boxStyle = { top: "50%", left: "50%", transform: "translate(-50%, -50%)" } if (offset && $(window).width() > 1000) { boxStyle.top = offset.top boxStyle.left = offset.left boxStyle.transform = "translate(-50%, 60px)" if (document.documentElement.clientHeight - offset.top < 200) { boxStyle.top = offset.top - 230 } if (offset.left < 200) { boxStyle.transform = "translate(0, 60px)" } $(noticeDiv).css("background", "none") } else { $(noticeDiv).css("background","#000000a3") } $(noticeDiv).find(".notice-box").css(boxStyle) $(noticeDiv).show() if ($(window).width() > 1000) { $(document.body).css({ overflowY: "hidden", marginRight: "17px" }) } $(noticeDiv).find('a').on("click", function () { $(noticeDiv).hide() $(document.body).css({ overflowY: "scroll", marginRight: "0" }) return false }) } function initFeedbackForm(curForm, btnFeedback, btnName) { curForm.find('input[name=PageTitle]').val(document.title); curForm.validate({ onfocusout: false, onkeyup: false, showErrors: function (errorMap, errorList) { let offset = btnFeedback[0].getBoundingClientRect() $.validatorMsg(errorMap, errorList,offset); }, submitHandler: function (form) { btnFeedback.val("正在提交中"); $.FormRequest(form, function (data) { let offset = btnFeedback[0].getBoundingClientRect() if (data.code == 1) { showNoticeBox("提交成功!", "稍后会有0592开头的电话号码与您联系!", "", offset) $(".experience .item-code img").click() curForm.find('input[type=text]').each(function () { $(this).val(''); }); curForm.find('textarea').each(function () { $(this).val(''); }); } else { showNoticeBox("提交失败!", $.isNullEmpty(data.message) ? "" : data.message,offset) } }, null, function () { btnFeedback.val(btnName); }); return false; } }); } function initJobForm() { $("#jobForm").validate({ onfocusout: false, onkeyup: false, onkeydown: false, showErrors: function (errorMap, errorList) { $.validatorMsg(errorMap, errorList); }, submitHandler: function (form) { $("#btnJobSubmit").val("正在提交中"); $.FormRequest(form, function (data) { if (data.code == 1) { showNoticeBox("提交成功!", "") location.replace("/job"); } else { showNoticeBox("提交失败!", $.isNullEmpty(data.message) ? "" : data.message) } }, null, function () { $("#btnJobSubmit").val("提交"); $("#jobForm .item-code img").click() }); return false; } }); } function syncCodeImg(parent) { let codeSrc = $(parent + " .item-code img").attr("src") $("#feedbackWin .item-code img").attr("src", codeSrc) $(".experience .item-code img").attr("src", codeSrc) $("#topFeedbackForm .item-code img").attr("src", codeSrc) $("#jobForm .item-code img").attr("src", codeSrc) } function showFeedbackWin(posType, msg, title) { if ($.isNullEmpty(posType)) posType = 3; var html = '
'; html += '
'; html += '

' + ($.isNullEmpty(title) ? '立即免费体验' : title) + '

'; html += '
'; html += '
'; $('body').append(html); $("#feedbackWin").find('input[name=PageTitle]').val(document.title); let codeImg = $("#feedbackWin .item-code img") codeImg.click(function () { $(this).refreshCode() syncCodeImg("#feedbackWin") }) codeImg.click() $("#feedbackWinForm").validate({ onfocusout: false, onkeyup: false, showErrors: function (errorMap, errorList) { $.validatorMsg(errorMap, errorList); }, submitHandler: function (form) { var btnSubmit = $("#feedbackWin").find('input[type=submit]'); btnSubmit.val("正在提交中"); $.FormRequest(form, function (data) { if (data.code == 1) { showNoticeBox("提交成功!", "稍后会有0592开头的电话号码与您联系!") codeImg.click() closeFeedbackWin(); } else { showNoticeBox("提交失败!", $.isNullEmpty(data.message) ? "" : data.message) } }, null, function () { btnSubmit.val("提交"); }); return false; } }); } function showActivityWin(msg, qrPath) { var html = '
'; html += '
'; html += '

' + msg + '

'; html += '
'; html += '
'; html += '
  • '; html += '
  • '; html += '
  • '; html += '
  • '; html += '
  • '; html += '
  • '; html += '
'; $('body').append(html); $("#feedbackWin").find('input[name=PageTitle]').val(document.title); let codeImg = $("#feedbackWin .item-code img") codeImg.click(function () { $(this).refreshCode() syncCodeImg("#feedbackWin") }) codeImg.click() $("#feedbackWinForm").validate({ onfocusout: false, onkeyup: false, showErrors: function (errorMap, errorList) { $.validatorMsg(errorMap, errorList); }, submitHandler: function (form) { var btnSubmit = $("#feedbackWin").find('input[type=submit]'); btnSubmit.val("正在提交中"); $.FormRequest(form, function (data) { if (data.code == 1) { showNoticeBox("提交成功!", "") codeImg.click() closeFeedbackWin(); } else { showNoticeBox("提交失败!", $.isNullEmpty(data.message) ? "" : data.message) } }, null, function () { btnSubmit.val("提交"); }); return false; } }); } function showEbooksWin(msg, qrPath) { var html = '
'; html += '
'; html += '

获取电子书
' + msg + '

'; html += '
'; html += '
'; html += '
  • '; html += '
  • '; html += '
  • '; html += '
  • '; html += '
'; $('body').append(html); $("#feedbackWin").find('input[name=PageTitle]').val(document.title); let codeImg = $("#feedbackWin .item-code img") codeImg.click(function () { $(this).refreshCode() syncCodeImg("#feedbackWin") }) codeImg.click() $("#feedbackWinForm").validate({ onfocusout: false, onkeyup: false, showErrors: function (errorMap, errorList) { $.validatorMsg(errorMap, errorList); }, submitHandler: function (form) { var btnSubmit = $("#feedbackWin").find('input[type=submit]'); btnSubmit.val("正在提交中"); $.FormRequest(form, function (data) { if (data.code == 1) { showNoticeBox("提交成功!", "稍后会有0592开头的电话号码与您联系!") codeImg.click() closeFeedbackWin(); } else { showNoticeBox("提交失败!", $.isNullEmpty(data.message) ? "" : data.message) } }, null, function () { btnSubmit.val("提交"); }); return false; } }); } function closeFeedbackWin() { $('#feedbackWinBg').remove(); $('#feedbackWin').remove(); } function createCityLi() { let cityUl = $("#cityList") for (let key in _cityMap) { let li = document.createElement('li') $(li).attr("id", key) $(li).attr("class", key.replace(/[^A-Z]/g, '')) $(li).on("click", function () { $("#citySearch").val(_cityMap[$(this).attr("id")]) }) $(li).text(_cityMap[key] + "(" + key + ")") cityUl.append(li) } $("#nocity").hide() } function createHotCityLi() { let hotCityUl = $("#hotCityList") hotCityUl.hide() _hotCityList.forEach(function(city){ let li = document.createElement('li') $(li).text(city) $(li).on("click", function () { $("#citySearch").val($(this).text()) }) hotCityUl.append(li) }) hotCityUl.show() } function filterCity(e) { let en = /^[a-zA-Z]+$/ let filter = e.target.value let filterExp = new RegExp('^' + e.target.value.toLowerCase()) if (filter) { $('#hotCity').hide() $('#filterCity').show() cityLi.hide() $("#nocity").hide() let showCity = false for (let key in _cityMap) { if (en.test(filter)) { if (filterExp.test(key.toLowerCase())) { $("#" + key).show() showCity = true } else { let caps = key.replace(/[^A-Z]/g, '') if (filterExp.test(caps.toLowerCase())) { $("#" + key).show() showCity = true } } } else { if (filterExp.test(_cityMap[key])) { $("#" + key).show() showCity = true } } } if (!showCity) { $("#nocity").show() } } else { $("#cityBox").hide() $('#filterCity').hide() $('#hotCity').show() $("#cityBox").show() } }