diff --git a/framework/sdk-parent/frontend/src/components/head/ProjectSearchList.vue b/framework/sdk-parent/frontend/src/components/head/ProjectSearchList.vue index a9a22932cc..21b4634b3d 100644 --- a/framework/sdk-parent/frontend/src/components/head/ProjectSearchList.vue +++ b/framework/sdk-parent/frontend/src/components/head/ProjectSearchList.vue @@ -30,7 +30,7 @@ import {fullScreenLoading, stopFullScreenLoading} from "../../utils"; import {getCurrentProjectID, getCurrentUser, getCurrentUserId, getCurrentWorkspaceId} from "../../utils/token"; import {hasPermissions} from "../../utils/permission"; import {getUserProjectList, switchProject} from "../../api/project"; -import {useUserStore, useCommonStore} from "@/store"; +import {useUserStore} from "@/store"; import {getDefaultSecondLevelMenu} from "../../router"; export default { @@ -42,7 +42,6 @@ export default { created() { this.init(); this.userStore = useUserStore(); - this.commonStore = useCommonStore(); }, inject: [ 'reload', @@ -148,7 +147,7 @@ export default { switchProject({id: this.userId, lastProjectId: projectId}) .then(response => { this.userStore.switchProject(response); - this.commonStore.projectChangeFlag = true; + this.userStore.projectChangeFlag = true; this.$EventBus.$emit('projectChange'); this.changeProjectName(projectId); // 刷新路由 diff --git a/framework/sdk-parent/frontend/src/store/modules/common.js b/framework/sdk-parent/frontend/src/store/modules/common.js index 76256703c9..cb54cf6d0e 100644 --- a/framework/sdk-parent/frontend/src/store/modules/common.js +++ b/framework/sdk-parent/frontend/src/store/modules/common.js @@ -2,7 +2,6 @@ export default { id: "commonStore", state: () => ({ fileDownloadList: [], // 文件下载进度列表, - projectChangeFlag: false }), persist: false, getters: {}, diff --git a/framework/sdk-parent/frontend/src/store/modules/user.js b/framework/sdk-parent/frontend/src/store/modules/user.js index 28e9308c82..3e4eafbc40 100644 --- a/framework/sdk-parent/frontend/src/store/modules/user.js +++ b/framework/sdk-parent/frontend/src/store/modules/user.js @@ -42,6 +42,7 @@ export default { state: () => ({ language: getLanguage(), showLicenseCountWarning: false, + projectChangeFlag: false }), persist: true, getters: { diff --git a/test-track/frontend/src/business/case/components/TestCaseEdit.vue b/test-track/frontend/src/business/case/components/TestCaseEdit.vue index 3c172d1cfa..c42f91392a 100644 --- a/test-track/frontend/src/business/case/components/TestCaseEdit.vue +++ b/test-track/frontend/src/business/case/components/TestCaseEdit.vue @@ -365,7 +365,7 @@ import TestCaseBaseInfo from "@/business/case/components/TestCaseBaseInfo"; import MsContainer from "metersphere-frontend/src/components/MsContainer"; import MsAsideContainer from "metersphere-frontend/src/components/MsAsideContainer"; import MsMainContainer from "metersphere-frontend/src/components/MsMainContainer"; -import {useCommonStore, useStore} from "@/store"; +import {useStore, useUserStore} from "@/store"; import { getProjectApplicationConfig } from "@/api/project-application"; import { deleteTestCaseVersion, @@ -400,7 +400,7 @@ import CaseDiffSideViewer from "./case/diff/CaseDiffSideViewer"; import TestCaseEditNameView from "@/business/case/components/head/TestCaseEditNameView"; const store = useStore(); -const commonStore = useCommonStore(); + export default { name: "TestCaseEdit", components: { @@ -581,7 +581,8 @@ export default { projectId: null, createVersionId: null, editableState: false, - isNameEdit: false + isNameEdit: false, + useUserStore: {} }; }, props: { @@ -713,6 +714,7 @@ export default { this.loadTestCase(); }, created(){ + this.useUserStore = useUserStore(); this.$EventBus.$on("handleSaveCaseWithEvent", this.handleSaveCaseWithEvent); this.setInitialVal(); }, @@ -757,9 +759,8 @@ export default { }); }, async loadTestCase() { - - if (commonStore.projectChangeFlag) { - commonStore.projectChangeFlag = false; + if (this.useUserStore.projectChangeFlag) { + this.useUserStore.projectChangeFlag = false; this.$router.push('/track/case/all'); return; }