xiugai
This commit is contained in:
@@ -17,18 +17,16 @@ import {
|
||||
import { motion } from 'motion/react';
|
||||
import bgcImg from '../assets/bgc2.png';
|
||||
import logincard from '../assets/logincard.png';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { setUserInfo, userLogin } from '../store/userSlice';
|
||||
import { userLogin } from '../store/userSlice';
|
||||
import { useAppDispatch } from '../store';
|
||||
import Cookies from 'js-cookie';
|
||||
|
||||
const { Text, Title } = Typography;
|
||||
|
||||
export default function Login() {
|
||||
const navigate = useNavigate();
|
||||
const dispatch = useAppDispatch();
|
||||
const { message, modal, notification } = App.useApp();
|
||||
|
||||
|
||||
const { message, } = App.useApp();
|
||||
|
||||
// 账号密码登录
|
||||
const onFinish = async (values: any) => {
|
||||
@@ -41,9 +39,19 @@ export default function Login() {
|
||||
|
||||
if (loginResult.code == 200) {
|
||||
//dispatch(setUserInfo(loginResult))
|
||||
const searchParams = new URLSearchParams(window.location.search);
|
||||
const goRemote = searchParams.get('goRemote');
|
||||
if (Number(goRemote) == 1) {
|
||||
const rawUserId = Cookies.get("userId"); // 比如 "32434"
|
||||
|
||||
const encodedUserId = btoa(unescape(encodeURIComponent(rawUserId)));
|
||||
window.location.href = `https://ai.satabot.com/?userId=${encodedUserId}`;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
message.success(`登录成功`);
|
||||
navigate('/');
|
||||
navigate('/', { replace: true });
|
||||
} else {
|
||||
|
||||
message.error("登录失败:" + loginResult.msg);
|
||||
@@ -54,12 +62,10 @@ export default function Login() {
|
||||
// 登录成功后跳转
|
||||
|
||||
} catch (err) {
|
||||
// 接口失败、密码错误都会进这里
|
||||
//console.error("登录失败:", err);
|
||||
//message.error('登录失败,请检查账号密码');
|
||||
message.error("登录失败:" + err.toString());
|
||||
|
||||
}
|
||||
|
||||
//navigate('/');
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -107,11 +113,11 @@ export default function Login() {
|
||||
</Form.Item>
|
||||
|
||||
{/* 记住密码 */}
|
||||
<Form.Item name="remember" valuePropName="checked" noStyle>
|
||||
{/*<Form.Item name="remember" valuePropName="checked" noStyle>
|
||||
<Checkbox>
|
||||
<Text style={{ fontSize: 14, color: '#666' }}>记住密码</Text>
|
||||
</Checkbox>
|
||||
</Form.Item>
|
||||
</Form.Item>*/}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user