|
@@ -1,5 +1,6 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="banner-content" :style="{ height: `${height * 2}rpx` }">
|
|
<div class="banner-content" :style="{ height: `${height * 2}rpx` }">
|
|
|
|
|
+ <!-- <div class="topBanner" :style="{ backgroundImage: `url(${this.nowImg})`, height: `${height * 2}rpx` }"></div> -->
|
|
|
<div class="swiperContent" :style="bannerStyle">
|
|
<div class="swiperContent" :style="bannerStyle">
|
|
|
<swiper :autoplay="autoplay" :style="scale" @change="swiperChange" :current="current">
|
|
<swiper :autoplay="autoplay" :style="scale" @change="swiperChange" :current="current">
|
|
|
<swiper-item v-for="(item, index) in banners" :key="index">
|
|
<swiper-item v-for="(item, index) in banners" :key="index">
|
|
@@ -66,25 +67,21 @@ export default {
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
|
bannerStyle() {
|
|
bannerStyle() {
|
|
|
- if (this.scrollTop < 0) {
|
|
|
|
|
|
|
+ if (this.scrollTop <= 0 && this.fixed) {
|
|
|
return {
|
|
return {
|
|
|
position: 'fixed',
|
|
position: 'fixed',
|
|
|
top: 0,
|
|
top: 0,
|
|
|
left: 0,
|
|
left: 0,
|
|
|
- bottom: 0,
|
|
|
|
|
- right: 0
|
|
|
|
|
- };
|
|
|
|
|
- } else if (this.scrollTop === 0 && this.fixed) {
|
|
|
|
|
- return {
|
|
|
|
|
- position: 'fixed',
|
|
|
|
|
- top: 0,
|
|
|
|
|
- left: 0,
|
|
|
|
|
- bottom: 0,
|
|
|
|
|
- right: 0
|
|
|
|
|
|
|
+ right: 0,
|
|
|
|
|
+ zIndex: 2,
|
|
|
|
|
+ height: this.height * 2 + 'rpx'
|
|
|
};
|
|
};
|
|
|
} else {
|
|
} else {
|
|
|
return {
|
|
return {
|
|
|
- position: 'relative'
|
|
|
|
|
|
|
+ position: 'relative',
|
|
|
|
|
+ zIndex: 2,
|
|
|
|
|
+ top: 0,
|
|
|
|
|
+ height: this.height * 2 + 'rpx'
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -110,6 +107,13 @@ export default {
|
|
|
},
|
|
},
|
|
|
oss() {
|
|
oss() {
|
|
|
return `?x-oss-process=image/resize,h_${this.height * 3},m_lfit`;
|
|
return `?x-oss-process=image/resize,h_${this.height * 3},m_lfit`;
|
|
|
|
|
+ },
|
|
|
|
|
+ nowImg() {
|
|
|
|
|
+ if (this.banners.length > this.current) {
|
|
|
|
|
+ return this.checkImg(this.banners[this.current].img) ? this.banners[this.current].img : '';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return '';
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
@@ -194,7 +198,15 @@ export default {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+.topBanner {
|
|
|
|
|
+ background-position: center center;
|
|
|
|
|
+ background-size: cover;
|
|
|
|
|
+ position: fixed;
|
|
|
|
|
+ top: 0;
|
|
|
|
|
+ left: 0;
|
|
|
|
|
+ right: 0;
|
|
|
|
|
+ z-index: 0;
|
|
|
|
|
+}
|
|
|
#main {
|
|
#main {
|
|
|
position: relative;
|
|
position: relative;
|
|
|
z-index: 2;
|
|
z-index: 2;
|
|
@@ -219,6 +231,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
.swiperContent {
|
|
.swiperContent {
|
|
|
z-index: 1;
|
|
z-index: 1;
|
|
|
|
|
+ transition: all ease-in-out 0.3s;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.video {
|
|
.video {
|