From 5672b74037c93b9a74650ecb9c30d3424ba00721 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kaizheng=28=E9=83=91=E5=87=AF=29?= Date: Sun, 2 Mar 2025 16:56:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../circle/detail/components/privateList.vue | 15 +++++++++++---- src/views/circle/detail/components/userList.vue | 10 +++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/views/circle/detail/components/privateList.vue b/src/views/circle/detail/components/privateList.vue index 11e5fe7..1fc759e 100644 --- a/src/views/circle/detail/components/privateList.vue +++ b/src/views/circle/detail/components/privateList.vue @@ -91,7 +91,7 @@ export default { groupId(value) { this.params.id = value; this.keyword = ""; - this.getPrivateChatList(); + this.searchMsg(); }, privateNewMsg(msg) { if (this.userIdsMsgObj[msg.privateUserId]) { @@ -126,8 +126,12 @@ export default { new Date(y.createTime).getTime() - new Date(x.createTime).getTime() ); }); - list.forEach(item => { - this.userIdsMsgObj[item.privateUserId] = item; + list.forEach((item, index) => { + if (this.userIdsMsgObj[item.privateUserId]) { + list.splice(index, 1); + } else { + this.userIdsMsgObj[item.privateUserId] = item; + } }); this.list = this.list.concat(list); this.filterList = this.list; @@ -136,6 +140,9 @@ export default { this.loading = false; }, async searchMsg() { + this.hasNext = true; + this.list = []; + this.userIdsMsgObj = {}; this.params.current = 0; await this.getPrivateChatList(); // if (this.keyword) { @@ -153,7 +160,6 @@ export default { .list-wrap { height: 600px; overflow-y: scroll; - background: #fff; } .search { display: flex; @@ -210,5 +216,6 @@ ul { .load-tip { text-align: center; line-height: 50px; + background: #fff; } diff --git a/src/views/circle/detail/components/userList.vue b/src/views/circle/detail/components/userList.vue index 33aae47..8957a30 100644 --- a/src/views/circle/detail/components/userList.vue +++ b/src/views/circle/detail/components/userList.vue @@ -67,7 +67,6 @@ export default { }, methods: { modifyStateCallback(item) { - debugger; this.$emit("modifyStateCallback", item); }, async getList() { @@ -79,8 +78,12 @@ export default { if (ret && ret.code === 0 && ret.data.list) { const list = ret.data.list; - list.forEach(item => { - this.userIdsObj[item.privateUserId] = item; + list.forEach((item, index) => { + if (this.userIdsObj[item.privateUserId]) { + list.splice(index, 1); + } else { + this.userIdsObj[item.privateUserId] = item; + } }); this.list = this.list.concat(list); this.hasNext = ret.data.list.length === this.params.size; @@ -90,6 +93,7 @@ export default { searchMsg() { this.hasNext = true; this.params.current = 0; + this.userIdsObj = {}; this.list = []; this.getList(); },