// 姝e紡鐗 const dataBaseUrl='https://cms.jingdiao.com' // 寮€鍙戠増 // const dataBaseUrl='http://localhost:1337' const token="1234f95023ab9af2112324d1940f005187b02fefbd4b9b2841904f28128450639ceb81c474a65dc14e754b83458d5604e0575a1b875c6519c64fbecd2b915ab9ad5b0420d37ad86980f2e8c54ab5daff8e211d59daf841786dd4a5a6a45f1bcf8002064802610cb8e8afbd39f5a03be2f251a521bdabc911f2affc73bb57b24e" var vueApp initApp() getData() function initApp(){ const { createApp, ref, onUpdated,computed } = Vue vueApp = createApp({ setup(){ const customerStories=ref([]) onUpdated(()=>{ init(strNum()) ScrollTo() }) return { customerStories, dataBaseUrl } } }).mount('#customer-stories-app') } function getData(){ jQuery.ajax({ type: "GET", url: `${dataBaseUrl}/api/customer-story?sort[0]=id:desc&populate[paragraph]=*&populate[medias][populate]=*&pagination[pageSize]=500`, beforeSend: function(request) { request.setRequestHeader("Authorization",`Bearer ${token}`) }, success: function(result) { vueApp.customerStories=result.data||[] } }) } jQuery(window).resize(function() { init(strNum()) }); //瀹㈡埛鏁呬簨灞曞紑/鎶樺彔 function init (len) { //绉诲姩绔痵wiper new Swiper('.swiper-container1', { autoplay: false, loop: true, navigation: { nextEl: '.swiper-button-next1', prevEl: '.swiper-button-prev1', }, on: { slideChangeTransitionEnd: function(){ jQuery('#video2').parents(".video-area").siblings(".video-info").show(); jQuery('#video2').parents(".video-area").hide(); } } }); jQuery('.story-container').each(function() { jQuery(this).prevAll('.temp-content').html(jQuery(this).html().slice(0, len) + '鈥︹€?); }); jQuery('.read-more').click(function(e) { e.stopPropagation(); if(jQuery(this).prevAll(".story-content").children('.story-container').hasClass('hidden-content')) { jQuery(this).prevAll(".story-content").children('.temp-content').addClass('hidden-content'); jQuery(this).prevAll(".story-content").children('.story-container').removeClass('hidden-content'); jQuery(this).find(".buttonBox").text('鏀惰捣'); } else { jQuery(this).prevAll(".story-content").children('.temp-content').removeClass('hidden-content'); jQuery(this).prevAll(".story-content").children('.story-container').addClass('hidden-content'); jQuery(this).find(".buttonBox").text('闃呰瀹屾暣瀹㈡埛鏁呬簨'); } }); initVideo() } function strNum() { if(jQuery(window).width() > 1499) { return 300; } else if (jQuery(window).width() <= 1499 && jQuery(window).width() > 1024) { return 240; } else if (jQuery(window).width() <= 1024 && jQuery(window).width() > 555) { return 193; } else { return 130; } } //瑙嗛 function initVideo(){ var videowidth = jQuery(".part-video-item").width(); var videoheight = videowidth * 0.5625; var videowidthm = jQuery(".part-img-m").width(); var videoheightm = videowidthm * 0.5625; jQuery(".part-video-item").click(function(){ if(jQuery(this).children(".video-area").css("display")=="none"){ var videoEle = jQuery(this).find("video"); var videoId= videoEle.attr('id') var videoSrc= videoEle.attr('data-video') if(videoId.startsWith('m-video')){ setVideo (videoId, videoSrc,videowidthm,videoheightm) }else{ setVideo (videoId, videoSrc,videowidth,videoheight) } jQuery(this).children(".video-info").hide(); jQuery(this).children(".video-area").show(); var video = jQuery(this).find("video")[0]; console.log(video) video.currentTime = 0; video.play(); } }); } function setVideo (id, sourcesSrc, width,height) { videojs(id, { controls: true, preload: 'none', width: width, height: height, loop: false, sources: [{ src: sourcesSrc, type: 'video/mp4' }] }); } function ScrollTo(){ var allwidth = jQuery(window).width(); var scrolltoIndex=window.location.search.search("scrollto"); if(scrolltoIndex!=-1){ var scrollto=window.location.search.substr(scrolltoIndex+9,15); var newsroomEle=jQuery("#product"+scrollto); if(newsroomEle){ if( allwidth>1024 ){ jQuery("html, body").animate( {scrollTop:newsroomEle.offset().top-100}, {duration: 1000,easing: "swing"}); } else{ jQuery("html, body").animate( {scrollTop:newsroomEle.offset().top-300}, {duration: 1000,easing: "swing"}); } } } }