panhui 3 роки тому
батько
коміт
b29a395ab8

+ 1 - 1
.env.development

@@ -1,4 +1,4 @@
-VUE_APP_BASE_URL=https://test.raex.vip/
+VUE_APP_BASE_URL=https://www.raex.vip/
 NODE_ENV=development
 VUE_APP_PUBLIC_PATH=/
 ASSETS_PATH=raex

BIN
src/assets/png-mingcheng.png


BIN
src/assets/png-xiliefenlei.png


BIN
src/assets/png-xiyoudu.png


BIN
src/assets/png-zhutifenlei.png


+ 286 - 0
src/components/product/productSelect.vue

@@ -0,0 +1,286 @@
+<template>
+    <van-popup v-model:show="show" position="right">
+        <div class="select-right padding-safe-top">
+            <div class="select-content">
+                <div class="select-title">
+                    <img src="@assets/png-zhutifenlei.png" alt="" />
+                    <span>主题分类</span>
+                </div>
+                <div class="select-list">
+                    <div
+                        class="select-info"
+                        :class="{ prim: settingId === item.id }"
+                        v-for="(item, index) in settings"
+                        :key="index"
+                        @click="showBanner(item.id)"
+                    >
+                        {{ item.name }}
+                    </div>
+                </div>
+            </div>
+            <div class="select-content" v-if="settingId">
+                <div class="select-title">
+                    <img src="@assets/png-xiliefenlei.png" alt="" />
+                    <span>系列分类</span>
+                </div>
+                <div class="select-list">
+                    <div
+                        class="select-info"
+                        :class="{ prim: bannerName === item.linkContent }"
+                        @click="chooseBanner(item.linkContent)"
+                        v-for="(item, index) in banners"
+                        :key="index"
+                    >
+                        {{ item.name }}
+                    </div>
+                </div>
+            </div>
+            <div class="select-content" v-if="classification">
+                <div class="select-title">
+                    <img src="@assets/png-xiliefenlei.png" alt="" />
+                    <span>稀有度分类</span>
+                </div>
+                <div class="select-list">
+                    <div
+                        class="select-info"
+                        :class="{ prim: rarityLabel === item.value }"
+                        @click="changeLabel(item.value)"
+                        v-for="(item, index) in selectOptions"
+                        :key="index"
+                    >
+                        {{ item.name }}
+                    </div>
+                </div>
+            </div>
+            <div class="select-content" v-if="bannerName && !empty">
+                <div class="select-title">
+                    <img src="@assets/png-mingcheng.png" alt="" />
+                    <span>名称分类</span>
+                </div>
+                <van-list
+                    v-model:loading="loading"
+                    :finished="finished"
+                    finished-text=""
+                    :immediate-check="false"
+                    @load="getData"
+                    class="select-list"
+                >
+                    <div
+                        class="select-info product"
+                        :class="{ prim: productId === item.id }"
+                        v-for="(item, index) in list"
+                        :key="index"
+                        @click="productId = item.id"
+                    >
+                        {{ item.name }}
+                    </div>
+                </van-list>
+            </div>
+
+            <div class="select-btns">
+                <van-button type="primary" plain round @click="refreash">重置</van-button>
+                <van-button type="primary" round @click="submit">确认筛选</van-button>
+            </div>
+        </div>
+    </van-popup>
+</template>
+
+<script>
+import list from '../../mixins/list';
+export default {
+    data() {
+        return {
+            show: false,
+            settings: [],
+            settingId: 0,
+            banners: [],
+            url: '/collection/all',
+            bannerName: '',
+            selectOptions: [],
+            classification: false,
+            rarityLabel: '',
+            productId: ''
+        };
+    },
+    mixins: [list],
+    mounted() {
+        this.$http
+            .post('/setting/byFlag', { flag: 1 })
+            .then(res => {
+                this.settings = res.filter(item => {
+                    return item.pic;
+                });
+                if (this.settings.length > 0) {
+                    this.showBanner(this.settings[0].id);
+                }
+            })
+            .catch(e => {
+                console.log(e);
+                this.$message.error(e.error);
+            });
+    },
+    methods: {
+        refreash() {
+            this.settingId = 0;
+            this.bannerName = '';
+            this.rarityLabel = '';
+            this.productId = '';
+        },
+        chooseBanner(name) {
+            this.bannerName = name;
+            this.getLabel();
+        },
+        getLabel() {
+            this.$http.get('/rarityLabel/label/' + this.bannerName).then(res => {
+                this.selectOptions = Object.values(res);
+                if (Object.values(res).length > 0) {
+                    this.classification = true;
+                    this.rarityLabel = Object.values(res)[0].value;
+                } else {
+                    this.classification = false;
+                    this.rarityLabel = '';
+                }
+                this.getData(true);
+            });
+        },
+        changeLabel(label) {
+            this.rarityLabel = label;
+
+            this.getData(true);
+        },
+        beforeData() {
+            return {
+                query: {
+                    del: false,
+                    onShelf: true,
+                    rarityLabel: this.rarityLabel
+                },
+                sort: 'id,desc',
+                search: this.bannerName
+            };
+        },
+        showBanner(settingId) {
+            this.settingId = settingId;
+            this.bannerName = '';
+            this.rarityLabel = '';
+            this.productId = '';
+            this.$http
+                .post(
+                    '/banner/all',
+                    {
+                        query: {
+                            type: 'MARKET',
+                            del: false,
+                            settingId: settingId
+                        },
+                        size: 99,
+                        sort: 'sort,asc;createdAt,desc'
+                    },
+                    { body: 'json' }
+                )
+                .then(res => {
+                    this.banners = res.content;
+                });
+        },
+        submit() {
+            let info = [...this.list].find(item => {
+                return item.id === this.productId;
+            });
+            this.show = false;
+            this.$emit('select', {
+                search: this.bannerName,
+                rarityLabel: this.rarityLabel,
+                productName: info ? info.name : ''
+            });
+        },
+        init() {
+            this.show = true;
+        }
+    }
+};
+</script>
+<style lang="less" scoped>
+.select-right {
+    width: 80vw;
+    height: var(--app-height);
+    background: #222426;
+    box-sizing: border-box;
+    overflow: auto;
+    .bottom(100px);
+    position: relative;
+}
+
+.select-btns {
+    position: fixed;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    width: 100%;
+    padding: 9px 16px;
+    background: #222426;
+    .bottom(9px);
+    box-sizing: border-box;
+    .flex();
+    z-index: 20;
+    .van-button {
+        --van-button-primary-background-color: #3ab200;
+        &:nth-child(1) {
+            width: 100px;
+            border: 1px solid #43ce00;
+        }
+        &:nth-child(2) {
+            flex-grow: 1;
+            margin-left: 10px;
+        }
+    }
+}
+
+.select-content {
+    .select-title {
+        .flex();
+        padding: 18px 12px 0px;
+        img {
+            width: 24px;
+            height: 24px;
+            display: block;
+        }
+
+        span {
+            font-size: 16px;
+            color: #ffffff;
+            line-height: 24px;
+            margin-left: 6px;
+        }
+    }
+
+    .select-list {
+        padding: 12px 6px 6px;
+        .select-info {
+            display: inline-block;
+            width: calc(50% - 12px);
+            padding: 0 10px;
+            box-sizing: border-box;
+            margin: 6px;
+            height: 36px;
+            font-size: 13px;
+            font-family: PingFangSC-Regular, PingFang SC;
+            font-weight: 400;
+            color: #939599;
+            line-height: 38px;
+            background: #383a3c;
+            text-align: center;
+            border-radius: 4px;
+            overflow: hidden;
+            white-space: nowrap;
+            text-overflow: ellipsis;
+            &.prim {
+                color: @prim;
+            }
+
+            &.product {
+                width: calc(100% - 12px);
+            }
+        }
+    }
+}
+</style>

