|
@@ -63,13 +63,13 @@ const user: Module<UserState, UserState> = {
|
|
|
state.userId = id
|
|
|
},
|
|
|
SET_MESSAGECOUNT: (state, num: Number) => {
|
|
|
- console.log("TCL: num", num)
|
|
|
+ console.log("TCL: num", num)
|
|
|
state.messageCount = num
|
|
|
},
|
|
|
- SET_MESSAGE: (state, ms:any) => {
|
|
|
+ SET_MESSAGE: (state, ms: any) => {
|
|
|
state.wsManager = ms
|
|
|
},
|
|
|
- SET_ADDRESSINFO: (state, data:any) => {
|
|
|
+ SET_ADDRESSINFO: (state, data: any) => {
|
|
|
state.addressInfo = data
|
|
|
},
|
|
|
},
|
|
@@ -120,10 +120,10 @@ const user: Module<UserState, UserState> = {
|
|
|
commit('SET_USERID', res.user.userId)
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
if (this.wsManager) {
|
|
|
this.wsManager.closeConnection();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
//获取账户时,连接soket
|
|
|
const ms = new WebSocketManager(res.user.userId);
|
|
|
// 设置消息回调
|
|
@@ -139,7 +139,7 @@ const user: Module<UserState, UserState> = {
|
|
|
commit('SET_MESSAGE', ms)
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
resolve(res)
|
|
|
}).catch(error => {
|
|
@@ -173,6 +173,19 @@ const user: Module<UserState, UserState> = {
|
|
|
handlerAddress({ commit, state }, address) {
|
|
|
commit('SET_ADDRESSINFO', address);
|
|
|
},
|
|
|
+ // 退出系统
|
|
|
+ ClearUserInfo({ commit, state }) {
|
|
|
+ console.log('ClearUserInfo');
|
|
|
+
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ commit('SET_TOKEN', '')
|
|
|
+ commit('SET_ROLES', [])
|
|
|
+ commit('SET_PERMISSIONS', [])
|
|
|
+ removeToken()
|
|
|
+ uni.removeStorageSync('userId')
|
|
|
+ storage.clean()
|
|
|
+ })
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
|