显示当前用户名称

pull/404/MERGE
ChenX 5 years ago
parent 47e95416f4
commit 0c9827e093

@ -45,6 +45,7 @@ export default class Login extends React.Component<{ store?: TopPanelStore }, IL
saveLoginInfos(data);
this.props.store.isLogin = true;
this.props.store.openMain = true;
this.props.store.userName = this.state.user_name;
userConfigStore.readConfigs.clear();
appCache.clear();
await userConfigStore.InitDrillConfig();

@ -124,6 +124,7 @@ export class TopPanel extends React.Component<{ store?: TopPanelStore }, {}>
<Button small={true} icon="annotation" />
<span className="bp3-navbar-divider hidden" />
<Button small={true} icon="user" />
{this.props.store.userName}
<Button small={true} text="注销" onClick={this.handleLoginOut} />
<Button small={true} icon="cog" onClick={() => this.handleClick('setting')} />
</div>

@ -27,10 +27,12 @@ export class TopPanelStore extends Singleton
used_size: "",
used_percentage: "0"
}
@observable userName = "";
constructor()
{
super();
this.isLogin = Boolean(localStorage.getItem(StoreageKeys.IsLogin));
this.userName = localStorage.getItem(StoreageKeys.UserName) || "";
//每20分钟发送一次心跳包
setInterval(() =>
@ -48,8 +50,8 @@ export class TopPanelStore extends Singleton
//有前面层视图的时候隐藏绘图区域
needOpacityEls.forEach(el =>
el.style.opacity = this.isLogin && !this.openMain ? "1" : "0"
)
})
);
});
}
async UpdateFileList()
{

Loading…
Cancel
Save