diff --git a/resources/assets/js/pages/manage/project.vue b/resources/assets/js/pages/manage/project.vue index b600cf60e..87f18faf9 100644 --- a/resources/assets/js/pages/manage/project.vue +++ b/resources/assets/js/pages/manage/project.vue @@ -26,9 +26,22 @@ export default { project_id(id) { if (id > 0) { this.$store.state.projectId = $A.runNum(id); - this.$store.dispatch("getProjectOne", id); - this.$store.dispatch("getColumns", id); - this.$store.dispatch("getTasks", {project_id: id}); + this.$store.dispatch("getProjectOne", id).then(() => { + this.$store.dispatch("getColumns", id); + this.$store.dispatch("getTasks", {project_id: id}); + }).catch(({msg}) => { + $A.modalWarning({ + content: msg, + onOk: () => { + const project = this.$store.state.projects.find(({id}) => id); + if (project) { + $A.goForward({path: '/manage/project/' + project.id}); + } else { + $A.goForward({path: '/manage/dashboard'}); + } + } + }); + }); } } }, diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index 5a80198a3..fca708c96 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -284,7 +284,9 @@ export default { state.projects.push(data); } } - state.method.setStorage("cacheProjects", state.cacheProjects = state.projects); + setTimeout(() => { + state.method.setStorage("cacheProjects", state.cacheProjects = state.projects); + }) }, /** @@ -305,7 +307,9 @@ export default { $A.goForward({path: '/manage/dashboard'}); } } - state.method.setStorage("cacheProjects", state.cacheProjects = state.projects); + setTimeout(() => { + state.method.setStorage("cacheProjects", state.cacheProjects = state.projects); + }) }, /** @@ -336,17 +340,22 @@ export default { * @param state * @param dispatch * @param project_id + * @returns {Promise} */ getProjectOne({state, dispatch}, project_id) { - dispatch("call", { - url: 'project/one', - data: { - project_id, - }, - }).then(result => { - dispatch("saveProject", result.data); - }).catch(e => { - console.error(e); + return new Promise(function (resolve, reject) { + dispatch("call", { + url: 'project/one', + data: { + project_id, + }, + }).then(result => { + dispatch("saveProject", result.data); + resolve(result) + }).catch(e => { + console.error(e); + reject(e) + }); }); }, @@ -433,7 +442,9 @@ export default { state.columns.push(data); } } - state.method.setStorage("cacheColumns", state.cacheColumns = state.columns); + setTimeout(() => { + state.method.setStorage("cacheColumns", state.cacheColumns = state.columns); + }) }, /** @@ -448,7 +459,9 @@ export default { dispatch('getProjectOne', state.columns[index].project_id) state.columns.splice(index, 1); } - state.method.setStorage("cacheColumns", state.cacheColumns = state.columns); + setTimeout(() => { + state.method.setStorage("cacheColumns", state.cacheColumns = state.columns); + }) }, /** @@ -536,7 +549,9 @@ export default { dispatch("getTaskContent", data.id); } } - state.method.setStorage("cacheTasks", state.cacheTasks = state.tasks); + setTimeout(() => { + state.method.setStorage("cacheTasks", state.cacheTasks = state.tasks); + }) }, /** @@ -555,7 +570,9 @@ export default { if (state.taskId == task_id) { state.taskId = 0; } - state.method.setStorage("cacheTasks", state.cacheTasks = state.tasks); + setTimeout(() => { + state.method.setStorage("cacheTasks", state.cacheTasks = state.tasks); + }) }, /** diff --git a/resources/assets/js/store/state.js b/resources/assets/js/store/state.js index 7e1833a6d..246dfed5f 100644 --- a/resources/assets/js/store/state.js +++ b/resources/assets/js/store/state.js @@ -130,7 +130,9 @@ const method = { } let keyName = '__state__'; if (key.substring(0, 5) === 'cache') { - keyName = '__state:Cache__'; + keyName = '__state:' + key + '__'; + } else if (key.substring(0, 7) === 'boolean') { + keyName = '__state:Boolean__'; } if (typeof value === 'undefined') { return this.loadFromlLocal(key, '', keyName); diff --git a/resources/assets/sass/pages/page-manage.scss b/resources/assets/sass/pages/page-manage.scss index 1561d125c..ebc83f42b 100644 --- a/resources/assets/sass/pages/page-manage.scss +++ b/resources/assets/sass/pages/page-manage.scss @@ -105,6 +105,7 @@ align-items: center; height: auto; padding: 14px 0 0; + cursor: default; > ul { width: 100%; > li { @@ -112,6 +113,7 @@ flex-direction: column; margin: 4px auto; list-style: none; + cursor: pointer; .project-h1 { position: relative; display: flex;