Merge remote-tracking branch 'origin/master'

This commit is contained in:
song.tianyang 2020-12-17 18:22:55 +08:00
commit a14065a0cc
4 changed files with 26 additions and 15 deletions

@ -1 +1 @@
Subproject commit 61397c16728a63493507679f7e0940d9099f337f
Subproject commit 2f4f76c93afa7b62b1d73fa90e73eec948a6ef3f

View File

@ -108,9 +108,10 @@ import {
if (response.data.workspaceId) {
localStorage.setItem("workspace_id", response.data.workspaceId);
}
localStorage.removeItem(PROJECT_ID)
this.$router.push('/');
window.location.reload();
localStorage.removeItem(PROJECT_ID);
this.$router.push('/').then(() => {
window.location.reload();
}).catch(err => err);
});
},
changeWs(data) {
@ -121,9 +122,10 @@ 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();
localStorage.removeItem(PROJECT_ID);
this.$router.push('/').then(() => {
window.location.reload();
}).catch(err => err);
})
}
}

View File

@ -36,11 +36,6 @@ export default {
currentProject: String
},
created() {
if (getCurrentUser().lastProjectId) {
localStorage.setItem(PROJECT_ID, getCurrentUser().lastProjectId);
}
},
mounted() {
this.init();
},
computed: {
@ -68,10 +63,24 @@ 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 userLastProjectId = getCurrentUser().lastProjectId;
if (userLastProjectId) {
// id
if (this.searchArray.length > 0 && this.searchArray.map(p => p.id).indexOf(userLastProjectId) !== -1) {
localStorage.setItem(PROJECT_ID, userLastProjectId);
}
}
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);
})
}

@ -1 +1 @@
Subproject commit a22a3005d9bd254793fcf634d72539cbdf31be3a
Subproject commit d39dafaf84b9c7a56cb51f2caf67dd7dfde5938c