128 lines
3.3 KiB
JavaScript
128 lines
3.3 KiB
JavaScript
var vm = new Vue({
|
|
el: "#app",
|
|
data: {
|
|
tel: '',
|
|
i: 2,
|
|
activeIndex: 2,
|
|
solveSwiper: "",
|
|
teleManaI: 2,
|
|
sscManaI: 1,
|
|
teleI: 1
|
|
},
|
|
mounted() {
|
|
if (screen.availWidth !== 1280 && window.devicePixelRatio !== 1.5) {
|
|
AOS.init({
|
|
disable: "mobile",
|
|
duration: 600,
|
|
delay: 50,
|
|
easing: 'ease-in-out'
|
|
})
|
|
} else {
|
|
AOS.init({
|
|
disable: true,
|
|
duration: 600,
|
|
delay: 50,
|
|
easing: 'ease-in-out'
|
|
})
|
|
}
|
|
this.allSwiper()
|
|
},
|
|
mixins: [mixins],
|
|
methods: {
|
|
solveTab(i) {
|
|
this.i = i;
|
|
var j = i - 1;
|
|
this.solveSwiper.slideTo(j, 1000, false);
|
|
},
|
|
teleMana(i) {
|
|
this.teleManaI = i;
|
|
},
|
|
sscTab(i) {
|
|
this.sscManaI = i;
|
|
},
|
|
allSwiper() {//swiper
|
|
if (screen.width <= 768) { //名企证言轮播
|
|
var comSwiper = new Swiper('.com-swiper', {
|
|
initialSlide: 1,//初始化时slide的索引
|
|
slidesPerView: 'auto',
|
|
slideToClickedSlide: true,
|
|
centeredSlides: true,
|
|
autoplay: {
|
|
delay: 3000,
|
|
disableOnInteraction: false
|
|
},
|
|
pagination: {
|
|
el: '.swiper-pagination',
|
|
clickable: true,
|
|
}
|
|
})
|
|
} else {
|
|
new Swiper('.com-swiper', {
|
|
initialSlide: 1,//初始化时slide的索引
|
|
slidesPerView: 'auto',
|
|
slideToClickedSlide: true,
|
|
centeredSlides: true,
|
|
autoplay: {
|
|
delay: 3000,
|
|
disableOnInteraction: false
|
|
},
|
|
pagination: {
|
|
el: '.swiper-pagination',
|
|
clickable: true,
|
|
}
|
|
})
|
|
}
|
|
new Swiper('.use-wrap .swiper-container', {
|
|
watchSlidesProgress: true,
|
|
slidesPerView: 'auto',
|
|
centeredSlides: true,
|
|
loop: true,
|
|
loopedSlides: 3,
|
|
autoplay: true,
|
|
navigation: {
|
|
nextEl: '.swiper-button-next',
|
|
prevEl: '.swiper-button-prev',
|
|
},
|
|
on: {
|
|
progress: function (progress) {
|
|
for (i = 0; i < this.slides.length; i++) {
|
|
var slide = this.slides.eq(i);
|
|
var slideProgress = this.slides[i].progress;
|
|
modify = 1;
|
|
if (Math.abs(slideProgress) > 1) {
|
|
modify = (Math.abs(slideProgress) - 1) * 0.3 + 1;
|
|
}
|
|
translate = slideProgress * modify * 450 + 'px';
|
|
scale = 1 - Math.abs(slideProgress) / 5;
|
|
zIndex = 999 - Math.abs(Math.round(10 * slideProgress));
|
|
slide.transform('translateX(' + translate + ') scale(' + scale + ')');
|
|
slide.css('zIndex', zIndex);
|
|
slide.css('opacity', 1);
|
|
if (Math.abs(slideProgress) > 3) {
|
|
slide.css('opacity', 0);
|
|
}
|
|
}
|
|
},
|
|
setTransition: function (swiper, transition) {
|
|
for (var i = 0; i < this.slides.length; i++) {
|
|
var slide = this.slides.eq(i)
|
|
slide.transition(transition);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
})
|
|
},
|
|
teleTab(i) {
|
|
this.teleI = i
|
|
// setInterval(() => {
|
|
// this.teleI++
|
|
// if (this.teleI >= 4) {
|
|
// this.teleI = 1
|
|
// }
|
|
// }, 3000)
|
|
}
|
|
}
|
|
});
|