修复移动端显示bug

This commit is contained in:
CaIon
2023-10-31 01:19:19 +08:00
parent 79bf621289
commit db358facc0
2 changed files with 75 additions and 151 deletions

View File

@@ -85,81 +85,81 @@ const HeaderBar = () => {
}); });
}; };
if (isMobile()) { // if (isMobile()) {
return ( // return (
<> // <>
<Menu // <Menu
borderless // borderless
size='large' // size='large'
style={ // style={
showSidebar // showSidebar
? { // ? {
borderBottom: 'none', // borderBottom: 'none',
marginBottom: '0', // marginBottom: '0',
borderTop: 'none', // borderTop: 'none',
height: '51px' // height: '51px'
} // }
: {borderTop: 'none', height: '52px'} // : {borderTop: 'none', height: '52px'}
} // }
> // >
<Container> // <Container>
<Menu.Item as={Link} to='/'> // <Menu.Item as={Link} to='/'>
<img // <img
src={logo} // src={logo}
alt='logo' // alt='logo'
style={{marginRight: '0.75em'}} // style={{marginRight: '0.75em'}}
/> // />
<div style={{fontSize: '20px'}}> // <div style={{fontSize: '20px'}}>
<b>{systemName}</b> // <b>{systemName}</b>
</div> // </div>
</Menu.Item> // </Menu.Item>
<Menu.Menu position='right'> // <Menu.Menu position='right'>
<Menu.Item onClick={toggleSidebar}> // <Menu.Item onClick={toggleSidebar}>
<Icon name={showSidebar ? 'close' : 'sidebar'}/> // <Icon name={showSidebar ? 'close' : 'sidebar'}/>
</Menu.Item> // </Menu.Item>
</Menu.Menu> // </Menu.Menu>
</Container> // </Container>
</Menu> // </Menu>
//
{showSidebar ? ( // {showSidebar ? (
<Segment style={{marginTop: 0, borderTop: '0'}}> // <Segment style={{marginTop: 0, borderTop: '0'}}>
<Menu secondary vertical style={{ width: '100%', margin: 0 }}> // <Menu secondary vertical style={{ width: '100%', margin: 0 }}>
{renderButtons(true)} // {renderButtons(true)}
<Menu.Item> // <Menu.Item>
{userState.user ? ( // {userState.user ? (
<Button onClick={logout}>注销</Button> // <Button onClick={logout}>注销</Button>
) : ( // ) : (
<> // <>
<Button // <Button
onClick={() => { // onClick={() => {
setShowSidebar(false); // setShowSidebar(false);
navigate('/login'); // navigate('/login');
}} // }}
> // >
登录 // 登录
</Button> // </Button>
<Button // <Button
onClick={() => { // onClick={() => {
setShowSidebar(false); // setShowSidebar(false);
navigate('/register'); // navigate('/register');
}} // }}
> // >
注册 // 注册
</Button> // </Button>
</> // </>
)} // )}
</Menu.Item> // </Menu.Item>
</Menu> // </Menu>
//
</Segment> // </Segment>
) : ( // ) : (
<></> // <></>
)} // )}
//
//
</> // </>
); // );
} // }
const switchMode = (model) => { const switchMode = (model) => {
const body = document.body; const body = document.body;
if (!model) { if (!model) {

View File

@@ -142,82 +142,6 @@ const HeaderBar = () => {
}); });
}; };
if (isMobile()) {
return (
<>
<Menu
borderless
size='large'
style={
showSidebar
? {
borderBottom: 'none',
marginBottom: '0',
borderTop: 'none',
height: '51px'
}
: {borderTop: 'none', height: '52px'}
}
>
<Container>
<Menu.Item as={Link} to='/'>
<img
src={logo}
alt='logo'
style={{marginRight: '0.75em'}}
/>
<div style={{fontSize: '20px'}}>
<b>{systemName}</b>
</div>
</Menu.Item>
<Menu.Menu position='right'>
<Menu.Item onClick={toggleSidebar}>
<Icon name={showSidebar ? 'close' : 'sidebar'}/>
</Menu.Item>
</Menu.Menu>
</Container>
</Menu>
{showSidebar ? (
<Segment style={{marginTop: 0, borderTop: '0'}}>
{/*<Menu secondary vertical style={{ width: '100%', margin: 0 }}>*/}
{/* {renderButtons(true)}*/}
{/* <Menu.Item>*/}
{/* {userState.user ? (*/}
{/* <Button onClick={logout}>注销</Button>*/}
{/* ) : (*/}
{/* <>*/}
{/* <Button*/}
{/* onClick={() => {*/}
{/* setShowSidebar(false);*/}
{/* navigate('/login');*/}
{/* }}*/}
{/* >*/}
{/* 登录*/}
{/* </Button>*/}
{/* <Button*/}
{/* onClick={() => {*/}
{/* setShowSidebar(false);*/}
{/* navigate('/register');*/}
{/* }}*/}
{/* >*/}
{/* 注册*/}
{/* </Button>*/}
{/* </>*/}
{/* )}*/}
{/* </Menu.Item>*/}
{/*</Menu>*/}
</Segment>
) : (
<></>
)}
</>
);
}
return ( return (
<> <>
<Layout> <Layout>