|
|
@ -777,6 +777,16 @@ Page({ |
|
|
page: this.data.page + 1, |
|
|
page: this.data.page + 1, |
|
|
lastDataTimestamp: new Date().getTime() |
|
|
lastDataTimestamp: new Date().getTime() |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// 检查过滤后的非广告商品数量,如果不足6个且当前不是加载更多状态,则自动触发上拉加载更多
|
|
|
|
|
|
const nonAdGoodsCount = filteredGoods.filter(item => !item.isAd).length; |
|
|
|
|
|
if (!isLoadMore && nonAdGoodsCount < 6 && !this.data.loadingMore && !this.data.isLoading) { |
|
|
|
|
|
console.log('非广告商品数量不足6个,自动触发上拉加载更多'); |
|
|
|
|
|
// 使用setTimeout确保当前任务完成后再触发加载更多
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
this.loadGoods(true); |
|
|
|
|
|
}, 100); |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 处理刷新数据 - 查重并保持原有商品
|
|
|
// 处理刷新数据 - 查重并保持原有商品
|
|
|
@ -858,6 +868,16 @@ Page({ |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
categoryQueryCache: newCategoryQueryCache |
|
|
categoryQueryCache: newCategoryQueryCache |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// 检查过滤后的非广告商品数量,如果不足6个,则自动触发上拉加载更多
|
|
|
|
|
|
const nonAdGoodsCount = filteredGoods.filter(item => !item.isAd).length; |
|
|
|
|
|
if (nonAdGoodsCount < 6 && !this.data.loadingMore && !this.data.isLoading) { |
|
|
|
|
|
console.log('刷新后商品数量不足6个,自动触发上拉加载更多'); |
|
|
|
|
|
// 使用setTimeout确保当前任务完成后再触发加载更多
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
this.loadGoods(true); |
|
|
|
|
|
}, 100); |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 插入广告位数据
|
|
|
// 插入广告位数据
|
|
|
|