fix:imSDK close

feature/im-0611-ch
ch 2 years ago
parent adafa9ff2c
commit b8a6c1e9f5

@ -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 11:48:41 * @LastEditTime: 2022-06-13 20:27:34
* @Description: file content * @Description: file content
*/ */
@ -39,7 +39,6 @@ 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;
store.commit('setSocketMsgData', JSON.parse(JSON.stringify(data))); store.commit('setSocketMsgData', JSON.parse(JSON.stringify(data)));
store.commit('setUnreadCount', msgCount); store.commit('setUnreadCount', msgCount);

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-05-18 14:54:47 * @Date: 2022-05-18 14:54:47
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-13 19:52:36 * @LastEditTime: 2022-06-13 21:04:11
* @Description: file content * @Description: file content
*/ */
import { CreateUUID, FormatDate, ToAsyncAwait } from "@/plugins/utils"; import { CreateUUID, FormatDate, ToAsyncAwait } from "@/plugins/utils";
@ -33,6 +33,7 @@ const fromatPotoReq = (traceId, traceType, content) => {
message: res.getMessage(), message: res.getMessage(),
}; };
}; };
class MsbIm { class MsbIm {
defaultOption = { defaultOption = {
ioKey: 'traceId', ioKey: 'traceId',
@ -458,5 +459,11 @@ class MsbIm {
} }
return Promise.resolve(result); return Promise.resolve(result);
} }
close() {
this.socket.close();
this.socket = null;
this.isOpen = false;
this.setSessionData([]);
}
} }
export default MsbIm; export default MsbIm;
Loading…
Cancel
Save