// JavaScript Document //jg script //Author 锛 sin鏄 /* function AddFavorite(url,title) { var url = url?url:window.location; var title = title?title:document.title; var ua = navigator.userAgent.toLowerCase(); if (ua.indexOf("msie 8") > -1) { external.AddToFavoritesBar(url, title, '');//IE8 } else { try { window.external.addFavorite(url, title); } catch (e) { try { window.sidebar.addPanel(title, url, "");//firefox } catch (e) { alert("鍔犲叆鏀惰棌澶辫触锛岃浣跨敤Ctrl+D杩涜娣诲姞"); } } } } */ //鍒涘缓鏄剧ず鏍囩 function label_create(obj,text,labelClass){ labelClass = labelClass||'normal_label'; obj.append("").find("."+labelClass+"").html(text); } //椤堕儴鎼滅储 function headerNavDrop(){ //瀵艰埅鎿嶄綔 $('.header1 ._nav li').each(function(){ var _this = $(this),navIndex = $(this).index(); if($("._navDrop li.g1").eq(navIndex).length>0){ _this.hover(function(){ $("._navDrop li.g1").eq(navIndex).slideToggle(100); },function(){ if($("._navDrop li.g1").eq(navIndex).is(":hover")){ }else{ $("._navDrop li.g1").eq(navIndex).slideToggle(100); } }) } }) //涓嬫媺鍖哄煙鎿嶄綔 $("._navDrop li.g1").each(function(){ var _this = $(this),dropIndex = $(this).index(); _this.hover(function(){ _this.css('display','block'); $('.header1 ._nav li').eq(dropIndex).addClass('hover'); },function(){ _this.slideToggle(100); $('.header1 ._nav li').eq(dropIndex).removeClass('hover'); }) }) } //琛ㄦ牸鎻愪氦 function formSend(){ if($(".formSubmit").length>0){ /* //楠岃瘉鐮 var show_num = []; draw(show_num); $("#canvas").on('click',function(){ draw(show_num); }) */ //鎻愪氦鎸夐挳 $('.formSubmit').click(function(){ var verifyArray = new Array(),_form = $(this).parents('._form'); _form.find(".formInputTarget input,.formInputTarget textarea").each(function(){ var _this=$(this), _val = $(this).val(), inputParent = $(this).parent(), inputIndex = inputParent.index(); var input_empty_text = _this.data("empty"), input_warn_text = _this.data("warn"), normal_label = _this.parent().find("label.normal_label"); //console.log(inputIndex+":"+_val); //蹇呭~閫夐」妫€娴 if(inputParent.hasClass('need')){ //绌洪€夐」澶勭悊 if(_val.length==0&&_this.data('empty')!=''){ normal_label.remove(); label_create(inputParent,input_empty_text,'empty_label'); verifyArray[inputIndex] = false; }else{ //闈炵┖閫夐」澶勭悊 switch(true){ //鏂囨湰寮傚父瀛楃妫€娴 case(inputParent.hasClass('textTest')): if(pattern2.test(_val)){ normal_label.remove(); label_create(inputParent,input_warn_text,'warn_label'); _this.animate({'opacity':0},500); verifyArray[inputIndex] = false; }else{ verifyArray[inputIndex] = true; } break; //鐢佃瘽鍙风爜妫€娴 case(inputParent.hasClass('phoneTest')): if(phone_regexp.test(_val)){ verifyArray[inputIndex] = true; }else{ normal_label.remove(); label_create(inputParent,input_warn_text,'warn_label'); _this.animate({'opacity':0},500); verifyArray[inputIndex] = false; } break; //閭妫€娴 case(inputParent.hasClass('emailTest')): if(email_regexp.test(_val)){ verifyArray[inputIndex] = true; }else{ normal_label.remove(); label_create(inputParent,input_warn_text,'warn_label'); _this.animate({'opacity':0},500); verifyArray[inputIndex] = false; } break; } } }else{ //妫€娴嬮」 switch(true){ //鏂囨湰寮傚父瀛楃妫€娴 case(inputParent.hasClass('textTest')): if(pattern2.test(_val)){ normal_label.remove(); label_create(inputParent,input_warn_text,'warn_label'); _this.animate({'opacity':0},500); verifyArray[inputIndex] = false; }else{ verifyArray[inputIndex] = true; } break; } } }) //鏁版嵁楠岃瘉 var verifyResult = true,verifyArrayLength = verifyArray.length; for(n=0;n0){ var pc2mb = 1200; $(".level2 ._scroll").slide({ titCell:'.hd ul li', mainCell:'.bd ul', prevCell:".l2Prev", nextCell:".l2Next", effect:"left", }) $(".level3 ._scroll").slide({ //titCell:".hd ul", mainCell:".bd ul", delayTime:100, vis:($(window).width()>pc2mb?6:1), scroll:(1), effect:"left", autoPage:true, prevCell:".l3Prev",nextCell:".l3Next",pnLoop:false }) } } //澶撮儴璇█鍒囨崲 function langChange(){ var _slideMenu = $(".langChange ._slideMenu"), langMenu = $(".langChange ul"), langItem = $(".langChange .langItem"); _slideMenu.click(function(){ langMenu.slideToggle(500); }) langItem.each(function(){ $(this).click(function(){ $.cookie('Language',langItem.data("id"),{path:"/"}); $.cookie('LanguageUrl',langItem.data("url"),{path:"/"}); window.location.reload(); }) }) } //浜у搧tab function proPageTab(){ $(".pageContent ._proNav").slide({ titCell:'.hd li', mainCell:'.bd .container', defaultPlay:false }); } //浜у搧璇︽儏 /* function pro_show(){ if($("._proItemImgList").length>0){ var pc2mb = 1200; //鍒嗛潰鍒囨崲 jQuery("._proItemImgList").slide({ titCell:".smallImg li", mainCell:".bigImg", effect:"fold", autoPlay:true,delayTime:200, startFun:function(i,p){ if(i==0){ jQuery("._proItemImgList .sPrev").click() } else if( i%($(window).width()>pc2mb?4:2)==0 ){ jQuery("._proItemImgList .sNext").click()} } }); jQuery("._proItemImgList .smallScroll").slide({ mainCell:"ul", delayTime:100, vis:($(window).width()>pc2mb?4:2), scroll:($(window).width()>pc2mb?4:2), effect:"left",autoPage:true,prevCell:".sPrev",nextCell:".sNext",pnLoop:false }); } } */ function pro_show(){ if($(".proItem ._dImg").length>0){ $(".proItem ._dImg").slide({mainCell:".bd ul",effect:"left",autoPlay:true}) } } //鍏徃婊氬姩 function companySlide(){ var pc2mb = 1200; if($(".company").length>0){ $(".level3 ._scroll").slide({ titCell:".hd ul", mainCell:".bd ul", delayTime:100, vis:($(window).width()>pc2mb?4:2), scroll:(1), effect:"leftLoop",autoPlay:true,interTime:3000,prevCell:".Prev",nextCell:".Next",pnLoop:true }) } } //棣栭〉banner function index_banner(){ var win_width = $(window).width(); function swiper_banner(obj){ var swiper = new Swiper(obj,{ pagination: { el: '.swiper-pagination', clickable :true, }, }); } function pc_banner_superslide(obj){ obj.slide({mainCell:".bd",titleCell:".hd",interTime:3000,delayTime:1000, effect:"fold",autoPlay:true}); } if($("#index_banner").length>0){ if($(".pc_banner").css("display")=='block'&&win_width>1200){ pc_banner_superslide($("#index_banner.pc_banner")); } if($(".mb_banner").css("display")=='block'&&win_width<1200){ swiper_banner($("#index_banner.mb_banner")); } } $(window).unbind('resize').resize(function(){ if($("#index_banner").length>0){ index_banner(); } }) } function videoPlay(){ if($(".videoList").length>0){ $(".videoLiteBox").each(function(){ var _this = $(this); _this.liteBox({ callbackBeforeOpen: function(){ //console.log(_this.data('video')); $("#videoPlayBox").html('').append(_this.data('video')); }, callbackAfterOpen: function(){ $(".litebox-container").addClass('litexbox-video'); //$(".litexbox-video .videoPlayBox").show(); }, }) }) } } function join_slide(){ if($(window).width()>=1200){ swiper_3dSlider('#certify .swiper-container'); }else{ var swiper = new Swiper('#certify .swiper-container',{ autoplay:true, pagination: { el: '.swiper-pagination', clickable :true, }, }); } } function mobi_nav(){ //鑿滃崟鎵撳紑涓庡叧闂 $(".mobi_menu").click(function(){ if(!$(".content_block").attr("style")){ $(".content_block").css({"position":'fixed','height':'100%'}).animate({"left":'50%'},300,function(){ $(".mobi_nav").css({"padding-top":$(".mb_header .header1").outerHeight(true),"padding-bottom":$(".fix_footer_link").outerHeight(true),'z-index':99}).fadeIn(500); }); }else{ $(".mobi_nav").fadeOut(300); $(".content_block").animate({"left":0},300,function(){ $(".content_block").removeAttr('style'); }); } }); //涓€绾ц彍鍗曟敹鏀 $(".mobi_nav ._g1").each(function(){ var _this = $(this), _thisA = _this.find("._g1A"), _thisG2 = _this.find(".g2"), other_g1 = $(this).siblings(); _thisA.click(function(){ //console.log(_this.index()); _thisA.addClass("on"); _thisA.find("b").removeClass("fa-plus").addClass("fa-minus"); _thisG2.slideToggle(500); other_g1.find("._g1A").removeClass('on'); other_g1.find("._g1A").find("b").removeClass("fa-minus").addClass("fa-plus"); other_g1.find(".g2").each(function(){ if($(this).css("display")=='block'){ $(this).slideToggle(500); } }) }) }) } //鐢ㄩ噺璁$畻鍣 function calc_ProSelect(series,proItem,sizes){ if($('.calculatorForm').length>0){ //console.log("鐪佷唤锛?+province+"鍩庡競锛?+city); var cityRes = {"listType":"seriesRes",'pId':'0',"list_order":"asc"}, cityList = ajax_request('list_require.php',cityRes,"POST",'json'); //瑁呭~鏁版嵁 function data_fill(target,el,selected_id){ //console.log(el); //console.log(selected_id); if(el){ index = 1; selectIndex = ""; $.each(el,function(k,v){ v_name = v.name?v.name:v; option = ""; target.append(option); if(k == selected_id){ selected_index = index; } //console.log(selectIndex); index++; }) } target.select2("val","") } var title = ['浜у搧绯诲垪' , '浜у搧鍚嶇О' , '浜у搧瑙勬牸']; $.each(title , function(k , v) { title[k] = ''; }) $('#calc_series').append(title[0]); $('#calc_proItem').append(title[1]); $('#calc_size').append(title[2]); $('#calc_series').change(function(){ //console.log($('#loc_province').val()); $('#calc_proItem').empty().append(title[1]).select2(); $('#calc_size').empty().append(title[2]).select2(); if($('#calc_series').val()!=''){ var proItemRes = {"pId":$('#calc_series').val(),"listType":"proItemRes","list_order":"asc"} var zoneList = ajax_request('list_require.php',proItemRes,"POST",'json'); data_fill($('#calc_proItem'),zoneList); } $('#calc_proItem').change(); }) $('#calc_proItem').change(function(){ //console.log($('#calc_series').val().length); if($('#calc_proItem').length>0){ $('#calc_size').empty().append(title[2]).select2(); if($('#calc_proItem').val()!=''){ var sizeRes = {"pId":$('#calc_proItem').val(),"listType":"sizeRes","list_order":"asc"} var stressList = ajax_request('list_require.php',sizeRes,"POST",'json'); data_fill($('#calc_size'),stressList); } $('#calc_size').change(); } }) $('#calc_size').change(function(){ if($('#calc_size').val()!=''){ var sizeFind = {"listType":"sizeFind",'id':$('#calc_proItem').val(),'size':$('#calc_size').val(),"list_order":"asc"}, sizeInfor = ajax_request('list_require.php',sizeFind,"POST",'json'); //console.log(sizeInfor); $('.dataInput').attr({ 'data-weight':sizeInfor.weight, 'data-danwei':sizeInfor.danwei, 'data-package':sizeInfor.package, }); }else{ $('.dataInput').attr({ 'data-weight':'', 'data-danwei':'', 'data-package':'', }); } }) /* if($('#loc_district').length>0){ $('#loc_district').change(function(){ $('input[name=location_id]').val($(this).val()); })} */ if (series) { data_fill($('#calc_series'),cityList,series); $('#calc_series').select2(); if(proItem){ data_fill($('#calc_proItem'),zoneList[$('#calc_proItem').val()].zoneList,proItem); if(sizes){ data_fill($('#calc_size'),cityList[$('#calc_series').val()].zoneList[$('#calc_proItem').val()].stressList,sizes); } } } else { data_fill($('#calc_series'),cityList); if($("#calc_series").length>0){ $("#calc_series,#calc_proItem,#calc_size").select2(); }else{ $("#calc_series,#calc_proItem").select2(); } } } } function calcBeizhu(){ if($('.calculatorForm').length>0){ $('#calc_series').change(function(){ //console.log($('#calc_series').val().length); if($('#calc_series').val()!=''){ var seriesFind = {"listType":"seriesFind",'id':$('#calc_series').val(),"list_order":"asc"}, seriesIntro = ajax_request('list_require.php',seriesFind,"POST",'json'); $('.calculator ._beizhu b').html(seriesIntro.intro); if($('.calculator ._beizhu').css('display')=='none'){ $('.calculator ._beizhu').fadeIn(500); } }else{ $('.calculator ._beizhu').fadeOut(500); } }) $('#calc_series,#calc_proItem,#calc_size').change(function(){ $('._errorMsg,._calResult').fadeOut(500); }) } } function calcInputTemplate(){ if($('.calculatorForm').length>0){ $('#calc_series').change(function(){ var inputTemplate = ''; $('.calculatorForm .dataInput').html(''); switch($('#calc_series').val()){ case('1'): inputTemplate += "

