|
|
@@ -0,0 +1,144 @@
|
|
|
+<template>
|
|
|
+ <div class="follow">
|
|
|
+ <van-sticky ref="top" @change="change">
|
|
|
+ <div class="top">
|
|
|
+ <div class="name">{{ pageName }}</div>
|
|
|
+ </div>
|
|
|
+ <van-tabs
|
|
|
+ v-model:active="source"
|
|
|
+ :ellipsis="false"
|
|
|
+ line-width="16"
|
|
|
+ line-height="2"
|
|
|
+ @change="getList"
|
|
|
+ >
|
|
|
+ <van-tab
|
|
|
+ :title="item.label"
|
|
|
+ :name="item.value"
|
|
|
+ :key="index"
|
|
|
+ v-for="(item, index) in sourceOptions"
|
|
|
+ ></van-tab>
|
|
|
+ </van-tabs>
|
|
|
+ </van-sticky>
|
|
|
+ <div class="list">
|
|
|
+ <template v-for="(item, index) in list" :key="index">
|
|
|
+ <product-info
|
|
|
+ v-model:info="list[index]"
|
|
|
+ @update:info="init"
|
|
|
+ ></product-info>
|
|
|
+ </template>
|
|
|
+ <van-empty v-if="empty" description="没有任何藏品哦~" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import ProductInfo from "../../components/product/productInfo.vue";
|
|
|
+import product from "../../mixins/product";
|
|
|
+export default {
|
|
|
+ components: { ProductInfo },
|
|
|
+ inject: ["bs"],
|
|
|
+ mixins: [product],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ list: [],
|
|
|
+ empty: false,
|
|
|
+ source: "",
|
|
|
+ type: "",
|
|
|
+ sourceOptions: [
|
|
|
+ {
|
|
|
+ label: "全部",
|
|
|
+ value: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "新品",
|
|
|
+ value: "OFFICIAL,USER",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "转让",
|
|
|
+ value: "TRANSFER",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ pageName() {
|
|
|
+ return this.getLabelName(this.type, this.typeOptions);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ if (this.$route.query.type) {
|
|
|
+ this.type = this.$route.query.type;
|
|
|
+ }
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ change(isFixed) {
|
|
|
+ if (isFixed) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ document.body.appendChild(this.stiky);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // this.$refs.top.$el.appendChild(this.stiky);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getList() {
|
|
|
+ this.$toast.loading({
|
|
|
+ message: "加载中...",
|
|
|
+ forbidClick: true,
|
|
|
+ });
|
|
|
+ this.$http
|
|
|
+ .post(
|
|
|
+ "/collection/all",
|
|
|
+ {
|
|
|
+ page: 0,
|
|
|
+ size: 20,
|
|
|
+ query: {
|
|
|
+ source: this.source,
|
|
|
+ type: this.type,
|
|
|
+ onShelf: true,
|
|
|
+ },
|
|
|
+ sort: "createdAt,desc",
|
|
|
+ },
|
|
|
+ { body: "json" }
|
|
|
+ )
|
|
|
+ .then((res) => {
|
|
|
+ this.list = res.content;
|
|
|
+ this.empty = res.empty;
|
|
|
+ setTimeout(() => {
|
|
|
+ this.bs.value.refresh();
|
|
|
+ }, 500);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+.follow {
|
|
|
+ background-color: #0f0f0f;
|
|
|
+ padding-bottom: 100px;
|
|
|
+}
|
|
|
+.top {
|
|
|
+ background-color: #181818;
|
|
|
+ padding: 0 16px;
|
|
|
+ height: 50px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ .name {
|
|
|
+ font-size: 20px;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #ffffff;
|
|
|
+ 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>
|