window._isMobile = navigator.userAgent.match( /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i )?true:false; $(function () { if(typeof(AOS)!=="undefined"){ AOS.init();//婊氬姩鍔ㄧ敾 } $(window).scroll(function(){ var top = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop; if (top > 100) { $(".header").addClass("headerBg"); } else { $(".header").removeClass("headerBg"); } }) //棣栭〉PC鐗堢殑鑿滃崟鍒囨崲 var searchStatus = localStorage.getItem('searchsta') if(!searchStatus || searchStatus == 1) { $(".header .nav-right .search .search-box").css('display','flex') }else { $(".header .nav-right .search .search-box").hide() } // $(".header .nav-right .search .search-box").hide(); $(".header .nav-right .search .search-box .close").click(function () { //鍏抽棴鐨勬椂鍊欒缃悳绱㈡鐘舵€ 2涓哄叧闂紝1鎴栦笉瀛樺湪涓哄睍寮€ localStorage.setItem('searchsta',2) //鍒ゆ柇涓€涓媔nput鏈夋病鏈夊唴瀹癸紝鏈夊氨鎼滅储 var input = $(".header .nav-right .search .search-box input").val(); /* if(input){ location.href="search.html?search="+input; } */ $(".header .nav-right .search .search-box").hide(200); return false; }); $(".header .nav-right .search").click(function () { //灞曞紑鐨勬椂鍊欒缃悳绱㈡鐘舵€ localStorage.setItem('searchsta',1) // $(".header .nav-right .search .search-box").show(200); $(".header .nav-right .search .search-box").css('display','flex') return false; }); $(".header .nav-left .nav > li.down").hover(function () { $(".header").addClass("headerBg"); $(this).addClass("hover").stop(100); // $("html").addClass("fixed"); }, function () { $(this).removeClass("hover").stop(100); // $("html").removeClass("fixed"); }); //棣栭〉鎵嬫満鐗堢殑鑿滃崟鍒囨崲 $(".header_mobile h3 .absolute").click(function(){ $(".header_mobile").toggleClass("open"); $("body").toggleClass("fixed") }) $(".header_mobile li.close").click(function(){ $(this).toggleClass("close") }); $(".header_mobile dt ul").click(function(){ if($(this).hasClass("single")){ $(".header_mobile").removeClass("open"); $("body").removeClass("fixed"); }else{ var index = $(this).index(); $(this).addClass("on").siblings().removeClass("on") $(".header_mobile dd ul").eq(index).addClass("on") .siblings().removeClass("on"); } }) //渚ц竟鎸夐挳灞曠ず $(".right-slide .item.more").click(function(){ $(this).parent().toggleClass("more") }); //閿氶摼鎺ョ殑鐐瑰嚮鏁堟灉 // $(".header_bg ~ .menu_bar.more > a").click(function(){ // var that = this; setTimeout(function(){ // $(that).addClass("on").siblings().removeClass("on"); },100) // }) //鍥剧墖鐐瑰嚮鏀惧ぇ if(typeof(Lightense)!=="undefined"){ var el = document.querySelectorAll('img.lightense'); if(el && el.length>0){ Lightense(el); } } // $(".product_body .header_bg~.menu_bar a").click(function(){ // $(this).addClass("on").siblings().removeClass("on") // }) }); function freeUse(){ $('.free_use.fixed').css('display','flex'); } function indexFreeUse(event){ event.stopPropagation(); $('.free_use.fixed').css('display','flex'); } function lookDetail(event,url) { event.stopPropagation() window.location.href = url } //鑾峰彇甯 $("#province_id").change(function() { province_id = $(this).val() if (!province_id) { return ; } var url = "/index.php?m=Home&c=Currency&a=getregion"; $.ajax({ type : "GET", url : url, data:{id:province_id,type_id:1}, dataType:'json', success: function(v) { if(v.errcode == 1){ var html =' '; if(v.data){ $.each(v.data,function (i,v) { html += ''; }); } $('#city_id').html(html); $('#city_id').show(); } },error: function(request) { alert("鏈嶅姟鍣ㄧ箒蹇? 璇疯仈绯荤鐞嗗憳!"); }, }); }); $(function () { /*if (self !== top) { top.location.href = self.location.href; }*/ if($.cookie('user_id') != null){ $(".no-login").addClass('hide'); $(".html-area").addClass('fixedHide'); $(".in-login").removeClass("hide"); }else{ $(".no-login").removeClass('hide'); $(".html-area").removeClass('fixedHide'); $(".in-login").addClass("hide"); } $("#getCode").click(function(){ getsmsCode(); }) // 鍙戦€佹墜鏈虹煭淇 function getsmsCode(){ var mobile = $('#free_form input[name="mobile"]').val(); var tipsok = {title:'娓╅Θ鎻愮ず',closeBtn:0,icon:1}; var tipserr = {title:'娓╅Θ鎻愮ず',closeBtn:0,icon:2}; if(mobile==''){ layer.msg('璇峰厛杈撳叆鎵嬫満鍙风爜'); return false; } if(!checkMobile(mobile)){ layer.msg('璇疯緭鍏ユ纭殑鎵嬫満鍙风爜'); return false; } var url = "/index.php?m=Home&c=Currency&a=sendsms&scene=2&typeid=1&mobile=" + mobile; $('#getCode').attr("disabled", "disabled").html("楠岃瘉鐮佸彂閫佷腑"); $.ajax({ url:url, dataType: "json", success: function(res){ if (res.errcode == 1) { $('#getCode').attr("disabled", "disabled"); intAs = 60; // 鎵嬫満鐭俊瓒呮椂鏃堕棿 jsInnerTimeout('getCode', intAs); layer.alert(res.message, tipsok); } else { layer.alert(res.message, tipserr); $('#getCode').removeAttr("disabled").html("鑾峰彇楠岃瘉鐮?); } } }); } $('#getCode').removeAttr("disabled"); //鍊掕鏃跺嚱鏁 function jsInnerTimeout(id,intAs){ var codeObj=$("#"+id); intAs--; if(intAs<=-1){ codeObj.removeAttr("disabled"); codeObj.text("鍙戦€侀獙璇佺爜"); return true; } codeObj.text(intAs+'绉掑悗閲嶆柊鍙戦€?); setTimeout("jsInnerTimeout('"+id+"',"+intAs+")",1000); } function checkMobile(tel) { var reg = /1[3456789]\d{9}$/; if (reg.test(tel)) { return true; }else{ return false; }; } $("#free_form input[name='agreement']").click(function () { if ($(this).hasClass("checked")) { $(this).removeClass("checked"); $('#free_form input[name=agreement]').val(0); } else { $(this).addClass("checked"); $('#free_form input[name=agreement]').val(1); } }); $("#freeformsubmit").click(function () { free_form(); }) function free_form() { var demand = true; var realname = true; var company = true; var email = true; var mobile = true; var code = true; var agreement = true; /*if ($('#free_form input[name=demand]').val() == '') { layer.msg('鎮ㄧ殑闇€姹備笉鑳戒负绌?); $('#free_form input[name=demand]').focus(); demand = false; return false; }*/ if ($('#free_form input[name=realname]').val() == '') { layer.msg('绉板懠涓嶈兘涓虹┖'); $('#free_form input[name=realname]').focus(); realname = false; return false; } if ($('#free_form input[name=company]').val() == '') { layer.msg('鍗曚綅鍚嶇О涓嶈兘涓虹┖'); $('#free_form input[name=company]').focus(); company = false; return false; } if ($('#free_form input[name=email]').val() == '') { layer.msg('閭涓嶈兘涓虹┖'); $('#free_form input[name=email]').focus(); email = false; return false; } if ($('#free_form input[name=mobile]').val() == '') { layer.msg('鎵嬫満鍙蜂笉鑳戒负绌?); $('#free_form input[name=mobile]').focus(); mobile = false; return false; } if ($('#free_form input[name=code]').val() == '') { layer.msg('楠岃瘉鐮佷笉鑳戒负绌?); $('#free_form input[name=code]').focus(); code = false; return false; } if ($('#free_form input[name=agreement]').val() == 0) { layer.msg('璇锋湰浜虹煡鎮夊苟鍚屾剰璐靛崟浣嶉€氳繃涓婅堪鎵€鎻愪氦鐨勪俊鎭笌鏈汉鑱旂郴鎴栨帹閫佺浉鍏宠祫璁€?); agreement = false; return false; } var loading = layer.msg('鎻愪氦涓紝璇风◢鍚?..', { icon: 16, offset: '300px', shade: 0.2,time:300000 }); if (demand && realname && company && email && mobile && code) { $.ajax({ //async: false, url: "/index.php?m=Home&c=Cooperate&a=freesubmit", data: $("#free_form").serialize(), type: 'post', dataType: 'json', success: function (res) { layer.close(loading); if (res.errcode != 1) { layer.msg(res.message); //demand = false; realname = false; company = false; email = false; mobile = false; code = false; return false; } else { layer.msg(res.message, { icon: 1 }); setTimeout(function () { location.reload(); }, 1000); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { layer.msg('缃戠粶澶辫触锛岃鍒锋柊椤甸潰鍚庨噸璇?'); } }); } else { return false; } } var hrefList = []; var dom; setTimeout(function(){ if($("body").hasClass("product_body")){ dom = $(".product_body .header_bg~.menu_bar a"); }else if($("body").hasClass("about_us")){ dom = $(".about_us .header_bg~.menu_bar a"); } if(dom){ dom.each(function(){ var href = $(this).attr("href"); hrefList.push({ id:href,top:$(href).offset().top,eq:$(this).index(),height:$(href).height() }); }); } for(let i =0 ; i < hrefList.length; i++) { dom[i].addEventListener('click',function() { for(let j = 0; j < hrefList.length; j++) { dom[j].classList.remove('on') } this.classList.add('on') }) } listenScrol(); },700); var listenScrolTime; function listenScrol(){ if(listenScrolTime){ clearTimeout(listenScrolTime); } if(hrefList.length>0){ listenScrolTime = setTimeout(function(){ listenScrol(); },50); } var top = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop; var scrollTop; if (typeof window.pageYOffset != 'undefined') { scrollTop = window.pageYOffset; } else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') { scrollTop = document.documentElement.scrollTop; } else if (typeof document.body != 'undefined') { scrollTop = document.body.scrollTop; } //鐩戝惉婊氬姩鏍囬鏀瑰彉 for(var i=0;i0?hrefList[i].height-160:160)); var maxTop = (top + ((hrefList[i].height-160)>0?hrefList[i].height+160:160)); if(scrollTop > top && scrollTop < maxTop){ var item = dom.eq(eq); item.addClass("on").siblings().removeClass("on"); // if(_isMobile){ // var left = (eq)*70; // $("body .header_bg~.menu_bar.more").scrollLeft(left); // } } } }; }); function Login(){ //$('.fixed.login_alert').css('display','flex'); layer.open({ type: 2, title: false, closeBtn: 1, shadeClose: true, area: [_isMobile?'100vw':'1010px', _isMobile?'100vh':'580px'], anim: 2, content: ['/index.php/User/login', 'no'], }); //fleshVerify2(); } //閫€鍑 function logout(){ $.cookie('user_id',null , {expires: 1 ,path:'/'}); window.location.href = "/index.php?m=Home&c=User&a=logout"; } $("#search-box").click(function(){ $("#search-box-form").submit(); })