🐛 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: '',
|
||||
lark_login: false,
|
||||
lark_client_id: '',
|
||||
telegram_bot: ''
|
||||
telegram_bot: '',
|
||||
isLoading: true, // 添加加载状态
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -8,7 +8,8 @@ const siteInfoReducer = (state = initialState, action) => {
|
||||
case actionTypes.SET_SITE_INFO:
|
||||
return {
|
||||
...state,
|
||||
...action.payload
|
||||
...action.payload,
|
||||
isLoading: false, // 添加加载状态
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
|
@ -17,9 +17,15 @@ import { useTheme } from '@mui/material/styles';
|
||||
const Logo = () => {
|
||||
const siteInfo = useSelector((state) => state.siteInfo);
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user