This commit is contained in:
2025-07-21 23:06:28 +08:00
parent cf8651fb14
commit fdab1188c0
4 changed files with 454 additions and 409 deletions

View File

@ -599,7 +599,7 @@ export const selectUserDeptPage = (data = {}) => {
///unifiedLogin ///unifiedLogin
export const unifiedLogin = (data) => { export const unifiedLogin = (data) => {
return request({ return request({
url: api + `/unifiedLogin`, url: api + `/ssoLogin`,
method: "POST", method: "POST",
data data
}); });

View File

@ -130,7 +130,10 @@ export const privateRoutes = [
/** /**
* 公开路由表 * 公开路由表
*/ */
export const publicRoutes = [ export const publicRoutes = [{
path: "/oatuh_login",
component: () => import("@/views/login/oatuh_login") //统一登录
},
{ {
path: "/login", path: "/login",
name: "login", name: "login",

View File

@ -221,7 +221,7 @@ export default {
removeAllItem(); removeAllItem();
// 待补充 清理权限相关的配置 // 待补充 清理权限相关的配置
if (isOatuh) { if (isOatuh) {
window.location.href = `http://80.149.27.78:8001/login`; window.location.href = `http://155.240.22.102:40992`;
} else { } else {
router.push("/login"); router.push("/login");
} }

View File

@ -0,0 +1,42 @@
<template></template>
<script setup>
import { ref, onMounted } from "vue";
import { useStore } from "vuex";
import { useRouter } from "vue-router";
import {
setItem
} from "@/utils/storage";
const loginDialog = ref(false);
const deptList = ref([]);
const store = useStore();
function redirectAuth() {
let token = location.hash.slice(20) || null;
if (token != null) {
token = token.replace(/\ +/g, "");
setItem("SSOTOKEN", token)
handleLogin({ token: token});
} else {
window.location.href = `http://155.240.22.102:40992`;
}
}
const handleLogin = (e) => {
store.dispatch("user/oatuhLogin", e).then((res) => {
// 登录后操作
if (res.deptList.length === 1) {
window.location.hash = "/";
} else {
deptList.value = [...res.deptList];
loginDialog.value = true;
authorization.value = res.jwtToken;
}
});
};
onMounted(() => {
redirectAuth();
});
</script>
<style></style>