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