|
@@ -24,6 +24,10 @@ Component({
|
|
//朋友圈
|
|
//朋友圈
|
|
cardList: [],
|
|
cardList: [],
|
|
|
|
|
|
|
|
+ loadedItems: 0, // 已加载的商品数量
|
|
|
|
+ pageSize: 6, // 每次加载的商品数量
|
|
|
|
+ noMoreItems: false, // 是否还有更多商品
|
|
|
|
+
|
|
|
|
|
|
},
|
|
},
|
|
lifetimes: {
|
|
lifetimes: {
|
|
@@ -48,7 +52,7 @@ Component({
|
|
bottomNavHeight,
|
|
bottomNavHeight,
|
|
contentHeight
|
|
contentHeight
|
|
});
|
|
});
|
|
- console.log('123', contentHeight);
|
|
|
|
|
|
+ // console.log('123', contentHeight);
|
|
this.getcircle()
|
|
this.getcircle()
|
|
},
|
|
},
|
|
|
|
|
|
@@ -69,9 +73,9 @@ Component({
|
|
Profilequery2.notEqualTo('isDeleted', true)
|
|
Profilequery2.notEqualTo('isDeleted', true)
|
|
let P2 = await Profilequery2.find();
|
|
let P2 = await Profilequery2.find();
|
|
let profile1List2 = P2.map(item => item.toJSON());
|
|
let profile1List2 = P2.map(item => item.toJSON());
|
|
- console.log(profile1List2);
|
|
|
|
|
|
+ // console.log(profile1List2);
|
|
const department = profile1List2[0].department.objectId
|
|
const department = profile1List2[0].department.objectId
|
|
- console.log(department);
|
|
|
|
|
|
+ // console.log(department);
|
|
let queryWhere = {
|
|
let queryWhere = {
|
|
where: {
|
|
where: {
|
|
profile: {
|
|
profile: {
|
|
@@ -88,25 +92,50 @@ Component({
|
|
Profilequery.equalTo('company', company);
|
|
Profilequery.equalTo('company', company);
|
|
Profilequery.equalTo('isVisible', true);
|
|
Profilequery.equalTo('isVisible', true);
|
|
Profilequery.notEqualTo('isDeleted', true)
|
|
Profilequery.notEqualTo('isDeleted', true)
|
|
|
|
+ Profilequery.descending('createdAt');
|
|
|
|
+ // 设置查询的限制和偏移
|
|
|
|
+ Profilequery.limit(this.data.pageSize);
|
|
|
|
+ Profilequery.skip(this.data.loadedItems);
|
|
let P = await Profilequery.find();
|
|
let P = await Profilequery.find();
|
|
let profile1List = P.map(item => item.toJSON());
|
|
let profile1List = P.map(item => item.toJSON());
|
|
- profile1List.sort((a, b) => new Date(b.createdAt) - new Date(a.createdAt));
|
|
|
|
- console.log(profile1List);
|
|
|
|
|
|
+ // profile1List.sort((a, b) => new Date(b.createdAt) - new Date(a.createdAt));
|
|
|
|
+ // 检查是否还有更多商品
|
|
|
|
+ if (profile1List.length < this.data.pageSize) {
|
|
|
|
+ this.setData({
|
|
|
|
+ noMoreItems: true
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ this.setData({
|
|
|
|
+ noMoreItems: false
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
this.setData({
|
|
this.setData({
|
|
- cardList: profile1List
|
|
|
|
|
|
+ cardList: this.data.cardList.concat(profile1List),
|
|
|
|
+ loadedItems: this.data.loadedItems + profile1List.length
|
|
})
|
|
})
|
|
|
|
+ console.log(this.data.cardList);
|
|
|
|
+ },
|
|
|
|
+ loadMoreData: async function () {
|
|
|
|
+ // 触底时加载更多数据
|
|
|
|
+ if (!this.data.noMoreItems) {
|
|
|
|
+ await this.getcircle();
|
|
|
|
+ }
|
|
},
|
|
},
|
|
- getcircle2(){
|
|
|
|
|
|
+ getcircle2() {
|
|
this.setData({
|
|
this.setData({
|
|
- cardList:[]
|
|
|
|
|
|
+ cardList: [],
|
|
|
|
+ loadedItems:0,
|
|
|
|
+ noMoreItems:false
|
|
})
|
|
})
|
|
|
|
+ console.log('运行了');
|
|
this.getcircle()
|
|
this.getcircle()
|
|
},
|
|
},
|
|
//跳转
|
|
//跳转
|
|
gourl(e) {
|
|
gourl(e) {
|
|
const url = e.currentTarget.dataset.url
|
|
const url = e.currentTarget.dataset.url
|
|
wx.navigateTo({
|
|
wx.navigateTo({
|
|
- url: `${url}`// 目标页面的路径
|
|
|
|
|
|
+ url: `${url}` // 目标页面的路径
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
|