提交 bf20b749 authored 作者: 钟是志's avatar 钟是志

乱七八糟改一通

上级 594bbfc1
......@@ -3,6 +3,9 @@ import { LocaleProvider } from 'antd-mobile';
import styles from './index.css';
import { router, connect } from 'dva';
import { getToken, setToken } from '@/H5Public/utils/authority';
import requestJSON from '@/H5Public/utils/requestJSON';
import { setUserInfo } from '@/H5Public/utils/2022new/currentUser';
import config from '@/config/config';
const routerWhiteList = [
'/login',
......@@ -28,8 +31,22 @@ let BasicLayout = ({ children, dispatch, location: { pathname } }) => {
};
BasicLayout = connect()(BasicLayout);
function getUserInfo() {
const url = config.mockServer + '/v1/api/uiaAdmin/userApi/getMyInfo'; // 获取用户基本信息
requestJSON(url, {}).then((res) => {
if (res && res.data) {
setUserInfo(res.data);
}
});
}
export default (props) => {
const { location: { pathname, query: { token, returnUrl } }, children } = props;
useEffect(() => {
if(token || getToken()){
getUserInfo();
}
}, []);
if (routerWhiteList.includes(pathname)) return children;
if (!!token || getToken()) {
if (!!token) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论