|
|
@@ -54,10 +54,11 @@
|
|
|
</div>
|
|
|
<div class="content1 center-content">
|
|
|
<div class="hot">官方活动</div>
|
|
|
- <div class="imgBox">
|
|
|
- <img class="imgBox1" src="../assets/img/888.jpg" alt="" />
|
|
|
- <img class="imgBox1" src="../assets/img/888.jpg" alt="" />
|
|
|
- </div>
|
|
|
+ <swiper class="mySwiper" ref="mySwiper" :options="swiperOptions">
|
|
|
+ <swiper-slide v-for="(item, index) in banners" :key="index">
|
|
|
+ <el-image @click="goNext(item)" :src="item.pic" fit="fill" :lazy="true"></el-image>
|
|
|
+ </swiper-slide>
|
|
|
+ </swiper>
|
|
|
<more-title path="/collection"></more-title>
|
|
|
<div class="describe">
|
|
|
<div class="box">
|
|
|
@@ -119,17 +120,24 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import CollectionInfo from '../components/CollectionInfo.vue';
|
|
|
-import GoodsInfo from '../components/GoodsInfo.vue';
|
|
|
import MoreTitle from '../components/MoreTitle.vue';
|
|
|
+import { Swiper, SwiperSlide } from 'vue-awesome-swiper';
|
|
|
+import 'swiper/css/swiper.css';
|
|
|
export default {
|
|
|
- components: { GoodsInfo, CollectionInfo, MoreTitle },
|
|
|
+ components: { CollectionInfo, MoreTitle, Swiper, SwiperSlide },
|
|
|
data() {
|
|
|
return {
|
|
|
creators: [],
|
|
|
showCreator: 3,
|
|
|
initChange: true,
|
|
|
timer: null,
|
|
|
- products: []
|
|
|
+ products: [],
|
|
|
+ banners: [],
|
|
|
+ swiperOptions: {
|
|
|
+ slidesPerView: 2,
|
|
|
+ spaceBetween: 20,
|
|
|
+ autoplay: true
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
@@ -140,19 +148,19 @@ export default {
|
|
|
});
|
|
|
|
|
|
this.$http
|
|
|
- .post(
|
|
|
- '/banner/all',
|
|
|
- {
|
|
|
- query: {
|
|
|
- type: 'HOME'
|
|
|
- },
|
|
|
- sort: 'createdAt,desc'
|
|
|
+ .post(
|
|
|
+ '/banner/all',
|
|
|
+ {
|
|
|
+ query: {
|
|
|
+ type: 'HOME'
|
|
|
},
|
|
|
- { body: 'json' }
|
|
|
- )
|
|
|
- .then(res => {
|
|
|
- this.banners = res.content;
|
|
|
- })
|
|
|
+ sort: 'createdAt,desc'
|
|
|
+ },
|
|
|
+ { body: 'json' }
|
|
|
+ )
|
|
|
+ .then(res => {
|
|
|
+ this.banners = res.content;
|
|
|
+ });
|
|
|
},
|
|
|
methods: {
|
|
|
getCreators() {
|
|
|
@@ -200,6 +208,11 @@ export default {
|
|
|
.then(res => {
|
|
|
return Promise.resolve(res.content);
|
|
|
});
|
|
|
+ },
|
|
|
+ goNext(info) {
|
|
|
+ if (info.link && info.linkType === 'collection') {
|
|
|
+ this.$router.push(`/collectionDetail?id=${info.linkContent}`);
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -395,6 +408,7 @@ export default {
|
|
|
height: 114px;
|
|
|
border: 1px solid;
|
|
|
margin-bottom: 30px;
|
|
|
+ cursor: inherit;
|
|
|
.box1 {
|
|
|
margin: 30px 0 0 40px;
|
|
|
.text1 {
|
|
|
@@ -491,4 +505,13 @@ export default {
|
|
|
padding: 0;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+.mySwiper {
|
|
|
+ .el-image {
|
|
|
+ width: 100%;
|
|
|
+ height: 260px;
|
|
|
+ border-radius: 8px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|