fix(测试计划): 修复测试计划报告无痕浏览器打开重定向登录页面

This commit is contained in:
xinxin.wu 2024-06-19 19:02:53 +08:00 committed by Craftsman
parent 64a2cb00d9
commit bf515c0802
3 changed files with 31 additions and 21 deletions

View File

@ -81,7 +81,10 @@
} }
const { height } = useWindowSize(); const { height } = useWindowSize();
appStore.innerHeight = height.value; appStore.innerHeight = height.value;
userStore.initLocalConfig(); // if (userStore.id) {
userStore.initLocalConfig(); //
}
// @desc: TODO便 // @desc: TODO便
appStore.getProjectInfos(); appStore.getProjectInfos();
}); });

View File

@ -302,6 +302,9 @@
onBeforeMount(async () => { onBeforeMount(async () => {
try { try {
loading.value = true; loading.value = true;
if (!userStore.id) {
return;
}
const res = await getLocalConfig(); const res = await getLocalConfig();
if (Array.isArray(res)) { if (Array.isArray(res)) {
res.forEach((config) => { res.forEach((config) => {

View File

@ -114,7 +114,9 @@ const useUserStore = defineStore('user', {
appStore.setCurrentOrgId(res.lastOrganizationId || ''); appStore.setCurrentOrgId(res.lastOrganizationId || '');
appStore.setCurrentProjectId(res.lastProjectId || ''); appStore.setCurrentProjectId(res.lastProjectId || '');
this.setInfo(res); this.setInfo(res);
this.initLocalConfig(); // 获取本地执行配置 if (res) {
this.initLocalConfig(); // 获取本地执行配置
}
} catch (err) { } catch (err) {
clearToken(); clearToken();
throw err; throw err;
@ -129,7 +131,9 @@ const useUserStore = defineStore('user', {
appStore.setCurrentOrgId(res.lastOrganizationId || ''); appStore.setCurrentOrgId(res.lastOrganizationId || '');
appStore.setCurrentProjectId(res.lastProjectId || ''); appStore.setCurrentProjectId(res.lastProjectId || '');
this.setInfo(res); this.setInfo(res);
this.initLocalConfig(); // 获取本地执行配置 if (res) {
this.initLocalConfig(); // 获取本地执行配置
}
} catch (err) { } catch (err) {
clearToken(); clearToken();
throw err; throw err;
@ -207,24 +211,24 @@ const useUserStore = defineStore('user', {
}, },
// 获取本地执行配置 // 获取本地执行配置
async initLocalConfig() { async initLocalConfig() {
try { // try {
const res = await getLocalConfig(); // const res = await getLocalConfig();
if (res) { // if (res) {
const apiLocalExec = res.find((e) => e.type === 'API'); // const apiLocalExec = res.find((e) => e.type === 'API');
if (apiLocalExec && apiLocalExec.userUrl) { // if (apiLocalExec && apiLocalExec.userUrl) {
this.hasLocalExec = true; // this.hasLocalExec = true;
this.isPriorityLocalExec = apiLocalExec.enable || false; // this.isPriorityLocalExec = apiLocalExec.enable || false;
this.localExecuteUrl = apiLocalExec.userUrl || ''; // this.localExecuteUrl = apiLocalExec.userUrl || '';
} else { // } else {
this.hasLocalExec = false; // this.hasLocalExec = false;
this.isPriorityLocalExec = false; // this.isPriorityLocalExec = false;
this.localExecuteUrl = ''; // this.localExecuteUrl = '';
} // }
} // }
} catch (error) { // } catch (error) {
// eslint-disable-next-line no-console // // eslint-disable-next-line no-console
console.log(error); // console.log(error);
} // }
}, },
async checkIsLogin(forceSet = false) { async checkIsLogin(forceSet = false) {
const { isLoginPage } = useUser(); const { isLoginPage } = useUser();