获取登陆人
This commit is contained in:
parent
5b56ecefea
commit
ac462de5ff
@ -1,5 +1,13 @@
|
||||
import { request } from '@umijs/max';
|
||||
|
||||
// 获取登陆人
|
||||
export function getCurrentUser( data ) {
|
||||
return request('/api/user/getCurrentUser', {
|
||||
method: 'get',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
// 密码登录
|
||||
export function passwordLogin( data ) {
|
||||
return request('/api/user/login', {
|
||||
|
@ -48,6 +48,7 @@
|
||||
border-radius: 10px 10px 10px 10px;
|
||||
opacity: 1;
|
||||
z-index: 99;
|
||||
margin-top: 60px;
|
||||
}
|
||||
.homepageMsgItem {
|
||||
display: flex;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { useState } from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Tabs } from 'antd';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { passwordLogout } from '../../api';
|
||||
import { passwordLogout, getCurrentUser } from '../../api';
|
||||
import { observer } from 'mobx-react-lite'
|
||||
import loginStore from '../../store/login.store';
|
||||
import '../../index.less';
|
||||
@ -17,7 +17,14 @@ function Header (e) {
|
||||
navigate('/login');
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
useEffect(() =>{
|
||||
getCurrentUser().then((e) => {
|
||||
const d = e.data;
|
||||
token.username = d.username;
|
||||
})
|
||||
})
|
||||
|
||||
return (
|
||||
<div id='header'>
|
||||
<div className='header-left'><span className='user-name'>{token.username}</span>,您好</div>
|
||||
|
Loading…
Reference in New Issue
Block a user