mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 05:10:19 +08:00
Add renderAvatar().
This commit is contained in:
@ -142,7 +142,7 @@ class App extends Component {
|
||||
account: null
|
||||
});
|
||||
|
||||
Setting.showMessage("success", `Successfully logged out, redirected to homepage`);
|
||||
Setting.showMessage("success", `Logged out successfully`);
|
||||
|
||||
Setting.goToLinkSoft(this, "/");
|
||||
} else {
|
||||
@ -159,6 +159,22 @@ class App extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
renderAvatar() {
|
||||
if (this.state.account.avatar === "") {
|
||||
return (
|
||||
<Avatar style={{ backgroundColor: Setting.getAvatarColor(this.state.account.name), verticalAlign: 'middle' }} size="large">
|
||||
{Setting.getShortName(this.state.account.name)}
|
||||
</Avatar>
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
<Avatar src={this.state.account.avatar} style={{verticalAlign: 'middle' }} size="large">
|
||||
{Setting.getShortName(this.state.account.name)}
|
||||
</Avatar>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
renderRightDropdown() {
|
||||
const menu = (
|
||||
<Menu onClick={this.handleRightDropdownClick.bind(this)}>
|
||||
@ -176,9 +192,9 @@ class App extends Component {
|
||||
return (
|
||||
<Dropdown key="200" overlay={menu} >
|
||||
<div className="ant-dropdown-link" style={{float: 'right', cursor: 'pointer'}}>
|
||||
<Avatar style={{ backgroundColor: Setting.getAvatarColor(this.state.account.name), verticalAlign: 'middle' }} size="large">
|
||||
{Setting.getShortName(this.state.account.name)}
|
||||
</Avatar>
|
||||
{
|
||||
this.renderAvatar()
|
||||
}
|
||||
|
||||
|
||||
{Setting.isMobile() ? null : Setting.getShortName(this.state.account.name)} <DownOutlined />
|
||||
|
Reference in New Issue
Block a user