$(document).ready(function() { $(document).on("click",".contact_b2 .biaodan ul li.ysmxy .bt",function(){ if($(this).parents("li.ysmxy").hasClass("mozhanshi")){ $(this).parents("li").removeClass("mozhanshi"); }else{ $(".contact_b2 .biaodan ul li.ysmxy").removeClass("mozhanshi"); $(this).parents("li").addClass("mozhanshi"); } //return false; }); if($(window).width() < 1101){ $(document).on("click",".contact_b2 .biaodan ul li.ysmxy .xial label",function(){ if($(this).hasClass("zxxl")){ }else{ $(this).parents("li.ysmxy").removeClass("mozhanshi"); } }); //return false; } $(".nybanner").addClass("cur"); // 导航下拉 $(".new_header .right .btm .ul li .xl_box_c .r .nr.list").hover(function(){ $(".new_header .right .btm .ul li .xl_box_c .you .zhankai.list_box").removeClass("cur").eq($(this).index()).addClass("cur"); }); // $(".new_header .right .btm .ul li .xl_box_b2 .z .nr_erji .nr_erji_box").hover(function(){ // var dataid = $(this).attr('data-id'); // $(".new_header .right .btm .ul li .xl_box_b2 .r .boxboxbox").each(function(){ // if($(this).attr('data-id') == dataid){ // $(".new_header .right .btm .ul li .xl_box_b2 .r .boxboxbox").removeClass("cur"); // $(this).addClass("cur"); // } // }); // }); $(".new_header .right .btm .ul li .xl_box_b2 .z [data-id]").hover(function(){ var dataid = $(this).attr('data-id'); $(".new_header .right .btm .ul li .xl_box_b2 .r .boxboxbox").each(function(){ if($(this).attr('data-id') == dataid){ $(".new_header .right .btm .ul li .xl_box_b2 .r .boxboxbox").removeClass("cur"); $(this).addClass("cur"); } }); }); $(".new_header .right .btm .ul li .xl_box_b2 .r .boxboxbox .nr .bt3").hover(function(){ if($(this).next().css('display') != 'block'){ $(".new_header .right .btm .ul li .xl_box_b2 .r .boxboxbox .nr .bt3").removeClass("cur"); $(this).addClass("cur") $(".new_header .right .btm .ul li .xl_box_b2 .r .boxboxbox .nr .abox").slideUp(); $(this).next().slideDown(); } }); $(".new_header .right .btm .ul li .xl_box_b .r .nr .bt").hover(function(){ if($(this).parents(".nr").find(".zhankai").css('display')=='block'){ $(this).parents(".nr").find(".zhankai").slideUp(); $(this).parents(".nr").removeClass("cur"); }else{ $(".new_header .right .btm .ul li .xl_box_b .r .nr .zhankai").slideUp(); $(this).parents(".nr").find(".zhankai").slideDown(); $(".new_header .right .btm .ul li .xl_box_b .r .nr").removeClass("cur"); $(this).parents(".nr").addClass("cur"); } },function(){ }) $(".new_header .right .btm .ul li .xl_box_b .r .nr .bt .i").click(function(){ $(this).parent().next().slideToggle(); }) // -- $(".new_header .right .btm .ul li .xl_box_b2 .z .bt").mouseenter(function(){ if($(this).next().css('display') != 'block'){ $(".new_header .right .btm .ul li .xl_box_b2 .z .bt").removeClass("cur"); $(this).addClass("cur"); $(".new_header .right .btm .ul li .xl_box_b2 .z .nr_erji").slideUp(); $(this).next().slideDown(); } }); $(".new_header .right .btm .ul li .xl_box_b2 .z .nr_erji .bt2").mouseenter(function(){ if($(this).next().css('display') != 'block'){ $(".new_header .right .btm .ul li .xl_box_b2 .z .nr_erji .bt2").removeClass("cur"); $(this).addClass("cur") $(".new_header .right .btm .ul li .xl_box_b2 .z .nr_erji .nr_sanji ").slideUp(); $(this).next().slideDown(); } }); $(".new_header .right .btm .ul li .xl_box_b2 .z .nr_erji .nr_sanji a").mouseenter(function(){ var dataid = $(this).attr("data-id"); $(".new_header .right .btm .ul li .xl_box_b2 .z .nr_erji .nr_sanji a").removeClass("cur"); $(this).addClass("cur"); $(".new_header .right .btm .ul li .xl_box_b2 .r .box").removeClass("cur"); $(".new_header .right .btm .ul li .xl_box_b2 .r .box").each(function(i,v){ if(dataid == $(v).attr("data-id")){ $(v).addClass("cur"); } }); }); $(".new_header .right .btm .ul li .xl_box_b2 .z .i").click(function(){ $(this).parent().next().slideToggle(); }); // end $(document).on("click",".navBtn",function(){ $(".nav_box_6").toggleClass("cur"); $(".topHeader").toggleClass("fixed-headA"); // $(".topHeader").addClass("bgGreen"); }) $(".backFirst").click(function(){ $(".nav_box .navlist ul>li .navlist2").css('left','-102%'); }) $(document).on('click',".nav_box .navlist ul>li .navlist2 a",function(){ $(".navBtn").removeClass("mobile-menu-on"); }) $(document).on('click',".nav_box .navlist ul>li .ii",function(){ $(this).next().css('left','0'); }) $(".backSecond").click(function(){ $(".navlist3").css('left','-102%'); }) $(".backThird").click(function(){ $(".navlist4").css('left','-102%'); }) $(".backFifth").click(function(){ $(".navlist5").css('left','-102%'); }) $(".backsix").click(function(){ $(".navlist6").css('left','-102%'); }) // Phone Nav = $(".navBtn").click(function (e) { $(".nav_box").toggleClass("cur"); $("body").bind("touchmove", function (event) { event.preventDefault(), event.stopPropagation(); }); $(this).toggleClass("mobile-menu-on"); $(this).toggleClass("navBtnA"); $(".nav_box .navlist ul>li .navlist2,.nav_box .navlist ul>li .navlist3,.nav_box .navlist ul>li .navlist4,.nav_box .navlist ul>li .navlist5,.nav_box .navlist ul>li .navlist6").css('left','-102%'); $(".nav_box .navlist ul>li").removeClass("cur"); e.stopPropagation(); }); $(".nav_box .navclose").click(function () { $(".nav_box").animate({ left: "-100%" }); $("body").unbind("touchmove"); }); $(document).click(function(e){ var a = $('.sousuo'); //设置空白以外的目标区域 if(!a.is(e.target) && a.has(e.target).length === 0){ $(".sousuo").each(function(){ if($(this).hasClass("cur")){ $(this).removeClass("cur"); } }) } }); $(".sousuo .box").click(function(){ $(this).parents(".sousuo").addClass("cur"); return false; }); $(document).ready(function() { mh = $('body').height(); fh = $('.header').height(); $(window).scroll(function(e){ s = $(document).scrollTop(); if(s > fh){ $('.header').addClass('fixed-head'); }else{ $('.header').removeClass('fixed-head'); } }); }); $(document).ready(function() { mh = $('body').height(); fh = $('.mo_header').height(); $(window).scroll(function(e){ s = $(document).scrollTop(); if(s > fh){ $('.mo_header').addClass('fixed-head'); }else{ $('.mo_header').removeClass('fixed-head'); } }); }); //语言 $(".Language span").click(function() { $(this).parent().find("dl").stop().slideToggle(); }); //返回顶部 $(function() { $(".backTop").click(function() { if($(document).scrollTop() != 0){ $("html,body").animate({ scrollTop: 0 }, 500); } }); }); //通用切换 //**鼠标点击 $('.tabSwitch').each(function(index, element) { var obj = $(this); obj.find('.tabTit').children().on('click tab', function() { $(this).addClass('cur').siblings().removeClass('cur'); if ($(this).data('to')){ $($(this).data('to')).val($(this).data('id')); } if (obj.find('.tabBox').children().eq($(this).index()).length > 0) obj.find('.tabBox').children().hide().eq($(this).index()).show(); if (obj.find('.tabBox2').children().eq($(this).index()).length > 0) obj.find('.tabBox2').children().hide().eq($(this).index()).show(); return false; }); obj.find('.tabTit .cur').trigger('tab'); }); $('.tabSwitch').each(function(index, element) { var obj = $(this); obj.find('.tabTit2').children().on('click tab', function() { index = $(this).index(); $(this).addClass('cur').siblings().removeClass('cur'); if ($(this).data('to')){ $($(this).data('to')).val($(this).data('id')); } if (obj.find('.tabBox').children().eq($(this).index()).length > 0) obj.find('.tabBox').children().hide().eq($(this).index()).show(); if(index == 0){ var swiperX1 = new Swiper(".EnfuChinaF-swiper1", { slidesPerView: 1.3, spaceBetween: 20, loop:true, speed:1000, observer: true, observeParents: true, pagination: { el: '.swiper-pagination-topE1', clickable: true, }, autoplay: { delay: 1000, disableOnInteraction: false, }, centeredSlides: true, breakpoints: { 1101: { slidesPerView: 1.95, }, }, }); swiperX1.update(); swiperX1.autoplay.start(); }else if(index == 1){ var swiperX2 = new Swiper(".EnfuChinaF-swiper2", { slidesPerView: 1.3, spaceBetween: 20, loop:true, speed:1000, observer: true, observeParents: true, pagination: { el: '.swiper-pagination-topE2', clickable: true, }, autoplay: { delay: 1000, disableOnInteraction: false, }, centeredSlides: true, breakpoints: { 1101: { slidesPerView: 1.95, }, }, }); swiperX2.update(); swiperX2.autoplay.start(); }else if(index == 2){ var swiperX3 = new Swiper(".EnfuChinaF-swiper3", { slidesPerView: 1.3, spaceBetween: 20, loop:true, speed:1000, observer: true, observeParents: true, pagination: { el: '.swiper-pagination-topE3', clickable: true, }, autoplay: { delay: 1000, disableOnInteraction: false, }, centeredSlides: true, breakpoints: { 1101: { slidesPerView: 1.95, }, }, }); swiperX3.update(); swiperX3.autoplay.start(); }else if(index == 3){ swiperX4.update(); swiperX4.autoplay.start(); } return false; }); obj.find('.tabTit2 .cur').trigger('tab'); }); //鼠标经过 $('.tabSwitchHover').each(function(index, element) { var obj = $(this); obj.find('.tabTit').children().on('mouseover tab', function() { $(this).addClass('cur').siblings().removeClass('cur'); if ($(this).data('to')){ $($(this).data('to')).val($(this).data('id')); } if (obj.find('.tabBox').children().eq($(this).index()).length > 0) obj.find('.tabBox').children().hide().eq($(this).index()).show(); if (obj.find('.tabBox2').children().eq($(this).index()).length > 0) obj.find('.tabBox2').children().hide().eq($(this).index()).show(); //return false; }); obj.find('.tabTit .cur').trigger('tab'); }); $('.tabSwitchHovera').each(function(index, element) { var obj = $(this); obj.find('.tabTitm').children().on('mouseover tab', function() { $(this).addClass('cure').siblings().removeClass('cure'); if ($(this).data('to')){ $($(this).data('to')).val($(this).data('id')); } if (obj.find('.tabBpox').children().eq($(this).index()).length > 0) obj.find('.tabBpox').children().hide().eq($(this).index()).show(); if (obj.find('.tabBpox2').children().eq($(this).index()).length > 0) obj.find('.tabBpox2').children().hide().eq($(this).index()).show(); //return false; }); obj.find('.tabTitm .cure').trigger('tab'); }); //发送验证码 $('body').on('click','.getMobileCode',function(){ sendSms($(this),0); return false; }); $("#mobile").on('blur', function () { if ($("#mobile").val() != $("#old_mobile").val()){ $('.getMobileCode').show(); $('.yanzhengma div').addClass('bitian'); }else{ //$('.getMobileCode').hide(); $('.yanzhengma div').removeClass('bitian'); } }); }); function act() { var wid = $(window).width(); var hei = $(window).height(); $(".banner .swiper-wrapper .bg").css("height", hei); $(".banner .swiper-wrapper .bg").css("width", wid); } $(document).ready(function() { act(); }); $(window).resize(function() { act(); }); fh = $('.topNav').height(); $(window).scroll(function(e) { s = $(document).scrollTop(); // if (s > $(window).height()) { // $(".backTop").fadeIn(); // } else { // $(".backTop").fadeOut(); // } if (s > fh) { $('.topNav').addClass('fixed-head'); } else { $('.topNav').removeClass('fixed-head'); } }); $(window).scroll(function(e) { s = $(document).scrollTop(); if (s > $(".banner").height()) { $(".guide").fadeIn(); } else { $(".guide").fadeOut(); } }); $(".menu").click(function(){ $(".nav_box ").toggleClass("cur"); }); // AJAX $(document).ready(function () { $.ajaxNoload = $.ajax; //首先备份下jquery的ajax方法 var _ajax=$.ajax; //重写jquery的ajax方法 $.ajax=function(opt){ //备份opt中error和success方法 var fn = { error:function(XMLHttpRequest, textStatus, errorThrown){}, success:function(data, textStatus){} } if(opt.error){ fn.error=opt.error; } if(opt.success){ fn.success=opt.success; } //扩展增强处理 var _opt = $.extend(opt,{ error:function(XMLHttpRequest, textStatus, errorThrown){ //错误方法增强处理 fn.error(XMLHttpRequest, textStatus, errorThrown); }, success:function(data, textStatus){ //成功回调方法增强处理 fn.success(data, textStatus); }, beforeSend:function(XHR){ //提交前回调方法 //$('body').append("
正在加载,请稍后...
"); layer.load(); }, complete:function(XHR, TS){ //请求完成后回调函数 (请求成功或失败之后均调用)。 //$("#ajaxInfo").remove();; layer.closeAll('loading'); } }); return _ajax(_opt); }; }); function CheckSearch(o){ obj = $(o); obj.find('[type="submit"]').attr('disabled',true); msg = ''; searKey = obj.find('[name="searKey"]').val(); if (searKey.length <= 0){ msg += '请输入您想搜索的内容....\r'; } if (msg.length){ alert(msg); obj.find('[name="searKey"]').focus(); obj.find('[type="submit"]').attr('disabled',false); return false; } return true; } //检查登录状态 function CheckLogin(callback){ $.ajaxNoload({ type: 'POST', url: '/ajax', cache: false, data: {act:'checkLogin'}, dataType: 'json', beforeSend:function(XHR){ //提交前回调方法 // layer.load(); }, error: function(){ console.log('Error!'); return false; }, success:function(json){ if (json.msg){ if (check_user_login_timer){ clearInterval(check_user_login_timer); } if (typeof callback === 'function'){ callback(); } return true; }else{ return false; } } }); } // 资料下载 function CheckDownload(o) { var obj = $(o); obj.find('[type="submit"]').attr('disabled',true); var msg = ''; layer.closeAll('tips'); var serKey = obj.find('[name="serKey"]').val(); var gid = obj.find('[name="gid"]').val(); if (serKey){ }else{ $.get(window.location.href, {}, function (data, textStatus, jqXHR) { $('#ajax_list').html($(data).find('#ajax_list').html()); }, "html" ); obj.find('[type="submit"]').attr('disabled',false); return false; } if (msg.length){ obj.find('[type="submit"]').attr('disabled',false); return false; }else{ $.ajax({ type: 'POST', url: '/ajax', dataType: 'json', cache: false, data: {serKey:serKey, gid:gid, location:location.href, act:obj.find('[name="act"]').val(), formhash:obj.find('[name="formhash"]').val()}, error: function(){ alert('出错了!'); return false; }, success:function(json){ $('[name="formhash"]').val(json.formhash); if (json.errmsg == ''){ $('#ajax_list').html(json.msg); }else{ layer.alert(json.errmsg, {icon: 2}); } obj.find('[type="submit"]').attr('disabled',false); } }); } return false; } // 新闻中心 function CheckNews(o) { var obj = $(o); obj.find('[type="submit"]').attr('disabled',true); var msg = ''; layer.closeAll('tips'); var serKey = obj.find('[name="serKey"]').val(); var year = obj.find('[name="year"]').val(); if (serKey || year){ }else{ $.get(window.location.href, {}, function (data, textStatus, jqXHR) { $('#ajax_list2').html($(data).find('#ajax_list2').html()); }, "html" ); obj.find('[type="submit"]').attr('disabled',false); return false; } if (msg.length){ obj.find('[type="submit"]').attr('disabled',false); return false; }else{ $.ajax({ type: 'POST', url: '/ajax', dataType: 'json', cache: false, data: {serKey:serKey, year:year, location:location.href, act:obj.find('[name="act"]').val(), formhash:obj.find('[name="formhash"]').val()}, error: function(){ alert('出错了!'); return false; }, success:function(json){ $('[name="formhash"]').val(json.formhash); if (json.errmsg == ''){ $('#ajax_list2').html(json.msg); }else{ layer.alert(json.errmsg, {icon: 2}); } obj.find('[type="submit"]').attr('disabled',false); } }); } return false; } function CheckContact(o, callback){ var obj = $(o); obj.find('[type="submit"]').attr('disabled',true); var msg = ''; layer.closeAll('tips'); var username = obj.find('[name="username"]').val(); var companyname = obj.find('[name="companyname"]').val(); var leixing = obj.find('[name="leixing"]:checked').val(); var leixing_other = obj.find('[name="leixing_other"]').val(); var oem = obj.find('[name="oem"]').val(); var mobile = obj.find('[name="mobile"]').val(); var code = obj.find('[name="code"]').val(); var email = obj.find('[name="email"]').val(); var city = obj.find('[name="city"]:checked').val(); var hangye = obj.find('[name="hangye"]:checked').val(); var hangye_other = obj.find('[name="hangye_other"]').val(); var xuqiu = obj.find('[name="xuqiu"]:checked').val(); if (!xuqiu){ xuqiu = '资料下载'; } var xuqiu_other = obj.find('[name="xuqiu_other"]').val(); var chanpinjishu = obj.find('[name="chanpinjishu"]:checked').val(); var chanpinjishu_other = obj.find('[name="chanpinjishu_other"]').val(); var guigexinghao = obj.find('[name="guigexinghao"]').val(); var gongkuang = obj.find('[name="gongkuang"]').val(); var jieduan = obj.find('[name="jieduan"]').val(); var xuqiunum = obj.find('[name="xuqiunum"]').val(); var weilaixuqiunum = obj.find('[name="weilaixuqiunum"]').val(); var duijie = obj.find('[name="duijie"]:checked').val(); var duijie_other = obj.find('[name="duijie_other"]').val(); if (duijie == "已与恩福销售联络"){ duijie_other = obj.find('[name="duijie_1_name"]').val(); }else if (duijie == "已与恩福代理商联络"){ duijie_other = obj.find('[name="duijie_2_name"]').val(); } var qudao = obj.find('[name="qudao"]:checked').val(); var qudao_other = obj.find('[name="qudao_other"]').val(); var tuzhifile = obj.find('[name="tuzhifile"]').val(); var mess = obj.find('[name="mess"]').val(); var downurl = obj.find('[name="downurl"]').val(); var pageid = obj.find('[name="pageid"]').val(); if (!obj.find('.bt01 i').hasClass('cur')){ msg = "请阅读并同意相关协议"; obj.find('.bt01 i').inputError({'err': msg, 'tips': 3, tipsMore: true}); } if (!obj.find('.bt02 i').hasClass('cur')){ msg = "请阅读并同意相关协议"; obj.find('.bt02 i').inputError({'err': msg, 'tips': 3, tipsMore: true}); } if (companyname.length < 1 || companyname.length > 100){ msg = obj.find('[name="companyname"]').attr('placeholder')?obj.find('[name="companyname"]').attr('placeholder'):'请输入您的公司'; obj.find('[name="companyname"]').inputError({'err': '请输入您的公司', 'tips': 3, tipsMore: true}); } if (!leixing || leixing.length < 1){ msg = obj.find('[name="leixing"]').attr('placeholder')?obj.find('[name="leixing"]').attr('placeholder'):'请选择公司类型'; obj.find('[name="leixing"]').parents('.bitian').inputError({'err': '请选择公司类型', 'tips': 3, tipsMore: true}); }else if (leixing == "其他" && leixing_other.length < 1){ msg = obj.find('[name="leixing_other"]').attr('placeholder')?obj.find('[name="leixing_other"]').attr('placeholder'):'请填写公司类型具体说明'; obj.find('[name="leixing_other"]').parents('.bitian').inputError({'err': '请填写公司类型具体说明', 'tips': 3, tipsMore: true}); } if (!hangye || hangye.length < 1){ msg = obj.find('[name="hangye"]').attr('placeholder')?obj.find('[name="hangye"]').attr('placeholder'):'请选择行业'; obj.find('[name="hangye"]').parents('.bitian').inputError({'err': '请选择行业', 'tips': 3, tipsMore: true}); }else if (hangye == "其他" && hangye_other.length < 1){ msg = obj.find('[name="hangye_other"]').attr('placeholder')?obj.find('[name="hangye_other"]').attr('placeholder'):'请填写其他行业名称'; obj.find('[name="hangye_other"]').parents('.bitian').inputError({'err': '请填写其他行业名称', 'tips': 3, tipsMore: true}); } if (!city || city.length < 1){ msg = obj.find('[name="city"]').attr('placeholder')?obj.find('[name="city"]').attr('placeholder'):'请选择省份'; obj.find('[name="city"]').parents('.bitian').inputError({'err': '请选择省份', 'tips': 3, tipsMore: true}); } if (username.length < 1 || username.length > 100){ msg = obj.find('[name="username"]').attr('placeholder')?obj.find('[name="username"]').attr('placeholder'):'请输入您的姓名'; obj.find('[name="username"]').inputError({'err': '请输入您的姓名', 'tips': 3, tipsMore: true}); } if (mobile.length < 1 || mobile.length > 100){ msg = obj.find('[name="mobile"]').attr('placeholder')?obj.find('[name="mobile"]').attr('placeholder'):'请输入您的电话'; obj.find('[name="mobile"]').inputError({'err': '请输入您的电话', 'tips': 3, tipsMore: true}); } if ($("#mobile").val() != $("#old_mobile").val() && code.length != 6){ msg = obj.find('[name="code"]').attr('placeholder')?obj.find('[name="code"]').attr('placeholder'):'请输入验证码'; obj.find('[name="code"]').inputError({'err': '请输入验证码', 'tips': 3, tipsMore: true}); } if (!xuqiu || xuqiu.length < 1){ msg = obj.find('[name="xuqiu"]').attr('placeholder')?obj.find('[name="xuqiu"]').attr('placeholder'):'请选择需求'; obj.find('[name="xuqiu"]').parents('.bitian').inputError({'err': '请选择需求', 'tips': 3, tipsMore: true}); }else if (xuqiu == "咨询报价" || xuqiu == "合作技术开发" || xuqiu == "售后服务"){ if (!chanpinjishu || chanpinjishu.length < 1){ msg = obj.find('[name="chanpinjishu"]').attr('placeholder')?obj.find('[name="chanpinjishu"]').attr('placeholder'):'请选择需要的产品/技术'; obj.find('[name="chanpinjishu"]').parents('.bitian').inputError({'err': '请选择需要的产品/技术', 'tips': 3, tipsMore: true}); }else if (chanpinjishu == "其他" && chanpinjishu_other.length < 1){ msg = obj.find('[name="chanpinjishu_other"]').attr('placeholder')?obj.find('[name="chanpinjishu_other"]').attr('placeholder'):'请填写其他产品/技术名称'; obj.find('[name="chanpinjishu_other"]').parents('.bitian').inputError({'err': '请填写其他产品/技术名称', 'tips': 3, tipsMore: true}); } if (guigexinghao.length < 1 || guigexinghao.length > 100){ msg = obj.find('[name="guigexinghao"]').attr('placeholder')?obj.find('[name="guigexinghao"]').attr('placeholder'):'请输入规格型号说明,如型号编码,尺寸'; obj.find('[name="guigexinghao"]').inputError({'err': '请输入规格型号说明,如型号编码,尺寸', 'tips': 3, tipsMore: true}); } if (gongkuang.length < 1 || gongkuang.length > 100){ msg = obj.find('[name="gongkuang"]').attr('placeholder')?obj.find('[name="gongkuang"]').attr('placeholder'):'请输入工况条件说明,如温度、压力'; obj.find('[name="gongkuang"]').inputError({'err': '请输入工况条件说明,如温度、压力', 'tips': 3, tipsMore: true}); } if (!jieduan || jieduan.length < 1){ msg = obj.find('[name="jieduan"]').attr('placeholder')?obj.find('[name="jieduan"]').attr('placeholder'):'请选择目前项目阶段'; obj.find('[name="jieduan"]').parents('.bitian').inputError({'err': '请选择目前项目阶段', 'tips': 3, tipsMore: true}); } if (xuqiunum.length < 1 || xuqiunum.length > 100){ msg = obj.find('[name="xuqiunum"]').attr('placeholder')?obj.find('[name="xuqiunum"]').attr('placeholder'):'请输入当前需求数量'; obj.find('[name="xuqiunum"]').inputError({'err': '请输入当前需求数量', 'tips': 3, tipsMore: true}); } if (weilaixuqiunum.length < 1 || weilaixuqiunum.length > 100){ msg = obj.find('[name="weilaixuqiunum"]').attr('placeholder')?obj.find('[name="weilaixuqiunum"]').attr('placeholder'):'请输入未来年需求量预估'; obj.find('[name="weilaixuqiunum"]').inputError({'err': '请输入未来年需求量预估', 'tips': 3, tipsMore: true}); } if (!duijie || duijie.length < 1){ msg = obj.find('[name="duijie"]').attr('placeholder')?obj.find('[name="duijie"]').attr('placeholder'):'请选择是否已与恩福对接联络'; obj.find('[name="duijie"]').parents('.bitian').inputError({'err': '请选择是否已与恩福对接联络', 'tips': 3, tipsMore: true}); }else if (duijie == "已与恩福销售联络" && duijie_other.length < 1){ msg = obj.find('[name="duijie_other"]').attr('placeholder')?obj.find('[name="duijie_other"]').attr('placeholder'):'请填写恩福销售名称'; obj.find('[name="duijie_other"]').parents('.bitian').inputError({'err': '请填写恩福销售名称', 'tips': 3, tipsMore: true}); }else if (duijie == "已与恩福代理商联络" && duijie_other.length < 1){ msg = obj.find('[name="duijie_other"]').attr('placeholder')?obj.find('[name="duijie_other"]').attr('placeholder'):'请填写恩福代理商名称'; obj.find('[name="duijie_other"]').parents('.bitian').inputError({'err': '请填写恩福代理商名称', 'tips': 3, tipsMore: true}); }else if (duijie == "其他" && duijie_other.length < 1){ msg = obj.find('[name="duijie_other"]').attr('placeholder')?obj.find('[name="duijie_other"]').attr('placeholder'):'请填写其他对接名称'; obj.find('[name="duijie_other"]').parents('.bitian').inputError({'err': '请填写其他对接名称', 'tips': 3, tipsMore: true}); } }else if (xuqiu == "其他" && xuqiu_other.length < 1){ msg = obj.find('[name="xuqiu_other"]').attr('placeholder')?obj.find('[name="xuqiu_other"]').attr('placeholder'):'请填写其他需求名称'; obj.find('[name="xuqiu_other"]').parents('.bitian').inputError({'err': '请填写其他需求名称', 'tips': 3, tipsMore: true}); } if (!qudao || qudao.length < 1){ msg = obj.find('[name="qudao"]').attr('placeholder')?obj.find('[name="qudao"]').attr('placeholder'):'请选择您从哪里得知恩福'; obj.find('[name="qudao"]').parents('.bitian').inputError({'err': '请选择您从哪里得知恩福', 'tips': 3, tipsMore: true}); }else if (qudao == "其他" && qudao_other.length < 1){ msg = obj.find('[name="qudao_other"]').attr('placeholder')?obj.find('[name="qudao_other"]').attr('placeholder'):'请填写其他得知渠道名称'; obj.find('[name="qudao_other"]').parents('.bitian').inputError({'err': '请填写其他得知渠道名称', 'tips': 3, tipsMore: true}); } if (email.length < 1 || email.length > 100){ msg = obj.find('[name="email"]').attr('placeholder')?obj.find('[name="email"]').attr('placeholder'):'请输入您的邮箱'; obj.find('[name="email"]').inputError({'err': '请输入您的邮箱', 'tips': 3, tipsMore: true}); } if (msg.length){ obj.find('[type="submit"]').attr('disabled',false); return false; }else{ var post_data = new FormData() post_data.append("companyname", companyname?companyname:''); post_data.append("leixing", leixing?leixing:''); post_data.append("leixing_other", leixing_other?leixing_other:''); post_data.append("oem", oem?oem:''); post_data.append("hangye", hangye?hangye:''); post_data.append("hangye_other", hangye_other?hangye_other:''); post_data.append("city", city?city:''); post_data.append("username", username?username:''); post_data.append("email", email?email:''); post_data.append("mobile", mobile?mobile:''); post_data.append("code", code?code:''); post_data.append("xuqiu", xuqiu?xuqiu:''); post_data.append("xuqiu_other", xuqiu_other?xuqiu_other:''); post_data.append("chanpinjishu", chanpinjishu?chanpinjishu:''); post_data.append("chanpinjishu_other", chanpinjishu_other?chanpinjishu_other:''); post_data.append("guigexinghao", guigexinghao?guigexinghao:''); post_data.append("gongkuang", gongkuang?gongkuang:''); post_data.append("jieduan", jieduan?jieduan:''); post_data.append("xuqiunum", xuqiunum?xuqiunum:''); post_data.append("weilaixuqiunum", weilaixuqiunum?weilaixuqiunum:''); post_data.append("duijie", duijie?duijie:''); post_data.append("duijie_other", duijie_other?duijie_other:''); post_data.append("tuzhifile", $('#wjxz1').prop('files')?$('#wjxz1').prop('files')[0]:''); post_data.append("qudao", qudao?qudao:''); post_data.append("qudao_other", qudao_other?qudao_other:''); post_data.append("mess", mess?mess:''); post_data.append("downurl", downurl?downurl:''); post_data.append("pageid", pageid?pageid:''); post_data.append("location", location.href); post_data.append("act", obj.find('[name="act"]').val()); post_data.append("formhash", obj.find('[name="formhash"]').val()); $.ajax({ type: 'POST', url: '/ajax', dataType: 'json', cache: false, processData: false, contentType: false, data: post_data, error: function(){ alert('出错了!'); return false; }, success:function(json){ $('[name="formhash"]').val(json.formhash); if (json.errmsg == ''){ if (typeof callback == 'function'){ callback(); }else{ layer.alert('留言提交成功', {icon: 1}); } }else{ layer.alert(json.errmsg, {icon: 2}); } obj.find('[type="submit"]').attr('disabled',false); } }); } return false; } function sendSms(o, i){ if (o.hasClass('disabled')){return false;}else{o.addClass('disabled');} obj = o.parents('form'); var i = 0, msg = '', wcode = ''; if (i == 0){ mobile = obj.find('[name="mobile"]').val(); oname = 'mobile'; if (mobile.length <= 0){ msg += '输入您的手机号'; }else if (!CheckMobile(mobile)){ msg += '请输入正确的手机号'; } } o.show(); if (msg.length){ alert(msg); obj.find('[name="'+oname+'"]').focus(); o.removeClass('disabled'); return false; }else{ $.ajax({ type: 'POST', url: (typeof window.ajax_url==='string')?window.ajax_url:'/ajax', dataType: 'json', cache: false, data: {mobile:mobile, oname:oname, location:location.href, act:'sendsms', formhash:obj.find('[name="formhash"]').val()}, error: function(){ alert('出错了!'); return false; }, success:function(json){ $('[name="formhash"]').val(json.formhash); if (json.errmsg == ''){ obj.find('[name="code"]').focus(); if (o.is('a')){ setButtonVal(o,'s',60); }else{ window.setTimeout(function(){ o.removeClass('disabled'); },1000 * 60); } //alert(json.msg); }else{ alert(json.errmsg); o.removeClass('disabled'); } if (wcode){ //$('.getCaptcha').trigger('click'); } } }); } } function setButtonVal(obj, val, ms){ if (ms >= 1){ if (!$(obj).attr('data-title')){ var title = $(obj).html(); if (!title){ title = $(obj).val(); } $(obj).attr('data-title', title).attr('disabled',true).addClass('disabled'); } $(obj).html(ms+''+val).text(ms+''+val).val(ms+''+val); window.setTimeout(function(){ setButtonVal(obj, val,(ms-1)); },1000); }else{ $(obj).html($(obj).attr('data-title')).text($(obj).attr('data-title')).val($(obj).attr('data-title')).attr('disabled',false).removeClass('disabled'); } } function CheckMobile(m){ var reg = /^(((13[0-9]{1})|(14[0-9]{1})|(17[0-9]{1})|(15[0-3]{1})|(15[5-9]{1})|(18[0-9]{1}))+\d{8})$/; if (reg.test(m)) { return true; } return false; } function CheckEmail(m){ var reg = /^([a-z0-9+_]|\-|\.)+@(([a-z0-9_]|\-)+\.)+[a-z]{2,6}$/; if (reg.test(m)) { return true; } return false; } jQuery.fn.extend({ inputError: function(options) { return this.each(function() { new jQuery.inputError(this, options); }); } }); jQuery.inputError = function(inputobj, options) { var opt = options || {}; opt.class = opt.class || 'inputerror'; opt.err = opt.err || ''; opt.tips = opt.tips || 2; opt.tipsMore = opt.tipsMore || false; var obj = $(inputobj); if (!obj.data('placeholder')){ obj.data('data-placeholder', obj.attr('placeholder')); obj.attr('placeholder', opt.err?opt.err:obj.data('placeholder')); } obj.removeClass(opt.class).addClass(opt.class); //小tips if (opt.err) layer.tips(opt.err, obj, {tips: [opt.tips, '#dd1721'], tipsMore: opt.tipsMore}); obj.unbind('focus').focus(function(event) { $(this).removeClass(opt.class); //obj.attr('placeholder', obj.data('placeholder')); }); obj.unbind('blur').blur(function(event) { $(this).removeClass(opt.class); obj.attr('placeholder', obj.data('placeholder')); }); if (obj.get(0).tagName!='INPUT' && obj.get(0).tagName!='TEXTAREA' && !obj.data('bindClick')){ obj.click(function(event) { $(this).removeClass(opt.class); obj.attr('placeholder', obj.data('placeholder')); }); obj.children().click(function(){obj.click()}); obj.data('bindClick',true); } }; (function(window){ var defaults = { floorClass : '.scroll-floor', navClass : '.scroll-nav', activeClass : 'active', activeTop : 100, scrollTop : 100, delayTime : 200 }; var $body = $('body'),floorList = null,navList = null; function getItem(_list,newOptions){ var data = []; _list.each(function() { var item = {}; item.$obj = $body.find(this); item.$activeTop = $body.find(this).offset().top - newOptions.activeTop; item.$scrollTop = $body.find(this).offset().top + newOptions.scrollTop; data.push(item); }); return data; } function scrollActive(_list,newOptions){ var nowScrollTop = $(window).scrollTop(); var data = getItem(floorList,newOptions); $.each(data,function(i,item){ if(nowScrollTop > item.$activeTop){ _list.removeClass(newOptions.activeClass).eq(i).addClass(newOptions.activeClass); } }); } function clickActive(_index,newOptions){ var data = getItem(floorList,newOptions); $('html,body').animate({'scrollTop' : data[_index].$scrollTop},newOptions.delayTime); } var scroll_floor = window.scrollFloor = function(options){ var newOptions = $.extend({}, defaults, options); floorList = $body.find(newOptions.floorClass); navList = $body.find(newOptions.navClass); scrollActive(navList,newOptions); $(window).bind('scroll',function(){scrollActive(navList,newOptions);}); navList.bind('click',function(){ var _index = $body.find(this).index(); clickActive(_index,newOptions); }); } })(window);