🐛 fix: Fix the issue of default logo still loading after user customizes LOGO (#238)
This commit is contained in:
parent
7d90e43492
commit
dbb1b5ebec
@ -25,7 +25,8 @@ const config = {
|
|||||||
wechat_qrcode: '',
|
wechat_qrcode: '',
|
||||||
lark_login: false,
|
lark_login: false,
|
||||||
lark_client_id: '',
|
lark_client_id: '',
|
||||||
telegram_bot: ''
|
telegram_bot: '',
|
||||||
|
isLoading: true, // 添加加载状态
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -8,7 +8,8 @@ const siteInfoReducer = (state = initialState, action) => {
|
|||||||
case actionTypes.SET_SITE_INFO:
|
case actionTypes.SET_SITE_INFO:
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
...action.payload
|
...action.payload,
|
||||||
|
isLoading: false, // 添加加载状态
|
||||||
};
|
};
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
|
@ -17,9 +17,15 @@ import { useTheme } from '@mui/material/styles';
|
|||||||
const Logo = () => {
|
const Logo = () => {
|
||||||
const siteInfo = useSelector((state) => state.siteInfo);
|
const siteInfo = useSelector((state) => state.siteInfo);
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const logo = theme.palette.mode === 'light' ? logoLight : logoDark;
|
const defaultLogo = theme.palette.mode === 'light' ? logoLight : logoDark;
|
||||||
|
|
||||||
return <img src={siteInfo.logo || logo} alt={siteInfo.system_name} height="50" />;
|
if (siteInfo.isLoading) {
|
||||||
|
return null; // 数据加载未完成时不显示 logo
|
||||||
|
}
|
||||||
|
|
||||||
|
const logoToDisplay = siteInfo.logo ? siteInfo.logo : defaultLogo;
|
||||||
|
|
||||||
|
return <img src={logoToDisplay} alt={siteInfo.system_name} height="50" />;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Logo;
|
export default Logo;
|
||||||
|
Loading…
Reference in New Issue
Block a user