//澶撮儴鑿滃崟鏍廕S var news_swiper1 = 0, news_swiper2 = 0, news_swiper3 = 0, news_swiper4 = 0, news_swiper5 = 0, news_swiper6 = 0; var myswiper1,myswiper2,myswiper3,myswiper4,myswiper5,myswiper6; $('.right_img_toc').empty(); $('.right_img').empty(); newHeadjs.getJSON(`/headnews.json?t=${Date.now()}`, function (data) { getNewsChild(data.toc_news,'geren','new_toc_box_c_swiper'); getNewsChild(data.tob_news,'bangong','new_tob_box_c_swiper'); getNewsChild(data.csr_news,'csr','new_csr_box_c_swiper'); getNewsChild(data.about_news,'about','new_about_box_c_swiper'); getNewsChild(data.purchase_news,'purchase','new_purchase_box_c_swiper',); getNewsChild(data.supports_news,'supports'); getNewsChild(data.video_banner,'video'); getNewsChilds(data.toc_banner,'toc_banner','new_toc_box','banner_sp_toc'); getNewsChilds(data.tob_banner,'tob_banner','new_tob_box','banner_sp_tob'); }); var clickEvent = (function () { if ('ontouchstart' in document.documentElement === true) return 'touchstart'; else return 'click'; })(); var Button_fw = document.querySelector("#nav4>h2>a"); Button_fw.addEventListener(clickEvent, function () { if (clickEvent == 'click') { window.location.href = '/supports/service.html'; } }); var Button_gr = document.querySelector("#nav1>h2>a"); Button_gr.addEventListener(clickEvent, function () { if (clickEvent == 'click') { window.location.href = '/overview/toc.html'; } }); var Button_bg = document.querySelector("#nav2>h2>a"); Button_bg.addEventListener(clickEvent, function () { if (clickEvent == 'click') { window.location.href = '/overview/tob.html'; } }); var Button_csr = document.querySelector("#nav25>h2>a"); Button_csr.addEventListener(clickEvent, function () { if (clickEvent == 'click') { window.location.href = '/csr/'; } }); var Button_about = document.querySelector("#nav5>h2>a"); Button_about.addEventListener(clickEvent, function () { if (clickEvent == 'click') { window.location.href = '/about/'; } }); var Button_video = document.querySelector("#nav6>h2>a"); Button_video.addEventListener(clickEvent, function () { if (clickEvent == 'click') { window.location.href = '/video/'; } }); var Button_purchase = document.querySelector("#nav7>h2>a"); Button_purchase.addEventListener(clickEvent, function () { if (clickEvent == 'click') { window.location.href = '/purchase/guide.html'; } }); var Button_zzfw = document.querySelector(".new_supports_head_contents_cc1>h3>a[data-text=zzfwtitle]"); Button_zzfw.addEventListener(clickEvent, function () { if (clickEvent == 'click') { window.location.href = '/supports/servicemenu/imageinformation.html'; } }); var Button_all = document.querySelectorAll(".new_supports_box .new_supports_head_ul li"); for (var i = 0; i < Button_all.length; i++) { urlClick(Button_all[i], clickEvent); }; $(".new_supports_box .new_supports_head_ul li").click(function (event) { let target = event.currentTarget; var flag = urlClick(target, clickEvent); }); function urlClick(Button_all, clickEvent) { Button_all.addEventListener(clickEvent, function (e) { if (clickEvent == 'click') { var link = e.srcElement.getAttribute("data-text"); if (link == 'newsall') { window.location.href = '/supports/announce/index.html'; } if (link == 'cpxg') { window.location.href = '/supports/announce/products/'; } if (link == 'scxg') { window.location.href = '/supports/announce/marketing/'; } if (link == 'fjlstz') { window.location.href = '/supports/announce/temporary/'; } if (link == 'aqxg') { window.location.href = '/supports/announce/security/'; } if (link == 'xxxfl') { window.location.href = '/supports/servicemenu/index.html'; } if (link == 'yxxx') { window.location.href = '/supports/servicemenu/imageinformation.html'; } if (link == 'xxswlbg') { window.location.href = '/supports/servicemenu/lsetup.html'; } if (link == 'dxswlbg') { window.location.href = '/supports/servicemenu/lbimagerunnerrent.html'; } if (link == 'zydy') { window.location.href = '/supports/servicemenu/professionalproducts.html'; } } }, false); } function getNewsChild(data,flag,element){ var news_contents = ''; if(flag == 'supports'){ var cpxg_html = creatSupportsNews(data[0]['cpxg']); var scxg_html = creatSupportsNews(data[0]['scxg']); var fjlstz_html = creatSupportsNews(data[0]['fjlstz']); var aqxg_html = creatSupportsNews(data[0]['aqxg']); var newsall_html = creatSupportsNews(data[0]['newsall']); $(".cpxg").append(cpxg_html); $(".scxg").append(scxg_html); $(".fjlstz").append(fjlstz_html); $(".aqxg").append(aqxg_html); $(".newsall").append(newsall_html); }else if(flag == 'video'){ if($(".new_video_box_banner_mini").length > 0){ var video_html = ` play icon `; $(".new_video_box_banner_mini").append(video_html); } if($(".new_video_box_banner").length > 0){ var video_html = ` play icon `; $(".new_video_box_banner").append(video_html); } } else { for (var i = 0; i < 3; i++) { news_contents = `

${data[i]['title']}

`; $(`.${element} .swiper-slide`).eq(i).append(news_contents); } } } function getNewsChilds(data,flag,element,element2){ var news_contents = ''; var news_contents2 = ''; for (var i=0;i

${data[i]['lab']}

鍙冲浘${i+1}

浜嗚В鏇村

`; news_contents2 = `
  • ${data[i]['lab']}

    鍙冲浘${i+1}

    浜嗚В鏇村

  • `; if (flag == 'toc_banner') { $(`.${element} .right_img_toc `).append(news_contents); } else { $(`.${element} .right_img `).append(news_contents); } $(`#${element2} `).append(news_contents2); } } function creatSupportsNews(data){ var html= ''; for (var i = 0; i < 3; i++) { html += `
    ${data[i]['date']}
    ${data[i]['type']}

    ${data[i]['title']}

    `; } return html; } function newsswiper(flag,classname) { if (flag == 'geren' && news_swiper1 == 0) { news_swiper1++; } if (flag == 'bangong' && news_swiper2 == 0) { news_swiper2++; } if (flag == 'csr' && news_swiper3 == 0) { news_swiper3++; } if (flag == 'about' && news_swiper4 == 0) { news_swiper4++; } if (flag == 'purchase' && news_swiper5 == 0) { news_swiper5++; } if (flag == 'btob' && news_swiper6 == 0) { news_swiper6++; } var obj = new Swiper(`.${classname}`, { loop: true, autoHeight: true, autoplay: { delay: 3000, disableOnInteraction: false }, pagination: { el: '.swiper-pagination91', clickable: true, }, }); return obj; } $(window).scroll(function () { if ($(window).scrollTop() > 0) { $(".new_supports_box,.new_toc_box,.new_tob_box,.new_csr_box,.new_about_box,.new_video_box,.new_purchase_box,.new_btob_box").addClass("head_scroll"); } else { $(".new_supports_box,.new_toc_box,.new_tob_box,.new_csr_box,.new_about_box,.new_video_box,.new_purchase_box,.new_btob_box").removeClass("head_scroll"); } }); $(window).resize(function () { if ($(window).width() > 975) { var height_f = $(".headpc").height() + $(".head2").height(); $(".new_supports_box,.new_toc_box,.new_tob_box,.new_csr_box,.new_about_box,.new_video_box,.new_purchase_box,.new_btob_box").css("top", height_f); $(".new_head_bg").css("top", height_f); } }); $(document).ready(function () { $(".new_head_sp_click").click(function () { if ($(this).hasClass("sp_menu_flag")) { $(this).find(".new_head_sp_show").removeClass("active"); $(this).removeClass("sp_menu_flag"); $(this).siblings(".new_head_sp_secend").slideUp('slow'); } else { $(".new_head_sp_show").removeClass("active"); $(this).find(".new_head_sp_show").addClass("active"); $(".new_head_sp_click").removeClass("sp_menu_flag"); $(this).addClass("sp_menu_flag"); $(".new_head_sp_secend").slideUp('slow'); $(this).siblings(".new_head_sp_secend").slideDown('slow'); } }); $(".new_head_sp_secend_click").click(function () { if ($(this).hasClass("active")) { $(this).removeClass("active"); $(this).siblings(".new_head_sp_third").slideUp('slow'); } else { $(this).addClass("active"); $(this).siblings(".new_head_sp_third").slideDown('slow'); } }); $(".new_supports_head_close").click(function (e) { e.stopPropagation(); $(".new_supports_box,.new_toc_box,.new_tob_box,.new_csr_box,.new_about_box,.new_video_box,.new_purchase_box,.new_btob_box").slideUp(600); $(".new_head2_pc>ul>li").removeClass('new_head_hover'); $(".new_head_bg").hide(); }); $("#nav4>h2").click(function (e) { e.stopPropagation(); if ($("#nav4").hasClass("new_head_hover")) { lazyImg('nav4'); $(".new_supports_box").slideUp(600); $(".new_head_bg").hide(); $("#nav4").removeClass('new_head_hover'); } else { $(".new_supports_box").slideDown(600); $(".new_head_bg").show(); $("#nav4").addClass('new_head_hover'); } }); $("#nav1>h2").click(function (e) { e.stopPropagation(); if ($("#nav1").hasClass("new_head_hover")) { lazyImg('nav1'); $(".new_toc_box").slideUp(600); $(".new_head_bg").hide(); $("#nav1").removeClass('new_head_hover'); } else { $(".new_toc_box").slideDown(600); $(".new_head_bg").show(); $("#nav1").addClass('new_head_hover'); } }); $("#nav2>h2").click(function (e) { e.stopPropagation(); if ($("#nav2").hasClass("new_head_hover")) { lazyImg('nav2'); $(".new_tob_box").slideUp(600); $(".new_head_bg").hide(); $("#nav2").removeClass('new_head_hover'); } else { $(".new_tob_box").slideDown(600); $(".new_head_bg").show(); $("#nav2").addClass('new_head_hover'); } }); $("#nav25>h2").click(function (e) { e.stopPropagation(); if ($("#nav25").hasClass("new_head_hover")) { lazyImg('nav25'); $(".new_csr_box").slideUp(600); $(".new_head_bg").hide(); $("#nav25").removeClass('new_head_hover'); } else { $(".new_csr_box").slideDown(600); $(".new_head_bg").show(); $("#nav25").addClass('new_head_hover'); } }); $("#nav5>h2").click(function (e) { e.stopPropagation(); if ($("#nav5").hasClass("new_head_hover")) { lazyImg('nav5'); $(".new_about_box").slideUp(600); $(".new_head_bg").hide(); $("#nav5").removeClass('new_head_hover'); } else { $(".new_about_box").slideDown(600); $(".new_head_bg").show(); $("#nav5").addClass('new_head_hover'); } }); $("#nav6>h2").click(function (e) { e.stopPropagation(); if ($("#nav6").hasClass("new_head_hover")) { $(".new_video_box").slideUp(600); $(".new_head_bg").hide(); $("#nav6").removeClass('new_head_hover'); lazyImg('nav6'); } else { $(".new_video_box").slideDown(600); $(".new_head_bg").show(); $("#nav6").addClass('new_head_hover'); } }); $("#nav7>h2").click(function (e) { e.stopPropagation(); if ($("#nav7").hasClass("new_head_hover")) { lazyImg('nav7'); $(".new_purchase_box").slideUp(600); $(".new_head_bg").hide(); $("#nav7").removeClass('new_head_hover'); } else { $(".new_purchase_box").slideDown(600); $(".new_head_bg").show(); $("#nav7").addClass('new_head_hover'); } }); var flag_news = 1,flag_video = 1; newHeadjs("#nav4").hoverIntent(function () { $(".new_supports_box").stop().slideDown(600); $(".new_head_bg").show(); $(this).addClass('new_head_hover'); if(flag_news == 1){ lazyImg($(this)[0].id) ++flag_news; } }, function () { $(".new_supports_box").stop().slideUp(600); $(".new_head_bg").hide(); $(this).removeClass('new_head_hover'); }); newHeadjs(".new_supports_box .new_supports_head_ul").hoverIntent(function () { var flag = $(this).attr("data-text"); if (flag !== undefined) { $('.' + flag + '').addClass('new_supports_head_active'); $('.' + flag + '').siblings().removeClass('new_supports_head_active'); } $(".new_supports_box .new_supports_head_ul li").removeClass("active"); $(this).addClass("active"); $(".new_supports_head_zzfwtitle").removeClass("active"); }, function () { }, 'li'); newHeadjs(".new_supports_head_zzfwtitle").hoverIntent(function () { console.log("title") var flag = $(this).attr("data-text"); if (flag !== undefined) { $('.' + flag + '').addClass('new_supports_head_active'); $('.' + flag + '').siblings().removeClass('new_supports_head_active'); } $(".new_supports_head_ul li").removeClass("active"); $(this).addClass("active"); }); //涓汉浜у搧 newHeadjs("#nav1").hoverIntent(function () { $(".new_toc_box").stop().slideDown(600); $(".new_head_bg").show(); $(this).addClass('new_head_hover'); if(news_swiper1 == 0){ lazyImg($(this)[0].id) myswiper1 = newsswiper('geren','new_toc_box_c_swiper'); } myswiper1.autoplay.start(); }, function () { myswiper1.autoplay.stop(); $(".new_toc_box").stop().slideUp(600); $(".new_head_bg").hide(); $(this).removeClass('new_head_hover'); }); //鍔炲叕鍙婂伐涓氫骇鍝 newHeadjs("#nav2").hoverIntent(function () { $(".new_tob_box").stop().slideDown(600); $(".new_head_bg").show(); $(this).addClass('new_head_hover'); if(news_swiper2 == 0){ lazyImg($(this)[0].id) myswiper2 = newsswiper('bangong','new_tob_box_c_swiper'); } myswiper2.autoplay.start(); }, function () { myswiper2.autoplay.stop(); $(".new_tob_box").stop().slideUp(600); $(".new_head_bg").hide(); $(this).removeClass('new_head_hover'); }); //璐拱鎸囧崡 newHeadjs("#nav7").hoverIntent(function () { $(".new_purchase_box").stop().slideDown(600); $(".new_head_bg").show(); $(this).addClass('new_head_hover'); if(news_swiper5 == 0){ lazyImg($(this)[0].id) myswiper5 = newsswiper('purchase','new_purchase_box_c_swiper'); } myswiper5.autoplay.start(); }, function () { myswiper5.autoplay.stop(); $(".new_purchase_box").stop().slideUp(600); $(".new_head_bg").hide(); $(this).removeClass('new_head_hover'); }); //浼佷笟绀句細璐d换 newHeadjs("#nav25").hoverIntent(function () { $(".new_csr_box").stop().slideDown(600); $(".new_head_bg").show(); $(this).addClass('new_head_hover'); if(news_swiper3 == 0){ lazyImg($(this)[0].id) myswiper3 = newsswiper('csr','new_csr_box_c_swiper'); } myswiper3.autoplay.start(); }, function () { myswiper3.autoplay.stop(); $(".new_csr_box").stop().slideUp(600); $(".new_head_bg").hide(); $(this).removeClass('new_head_hover'); }); //鍏充簬浣宠兘 newHeadjs("#nav5").hoverIntent(function () { $(".new_about_box").stop().slideDown(600); $(".new_head_bg").show(); $(this).addClass('new_head_hover'); if(news_swiper4 == 0){ lazyImg($(this)[0].id) myswiper4 = newsswiper('about','new_about_box_c_swiper'); } myswiper4.autoplay.start(); }, function () { myswiper4.autoplay.stop(); $(".new_about_box").stop().slideUp(600); $(".new_head_bg").hide(); $(this).removeClass('new_head_hover'); }); //绮惧僵瑙嗛 newHeadjs("#nav6").hoverIntent(function () { $(".new_video_box").stop().slideDown(600); $(".new_head_bg").show(); $(this).addClass('new_head_hover'); if(flag_video == 1){ lazyImg($(this)[0].id) ++flag_video; } }, function () { $(".new_video_box").stop().slideUp(600); $(".new_head_bg").hide(); $(this).removeClass('new_head_hover'); }); //瀹樼綉娴獥寮圭獥鍒ゆ柇 let canoweb_cookie_flag = localStorage.getItem('canoweb_cookie'); if (canoweb_cookie_flag != 'flag' ){ var canoweb_cookie = ``; $('.new_head_bg').after(canoweb_cookie); } }); function lazyImg(element){ for (let index = 0; index < $('#'+element+' img').length; index++) { $('#'+element+' img').eq(index).attr('src', $('#'+element+' img').eq(index).data('src')); } } function closeCookieAlert() { localStorage.setItem('canoweb_cookie', 'flag'); cookieFun(); } function cookieFun() { document.querySelector('#canonweb_cookie').remove(); }