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

@@ -13,12 +13,12 @@
<view v-for="(friendItem, index) in item" :key="index" class="friend-flex"
@click="addContact(friendItem.targetId)">
<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"
:src="contact(friendItem.targetId).portraitUrl" />
<view class="info">
<view class="name">{{ contact(friendItem.targetId).name }}</view>
<!-- <view class="address">Hash:{{ friendItem.address }}</view> -->
</view>
</view>
</u-index-item>
@@ -78,19 +78,14 @@
this.friends = this.orignalFriends.map((list, index) => {
const resList = list.filter(item => item.name.indexOf(val) > 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
})
this.friends = this.friends.filter(n => n)
console.log( this.indexs);
} else {
this.friends = this.orignalFriends
this.indexs = this.orignalIndexs
@@ -116,11 +111,16 @@
// 点击名字新增或删除选中数据
addContact(targetId) {
const index = this.checkboxValue.findIndex(item => item == targetId)
if (index === -1) {
this.checkboxValue.push(targetId)
if (utils.inArray(targetId, this.selectValue)) {
} else {
this.checkboxValue.splice(index, 1)
if (index === -1) {
this.checkboxValue.push(targetId)
} else {
this.checkboxValue.splice(index, 1)
}
}
},
onInvite() {
inviteGroupUser(this.targetId, this.checkboxValue).then(res => {
@@ -130,6 +130,7 @@
animationType: 'pop-out',
animationDuration: 200
});
uni.$emit('groupInvitedUser')
}).catch(err => {
uni.showToast({
icon: 'none',
@@ -137,7 +138,6 @@
})
})
}
}
};
</script>