diff --git a/web/src/config.js b/web/src/config.js index 9a252fbf..d8211766 100644 --- a/web/src/config.js +++ b/web/src/config.js @@ -25,7 +25,8 @@ const config = { wechat_qrcode: '', lark_login: false, lark_client_id: '', - telegram_bot: '' + telegram_bot: '', + isLoading: true, // 添加加载状态 } }; diff --git a/web/src/store/siteInfoReducer.js b/web/src/store/siteInfoReducer.js index e14bc245..2132c0e3 100644 --- a/web/src/store/siteInfoReducer.js +++ b/web/src/store/siteInfoReducer.js @@ -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; diff --git a/web/src/ui-component/Logo.js b/web/src/ui-component/Logo.js index 52e61f4f..93e8d053 100644 --- a/web/src/ui-component/Logo.js +++ b/web/src/ui-component/Logo.js @@ -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 {siteInfo.system_name}; + if (siteInfo.isLoading) { + return null; // 数据加载未完成时不显示 logo + } + + const logoToDisplay = siteInfo.logo ? siteInfo.logo : defaultLogo; + + return {siteInfo.system_name}; }; export default Logo;