window.onload=function(){ setTimeout(function(){ $('.second-show').addClass('hover'); $('.loading-box').fadeOut(500) },100) } deviceWidth() $(window).resize(function(){ deviceWidth() }) function deviceWidth(){ var deviceWidth = document.documentElement.clientWidth; if(deviceWidth<1200){ if(deviceWidth > 1200) deviceWidth = 1200; document.documentElement.style.fontSize = deviceWidth / 12 + 'px' } if(deviceWidth<750){ if(deviceWidth > 750) deviceWidth = 750; document.documentElement.style.fontSize = deviceWidth / 7.5 + 'px' } } //瀵艰埅 begin $('[data-nav="navlist"] li').each(function(index){ if($(this).find('.drop-down').length>0){ $(this).addClass('d') } }) if($(window).width()<750){ $('[data-nav="navlist"] li').each(function(index){ if($(this).find('.drop-down').length>0){ $(this).find('.a').attr('onClick','dropDown(this)') } }) }else{ $('[data-nav="navlist"] li').hover(function(){ $(this).find('.drop-down').stop().slideDown(100) },function(){ $(this).find('.drop-down').stop().slideUp(100) }) } function dropDown(e){ $(e).parent().addClass('hover'); $(e).parent().siblings().removeClass('hover'); if($(e).hasClass('on')){ $(e).removeClass('on'); $(e).parent().find(".drop-down").slideUp(500) }else{ $(e).addClass('on'); $(e).parent().find(".drop-down").slideDown(500) } } $('[data-nav="switch"]').click(function(){ if($(this).hasClass('on')){ $(this).removeClass('on'); $('.headbar_web .a').show() $('.ioc_Signin').show() $('[data-nav="navlist"]').slideUp(500) }else{ $(this).addClass('on'); $('.headbar_web .a').hide() $('.ioc_Signin').hide() $('[data-nav="navlist"]').slideDown(500) } }) $('[data-Signin="switch"]').click(function(){ if($(this).hasClass('on')){ $(this).removeClass('on'); $('.headbar_web .a').show() $('[data-nav="switch"]').show() $('[data-Signin="navlist"]').slideUp(500) }else{ $(this).addClass('on'); $('.headbar_web .a').hide() $('[data-nav="switch"]').hide() $('[data-Signin="navlist"]').slideDown(500) } }) //瀵艰埅 end $('[data-tab="box"] [data-tab="nav"] li').click(function(){ $(this).addClass('hover').siblings().removeClass('hover'); $(this).parents('[data-tab="box"]').find('[data-tab="boxdiv"] [data-tab="li"]').addClass('hide'); $(this).parents('[data-tab="box"]').find('[data-tab="boxdiv"] [data-tab="li"]').eq($(this).index()).removeClass('hide') }) function rightContact(){ $('.contact_pop').fadeIn() } function contactClose(){ $('.contact_pop').fadeOut() } function axiosErr(error_data) { if (error_data) { if (error_data.errors) { for (var i in error_data.errors) { layer.alert(error_data.errors[i].join(',')); return; } } if (error_data.msg){ for (var i in error_data.msg){ layer.alert(error_data.msg[i].join(',')); return; } } if (error_data.error) { layer.alert(error_data.error); return; } } } function ajax(type, url, param, success_fn, error_fn, complete_fn, async) { error_fn = error_fn || function (){}; complete_fn = complete_fn || function (){}; if(async !== false){ async = true; } //console.log(url,async) var ajaxTimeOut = $.ajax({ type: type, async: async, data: param, url: url, dataType: 'json', crossDomain:true, xhrFields: { withCredentials: true //榛樿鎯呭喌涓嬶紝鏍囧噯鐨勮法鍩熻姹傛槸涓嶄細鍙戦€乧ookie鐨 }, success: function (res) { success_fn(res); }, error: function (data) { var error_data = data.responseJSON; error_fn(error_data); }, complete: function (XMLHttpRequest, status) { //璇锋眰瀹屾垚鍚庢渶缁堟墽琛屽弬鏁 if (status == 'timeout') {//瓒呮椂,status杩樻湁success,error绛夊€肩殑鎯呭喌 ajaxTimeOut.abort(); //鍙栨秷璇锋眰 } complete_fn(); } }); } function ajaxPost(url, param, success_fn, error_fn, complete_fn, async){ ajax('post', url, param, success_fn, error_fn, complete_fn, async); } function ajaxGet(url, param, success_fn, error_fn, complete_fn, async){ ajax('get', url, param, success_fn, error_fn, complete_fn, async); } function ajaxPut(url, param, success_fn, error_fn, complete_fn, async){ ajax('put', url, param, success_fn, error_fn, complete_fn, async); } function ajaxDelete(url, param, success_fn, error_fn, complete_fn, async){ ajax('delete', url, param, success_fn, error_fn, complete_fn, async); } $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') } }); function strReplace(str, replace) { for (var i in replace) { str = str.replace(i, replace[i]); } return str; } //20220419鏂板姞js $('[data-history="bnt"]').click(function(){ if($(this).hasClass('open')){ $(this).removeClass('open') $(this).next('[data-history="list"]').slideUp() }else{ $(this).addClass('open') $(this).next('[data-history="list"]').slideDown() } }) $('[data-down="bnt"]').click(function(){ $(this).addClass('on') $('[data-down="box"]').show() }) $('[data-down="box"] p').click(function(){ $('[data-down="box"]').hide() $('input[name="searchDown"]').val($(this).data('down')) $('[data-down="text"]').text($(this).text()) })