|
@ -1,8 +1,7 @@ |
|
|
import { |
|
|
import { |
|
|
getPartyUserList, |
|
|
getPartyUserList, |
|
|
postUserBanned, |
|
|
postUserBanned, |
|
|
postModifyIdentity, |
|
|
postModifyIdentity |
|
|
getCurrentUserInfo |
|
|
|
|
|
} from '../../utils/api' |
|
|
} from '../../utils/api' |
|
|
Page({ |
|
|
Page({ |
|
|
|
|
|
|
|
@ -25,11 +24,7 @@ Page({ |
|
|
*/ |
|
|
*/ |
|
|
onLoad: function (options) { |
|
|
onLoad: function (options) { |
|
|
this.data.partyGroupId = options.partyGroupId |
|
|
this.data.partyGroupId = options.partyGroupId |
|
|
this.getCurrentUserInfo().then(res => { |
|
|
this.getPartyUserList() |
|
|
if (res) { |
|
|
|
|
|
this.getPartyUserList(); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -53,22 +48,6 @@ Page({ |
|
|
this.getPartyUserList() |
|
|
this.getPartyUserList() |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
//获取当前用户信息
|
|
|
|
|
|
getCurrentUserInfo () { |
|
|
|
|
|
return new Promise ((resolve,reject) => { |
|
|
|
|
|
getCurrentUserInfo (this.data.partyGroupId).then(res => { |
|
|
|
|
|
console.log('获取当前用户信息', res) |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
currentUser: {...res.data} |
|
|
|
|
|
}) |
|
|
|
|
|
resolve(true) |
|
|
|
|
|
}).catch(err =>{ |
|
|
|
|
|
console.log(err) |
|
|
|
|
|
this.data.currentUser = {} |
|
|
|
|
|
reject(false) |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
// 获取群成员列表
|
|
|
// 获取群成员列表
|
|
|
getPartyUserList () { |
|
|
getPartyUserList () { |
|
|
const para = { |
|
|
const para = { |
|
@ -76,14 +55,18 @@ Page({ |
|
|
pageSize: this.data.pageSize, |
|
|
pageSize: this.data.pageSize, |
|
|
partyGroupId: this.data.partyGroupId |
|
|
partyGroupId: this.data.partyGroupId |
|
|
} |
|
|
} |
|
|
|
|
|
wx.showLoading({ |
|
|
|
|
|
title:'' |
|
|
|
|
|
}) |
|
|
getPartyUserList(para).then(res => { |
|
|
getPartyUserList(para).then(res => { |
|
|
console.log('获取群成员列表', res) |
|
|
console.log('获取群成员列表', res) |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
// currentUser: {...res.data.currentUser},
|
|
|
currentUser: {...res.data.currentUser}, |
|
|
gMembersList: [...this.data.gMembersList, ...res.data], |
|
|
gMembersList: [...this.data.gMembersList, ...res.data.otherUsers], |
|
|
loadMoreType: res.data.length === this.data.pageSize ? 'loading': 'none', |
|
|
loadMoreType: res.data.length === this.data.pageSize ? 'loading': 'none', |
|
|
preloadVisible: false |
|
|
preloadVisible: false |
|
|
}) |
|
|
}) |
|
|
|
|
|
wx.hideLoading() |
|
|
}).catch(err => { |
|
|
}).catch(err => { |
|
|
console.log(err) |
|
|
console.log(err) |
|
|
this.setData({ |
|
|
this.setData({ |
|
@ -98,11 +81,10 @@ Page({ |
|
|
const para = {...e.detail} |
|
|
const para = {...e.detail} |
|
|
postUserBanned(para).then(res => { |
|
|
postUserBanned(para).then(res => { |
|
|
console.log('用户禁言', res) |
|
|
console.log('用户禁言', res) |
|
|
this.data.gMembersList = this.data.gMembersList.map( item => { |
|
|
this.data.gMembersList.forEach(item => { |
|
|
if (item.userId === e.detail.userId) { |
|
|
if (item.id === e.detail.groupUserId) { |
|
|
item.bannedFlag = e.detail.bannedFlag |
|
|
item.bannedFlag = e.detail.bannedFlag |
|
|
} |
|
|
} |
|
|
return item |
|
|
|
|
|
}) |
|
|
}) |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
gMembersList: this.data.gMembersList |
|
|
gMembersList: this.data.gMembersList |
|
@ -116,6 +98,10 @@ Page({ |
|
|
const para = {...e.detail} |
|
|
const para = {...e.detail} |
|
|
postModifyIdentity(para).then(res => { |
|
|
postModifyIdentity(para).then(res => { |
|
|
console.log('修改用户身份', res) |
|
|
console.log('修改用户身份', res) |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
gMembersList: [], |
|
|
|
|
|
currentUser: {} |
|
|
|
|
|
}) |
|
|
this.getPartyUserList(); |
|
|
this.getPartyUserList(); |
|
|
}).catch(err => { |
|
|
}).catch(err => { |
|
|
console.log(err) |
|
|
console.log(err) |
|
|