diff --git a/src/views/circle/detail/components/newsList.vue b/src/views/circle/detail/components/newsList.vue index 5e6775e..a16f349 100644 --- a/src/views/circle/detail/components/newsList.vue +++ b/src/views/circle/detail/components/newsList.vue @@ -139,7 +139,7 @@ export default { privateNewMsg(msg) { if ( msg.userType !== 2 || - (msg.userType === 2 && this.privateNewMsg.privateUserId === this.userId) + (msg.userType === 2 && msg.privateUserId === this.userId) ) { this.list.unshift(msg); } diff --git a/src/views/circle/detail/components/privateChat.vue b/src/views/circle/detail/components/privateChat.vue index edb4f1c..1444c83 100644 --- a/src/views/circle/detail/components/privateChat.vue +++ b/src/views/circle/detail/components/privateChat.vue @@ -2,11 +2,9 @@
- 返回群聊 + 返回群聊
{{ userInfo.userName }}
私聊中
diff --git a/src/views/circle/detail/components/privateList.vue b/src/views/circle/detail/components/privateList.vue index fffba01..1d8dc45 100644 --- a/src/views/circle/detail/components/privateList.vue +++ b/src/views/circle/detail/components/privateList.vue @@ -19,7 +19,7 @@ - +

@@ -76,10 +76,10 @@ export default { privateNewMsg(msg) { if (this.userIdsMsgObj[msg.privateUserId]) { Object.assign(this.userIdsMsgObj[msg.privateUserId], msg); - this.$set(msg, "newMsgTip", true); + this.$set(this.userIdsMsgObj[msg.privateUserId], "newMsgTip", true); } else { this.list.unshift(msg); - this.$set(msg, "newMsgTip", true); + this.$set(this.userIdsMsgObj[msg.privateUserId], "newMsgTip", true); } this.list = this.list.sort((x, y) => { return ( @@ -113,15 +113,14 @@ export default { } this.loading = false; }, - searchMsg() { + async searchMsg() { + await this.getPrivateChatList(); if (this.keyword) { this.filterList = this.list.filter(item => { const userName = item.userType !== 2 ? item.privateUserName : item.userName; return userName.includes(this.keyword); }); - } else { - this.filterList = this.list; } } } diff --git a/src/views/circle/detail/index.vue b/src/views/circle/detail/index.vue index 3c9b482..2b076ee 100644 --- a/src/views/circle/detail/index.vue +++ b/src/views/circle/detail/index.vue @@ -321,10 +321,17 @@ export default { }); }, toPrivateChat(userInfo) { - this.privateUserInfo = Object.assign({ - privateUserId: userInfo.userId, - privateUserName: userInfo.userName - }); + this.privateUserInfo = Object.assign( + userInfo.userType === 2 + ? { + privateUserId: userInfo.userId, + privateUserName: userInfo.userName + } + : { + privateUserId: userInfo.privateUserId, + privateUserName: userInfo.privateUserName + } + ); this.chatType = 2; }, closePrivateChat() { @@ -382,7 +389,6 @@ export default { } }, handlePrivateChatTopic(msg) { - debugger; console.log("handlePrivateChatTopic", msg); const body = JSON.parse(msg.body); if ([1].includes(body.type)) {