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.
79 lines
2.0 KiB
79 lines
2.0 KiB
import { getAssociationMember, deleteMember } from '../../utils/api'
|
|
import convertPY from '../../utils/convertPY'
|
|
|
|
Page({
|
|
data: {
|
|
associationMemberList: [],
|
|
groupId: '',
|
|
id: '',
|
|
dialogVisible: false,
|
|
groupCategory: '1'
|
|
},
|
|
onShow () {
|
|
},
|
|
onLoad (options) {
|
|
this.getAssociationMember(options.id)
|
|
this.setData({
|
|
groupId: options.id,
|
|
groupCategory: options.groupCategory
|
|
})
|
|
},
|
|
getAssociationMember (groupId) {
|
|
const para = {
|
|
state: 10,
|
|
groupId,
|
|
}
|
|
getAssociationMember(para).then(res => {
|
|
console.log('审核通过群成员',res)
|
|
let associationMemberList = []
|
|
res.data.forEach(item => {
|
|
const alphabet = convertPY.convertPYs(item.nickname)
|
|
const index = associationMemberList.findIndex(item => item.alphabet === alphabet)
|
|
if (index > -1) {
|
|
associationMemberList[index].memberList.push(item)
|
|
} else {
|
|
associationMemberList.push({
|
|
alphabet: alphabet,
|
|
memberList: [item]
|
|
})
|
|
}
|
|
})
|
|
associationMemberList.sort((a,b) => a.alphabet.charCodeAt() - b.alphabet.charCodeAt())
|
|
this.setData({
|
|
associationMemberList
|
|
})
|
|
}).catch(err => {
|
|
console.log(err)
|
|
})
|
|
},
|
|
deleteMember (e) {
|
|
this.setData({
|
|
id: e.detail.userId,
|
|
dialogVisible: !this.data.dialogVisible
|
|
})
|
|
},
|
|
confirmDialog () {
|
|
const para = {
|
|
groupId: this.data.groupId,
|
|
userId: this.data.id
|
|
}
|
|
wx.showLoading({
|
|
title: '加载中',
|
|
})
|
|
deleteMember(para).then(res => {
|
|
wx.hideLoading()
|
|
wx.showToast({
|
|
title: '删除群成员成功',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
this.getAssociationMember(this.data.groupId)
|
|
const pages = getCurrentPages()
|
|
const page = pages[pages.length - 2]
|
|
page.getAssociationDetail()
|
|
console.log('删除群成员',res)
|
|
}).catch(err => {
|
|
console.log(err)
|
|
})
|
|
}
|
|
})
|