提交 9dccd0b4 作者: ZhangLingKun

功能:问题修复

上级 fa3ce97a
流水线 #7357 已通过 于阶段
in 5 分 7 秒
...@@ -41,6 +41,7 @@ const HeaderView: React.FC<{ ...@@ -41,6 +41,7 @@ const HeaderView: React.FC<{
}; };
// 获取用户信息 // 获取用户信息
const getAccountInfo = async () => { const getAccountInfo = async () => {
if (!system?.token) return;
const res = await CommonAPI.getAccountInfo(); const res = await CommonAPI.getAccountInfo();
if (res && res.code === '200') { if (res && res.code === '200') {
dispatch(setUserInfo(res.result)); dispatch(setUserInfo(res.result));
...@@ -57,9 +58,8 @@ const HeaderView: React.FC<{ ...@@ -57,9 +58,8 @@ const HeaderView: React.FC<{
}, []); }, []);
// 当前是否登录 // 当前是否登录
useEffect(() => { useEffect(() => {
if (system?.token) { if (!system?.token) return;
getAccountInfo().then(); getAccountInfo().then();
}
}, [system?.token]); }, [system?.token]);
// 右上角按钮 // 右上角按钮
const items: MenuProps['items'] = [ const items: MenuProps['items'] = [
...@@ -72,7 +72,7 @@ const HeaderView: React.FC<{ ...@@ -72,7 +72,7 @@ const HeaderView: React.FC<{
</div> </div>
<div>昵称:{userInfo?.nickName}</div> <div>昵称:{userInfo?.nickName}</div>
<div>手机号:{userInfo?.phoneNum}</div> <div>手机号:{userInfo?.phoneNum}</div>
<div>加入云享飞 {getDiffDay(userInfo?.createTime)}</div> <div>来到云享飞 {getDiffDay(userInfo?.createTime)}</div>
</div> </div>
), ),
}, },
...@@ -137,7 +137,7 @@ const HeaderView: React.FC<{ ...@@ -137,7 +137,7 @@ const HeaderView: React.FC<{
联系客服 联系客服
</Button> </Button>
</div> </div>
{!!userInfo && ( {!!userInfo?.id && (
<div className="nav-user"> <div className="nav-user">
<Dropdown <Dropdown
overlayStyle={{ textAlign: 'center' }} overlayStyle={{ textAlign: 'center' }}
...@@ -153,7 +153,7 @@ const HeaderView: React.FC<{ ...@@ -153,7 +153,7 @@ const HeaderView: React.FC<{
</div> </div>
)} )}
<div className="nav-action"> <div className="nav-action">
{!userInfo && ( {!userInfo?.id && (
<Button <Button
type={'primary'} type={'primary'}
className="action-item" className="action-item"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论