no message

This commit is contained in:
aipaw 2021-06-22 08:59:09 +08:00
parent 0a8addc128
commit d43fb1c94a
4 changed files with 53 additions and 19 deletions

View File

@ -26,9 +26,22 @@ export default {
project_id(id) { project_id(id) {
if (id > 0) { if (id > 0) {
this.$store.state.projectId = $A.runNum(id); this.$store.state.projectId = $A.runNum(id);
this.$store.dispatch("getProjectOne", id); this.$store.dispatch("getProjectOne", id).then(() => {
this.$store.dispatch("getColumns", id); this.$store.dispatch("getColumns", id);
this.$store.dispatch("getTasks", {project_id: 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'});
}
}
});
});
} }
} }
}, },

View File

@ -284,7 +284,9 @@ export default {
state.projects.push(data); 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'}); $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 state
* @param dispatch * @param dispatch
* @param project_id * @param project_id
* @returns {Promise<unknown>}
*/ */
getProjectOne({state, dispatch}, project_id) { getProjectOne({state, dispatch}, project_id) {
dispatch("call", { return new Promise(function (resolve, reject) {
url: 'project/one', dispatch("call", {
data: { url: 'project/one',
project_id, data: {
}, project_id,
}).then(result => { },
dispatch("saveProject", result.data); }).then(result => {
}).catch(e => { dispatch("saveProject", result.data);
console.error(e); resolve(result)
}).catch(e => {
console.error(e);
reject(e)
});
}); });
}, },
@ -433,7 +442,9 @@ export default {
state.columns.push(data); 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) dispatch('getProjectOne', state.columns[index].project_id)
state.columns.splice(index, 1); 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); 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) { if (state.taskId == task_id) {
state.taskId = 0; state.taskId = 0;
} }
state.method.setStorage("cacheTasks", state.cacheTasks = state.tasks); setTimeout(() => {
state.method.setStorage("cacheTasks", state.cacheTasks = state.tasks);
})
}, },
/** /**

View File

@ -130,7 +130,9 @@ const method = {
} }
let keyName = '__state__'; let keyName = '__state__';
if (key.substring(0, 5) === 'cache') { 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') { if (typeof value === 'undefined') {
return this.loadFromlLocal(key, '', keyName); return this.loadFromlLocal(key, '', keyName);

View File

@ -105,6 +105,7 @@
align-items: center; align-items: center;
height: auto; height: auto;
padding: 14px 0 0; padding: 14px 0 0;
cursor: default;
> ul { > ul {
width: 100%; width: 100%;
> li { > li {
@ -112,6 +113,7 @@
flex-direction: column; flex-direction: column;
margin: 4px auto; margin: 4px auto;
list-style: none; list-style: none;
cursor: pointer;
.project-h1 { .project-h1 {
position: relative; position: relative;
display: flex; display: flex;