diff --git a/pages/index/index.js b/pages/index/index.js index 8c0f88b..4042e70 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -385,6 +385,7 @@ Page({ index, type } = e.currentTarget.dataset + console.log(type, 0); let recommendedTab = this.data.recommendedTab recommendedTab.forEach(el => { @@ -392,16 +393,28 @@ Page({ }) recommendedTab[index]['select'] = true this.setData({ - recommendedTab + recommendedTab, + listDataLeft: [], + listDataRight: [], + listType: type, + listPage: 1, }) + this.leftHeight = 0 + this.rightHeight = 0 + this.getListData() }, // 获取列表数据 getListData() { + if (this.getListDataState) return + this.getListDataState = true miucms.wxget(app.globalData.baseURL + "/tenement/v2/api/home/recommendList", { page: this.data.listPage, - limit: 10 + limit: 10, + type: this.data.listType }).then(res => { + this.getListDataState = false + if (res.code != 200) return let data = res.data.data @@ -467,7 +480,6 @@ Page({ // 判断在哪边的 whichSide(res, targetData) { - console.log(this.leftHeight, this.rightHeight, this.leftHeight <= this.rightHeight); if (this.leftHeight <= this.rightHeight) { this.leftHeight = this.leftHeight + res this.data.listDataLeft.push(targetData) @@ -503,6 +515,7 @@ Page({ }) }) }, + onReachBottom() { this.getListData() },