|
@@ -2,6 +2,7 @@ import vueStore from "@/store";
|
|
|
import { sessionStore } from "@/store/sessionStore";
|
|
|
import { logicConfig } from "@/logicConfig";
|
|
|
import { userController } from "@/controller/userController";
|
|
|
+import { toolUtils } from "./toolUtils";
|
|
|
|
|
|
export class authUtils {
|
|
|
/**
|
|
@@ -71,8 +72,17 @@ export class authUtils {
|
|
|
});
|
|
|
vueStore.commit("updateProjects", projects);
|
|
|
vueStore.commit("layout/setProjects", projects);
|
|
|
- vueStore.commit("layout/setprojectId", projects[0].id);
|
|
|
- vueStore.commit("updateSelectProject", projects[0]);
|
|
|
+ //从localStorage中取出缓存的项目ID
|
|
|
+ var oldProjectId = window.localStorage.getItem(logicConfig.localStorKeyToSelProject) || projects[0].id;
|
|
|
+ //判断该用户是否具有缓存的项目ID的权限
|
|
|
+ var defaultProject = projects.filter(_c => {
|
|
|
+ return _c.id == oldProjectId;
|
|
|
+ })[0];
|
|
|
+ if(!defaultProject)
|
|
|
+ defaultProject = projects[0];
|
|
|
+ vueStore.commit("layout/setprojectId", defaultProject.id);
|
|
|
+ vueStore.commit("updateSelectProject", defaultProject);
|
|
|
+ toolUtils.updateLocalStorageProject(defaultProject.id);
|
|
|
|
|
|
next();
|
|
|
|