|
@@ -189,15 +189,18 @@ export default {
|
|
|
let messageList = allMessages[message.toContactId];
|
|
|
// 如果是自己的消息需要push,发送的消息不再增加未读条数
|
|
|
let conversation=this.findConversation(message.toContactId);
|
|
|
- let unread=!!conversation.unread && conversation.unread>0?(conversation.unread+1):1;
|
|
|
- if (message.type == 'event' || this.user.id == message.fromUser.id) unread = "+0";
|
|
|
+ let unread=conversation.unread!=undefined && conversation.unread>0?(conversation.unread+1):1;
|
|
|
+ if (message.type == 'event'){
|
|
|
+ // if(this.user.id == message.fromUser.id){}
|
|
|
+ unread = 0;
|
|
|
+ }
|
|
|
if (messageList === undefined) {
|
|
|
- this.updateContact({
|
|
|
- id: message.toContactId,
|
|
|
- unread: unread,
|
|
|
- lastSendTime: message.sendTime,
|
|
|
- lastContent: this.lastContentRender(message),
|
|
|
- });
|
|
|
+ //console.log("qxj appendMessage messageList:"+messageList+",message"+JSON.stringify(message));
|
|
|
+ conversation.id=message.toContactId;
|
|
|
+ conversation.unread = unread;
|
|
|
+ conversation.lastSendTime=message.sendTime;
|
|
|
+ conversation.lastContent=this.lastContentRender(message);
|
|
|
+ this.updateContact(conversation);
|
|
|
} else {
|
|
|
// 如果消息存在则不再添加
|
|
|
let hasMsg = messageList.some(({id})=>id == message.id);
|
|
@@ -207,7 +210,6 @@ export default {
|
|
|
conversation.lastContent=this.lastContentRender(message);
|
|
|
conversation.lastSendTime=message.sendTime;
|
|
|
if (message.toContactId == this.currentContactId) {
|
|
|
-
|
|
|
conversation.unread=0;
|
|
|
if (scrollToBottom == true) {
|
|
|
this.messageViewToBottom();
|
|
@@ -971,20 +973,20 @@ export default {
|
|
|
return false;
|
|
|
}
|
|
|
if (this.hasConversation(conversation.conversationId)) return true;
|
|
|
- this.conversations.push(
|
|
|
- Object.assign(
|
|
|
- {
|
|
|
+ let insConversation=Object.assign({
|
|
|
conversationId: "",
|
|
|
displayName: "",
|
|
|
avatar: "",
|
|
|
index: "",
|
|
|
- unread: 0,
|
|
|
+ unread: 1,
|
|
|
lastSendTime: "",
|
|
|
lastContent: "",
|
|
|
- },
|
|
|
- conversation,
|
|
|
- ),
|
|
|
- );
|
|
|
+ },conversation
|
|
|
+ );
|
|
|
+ console.log("qxj insConversation:"+JSON.stringify(insConversation));
|
|
|
+ this.conversations.unshift(insConversation);
|
|
|
+ // this.updateContact(insConversation);
|
|
|
+ //this.conversations.push(insConversation);
|
|
|
return true;
|
|
|
},
|
|
|
removeContact(id) {
|