mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 19:35:50 +00:00
perf: 项目、消息对话置顶后要滚动到可以看到它的位置
This commit is contained in:
parent
b0b7c63561
commit
41ceb9bd82
@ -889,9 +889,17 @@ export default {
|
||||
project_id: this.topOperateItem.id,
|
||||
},
|
||||
}).then(() => {
|
||||
this.$store.dispatch("getProjects").catch(() => {});
|
||||
this.$store.dispatch("getProjects").then(() => {
|
||||
let active = this.$refs.projectWrapper.querySelector(".active")
|
||||
if (active) {
|
||||
$A.scrollToView(active, {
|
||||
behavior: 'smooth',
|
||||
scrollMode: 'if-needed',
|
||||
});
|
||||
}
|
||||
}).catch(() => {});
|
||||
}).catch(({msg}) => {
|
||||
$A.modalError(msg, 301);
|
||||
$A.modalError(msg);
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@ -470,11 +470,11 @@ export default {
|
||||
dialog_id: this.topOperateItem.id,
|
||||
},
|
||||
}).then(() => {
|
||||
this.$store.dispatch("getDialogs");
|
||||
this.$Modal.remove();
|
||||
this.$store.dispatch("getDialogs").then(() => {
|
||||
this.scrollIntoActive(true)
|
||||
});
|
||||
}).catch(({msg}) => {
|
||||
$A.modalError(msg, 301);
|
||||
this.$Modal.remove();
|
||||
$A.modalError(msg);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
28
resources/assets/js/store/actions.js
vendored
28
resources/assets/js/store/actions.js
vendored
@ -205,7 +205,7 @@ export default {
|
||||
*/
|
||||
getBasicData({dispatch}) {
|
||||
dispatch("getProjects").catch(() => {});
|
||||
dispatch("getDialogs");
|
||||
dispatch("getDialogs").catch(() => {});
|
||||
dispatch("getTaskForDashboard");
|
||||
},
|
||||
|
||||
@ -1813,18 +1813,24 @@ export default {
|
||||
* 获取会话列表
|
||||
* @param state
|
||||
* @param dispatch
|
||||
* @returns {Promise<unknown>}
|
||||
*/
|
||||
getDialogs({state, dispatch}) {
|
||||
if (state.userId === 0) {
|
||||
state.cacheDialogs = [];
|
||||
return;
|
||||
}
|
||||
dispatch("call", {
|
||||
url: 'dialog/lists',
|
||||
}).then(result => {
|
||||
dispatch("saveDialog", result.data.data);
|
||||
}).catch(e => {
|
||||
console.warn(e);
|
||||
return new Promise(function (resolve, reject) {
|
||||
if (state.userId === 0) {
|
||||
state.cacheDialogs = [];
|
||||
reject({msg: 'Parameter error'});
|
||||
return;
|
||||
}
|
||||
dispatch("call", {
|
||||
url: 'dialog/lists',
|
||||
}).then(result => {
|
||||
dispatch("saveDialog", result.data.data);
|
||||
resolve(result)
|
||||
}).catch(e => {
|
||||
console.warn(e);
|
||||
reject(e)
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user