娑傛枡闈㈢Н

娑傚埛鍘氬害

"; break; case('2'): inputTemplate += "

榛忚创闈㈢Н

璐村眰鍘氬害

"; break; case('3'): inputTemplate += "

鐮栭暱

"; inputTemplate += "

鐮栧

"; inputTemplate += "

缂濇繁

"; inputTemplate += "

缂濆

"; inputTemplate += "

鍏ㄥ眿闈㈢Н

0){ if($(window).width()<1200){ var selectorWidth = $('.tdSelect').width(); $(".tdSelect .select2-container").each(function(){ $(this).width(selectorWidth); }) }else{ $(".tdSelect .select2-container").each(function(){ $(this).removeAttr('style'); }) } $('#calc_series,#calc_proItem,#calc_size').change(function(){ mobiCalc(); }) $(window).unbind('resize').resize(function(){ mobiCalc(); }) } } function calculator(){ if($('.calculatorForm').length>0){ calc_ProSelect(); calcBeizhu(); calcInputTemplate(); mobiCalc(); $("._calBtn._start").click(function(){ if($('#calc_size').val()!=''){ var calcResult = calcPrograss(),calHtml = ''; var showSize = { 'weight':$('.dataInput').attr('data-weight'), 'danwei':$('.dataInput').attr('data-danwei'), 'package':$('.dataInput').attr('data-package'), }; var standard_size = $('.dataInput').attr('data-weight')+$('.dataInput').attr('data-danwei')+'/'+$('.dataInput').attr('data-package'); switch($('#calc_series').val()){ case('1'): calHtml += calcResult.minWeight+showSize.danwei; calHtml += '    '+'
'; calHtml += '绾︿负'+calcResult.minPackage+showSize.package+"("+standard_size+")"; break; case('2'): calHtml += calcResult.Weight+showSize.danwei; calHtml += '    '+'
'; calHtml += '绾︿负'+calcResult.Package+showSize.package+"("+standard_size+")"; break; case('3'): calHtml += calcResult.Weight+showSize.danwei; calHtml += '    '+'
'; calHtml += '绾︿负'+calcResult.Package+showSize.package+"("+standard_size+")"; break; case('4'): calHtml += '绾︿负'+calcResult.Package+showSize.package+"("+standard_size+")"; break; case('5'): calHtml += '娑傝啘:绾︿负'+calcResult.Package+showSize.package; calHtml += '
鎷夋瘺:绾︿负'+calcResult.Package2+showSize.package+"("+standard_size+")"; break; case('6'): calHtml += '绾︿负'+calcResult.Package+showSize.package+"("+standard_size+")"; break; case('7'): calHtml += '绾︿负'+calcResult.Package+showSize.package+"("+standard_size+")"; break; case('8'): calHtml += '绾︿负'+calcResult.Package+showSize.package+"("+standard_size+")"; } //console.log(calHtml); $('._calResult b i').html('').html(calHtml); $('._calResult').fadeIn(500).css('display','flex'); }else{ $('._calResult').fadeOut(500); $('._errorMsg').fadeIn(500); } }) $("._calBtn._reset").click(function(){ window.location.reload(); }) } } $(function(){ litebox_load(); headerNavDrop(); formSend(); index_slide(); proPageTab(); pro_show(); companySlide(); index_banner(); langChange(); videoPlay(); join_slide(); mobi_nav(); calculator(); //mobi_scale(); }) $(window).load(function(){ })