fix: 修复OIDC登陆的问题
This commit is contained in:
parent
3e3014c7ff
commit
25c2e08209
|
@ -38,6 +38,7 @@ import {registerRequestHeaders} from "@/common/js/ajax";
|
||||||
import {ORIGIN_COLOR} from "@/common/js/constants";
|
import {ORIGIN_COLOR} from "@/common/js/constants";
|
||||||
import MsTaskCenter from "@/business/components/task/TaskCenter";
|
import MsTaskCenter from "@/business/components/task/TaskCenter";
|
||||||
import MsNotification from "@/business/components/notice/Notification";
|
import MsNotification from "@/business/components/notice/Notification";
|
||||||
|
|
||||||
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||||
const header = requireComponent.keys().length > 0 ? requireComponent("./license/LicenseMessage.vue") : {};
|
const header = requireComponent.keys().length > 0 ? requireComponent("./license/LicenseMessage.vue") : {};
|
||||||
const display = requireComponent.keys().length > 0 ? requireComponent("./display/Display.vue") : {};
|
const display = requireComponent.keys().length > 0 ? requireComponent("./display/Display.vue") : {};
|
||||||
|
@ -60,7 +61,6 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
registerRequestHeaders();
|
|
||||||
this.initSessionTimer();
|
this.initSessionTimer();
|
||||||
if (!hasLicense()) {
|
if (!hasLicense()) {
|
||||||
setDefaultTheme();
|
setDefaultTheme();
|
||||||
|
@ -73,14 +73,12 @@ export default {
|
||||||
this.$store.commit('setTheme', res.data);
|
this.$store.commit('setTheme', res.data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (localStorage.getItem("store")) {
|
// OIDC redirect 之后不跳转
|
||||||
this.$store.replaceState(Object.assign({}, this.$store.state, JSON.parse(localStorage.getItem("store"))));
|
if (window.location.href.endsWith('/#/') || window.location.href.endsWith('/#')) {
|
||||||
this.$get("/project/listAll", response => {
|
window.location.replace("/#/setting/personsetting");
|
||||||
let projectIds = response.data;
|
setTimeout(() => {
|
||||||
if (projectIds && projectIds.length <= 0) {
|
window.location.reload();
|
||||||
this.$store.commit('setProjectId', undefined);
|
}, 500);
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
window.addEventListener("beforeunload", () => {
|
window.addEventListener("beforeunload", () => {
|
||||||
localStorage.setItem("store", JSON.stringify(this.$store.state));
|
localStorage.setItem("store", JSON.stringify(this.$store.state));
|
||||||
|
@ -91,6 +89,7 @@ export default {
|
||||||
if (response.data.success) {
|
if (response.data.success) {
|
||||||
this.$setLang(response.data.data.language);
|
this.$setLang(response.data.data.language);
|
||||||
saveLocalStorage(response.data);
|
saveLocalStorage(response.data);
|
||||||
|
registerRequestHeaders();
|
||||||
this.auth = true;
|
this.auth = true;
|
||||||
// 是否显示校验信息
|
// 是否显示校验信息
|
||||||
if (header.default !== undefined) {
|
if (header.default !== undefined) {
|
||||||
|
@ -100,6 +99,17 @@ export default {
|
||||||
if (display.default !== undefined) {
|
if (display.default !== undefined) {
|
||||||
display.default.showHome(this);
|
display.default.showHome(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (localStorage.getItem("store")) {
|
||||||
|
this.$store.replaceState(Object.assign({}, this.$store.state, JSON.parse(localStorage.getItem("store"))));
|
||||||
|
this.$get("/project/listAll", response => {
|
||||||
|
let projectIds = response.data;
|
||||||
|
if (projectIds && projectIds.length <= 0) {
|
||||||
|
this.$store.commit('setProjectId', undefined);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
window.location.href = "/login";
|
window.location.href = "/login";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue