From 21d92eff0e23974d76e3e5a79ba50e3fc1c0b879 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 15 四月 2022 01:08:15 +0800 Subject: [PATCH] 2022-04-15 --- src/components/header/index.jsx | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 1b78675..5b2824b 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -38,7 +38,8 @@ visible: false, // 淇敼瀵嗙爜妯℃�佹 dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, confirmLoading: false, - userName: sessionStorage.getItem('User_Name'), + userName: '', + fullName: '', logourl: window.GLOB.mainlogo, appVersion: window.GLOB.appVersion, loginVisible: false, @@ -609,6 +610,15 @@ UNSAFE_componentWillMount () { // 缁勪欢鍔犺浇鏃讹紝鑾峰彇鑿滃崟鏁版嵁 this.getRolesMenu() + + let fullName = sessionStorage.getItem('Full_Name') || '' + let userName = sessionStorage.getItem('User_Name') || '' + + if (fullName.toLowerCase() === userName.toLowerCase()) { + userName = '' + } + + this.setState({fullName, userName}) } componentDidMount () { @@ -838,7 +848,7 @@ <div> <img src={this.state.avatar || avatar} alt=""/> <span> - <span className="username">{this.state.userName}</span> <DownOutlined /> + <span className="username"><span>{this.state.fullName}</span>{this.state.userName ? <span>{this.state.userName}</span> : null}</span> <DownOutlined /> </span> </div> </Dropdown> -- Gitblit v1.8.0