fix(测试跟踪): 编辑用例页面切换项目无法跳转
--bug=1022821 --user=陈建星 【测试跟踪】功能用例,在编辑页面通过左上角的下拉列表切换项目失败 https://www.tapd.cn/55049933/s/1347922
This commit is contained in:
parent
0ae8294305
commit
96b9ae1e38
|
@ -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} from "@/store";
|
||||
import {useUserStore, useCommonStore} from "@/store";
|
||||
import {getDefaultSecondLevelMenu} from "../../router";
|
||||
|
||||
export default {
|
||||
|
@ -42,6 +42,7 @@ export default {
|
|||
created() {
|
||||
this.init();
|
||||
this.userStore = useUserStore();
|
||||
this.commonStore = useCommonStore();
|
||||
},
|
||||
inject: [
|
||||
'reload',
|
||||
|
@ -150,6 +151,7 @@ export default {
|
|||
switchProject({id: this.userId, lastProjectId: projectId})
|
||||
.then(response => {
|
||||
this.userStore.switchProject(response);
|
||||
this.commonStore.projectChangeFlag = true;
|
||||
this.$EventBus.$emit('projectChange');
|
||||
this.changeProjectName(projectId);
|
||||
// 刷新路由
|
||||
|
|
|
@ -2,6 +2,7 @@ export default {
|
|||
id: "commonStore",
|
||||
state: () => ({
|
||||
fileDownloadList: [], // 文件下载进度列表,
|
||||
projectChangeFlag: false
|
||||
}),
|
||||
persist: false,
|
||||
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 { useStore } from "@/store";
|
||||
import {useCommonStore, useStore} from "@/store";
|
||||
import { getProjectApplicationConfig } from "@/api/project-application";
|
||||
import {
|
||||
deleteTestCaseVersion,
|
||||
|
@ -400,6 +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: {
|
||||
|
@ -709,10 +710,6 @@ export default {
|
|||
this.loadTestCase();
|
||||
},
|
||||
created(){
|
||||
this.$EventBus.$on('projectChange', () => {
|
||||
localStorage.setItem('projectChangeFlag', 'true');
|
||||
this.$router.push('/track/case/all');
|
||||
});
|
||||
this.$EventBus.$on("handleSaveCaseWithEvent", this.handleSaveCaseWithEvent);
|
||||
this.setInitialVal();
|
||||
},
|
||||
|
@ -758,8 +755,9 @@ export default {
|
|||
},
|
||||
async loadTestCase() {
|
||||
|
||||
if (localStorage.getItem('projectChangeFlag')) {
|
||||
localStorage.removeItem('projectChangeFlag');
|
||||
if (commonStore.projectChangeFlag) {
|
||||
commonStore.projectChangeFlag = false;
|
||||
this.$router.push('/track/case/all');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue