|
|
@@ -353,8 +353,26 @@ export function Home() {
|
|
|
}, url: string, fullUrl: string) => {
|
|
|
try {
|
|
|
const res = await api.post('frame_login', data);
|
|
|
- localStorage.setItem('userInfo', JSON.stringify(res.data));
|
|
|
- location.replace(url);
|
|
|
+ console.log(res);
|
|
|
+ const resData = res?.data || {};
|
|
|
+ const msg = res.data.msg;
|
|
|
+ if(msg) {
|
|
|
+ Modal.error({
|
|
|
+ title: '登录信息',
|
|
|
+ content: msg,
|
|
|
+ });
|
|
|
+ // 延迟5秒执行存储和跳转
|
|
|
+ //setTimeout(() => {
|
|
|
+ // 存储前再次校验数据,避免 JSON.stringify 报错
|
|
|
+ if (resData) {
|
|
|
+ localStorage.setItem('userInfo', JSON.stringify(resData));
|
|
|
+ }
|
|
|
+ //location.replace(url);
|
|
|
+ //}, 5000);
|
|
|
+ } else {
|
|
|
+ localStorage.setItem('userInfo', JSON.stringify(resData));
|
|
|
+ //location.replace(url);
|
|
|
+ }
|
|
|
} catch (error: any) {
|
|
|
Modal.error({
|
|
|
title: '登录失败',
|