|
@@ -133,24 +133,24 @@ const user: Module<UserState, UserState> = {
|
|
|
|
|
|
|
|
|
|
|
|
- if (this.wsManager) {
|
|
|
- this.wsManager.closeConnection();
|
|
|
- } else {
|
|
|
- //获取账户时,连接soket
|
|
|
- const ms = new WebSocketManager(res.user.userId);
|
|
|
- // 设置消息回调
|
|
|
- ms.onMessage(data => {
|
|
|
- console.log("处理消息逻辑", data.data)
|
|
|
- // 处理消息逻辑
|
|
|
- if (data.type === 'msgUnreadCount') {
|
|
|
- commit('SET_MESSAGECOUNT', data.data);
|
|
|
- }
|
|
|
- });
|
|
|
- // 建立连接
|
|
|
- ms.connect();
|
|
|
- commit('SET_MESSAGE', ms)
|
|
|
-
|
|
|
- }
|
|
|
+ // if (this.wsManager) {
|
|
|
+ // this.wsManager.closeConnection();
|
|
|
+ // } else {
|
|
|
+ // //获取账户时,连接soket
|
|
|
+ // const ms = new WebSocketManager(res.user.userId);
|
|
|
+ // // 设置消息回调
|
|
|
+ // ms.onMessage(data => {
|
|
|
+ // console.log("处理消息逻辑", data.data)
|
|
|
+ // // 处理消息逻辑
|
|
|
+ // if (data.type === 'msgUnreadCount') {
|
|
|
+ // commit('SET_MESSAGECOUNT', data.data);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // // 建立连接
|
|
|
+ // ms.connect();
|
|
|
+ // commit('SET_MESSAGE', ms)
|
|
|
+
|
|
|
+ // }
|
|
|
|
|
|
|
|
|
resolve(res)
|
|
@@ -182,6 +182,9 @@ const user: Module<UserState, UserState> = {
|
|
|
handleMessageCount({ commit, state }, count) {
|
|
|
commit('SET_MESSAGECOUNT', count);
|
|
|
},
|
|
|
+ handleSoket({ commit, state }, ms) {
|
|
|
+ commit('SET_MESSAGE', ms);
|
|
|
+ },
|
|
|
handlerAddress({ commit, state }, address) {
|
|
|
commit('SET_ADDRESSINFO', address);
|
|
|
},
|