5.17 增加寻找商机中间页和供应商项目跟进跳转页
This commit is contained in:
@ -1,19 +1,54 @@
|
||||
import { getURLInformation } from '@/utils/CommonUtils';
|
||||
import { Result } from 'antd';
|
||||
import React from 'react';
|
||||
import { getURLInformation, isNotEmpty } from '@/utils/CommonUtils';
|
||||
import { getSessionRoleData } from '@/utils/session';
|
||||
import { Result, Typography } from 'antd';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { history } from 'umi';
|
||||
|
||||
const message = {
|
||||
401: '您的用户信息有误,请联系管理员',
|
||||
402: '您的用户角色信息缺失,请联系管理员',
|
||||
90401: '您的登录已超时,请重新登录',
|
||||
404: '系统错误,请联系管理员',
|
||||
};
|
||||
|
||||
const RequestTimeoutPage: React.FC<{}> = () => {
|
||||
const code: any = getURLInformation('code') == null ? '404' : getURLInformation('code');
|
||||
|
||||
const { Text } = Typography;
|
||||
const [time, setTime] = useState<number>(10);
|
||||
const roleData = getSessionRoleData();
|
||||
|
||||
useEffect(() => {
|
||||
let timeInteval: any
|
||||
if (code == 402 && isNotEmpty(roleData)) {
|
||||
timeInteval = setInterval(() => { // 倒计时
|
||||
setTime(n => {
|
||||
if (n == 1) {
|
||||
clearInterval(timeInteval)
|
||||
redirect();
|
||||
}
|
||||
return n - 1;
|
||||
})
|
||||
}, 1000);
|
||||
} else {
|
||||
clearInterval(timeInteval);
|
||||
}
|
||||
return () => {
|
||||
clearInterval(timeInteval);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const redirect = () => {
|
||||
if (isNotEmpty(roleData)) {
|
||||
history.replace({
|
||||
pathname: '/Dashboard',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Result
|
||||
title={message[code]}
|
||||
extra={isNotEmpty(roleData) && code == 402 && <Text type="secondary" strong>{time}秒后进入默认角色</Text>}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
Reference in New Issue
Block a user