|
|
|
@ -70,6 +70,8 @@ export default { |
|
|
|
if (state.chats[idx].type == chatInfo.type && |
|
|
|
state.chats[idx].targetId == chatInfo.targetId) { |
|
|
|
state.chats[idx].unreadCount = 0; |
|
|
|
state.chats[idx].atMe = false; |
|
|
|
state.chats[idx].atAll = false; |
|
|
|
} |
|
|
|
} |
|
|
|
this.commit("saveToStorage"); |
|
|
|
@ -127,7 +129,6 @@ export default { |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 会话列表内容
|
|
|
|
if(!state.loadingPrivateMsg && !state.loadingPrivateMsg){ |
|
|
|
if (msgInfo.type == MESSAGE_TYPE.IMAGE) { |
|
|
|
@ -140,11 +141,23 @@ export default { |
|
|
|
chat.lastContent = msgInfo.content; |
|
|
|
} |
|
|
|
chat.lastSendTime = msgInfo.sendTime; |
|
|
|
chat.sendNickName = msgInfo.sendNickName; |
|
|
|
} |
|
|
|
|
|
|
|
// 未读加1
|
|
|
|
if (!msgInfo.selfSend && msgInfo.status != MESSAGE_STATUS.READED) { |
|
|
|
chat.unreadCount++; |
|
|
|
} |
|
|
|
// 是否有人@我
|
|
|
|
if(!msgInfo.selfSend && chat.type=="GROUP" && msgInfo.atUserIds){ |
|
|
|
let userId = userStore.state.userInfo.id; |
|
|
|
if(msgInfo.atUserIds.indexOf(userId)>=0){ |
|
|
|
chat.atMe = true; |
|
|
|
} |
|
|
|
if(msgInfo.atUserIds.indexOf(-1)>=0){ |
|
|
|
chat.atAll = true; |
|
|
|
} |
|
|
|
} |
|
|
|
// 记录消息的最大id
|
|
|
|
if (msgInfo.id && type == "PRIVATE" && msgInfo.id > state.privateMsgMaxId) { |
|
|
|
state.privateMsgMaxId = msgInfo.id; |
|
|
|
@ -267,10 +280,10 @@ export default { |
|
|
|
groupMsgMaxId: state.groupMsgMaxId, |
|
|
|
chats: state.chats |
|
|
|
} |
|
|
|
// uni.setStorage({
|
|
|
|
// key: key,
|
|
|
|
// data: chatsData
|
|
|
|
// })
|
|
|
|
uni.setStorage({ |
|
|
|
key: key, |
|
|
|
data: chatsData |
|
|
|
}) |
|
|
|
}, |
|
|
|
clear(state) { |
|
|
|
state.chats = []; |
|
|
|
|