fix(通用功能): 切换项目没有反应
This commit is contained in:
parent
6901eb6cda
commit
88088536b0
|
@ -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);
|
||||
// 刷新路由
|
||||
|
|
|
@ -2,7 +2,6 @@ export default {
|
|||
id: "commonStore",
|
||||
state: () => ({
|
||||
fileDownloadList: [], // 文件下载进度列表,
|
||||
projectChangeFlag: false
|
||||
}),
|
||||
persist: false,
|
||||
getters: {},
|
||||
|
|
|
@ -42,6 +42,7 @@ export default {
|
|||
state: () => ({
|
||||
language: getLanguage(),
|
||||
showLicenseCountWarning: false,
|
||||
projectChangeFlag: false
|
||||
}),
|
||||
persist: true,
|
||||
getters: {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue