From 06663dd1a9c6514f8ec378d1e712099e91152028 Mon Sep 17 00:00:00 2001 From: aipaw Date: Tue, 22 Jun 2021 09:07:50 +0800 Subject: [PATCH] no message --- resources/assets/js/store/actions.js | 47 +++++++++++++++++----------- resources/assets/js/store/getters.js | 1 + 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index fca708c9..51c92580 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -628,20 +628,25 @@ export default { * @param state * @param dispatch * @param task_id + * @returns {Promise} */ getTaskOne({state, dispatch}, task_id) { - if (state.method.runNum(task_id) === 0) { - return; - } - dispatch("call", { - url: 'project/task/one', - data: { - task_id, - }, - }).then(result => { - dispatch("saveTask", result.data); - }).catch(e => { - console.error(e); + return new Promise(function (resolve, reject) { + if (state.method.runNum(task_id) === 0) { + return; + } + dispatch("call", { + url: 'project/task/one', + data: { + task_id, + }, + }).then(result => { + dispatch("saveTask", result.data); + resolve(result) + }).catch(e => { + console.error(e); + reject(e) + }); }); }, @@ -762,10 +767,18 @@ export default { openTask({state, dispatch}, task_id) { state.taskId = task_id; if (task_id > 0) { - dispatch("getTaskOne", task_id); - dispatch("getTaskContent", task_id); - dispatch("getTaskFiles", task_id); - dispatch("getTasks", {parent_id: task_id}); + dispatch("getTaskOne", task_id).then(() => { + dispatch("getTaskContent", task_id); + dispatch("getTaskFiles", task_id); + dispatch("getTasks", {parent_id: task_id}); + }).catch(({msg}) => { + $A.modalWarning({ + content: msg, + onOk: () => { + state.taskId = 0; + } + }); + }); } }, @@ -961,7 +974,6 @@ export default { openDialogUserid({state, dispatch}, userid) { return new Promise(function (resolve, reject) { if (userid === state.userId) { - reject(); return; } dispatch("call", { @@ -1049,7 +1061,6 @@ export default { getDialogMsgListNextPage({state, dispatch, commit}) { return new Promise(function (resolve, reject) { if (!state.dialogMsgHasMorePages) { - reject() return; } state.dialogMsgHasMorePages = false; diff --git a/resources/assets/js/store/getters.js b/resources/assets/js/store/getters.js index fa23a7b2..59c2f634 100644 --- a/resources/assets/js/store/getters.js +++ b/resources/assets/js/store/getters.js @@ -1,5 +1,6 @@ export default { projectData(state) { + console.log(111); let projectId = state.projectId; if (projectId == 0) { projectId = state.method.runNum(window.__projectId);