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) {
if (id > 0) {
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("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);
}
}
setTimeout(() => {
state.method.setStorage("cacheProjects", state.cacheProjects = state.projects);
})
},
/**
@ -305,7 +307,9 @@ export default {
$A.goForward({path: '/manage/dashboard'});
}
}
setTimeout(() => {
state.method.setStorage("cacheProjects", state.cacheProjects = state.projects);
})
},
/**
@ -336,8 +340,10 @@ export default {
* @param state
* @param dispatch
* @param project_id
* @returns {Promise<unknown>}
*/
getProjectOne({state, dispatch}, project_id) {
return new Promise(function (resolve, reject) {
dispatch("call", {
url: 'project/one',
data: {
@ -345,8 +351,11 @@ export default {
},
}).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);
}
}
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);
}
setTimeout(() => {
state.method.setStorage("cacheColumns", state.cacheColumns = state.columns);
})
},
/**
@ -536,7 +549,9 @@ export default {
dispatch("getTaskContent", data.id);
}
}
setTimeout(() => {
state.method.setStorage("cacheTasks", state.cacheTasks = state.tasks);
})
},
/**
@ -555,7 +570,9 @@ export default {
if (state.taskId == task_id) {
state.taskId = 0;
}
setTimeout(() => {
state.method.setStorage("cacheTasks", state.cacheTasks = state.tasks);
})
},
/**

View File

@ -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);

View File

@ -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;