From efb302de3853521124d1a71dcc62d4a8741acc01 Mon Sep 17 00:00:00 2001 From: jiazhipeng Date: Thu, 19 Jun 2025 11:38:10 +0800 Subject: [PATCH] 1 --- pages/index/index.vue | 114 ++++++++++++++++++++++++++++++------------ 1 file changed, 82 insertions(+), 32 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index 4ba0c7f..adba666 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -70,19 +70,42 @@ {{item.title}} - + - + - - + + + + {{item.title || item.goods.title}} + + + + + + + + {{item.title || item.goods.title}} + + + + + + + + + + + + {{item.title || item.goods.title}} + + + + + {{item.title || item.goods.title}} - @@ -140,8 +163,10 @@ id: '41' } ], + hotIndex: 0, hotList: [], + hotList1: [], isLoading: false, limit: 4, } @@ -157,12 +182,14 @@ this.initRectInfo() this.getList() + this.initHotList() this.changeType(0) }, onReachBottom() { - setTimeout(() => { - if (!this.isLoading) this.getHotList(); - }, 1000); + // setTimeout(() => { + // // if (!this.isLoading) this.getHotList(); + // this.getHotList() + // }, 1000); }, methods: { viewDetail(item) { @@ -263,30 +290,53 @@ } }, // 瀑布流 - getColumnItems(columnIndex) { - const columnItems = []; - this.hotList.forEach((item, index) => { - // switch (this.hotIndex) { - // case 1: - // item.src = this.showImg(item.image); - // break; - // default: - // item.src = this.showImg(item.goods.image); - // } - item.src = this.showImg(item.goods.image); + // getColumnItems(columnIndex) { + // const columnItems = []; + // this.hotList.forEach((item, index) => { + // // switch (this.hotIndex) { + // // case 1: + // // item.src = this.showImg(item.image); + // // break; + // // default: + // // item.src = this.showImg(item.goods.image); + // // } + // item.src = this.showImg(item.goods.image); - if (index % 2 === columnIndex) { - columnItems.push(item); - } - }); - return columnItems; - }, + // if (index % 2 === columnIndex) { + // columnItems.push(item); + // } + // }); + // return columnItems; + // }, // 更改热门推荐类型 changeType(index) { this.hotIndex = index - this.isLoading = false + // this.isLoading = false + // if (index==0) { + // this.hotList = this.hotList1 + // } + + // this.getHotList() + }, + initHotList () { this.hotList = [] - this.getHotList() + this.hotList1 = [] + this.Post({ + tag_id: 51, + offset: this.hotList.length, + limit: 100, + },'/api/tag/getGoodsByTagId').then(res => { + if(res.data.length < this.limit) this.isLoading = true + this.hotList = this.hotList.concat(res.data) + }) + this.Post({ + tag_id: 52, + offset: this.hotList1.length, + limit: 100, + },'/api/tag/getGoodsByTagId').then(res => { + if(res.data.length < this.limit) this.isLoading = true + this.hotList1 = this.hotList1.concat(res.data) + }) }, getHotList() { if(this.hotIndex == 1) { @@ -302,11 +352,11 @@ // }) this.Post({ tag_id: 52, - offset: this.hotList.length, + offset: this.hotList1.length, limit: this.limit, },'/api/tag/getGoodsByTagId').then(res => { if(res.data.length < this.limit) this.isLoading = true - this.hotList = this.hotList.concat(res.data) + this.hotList1 = this.hotList.concat(res.data) }) }else { this.Post({