/**
|
* 徐祥健<xuxj@hugeinfo.com.cn>
|
* 2018年7月16日 14:08
|
*
|
*/
|
|
|
import React from 'react';
|
|
import './style.scss';
|
import { message } from 'antd';
|
import Fetch from '../../fetch';
|
export default class Index extends React.Component {
|
constructor(props) {
|
super(props);
|
this.state = {
|
userInfo: {}
|
};
|
}
|
|
componentDidMount() {
|
Fetch.getUserInfo()
|
.then(res => {
|
if (res.code === 0) {
|
this.setState({ userInfo: res.data });
|
}
|
});
|
}
|
|
loginOut = () => {
|
Fetch.loginOut()
|
.then(res => {
|
if (res.code === 0) {
|
message.success('退出成功', 1, () => {
|
location.href = res.data;
|
})
|
} else {
|
message.error('退出失败,请联系管理员', 2)
|
}
|
});
|
}
|
userCenter = () => {
|
const { userInfo } = this.state;
|
this.props.history.push('/updatePWD/' + userInfo.id)
|
}
|
|
render() {
|
const { userInfo } = this.state;
|
return (
|
<div className="head-view-main">
|
<div>
|
<label className='head-view-name'>{userInfo.qywxUsername}</label>
|
<label className='head-view-center'>
|
<span style={{ cursor: 'pointer' }} onClick={this.userCenter}>个人中心</span> | <span style={{ cursor: 'pointer' }} onClick={this.loginOut}>退出登录</span>
|
</label>
|
</div>
|
<div>
|
<label className='head-view-role'>{userInfo.upasPostname}</label>
|
</div>
|
</div>
|
);
|
}
|
|
}
|