Bladeren bron

全域搜索

panhui 3 jaren geleden
bovenliggende
commit
d353a50bab
3 gewijzigde bestanden met toevoegingen van 96 en 58 verwijderingen
  1. 1 1
      .env.development
  2. 60 47
      src/views/search/SearchDetail.vue
  3. 35 10
      src/views/search/SearchResult.vue

+ 1 - 1
.env.development

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

+ 60 - 47
src/views/search/SearchDetail.vue

@@ -78,6 +78,9 @@
         />
         <van-list
             class="list"
+            :class="{
+                paddingList: pageType === 'news' || pageType === 'mintActivities' || pageType === 'users'
+            }"
             v-model:loading="loading"
             :immediate-check="false"
             :finished="finished"
@@ -89,7 +92,11 @@
                 <component :is="com" dark v-model:info="list[index]" @update:info="init" list></component>
                 <!-- <product-info dark v-model:info="list[index]" @update:info="init"></product-info> -->
             </template>
-            <van-empty v-if="empty" description="什么都没有搜到哦~" :image="require('@assets/kong_png_wusousuo.png')" />
+            <van-empty
+                v-if="empty"
+                description="什么都没有搜到哦~"
+                :image="require('@assets/empty_img_asset_dark.png')"
+            />
         </van-list>
     </div>
 </template>
@@ -135,7 +142,6 @@ export default {
             type: '',
             source: '',
             minterId: '',
-
             scrollTop: 0,
             sort: 'id,desc',
             sortDes: '',
@@ -163,7 +169,8 @@ export default {
             showAction: false,
             showHall: false,
             settings: [],
-            banners: []
+            banners: [],
+            pageType: ''
         };
     },
     watch: {
@@ -255,49 +262,49 @@ export default {
             this.getSearch(this.search);
         }
 
-        this.$http
-            .get('/sysConfig/get/hall_show')
-            .then(res => {
-                if (res.value === true || res.value === '1') {
-                    this.showHall = true;
-                } else {
-                    return Promise.reject();
-                }
-            })
-            .catch(() => {
-                this.showHall = false;
-            });
-
-        this.$http
-            .post('/setting/byFlag', { flag: 1 })
-            .then(res => {
-                this.settings = res;
-                this.$http
-                    .post(
-                        '/banner/all',
-                        {
-                            query: {
-                                type: 'MARKET',
-                                del: false
-                            },
-                            size: 999,
-                            sort: 'sort,asc;createdAt,desc'
-                        },
-                        { body: 'json' }
-                    )
-                    .then(res => {
-                        this.banners = res.content;
-                        this.$nextTick(() => {
-                            if (this.swiperRef) {
-                                this.swiperRef.update();
-                            }
-                        });
-                    });
-            })
-            .catch(e => {
-                console.log(e);
-                this.$message.error(e.error);
-            });
+        // this.$http
+        //     .get('/sysConfig/get/hall_show')
+        //     .then(res => {
+        //         if (res.value === true || res.value === '1') {
+        //             this.showHall = true;
+        //         } else {
+        //             return Promise.reject();
+        //         }
+        //     })
+        //     .catch(() => {
+        //         this.showHall = false;
+        //     });
+
+        // this.$http
+        //     .post('/setting/byFlag', { flag: 1 })
+        //     .then(res => {
+        //         this.settings = res;
+        //         this.$http
+        //             .post(
+        //                 '/banner/all',
+        //                 {
+        //                     query: {
+        //                         type: 'MARKET',
+        //                         del: false
+        //                     },
+        //                     size: 999,
+        //                     sort: 'sort,asc;createdAt,desc'
+        //                 },
+        //                 { body: 'json' }
+        //             )
+        //             .then(res => {
+        //                 this.banners = res.content;
+        //                 this.$nextTick(() => {
+        //                     if (this.swiperRef) {
+        //                         this.swiperRef.update();
+        //                     }
+        //                 });
+        //             });
+        //     })
+        //     .catch(e => {
+        //         console.log(e);
+        //         this.$message.error(e.error);
+        //     });
 
         this.emitter.on('updateList', info => {
             let list = [...this.list];
@@ -803,6 +810,12 @@ export default {
     .showInfo + .showInfo {
         margin-top: 16px;
     }
-}
 
+    &.paddingList {
+        margin: 8px 16px 0;
+        padding: 0;
+        border-radius: 8px;
+        overflow: hidden;
+    }
+}
 </style>

+ 35 - 10
src/views/search/SearchResult.vue

@@ -39,7 +39,13 @@
                                 list
                             ></component>
                         </template>
-                        <div class="more" @click="goDetail()">查看更多</div>
+                        <div
+                            class="more"
+                            v-if="item.listKey && searchInfo[item.listKey].length > 0 && !searchInfo[item.allKey]"
+                            @click="goDetail(item)"
+                        >
+                            查看更多
+                        </div>
                     </div>
                 </van-tab>
             </van-tabs>
@@ -68,42 +74,50 @@ export default {
                 {
                     label: '数字商品',
                     com: 'ProductInfo',
-                    listKey: 'collections'
+                    listKey: 'collections',
+                    allKey: 'collectionsAll'
                 },
                 {
                     label: '元域名',
                     com: 'ProductInfo',
-                    listKey: 'domains'
+                    listKey: 'domains',
+                    allKey: 'domainsAll'
                 },
                 {
                     label: '个人作品',
                     com: 'ProductInfo',
-                    listKey: 'pictures'
+                    listKey: 'pictures',
+                    allKey: 'picturesAll'
                 },
                 {
                     label: '新闻头条',
                     com: 'NewsRecord',
-                    listKey: 'news'
+                    listKey: 'news',
+                    allKey: 'newsAll'
                 },
                 {
                     label: '铸造中心',
                     com: 'ActivityRecord',
-                    listKey: 'mintActivities'
+                    listKey: 'mintActivities',
+                    allKey: 'mintActivitiesAll'
                 },
                 {
                     label: '艺术机构',
                     com: 'CreatorSmall',
-                    listKey: 'minters'
+                    listKey: 'minters',
+                    allKey: 'mintersAll'
                 },
                 {
                     label: '个人用户',
                     com: 'CreatorInfo',
-                    listKey: 'users'
+                    listKey: 'users',
+                    allKey: 'usersAll'
                 },
                 {
                     label: '数字展览',
                     com: 'ShowInfo',
-                    listKey: 'showrooms'
+                    listKey: 'showrooms',
+                    allKey: 'showroomAll'
                 }
             ],
             searchInfo: {
@@ -164,6 +178,16 @@ export default {
                         this.$forceUpdate();
                     });
                 });
+        },
+        goDetail(info) {
+            console.log(info);
+            this.$router.push({
+                path: '/searchDetail',
+                query: {
+                    search: this.search,
+                    pageType: info.listKey
+                }
+            });
         }
     },
     activated() {
@@ -181,7 +205,8 @@ export default {
             to.path === '/newsDetail' ||
             to.path === '/activityDetail' ||
             to.path === '/creatorDetail' ||
-            to.path === '/hall'
+            to.path === '/hall' ||
+            to.path === '/searchDetail'
         ) {
             this.beforeSort = this.sort;
             this.scrollTop = this.scrollWrapper.scrollTop;