|
@@ -31,18 +31,18 @@ const mutations = {
|
|
|
},
|
|
|
setSessionItemUnread (state, data) {
|
|
|
console.log('进来寻找session', data.unread, data, data.cont)
|
|
|
- state.sessionList.forEach((item, index) => {
|
|
|
+ state.sessionList.forEach((item) => {
|
|
|
if (item.session_id == `${data.session_id}`) {
|
|
|
- if (!data.unread) {
|
|
|
- item.unread = 0
|
|
|
- } else if (data.curSession != data.session_id) {
|
|
|
- item.unread += data.unread
|
|
|
+ let unread = item.unread
|
|
|
+ if (data.unread && data.curSession != data.session_id) {
|
|
|
+ unread += data.unread
|
|
|
} else {
|
|
|
- item.unread = 0
|
|
|
+ unread = 0
|
|
|
}
|
|
|
|
|
|
+ Vue.set(item, 'unread', unread)
|
|
|
Vue.set(item, 'cont', data.cont ? data.cont : item.cont)
|
|
|
- objSession.setUnread(item.session_id, item.unread)
|
|
|
+ objSession.setUnread(item.session_id, unread)
|
|
|
}
|
|
|
})
|
|
|
},
|