+ 29 - 13
src/views/product/HopeMarket.vue

@@ -148,6 +148,8 @@
             cancel-text="取消"
             close-on-click-action
         /> -->
+
+        <product-select ref="select" @select="selectEvent"></product-select>
         <van-overlay :show="show" @click="(show = false), (categorySelection = false)"></van-overlay>
         <van-pull-refresh
             success-text="加载成功"
@@ -184,13 +186,14 @@ import SwiperCore, { Pagination, Autoplay } from 'swiper';
 // install Swiper modules
 SwiperCore.use([Pagination, Autoplay]);
 import ProductInfo from '../../components/product/productInfo.vue';
+import productSelect from '../../components/product/productSelect.vue';
 import product from '../../mixins/product';
 import list from '../../mixins/list';
 import banner from '../../mixins/banner';
 import { useWindowSize } from '@vant/use';
 export default {
     name: 'productList',
-    components: { ProductInfo },
+    components: { ProductInfo, productSelect },
     inject: ['setKeeps', 'scrollWrapper', 'changeScroll', 'barHeight'],
     mixins: [product, list, banner],
     setup() {
@@ -244,7 +247,10 @@ export default {
             activeSettingIndex: '',
             activeSettingIndexOne: '',
             offsetWidth: 0,
-            show: false
+            show: false,
+            productName: '',
+            rarityLabel: '',
+            search: ''
         };
     },
     computed: {
@@ -351,6 +357,12 @@ export default {
         });
     },
     methods: {
+        selectEvent(info) {
+            this.search = info.search;
+            this.rarityLabel = info.rarityLabel;
+            this.productName = info.productName;
+            this.getData(true);
+        },
         onRefresh() {
             this.getData(true).then(() => {
                 this.isLoading = false;
@@ -388,7 +400,7 @@ export default {
                     });
                     setTimeout(() => {
                         this.$nextTick(() => {
-                            this.normalHeight = this.$refs.top.$el.offsetHeight;
+                            // this.normalHeight = this.$refs.top.$el.offsetHeight;
                         });
                     }, 500);
                 })
@@ -438,15 +450,16 @@ export default {
             }, 300);
         },
         categorySelections() {
-            this.categorySelection = !this.categorySelection;
-            if (this.categorySelection == true) {
-                this.$nextTick(() => {
-                    this.show = true;
-                    this.offsetWidth = this.$refs.zombie[0].offsetWidth;
-                });
-            } else {
-                this.show = false;
-            }
+            this.$refs.select.init();
+            // this.categorySelection = !this.categorySelection;
+            // if (this.categorySelection == true) {
+            //     this.$nextTick(() => {
+            //         this.show = true;
+            //         this.offsetWidth = this.$refs.zombie[0].offsetWidth;
+            //     });
+            // } else {
+            //     this.show = false;
+            // }
         },
         changeSort() {
             this.showAction = true;
@@ -491,8 +504,11 @@ export default {
                     minterId: this.minterId,
                     salable: this.salable,
                     minPrice: 0,
-                    notLike: this.notLike
+                    notLike: this.notLike,
+                    rarityLabel: this.rarityLabel,
+                    name: this.productName
                 },
+                search: this.search,
                 sort: this.sort === 'id,desc' ? this.sortOptions[this.title] || sort : sort
             };
         },