fix: bug修复

This commit is contained in:
kaizheng(郑凯) 2025-03-02 16:56:23 +08:00
parent bde3379cb6
commit 5672b74037
2 changed files with 18 additions and 7 deletions

View File

@ -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;
}
</style>

View File

@ -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();
},