|
|
@@ -3,96 +3,62 @@
|
|
|
<van-sticky ref="top" @change="change">
|
|
|
<div class="top">
|
|
|
<div class="top-btn">
|
|
|
- <div
|
|
|
- class="btn"
|
|
|
- :class="{ active: active === 'explore' }"
|
|
|
- @click="changeActive('explore')"
|
|
|
- >
|
|
|
- 收藏探索
|
|
|
- </div>
|
|
|
- <div
|
|
|
- class="btn"
|
|
|
- :class="{ active: active === 'creator' }"
|
|
|
- @click="changeActive('creator')"
|
|
|
- >
|
|
|
- 铸造者
|
|
|
- </div>
|
|
|
+ <div class="btn active">收藏探索</div>
|
|
|
+ <div class="btn" @click="$router.push('/creator')">铸造者</div>
|
|
|
</div>
|
|
|
<div class="search">
|
|
|
<img src="../assets/svgs/search.svg" alt="" />
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
- <van-tabs
|
|
|
- v-if="active === 'creator'"
|
|
|
- v-model:active="type"
|
|
|
- line-width="16"
|
|
|
- line-height="2"
|
|
|
- >
|
|
|
- <van-tab title="全部"></van-tab>
|
|
|
- <van-tab title="最新"></van-tab>
|
|
|
- <van-tab title="人气"></van-tab>
|
|
|
- <van-tab title="关注"></van-tab>
|
|
|
- </van-tabs>
|
|
|
</van-sticky>
|
|
|
|
|
|
- <template v-if="active === 'explore'">
|
|
|
- <swiper pagination class="mySwiper">
|
|
|
- <swiper-slide><img src="../assets/banner.jpg" /></swiper-slide>
|
|
|
- <swiper-slide><img src="../assets/banner.jpg" /></swiper-slide>
|
|
|
- <swiper-slide><img src="../assets/banner.jpg" /></swiper-slide>
|
|
|
- <swiper-slide><img src="../assets/banner.jpg" /></swiper-slide>
|
|
|
- <swiper-slide><img src="../assets/banner.jpg" /></swiper-slide>
|
|
|
- <swiper-slide><img src="../assets/banner.jpg" /></swiper-slide>
|
|
|
- </swiper>
|
|
|
-
|
|
|
- <van-grid :border="false">
|
|
|
- <van-grid-item text="精选推荐">
|
|
|
- <template v-slot:icon>
|
|
|
- <img
|
|
|
- class="grid-img"
|
|
|
- src="../assets/svgs/info_icon_jingxuanxilie.svg"
|
|
|
- />
|
|
|
- </template>
|
|
|
- </van-grid-item>
|
|
|
- <van-grid-item text="原创系列">
|
|
|
- <template v-slot:icon>
|
|
|
- <img
|
|
|
- class="grid-img"
|
|
|
- src="../assets/svgs/info_icon_yuanchangxilie.svg"
|
|
|
- />
|
|
|
- </template>
|
|
|
- </van-grid-item>
|
|
|
- <van-grid-item text="数字盲盒">
|
|
|
- <template v-slot:icon>
|
|
|
- <img
|
|
|
- class="grid-img"
|
|
|
- src="../assets/svgs/info_icon_manghexilie.svg"
|
|
|
- />
|
|
|
- </template>
|
|
|
- </van-grid-item>
|
|
|
- <van-grid-item text="拍卖系列">
|
|
|
- <template v-slot:icon>
|
|
|
- <img
|
|
|
- class="grid-img"
|
|
|
- src="../assets/svgs/info_icon_paimaixilie.svg"
|
|
|
- />
|
|
|
- </template>
|
|
|
- </van-grid-item>
|
|
|
- </van-grid>
|
|
|
+ <swiper pagination class="mySwiper" v-if="banners.length > 0">
|
|
|
+ <swiper-slide v-for="item in banners" :key="item.id">
|
|
|
+ <img :src="item.pic" />
|
|
|
+ </swiper-slide>
|
|
|
+ </swiper>
|
|
|
|
|
|
- <div class="title">本期推荐</div>
|
|
|
- <div class="box-list">
|
|
|
- <product-info></product-info>
|
|
|
- <product-info></product-info>
|
|
|
- <product-info></product-info>
|
|
|
- <product-info></product-info>
|
|
|
- <product-info></product-info>
|
|
|
- <product-info></product-info>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
+ <van-grid :border="false">
|
|
|
+ <van-grid-item text="精选推荐">
|
|
|
+ <template v-slot:icon>
|
|
|
+ <img
|
|
|
+ class="grid-img"
|
|
|
+ src="../assets/svgs/info_icon_jingxuanxilie.svg"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </van-grid-item>
|
|
|
+ <van-grid-item text="原创系列">
|
|
|
+ <template v-slot:icon>
|
|
|
+ <img
|
|
|
+ class="grid-img"
|
|
|
+ src="../assets/svgs/info_icon_yuanchangxilie.svg"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </van-grid-item>
|
|
|
+ <van-grid-item text="数字盲盒">
|
|
|
+ <template v-slot:icon>
|
|
|
+ <img
|
|
|
+ class="grid-img"
|
|
|
+ src="../assets/svgs/info_icon_manghexilie.svg"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </van-grid-item>
|
|
|
+ <van-grid-item text="拍卖系列">
|
|
|
+ <template v-slot:icon>
|
|
|
+ <img
|
|
|
+ class="grid-img"
|
|
|
+ src="../assets/svgs/info_icon_paimaixilie.svg"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </van-grid-item>
|
|
|
+ </van-grid>
|
|
|
|
|
|
- <creator v-else> </creator>
|
|
|
+ <div class="title">本期推荐</div>
|
|
|
+ <div class="box-list">
|
|
|
+ <template v-for="(item, index) in list" :key="item.id">
|
|
|
+ <product-info v-model:info="list[index]"></product-info>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -108,7 +74,6 @@ import SwiperCore, { Pagination } from "swiper";
|
|
|
SwiperCore.use([Pagination]);
|
|
|
|
|
|
import ProductInfo from "../components/product/productInfo.vue";
|
|
|
-import Creator from "./Creator.vue";
|
|
|
|
|
|
export default {
|
|
|
name: "discover",
|
|
|
@@ -117,13 +82,12 @@ export default {
|
|
|
Swiper,
|
|
|
SwiperSlide,
|
|
|
ProductInfo,
|
|
|
- Creator,
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- active: "explore",
|
|
|
stiky: null,
|
|
|
- type: 0,
|
|
|
+ banners: [],
|
|
|
+ list: [],
|
|
|
};
|
|
|
},
|
|
|
beforeUnmount() {
|
|
|
@@ -137,22 +101,80 @@ export default {
|
|
|
this.$nextTick(() => {
|
|
|
this.stiky = this.$refs.top.$el.childNodes[0];
|
|
|
});
|
|
|
+ this.getInit();
|
|
|
},
|
|
|
methods: {
|
|
|
+ getInit() {
|
|
|
+ this.$toast.loading({
|
|
|
+ message: "加载中...",
|
|
|
+ forbidClick: true,
|
|
|
+ });
|
|
|
+ Promise.all([this.getBanner(), this.getList()]).then(() => {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.bs.value.refresh();
|
|
|
+ }, 500);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getBanner() {
|
|
|
+ this.$http
|
|
|
+ .post(
|
|
|
+ "/banner/all",
|
|
|
+ {
|
|
|
+ query: {
|
|
|
+ type: "DISCOVER",
|
|
|
+ },
|
|
|
+ sort: "createdAt,desc",
|
|
|
+ },
|
|
|
+ { body: "json" }
|
|
|
+ )
|
|
|
+ .then((res) => {
|
|
|
+ this.banners = res.content;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getList() {
|
|
|
+ this.$http
|
|
|
+ .post(
|
|
|
+ "/collection/all",
|
|
|
+ {
|
|
|
+ page: 0,
|
|
|
+ size: 20,
|
|
|
+ query: {
|
|
|
+ onShelf: true,
|
|
|
+ },
|
|
|
+ sort: "createdAt,desc",
|
|
|
+ },
|
|
|
+ { body: "json" }
|
|
|
+ )
|
|
|
+ .then((res) => {
|
|
|
+ this.list = res.content;
|
|
|
+ });
|
|
|
+ },
|
|
|
change(isFixed) {
|
|
|
if (isFixed) {
|
|
|
this.$nextTick(() => {
|
|
|
document.body.appendChild(this.stiky);
|
|
|
});
|
|
|
} else {
|
|
|
- this.$refs.top.$el.appendChild(this.stiky);
|
|
|
+ // this.$refs.top.$el.appendChild(this.stiky);
|
|
|
}
|
|
|
},
|
|
|
changeActive(active) {
|
|
|
- this.active = active;
|
|
|
+ if (this.active === active) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.$nextTick(() => {
|
|
|
this.bs.value.scrollTo(0, 0);
|
|
|
this.bs.value.refresh();
|
|
|
+ setTimeout(() => {
|
|
|
+ this.active = active;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ if (active === "explore") {
|
|
|
+ this.getInit();
|
|
|
+ } else {
|
|
|
+ this.$refs.creator.init();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }, 100);
|
|
|
});
|
|
|
},
|
|
|
},
|
|
|
@@ -190,11 +212,13 @@ export default {
|
|
|
|
|
|
.discover {
|
|
|
background-color: @bg3;
|
|
|
+ padding-bottom: 100px;
|
|
|
}
|
|
|
|
|
|
/deep/ .mySwiper {
|
|
|
width: calc(100vw - 32px);
|
|
|
height: calc(41vw - 13px);
|
|
|
+ padding-top: 12px;
|
|
|
|
|
|
.swiper-pagination {
|
|
|
bottom: 12px;
|