mirror of
https://github.com/certd/certd.git
synced 2026-04-24 20:57:26 +08:00
fix: 修复企业管理模式下,切换用户登录后,丢失项目列表的bug
This commit is contained in:
@@ -15,11 +15,18 @@ export type ProjectItem = {
|
|||||||
export const useProjectStore = defineStore("app.project", () => {
|
export const useProjectStore = defineStore("app.project", () => {
|
||||||
const myProjects = ref([]);
|
const myProjects = ref([]);
|
||||||
const inited = ref(false);
|
const inited = ref(false);
|
||||||
|
const currentProjectId = ref(); // 直接调用
|
||||||
|
|
||||||
|
function $reset() {
|
||||||
|
myProjects.value = [];
|
||||||
|
currentProjectId.value = "";
|
||||||
|
inited.value = false;
|
||||||
|
}
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const userId = userStore.getUserInfo?.id;
|
const userId = userStore.getUserInfo?.id;
|
||||||
const lastProjectIdCacheKey = "currentProjectId:" + userId;
|
const lastProjectIdCacheKey = "currentProjectId:" + userId;
|
||||||
const lastProjectId = LocalStorage.get(lastProjectIdCacheKey);
|
const lastProjectId = LocalStorage.get(lastProjectIdCacheKey);
|
||||||
const currentProjectId = ref(lastProjectId); // 直接调用
|
currentProjectId.value = lastProjectId;
|
||||||
|
|
||||||
const projects = computed(() => {
|
const projects = computed(() => {
|
||||||
return myProjects.value;
|
return myProjects.value;
|
||||||
@@ -118,11 +125,6 @@ export const useProjectStore = defineStore("app.project", () => {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function $reset() {
|
|
||||||
myProjects.value = [];
|
|
||||||
currentProjectId.value = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
projects,
|
projects,
|
||||||
myProjects,
|
myProjects,
|
||||||
|
|||||||
Reference in New Issue
Block a user