You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
657 B
32 lines
657 B
3 years ago
|
/*
|
||
|
* @Author: ch
|
||
|
* @Date: 2022-05-20 11:00:07
|
||
|
* @LastEditors: ch
|
||
|
* @LastEditTime: 2022-05-20 11:36:51
|
||
|
* @Description: file content
|
||
|
*/
|
||
|
|
||
|
import MsbIm from '@/common/plugins/msbIm' ;
|
||
|
import $store from '@/common/store';
|
||
|
|
||
|
const Im = new MsbIm({
|
||
|
reconnect: true,
|
||
|
});
|
||
|
const ImInit = () => {
|
||
|
return Im.init({
|
||
|
url: `wss://k8s-horse-gateway.mashibing.cn/ws?client=${$store.state.token}&type=1`
|
||
|
})
|
||
|
};
|
||
|
Im.interceptors.dataChangeAfter = () => {
|
||
|
$store.commit('SET_SESSION_DATA', Im.sessionData);
|
||
|
let msgCount = 0;
|
||
|
Im.sessionData.forEach(i => {
|
||
|
msgCount += i.unreadCount;
|
||
|
})
|
||
|
$store.commit('SET_SESSION_MSG_COUNT', msgCount);
|
||
|
}
|
||
|
export {
|
||
|
Im,
|
||
|
ImInit
|
||
|
}
|