|
|
@@ -1,49 +1,105 @@
|
|
|
<template>
|
|
|
<div class="follow">
|
|
|
- <van-sticky>
|
|
|
+ <van-sticky ref="top" @change="change">
|
|
|
<div class="top">
|
|
|
<div class="name">我赞过的</div>
|
|
|
</div>
|
|
|
+ <van-tabs
|
|
|
+ v-model:active="type"
|
|
|
+ :ellipsis="false"
|
|
|
+ line-width="16"
|
|
|
+ line-height="2"
|
|
|
+ >
|
|
|
+ <van-tab
|
|
|
+ :title="item.label"
|
|
|
+ :name="item.type"
|
|
|
+ :key="index"
|
|
|
+ v-for="(item, index) in typeOptions"
|
|
|
+ ></van-tab>
|
|
|
+ </van-tabs>
|
|
|
</van-sticky>
|
|
|
<div class="list">
|
|
|
<template v-for="(item, index) in showList" :key="index">
|
|
|
- <creator-info v-model:info="showList[index]"></creator-info>
|
|
|
+ <product-info
|
|
|
+ v-model:info="list[item.index]"
|
|
|
+ @update:info="init"
|
|
|
+ ></product-info>
|
|
|
</template>
|
|
|
- <van-empty v-if="empty" description="你还没有任何关注哦~" />
|
|
|
+ <van-empty
|
|
|
+ v-if="showList.length === 0"
|
|
|
+ description="你还没有赞过任何藏品哦~"
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import CreatorInfo from "../../components/creator/CreatorInfo.vue";
|
|
|
+import ProductInfo from "../../components/product/productInfo.vue";
|
|
|
export default {
|
|
|
- components: { CreatorInfo },
|
|
|
+ components: { ProductInfo },
|
|
|
inject: ["bs"],
|
|
|
data() {
|
|
|
return {
|
|
|
list: [],
|
|
|
empty: false,
|
|
|
+ type: "",
|
|
|
+ typeOptions: [
|
|
|
+ {
|
|
|
+ label: "全部",
|
|
|
+ type: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "收藏品",
|
|
|
+ type: "DEFAULT",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "数字盲盒",
|
|
|
+ type: "BLIND_BOX",
|
|
|
+ },
|
|
|
+ ],
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
showList() {
|
|
|
- return [...this.list].filter((item) => {
|
|
|
- return item.follow;
|
|
|
- });
|
|
|
+ return [...this.list]
|
|
|
+ .map((item, index) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ index,
|
|
|
+ };
|
|
|
+ })
|
|
|
+ .filter((item) => {
|
|
|
+ return !this.type || this.type === item.type;
|
|
|
+ });
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.$toast.loading({
|
|
|
- message: "加载中...",
|
|
|
- forbidClick: true,
|
|
|
- });
|
|
|
- this.$http.get("/user/myFollows").then((res) => {
|
|
|
- this.list = res;
|
|
|
- this.empty = res.length === 0;
|
|
|
- setTimeout(() => {
|
|
|
- this.bs.value.refresh();
|
|
|
- }, 500);
|
|
|
- });
|
|
|
+ this.init();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ change(isFixed) {
|
|
|
+ if (isFixed) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ document.body.appendChild(this.stiky);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // this.$refs.top.$el.appendChild(this.stiky);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ init() {
|
|
|
+ this.$toast.loading({
|
|
|
+ message: "加载中...",
|
|
|
+ forbidClick: true,
|
|
|
+ });
|
|
|
+ this.empty = false;
|
|
|
+ this.$http.get("/collection/myLikes").then((res) => {
|
|
|
+ this.list = res;
|
|
|
+ this.empty = res.length === 0;
|
|
|
+ setTimeout(() => {
|
|
|
+ this.bs.value.refresh();
|
|
|
+ }, 500);
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
@@ -51,6 +107,7 @@ export default {
|
|
|
<style lang="less" scoped>
|
|
|
.follow {
|
|
|
background-color: #0f0f0f;
|
|
|
+ padding-bottom: 100px;
|
|
|
}
|
|
|
.top {
|
|
|
background-color: #181818;
|
|
|
@@ -65,4 +122,14 @@ export default {
|
|
|
line-height: 30px;
|
|
|
}
|
|
|
}
|
|
|
+/deep/.van-tabs {
|
|
|
+ .van-tabs__nav {
|
|
|
+ padding-left: 16px;
|
|
|
+ }
|
|
|
+}
|
|
|
+/deep/.van-tab {
|
|
|
+ flex-grow: 0;
|
|
|
+ padding: 0 0 0 0;
|
|
|
+ margin-right: 50px;
|
|
|
+}
|
|
|
</style>
|