锦水居民端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.3 KiB

5 years ago
// subpages/associationNew/pages/associationlist/associationlist.js
import {
getPartyGroupList,
5 years ago
getJoinGroup,
getImageUrl2
} from "../../utils/api"
const app = getApp()
5 years ago
Page({
data: {
associationList: [],
loadMoreVisible: false,
loadMoreType: "none",
pageNo: 1,
5 years ago
pageSize: 10,
imageUrlList: [],
statusHeight: 0, // 自定义头部状态栏高度
navigationHeight: 0, // 自定义头部导航栏高度
5 years ago
},
onLoad: function () {
// this.getPartyGroupList();
this.setData({
statusHeight: app.globalData.deviceInfo.statusHeight,
navigationHeight: app.globalData.deviceInfo.navigationHeight,
})
5 years ago
getImageUrl2().then(res => {
this.setData({
imageUrlList: [...res.data]
})
})
5 years ago
},
onShow: function () {
this.setData({
associationList: []
})
this.getPartyGroupList()
5 years ago
},
onReachBottom: function () {
this.setData({
loadMoreVisible: true
})
if (this.data.loadMoreType === "loading") {
this.setData({
pageNo: this.data.pageNo + 1
})
this.getPartyGroupList()
}
5 years ago
},
_backhome () {
wx.navigateBack()
},
//获取党群列表
getPartyGroupList () {
getPartyGroupList().then(res => {
console.log("获取党群列表", res)
// const groupNameList = ["进入玫瑰苑社群", "进入玫瑰湖社群", "进入锦水园社群", "进入锦祥园社群", "进入土楼社群", "进入子顺社群", "进入城西社群"]
// res.data.forEach((item, index) => {
// if (index <= 6) {
// item.groupName = groupNameList[index]
// } else {
// item.groupName = "进入社群"
// }
// })
this.setData({
associationList: [...this.data.associationList, ...res.data],
loadMoreType: res.data.length === this.data.pageSize ? "loading": "none"
})
}).catch(err => {
console.log(err)
this.setData({
associationList: [],
loadMoreType: "none"
})
})
},
//加入党群
getJoinGroup (pid) {
let parm = {
partyGroupId: pid
}
getJoinGroup(parm).then(res => {
console.log(res)
}).catch(err => {
console.log(err)
})
},
5 years ago
joinGroupCallBack (e) {
this.getJoinGroup(e.detail.partyGroupId);
5 years ago
}
})