This commit is contained in:
2022-02-18 17:45:52 +08:00
parent a290ad8df8
commit ae7b9ead46
3 changed files with 29 additions and 25 deletions

View File

@@ -85,18 +85,18 @@
}, },
// 新朋友 // 新朋友
toPending() { toPending() {
if (this.pendingCount > 0) { // if (this.pendingCount > 0) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/im/friends/pending' url: '/pages/im/friends/pending'
}); });
} else { // } else {
uni.showToast({ // uni.showToast({
title: ` 暂无好友申请 ~ `, // title: ` 暂无好友申请 ~ `,
icon: "none", // icon: "none",
mask: true, // mask: true,
duration: 3000 // duration: 3000
}) // })
} // }
} }
}, },
onNavigationBarButtonTap(e) { onNavigationBarButtonTap(e) {

View File

@@ -1,7 +1,7 @@
<template> <template>
<view class="container"> <view class="container">
<view class="members u-border-bottom"> <view class="members u-border-bottom">
<group-user-list :targetId="targetId" :count="14" /> <group-user-list ref="userList" :targetId="targetId" :count="14" />
</view> </view>
<u-cell-group class="cells" :border="false" > <u-cell-group class="cells" :border="false" >
@@ -94,11 +94,15 @@
}) })
this.initData() this.initData()
uni.$on('groupAnnouncementCreated', this.initData) uni.$on('groupAnnouncementCreated', this.initData)
uni.$on('groupInvitedUser', this.updateUserList)
}, },
onUnload() { onUnload() {
uni.$off('groupAnnouncementCreated') uni.$off('groupAnnouncementCreated')
}, },
methods: { methods: {
updateUserList() {
this.$refs.userList.initUsers()
},
initData() { initData() {
getGroupInfo(this.targetId).then(res => { getGroupInfo(this.targetId).then(res => {
console.log(res,'群信息。。。。。') console.log(res,'群信息。。。。。')

View File

@@ -13,12 +13,12 @@
<view v-for="(friendItem, index) in item" :key="index" class="friend-flex" <view v-for="(friendItem, index) in item" :key="index" class="friend-flex"
@click="addContact(friendItem.targetId)"> @click="addContact(friendItem.targetId)">
<u-checkbox :name="friendItem.targetId" shape="circle" activeColor="#34ce98" <u-checkbox :name="friendItem.targetId" shape="circle" activeColor="#34ce98"
style="margin-right: 20rpx;" :disabled="canSelect(friendItem.targetId)" /> style="margin-right: 20rpx;" :disabled="canSelect(friendItem.targetId)"
:checked="canSelect(friendItem.targetId)" />
<u-avatar class="avatar-img" size="40" shape="square" <u-avatar class="avatar-img" size="40" shape="square"
:src="contact(friendItem.targetId).portraitUrl" /> :src="contact(friendItem.targetId).portraitUrl" />
<view class="info"> <view class="info">
<view class="name">{{ contact(friendItem.targetId).name }}</view> <view class="name">{{ contact(friendItem.targetId).name }}</view>
<!-- <view class="address">Hash:{{ friendItem.address }}</view> -->
</view> </view>
</view> </view>
</u-index-item> </u-index-item>
@@ -78,19 +78,14 @@
this.friends = this.orignalFriends.map((list, index) => { this.friends = this.orignalFriends.map((list, index) => {
const resList = list.filter(item => item.name.indexOf(val) > 0) const resList = list.filter(item => item.name.indexOf(val) > 0)
if (resList.length > 0) { if (resList.length > 0) {
this.indexs.filter((t, i) => i == index) this.indexs = this.orignalIndexs.map((t, i) => {})
} else {
return;
} }
// if (resList.length > 0) {
// ix = this.orignalIndexs.map((t, i) => {
// if (i == index) {
// return t
// }
// }).filter(Boolean)
// }
return resList return resList
}) })
this.friends = this.friends.filter(n => n)
console.log( this.indexs);
} else { } else {
this.friends = this.orignalFriends this.friends = this.orignalFriends
this.indexs = this.orignalIndexs this.indexs = this.orignalIndexs
@@ -116,11 +111,16 @@
// 点击名字新增或删除选中数据 // 点击名字新增或删除选中数据
addContact(targetId) { addContact(targetId) {
const index = this.checkboxValue.findIndex(item => item == targetId) const index = this.checkboxValue.findIndex(item => item == targetId)
if (utils.inArray(targetId, this.selectValue)) {
} else {
if (index === -1) { if (index === -1) {
this.checkboxValue.push(targetId) this.checkboxValue.push(targetId)
} else { } else {
this.checkboxValue.splice(index, 1) this.checkboxValue.splice(index, 1)
} }
}
}, },
onInvite() { onInvite() {
inviteGroupUser(this.targetId, this.checkboxValue).then(res => { inviteGroupUser(this.targetId, this.checkboxValue).then(res => {
@@ -130,6 +130,7 @@
animationType: 'pop-out', animationType: 'pop-out',
animationDuration: 200 animationDuration: 200
}); });
uni.$emit('groupInvitedUser')
}).catch(err => { }).catch(err => {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
@@ -137,7 +138,6 @@
}) })
}) })
} }
} }
}; };
</script> </script>