mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-17 11:13:26 +00:00
perf: ws重连后重新获取会员基本信息
This commit is contained in:
parent
464d7bc635
commit
c53d7a5dd2
@ -95,12 +95,16 @@
|
|||||||
this.setUser(data)
|
this.setUser(data)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.$store.state.userAvatar[this._uid] = this.$props;
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
if (this.subscribe) {
|
if (this.subscribe) {
|
||||||
this.subscribe.unsubscribe();
|
this.subscribe.unsubscribe();
|
||||||
this.subscribe = null;
|
this.subscribe = null;
|
||||||
}
|
}
|
||||||
|
if (this.$store.state.userAvatar[this._uid] !== undefined) {
|
||||||
|
delete this.$store.state.userAvatar[this._uid];
|
||||||
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["userId", "userInfo", "userOnline", "cacheUserBasic"]),
|
...mapState(["userId", "userInfo", "userOnline", "cacheUserBasic"]),
|
||||||
|
|||||||
10
resources/assets/js/store/actions.js
vendored
10
resources/assets/js/store/actions.js
vendored
@ -250,12 +250,13 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取基本数据(项目、对话、仪表盘任务)
|
* 获取基本数据(项目、对话、仪表盘任务、会员基本信息)
|
||||||
|
* @param state
|
||||||
* @param dispatch
|
* @param dispatch
|
||||||
* @param timeout
|
* @param timeout
|
||||||
* @returns {Promise<unknown>}
|
* @returns {Promise<unknown>}
|
||||||
*/
|
*/
|
||||||
getBasicData({dispatch}, timeout) {
|
getBasicData({state, dispatch}, timeout) {
|
||||||
if (typeof timeout === "number") {
|
if (typeof timeout === "number") {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
window.__getBasicData && clearTimeout(window.__getBasicData)
|
window.__getBasicData && clearTimeout(window.__getBasicData)
|
||||||
@ -270,6 +271,11 @@ export default {
|
|||||||
dispatch("getProjects").catch(() => {});
|
dispatch("getProjects").catch(() => {});
|
||||||
dispatch("getDialogs").catch(() => {});
|
dispatch("getDialogs").catch(() => {});
|
||||||
dispatch("getTaskForDashboard");
|
dispatch("getTaskForDashboard");
|
||||||
|
//
|
||||||
|
const allIds = Object.values(state.userAvatar).map(({userid}) => userid);
|
||||||
|
[...new Set(allIds)].some(userid => {
|
||||||
|
dispatch("getUserBasic", {userid});
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
1
resources/assets/js/store/state.js
vendored
1
resources/assets/js/store/state.js
vendored
@ -50,6 +50,7 @@ const stateData = {
|
|||||||
userToken: '',
|
userToken: '',
|
||||||
userIsAdmin: false,
|
userIsAdmin: false,
|
||||||
userOnline: {},
|
userOnline: {},
|
||||||
|
userAvatar: {},
|
||||||
|
|
||||||
// 会话聊天
|
// 会话聊天
|
||||||
dialogMsgs: [],
|
dialogMsgs: [],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user