mirror of
https://github.com/kuaifan/dootask.git
synced 2026-02-28 04:40:37 +00:00
perf: ws重连后重新获取会员基本信息
This commit is contained in:
parent
464d7bc635
commit
c53d7a5dd2
@ -95,12 +95,16 @@
|
||||
this.setUser(data)
|
||||
}
|
||||
});
|
||||
this.$store.state.userAvatar[this._uid] = this.$props;
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (this.subscribe) {
|
||||
this.subscribe.unsubscribe();
|
||||
this.subscribe = null;
|
||||
}
|
||||
if (this.$store.state.userAvatar[this._uid] !== undefined) {
|
||||
delete this.$store.state.userAvatar[this._uid];
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...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 timeout
|
||||
* @returns {Promise<unknown>}
|
||||
*/
|
||||
getBasicData({dispatch}, timeout) {
|
||||
getBasicData({state, dispatch}, timeout) {
|
||||
if (typeof timeout === "number") {
|
||||
return new Promise(resolve => {
|
||||
window.__getBasicData && clearTimeout(window.__getBasicData)
|
||||
@ -270,6 +271,11 @@ export default {
|
||||
dispatch("getProjects").catch(() => {});
|
||||
dispatch("getDialogs").catch(() => {});
|
||||
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: '',
|
||||
userIsAdmin: false,
|
||||
userOnline: {},
|
||||
userAvatar: {},
|
||||
|
||||
// 会话聊天
|
||||
dialogMsgs: [],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user