function page_header_init() { $('#header').addClass('open'); $('.web_header_contain').css('height', '69px') // $('#header').css('position', 'static'); // $('.header_contain').css('position', 'static'); // $('.header_contain .bg').css('height', '100%'); } page_header_init(); $('#product_zixun').click(function() { $('#foot_Buy').click(); }); function init_product(fun) { let str = window.location.href; let id = str.substring(str.lastIndexOf('/') + 1, str.lastIndexOf('.html')) $.getJSON('/Open?api=a_product&id=' + id, function(rs) { fun && fun.call(this, rs.msg); }); } init_product(function(msg) { product_init(msg.banners); console.log(msg); if (msg.state_attr_hide == 0) { // product_attrs(msg.blocks); } else { $('#product_item_gui_ge_contain').remove(); $('#product_item_gui_ge_can_shu').remove(); $('#menu_product_item_gui_ge_can_shu').remove(); } file_list(msg.files); }); function file_list(files) { let string = ''; for (let i = 0; i < files.length; i++) { let item = files[i] let name = item.name; let url = item.url + '?' + $.now(); if (name.indexOf('浜у搧瑙勬牸涔?) != -1 || name.indexOf('浣跨敤璇存槑涔?) != -1) { url = 'https://iot.seuic.com/seuiot/'; } string += ('
' + '
' + item.name + '
' + '
' + ' ' + item.file_size + '
' + '
' + ' ' + ' 涓嬭浇' + ' ' + '
' + '
'); } $('#file_list').html(string); if (files.length != 0) { $('#product_item_zi_liao_xia_zai_body').show(); } } function product_attrs(blocks) { let str = ""; for (let i = 0; i < blocks.length; i++) { let item = blocks[i] let string = ""; for (let j = 0; j < item.attrs.length; j++) { let element = item.attrs[j] string += '
' + '
' + element.name + '
' + '
' + element.attr_Val + '
' + '
'; } if (item.attrs.length > 0) { str += '
' + '
' + item.name + '
' + '
' + '
' + '
' + string + '
' + '
' + '
' + '
'; } } $('#product_item_gui_ge_contain').html(str); } function product_init(banner_data) { console.log(banner_data); for (let i = 0; i < banner_data.length; i++) { let item = banner_data[i] if (i == 0) { $('#application_image').append(''); } let intro_in_short = item.intro_in_short intro_in_short = Base64.decode(intro_in_short); $('#product_item_banner_container').append(''); } var mySwiper = new Swiper('#product_item_banner', { loop: false, autoplay: { delay: 5000, stopOnLastSlide: false, disableOnInteraction: true, }, pagination: { el: '.swiper-pagination', type: 'bullets', }, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, on: { slideChangeTransitionEnd: function() { // let iin = this.realIndex; // let item = banner_data[iin] // let name = item.name // let intro_in_short = item.intro_in_short // intro_in_short = Base64.decode(intro_in_short); // $('#product_item_banner_title').html(name); // $('#product_item_banner_intro').html(intro_in_short); console.log(); }, } }); if (banner_data.length == 0) { $('#product_item_banner_body').remove(); } else { $('#product_item_banner').show(); } } (function() { let temp_video = document.getElementById('temp_video'); if (temp_video && temp_video.dataset.v != '') { let play_it = document.getElementById('play_it') play_it.onclick = function() { $('.temp_video_body').show(); temp_video.play(); return false; }; let video_close = document.getElementById('video_close') video_close.onclick = function() { let temp_video = document.getElementById('temp_video') temp_video.pause(); $('.temp_video_body').hide(); return false; }; $('#play_it').show(); } else { $('#play_it').remove(); $('#temp_video_body').remove(); } })(); $(document).resize(function() { resize_Handler(); }); resize_Handler() function resize_Handler() { let ww = window.innerWidth; let div_Resizes = document.getElementsByClassName('div_Resize') for (let i = 0; i < div_Resizes.length; i++) { let item = div_Resizes[i] if (ww < 768) { let src = item.dataset.h768; src = Base64.decode(src); console.log(src); src = src.replaceAll(/null/g, '') item.innerHTML = src; } else { let src = item.dataset.h; src = Base64.decode(src); src = src.replaceAll(/null/g, '') item.innerHTML = src; } } } const DIRECTION_ENUM = { DOWN: "down", UP: "up", }; // 璺濈椤堕儴鎴栧簳閮ㄧ殑闃堝€ const threshold = 50; // 璁板綍鍓嶄竴涓粴鍔ㄤ綅缃 let beforeScrollTop = 0; let direction_state = ''; function handleScroll() { // 璺濋《閮 var scrollTop = document.documentElement.scrollTop || document.body.scrollTop; // 鍙鍖洪珮搴 var clientHeight = document.documentElement.clientHeight || document.body.clientHeight; // 婊氬姩鏉℃€婚珮搴 var scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight; // 纭畾婊氬姩鏂瑰悜 let direction = DIRECTION_ENUM.DOWN; if (beforeScrollTop > scrollTop) { direction = DIRECTION_ENUM.UP; } beforeScrollTop = scrollTop; if (direction_state == direction) { return; } if ($('#header').hasClass('phone_header_menu_open')) { return; } if (scrollTop < 50) { $('.header_contain').css('top', '0px'); $('.product_mian_bao_xie').removeClass('top'); return; } // 閫氳繃婊氬姩鏂瑰悜鍒ゆ柇鏄Е搴曡繕鏄Е椤 if (direction == DIRECTION_ENUM.DOWN) { //涓嬫媺 let hhh = 0 - $('.header_contain').height(); $('.header_contain').css('top', hhh + 'px'); $('.product_mian_bao_xie').addClass('top'); } else { // 婊氬姩鍒伴《閮 $('.header_contain').css('top', '0px'); $('.product_mian_bao_xie').removeClass('top'); } direction_state = direction; let temp_video = document.getElementById('temp_video'); temp_video.pause(); $('.temp_video_body').hide(); } function getElementToPageTop(dom, distance) { distance = distance || 0 if (dom.offsetParent == null) { distance += dom.offsetTop return distance } else if (['BODY', null].includes(dom.offsetParent.nodeName)) { distance += dom.offsetTop return distance } else { distance += dom.offsetTop return getElementToPageTop(dom.offsetParent, distance) } } // 婊氬姩鑺傛祦 function scroll() { handleScroll(); } document.addEventListener('scroll', function() { scroll && scroll.call(this) }); // scroll && scroll.call(this) $('.product_menu a').click(function() { let tid = this.dataset.tid let to_dom = document.getElementById(tid); var scroll_offset = $('#' + tid).offset().top - 80; //寰楀埌box杩欎釜div灞傜殑offset锛屽寘鍚袱涓€硷紝top鍜宭eft $("body,html").stop().animate({ scrollTop: [scroll_offset, 'linear'] //璁゜ody鐨剆crollTop绛変簬pos鐨則op锛屽氨瀹炵幇浜嗘粴鍔 }, 100) });