fix(系统设置): 修复切换项目缺陷
This commit is contained in:
parent
e05657fe11
commit
cfdbdb7fa3
|
@ -108,9 +108,9 @@ import {
|
|||
if (response.data.workspaceId) {
|
||||
localStorage.setItem("workspace_id", response.data.workspaceId);
|
||||
}
|
||||
localStorage.removeItem(PROJECT_ID)
|
||||
this.$router.push('/');
|
||||
window.location.reload();
|
||||
this.$router.push('/').then(() => {
|
||||
window.location.reload();
|
||||
}).catch(err => err);
|
||||
});
|
||||
},
|
||||
changeWs(data) {
|
||||
|
@ -121,9 +121,9 @@ import {
|
|||
this.$post("/user/switch/source/ws/" + workspaceId, {}, response => {
|
||||
saveLocalStorage(response);
|
||||
localStorage.setItem("workspace_id", workspaceId);
|
||||
localStorage.removeItem(PROJECT_ID)
|
||||
this.$router.push('/');
|
||||
window.location.reload();
|
||||
this.$router.push('/').then(() => {
|
||||
window.location.reload();
|
||||
}).catch(err => err);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,10 +68,17 @@ export default {
|
|||
this.result = this.$get("/project/listAll", response => {
|
||||
this.items = response.data;
|
||||
this.searchArray = response.data;
|
||||
if (!getCurrentProjectID() && this.items.length > 0) {
|
||||
this.change(this.items[0].id);
|
||||
}
|
||||
let projectId = getCurrentProjectID();
|
||||
if (projectId) {
|
||||
// 保存的 projectId 是否存在; 切换工作空间后
|
||||
if (this.searchArray.length > 0 && this.searchArray.map(p => p.id).indexOf(projectId) === -1) {
|
||||
this.change(this.items[0].id);
|
||||
}
|
||||
} else {
|
||||
if (this.items.length > 0) {
|
||||
this.change(this.items[0].id);
|
||||
}
|
||||
}
|
||||
this.changeProjectName(projectId);
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue