Merge branch 'main' of http://61.139.16.27:26684/zy_oyj/sgxt_web
This commit is contained in:
@ -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
|
||||||
});
|
});
|
||||||
|
@ -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",
|
||||||
|
@ -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");
|
||||||
}
|
}
|
||||||
|
42
src/views/login/oatuh_login.vue
Normal file
42
src/views/login/oatuh_login.vue
Normal 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>
|
Reference in New Issue
Block a user