有已开通的工作台,登录后跳转到第一个工作台

This commit is contained in:
谢思 2025-02-19 15:03:11 +08:00
parent 03463ce3c4
commit 9732624e43
1 changed files with 16 additions and 3 deletions

View File

@ -10,6 +10,7 @@ import axios from 'axios';
import cookie from 'react-cookies';
import './LoginRegisterPageNew.scss';
import { Encrypt } from "../../common/Env";
import { getOrzCompanyList } from "../../forge/Information/api";
function Login(props){
const [message,setMessage] = useState();
@ -51,11 +52,23 @@ function Login(props){
cookie.save('autologin',values.remember);
cookie.save('supplyphone',true);
cookie.save("login",response.data.login);
//
const searchParams = new URLSearchParams(search.substring(1));
const goPage = searchParams.get("go_page");
//
window.location.href = goPage ? goPage : `/${response.data.login}`
//
if(goPage){
window.location.href = goPage
}else{
getOrzCompanyList().then(res=>{
if(res && res.data && res.data.rows && res.data.rows[0]){
window.location.href = `${ mygetHelmetapi && mygetHelmetapi.common.zone }/${res.data.rows[0].enterpriseIdentifier}`
}else{
window.location.href = `/${response.data.login}`
}
}).catch(()=>{
window.location.href = `/${response.data.login}`
})
}
}
}).catch((error) => {
console.log('error',error);