fix:通知消息不更新问题

feature/im-0611-ch
ch 2 years ago
parent d04791081c
commit b96a231952

@ -147,7 +147,7 @@ export default {
return false; return false;
} }
// IM // IM
ImInit().then((res) => { ImInit().then(() => {
// //
Im.getSessionList(); Im.getSessionList();
}).catch(e => {}); }).catch(e => {});

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-05-04 17:48:12 * @Date: 2022-05-04 17:48:12
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-13 10:50:28 * @LastEditTime: 2022-06-13 11:49:37
* @Description: file content * @Description: file content
--> -->
@ -65,7 +65,9 @@ export default {
}, },
computed: { computed: {
curSession(){ curSession(){
return this.$store.state.socketMsgData; let data = this.$store.state.socketMsgData
Im.setCurSessionId(data.id);
return data;
}, },
msgData(){ msgData(){
let data = this.curSession.messageList || []; let data = this.curSession.messageList || [];
@ -77,6 +79,7 @@ export default {
}, },
}, },
mounted() { mounted() {
setTimeout(()=>{ setTimeout(()=>{
this.readMsg(); this.readMsg();
},5000) },5000)
@ -109,6 +112,10 @@ export default {
} }
} }
}, },
destroyed(){
Im.setCurSessionId(null);
}
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-12 14:04:56 * @Date: 2022-06-12 14:04:56
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-13 10:52:48 * @LastEditTime: 2022-06-13 11:48:41
* @Description: file content * @Description: file content
*/ */
@ -39,8 +39,8 @@ export default ({store }) => {
let data = Im.sessionData.find(i => { let data = Im.sessionData.find(i => {
return (i.type === 4 && (typeof i.payload === 'string' ? JSON.parse(i.payload).type === 'system' : false)); return (i.type === 4 && (typeof i.payload === 'string' ? JSON.parse(i.payload).type === 'system' : false));
}) || {} }) || {}
console.log(data,'---');
let msgCount = data.unreadCount || 0; let msgCount = data.unreadCount || 0;
Im.setCurSessionId(data.id);
store.commit('setSocketMsgData', JSON.parse(JSON.stringify(data))); store.commit('setSocketMsgData', JSON.parse(JSON.stringify(data)));
store.commit('setUnreadCount', msgCount); store.commit('setUnreadCount', msgCount);
} }

Loading…
Cancel
Save