Commit 2a11d9ac authored by jim's avatar jim

fix review warning

parent e9d8e007
...@@ -25,8 +25,16 @@ export default class Info extends Component { ...@@ -25,8 +25,16 @@ export default class Info extends Component {
key = menuMap[key] ? key : 'base'; key = menuMap[key] ? key : 'base';
this.state = { this.state = {
selectKey: key, selectKey: key,
mode: 'inline',
}; };
} }
componentDidMount() {
window.addEventListener('resize', this.resize);
this.resize();
}
componentWillUnmount() {
window.removeEventListener('resize', this.resize);
}
getmenu = () => { getmenu = () => {
return Object.keys(menuMap).map(item => ( return Object.keys(menuMap).map(item => (
<Item key={item}>{menuMap[item]}</Item> <Item key={item}>{menuMap[item]}</Item>
...@@ -41,16 +49,37 @@ export default class Info extends Component { ...@@ -41,16 +49,37 @@ export default class Info extends Component {
selectKey: key, selectKey: key,
}); });
}; };
resize = () => {
if (!this.main) {
return;
}
let mode = 'inline';
const { offsetWidth } = this.main;
if (this.main.offsetWidth < 641 && offsetWidth > 400) {
mode = 'horizontal';
}
if (window.innerWidth < 768 && offsetWidth > 400) {
mode = 'horizontal';
}
this.setState({
mode,
});
};
render() { render() {
const { match, routerData, currentUser } = this.props; const { match, routerData, currentUser } = this.props;
if (!currentUser.userid) { if (!currentUser.userid) {
return ''; return '';
} }
return ( return (
<div className={styles.main}> <div
className={styles.main}
ref={(ref) => {
this.main = ref;
}}
>
<div className={styles.leftmenu}> <div className={styles.leftmenu}>
<Menu <Menu
mode="inline" mode={this.state.mode}
selectedKeys={[this.state.selectKey]} selectedKeys={[this.state.selectKey]}
onClick={this.selectKey} onClick={this.selectKey}
> >
...@@ -70,7 +99,11 @@ export default class Info extends Component { ...@@ -70,7 +99,11 @@ export default class Info extends Component {
exact={item.exact} exact={item.exact}
/> />
))} ))}
<Redirect exact from="/user-profile/userinfo" to="/user-profile/userinfo/base" /> <Redirect
exact
from="/user-profile/userinfo"
to="/user-profile/userinfo/base"
/>
<Redirect to="/exception/404" /> <Redirect to="/exception/404" />
</Switch> </Switch>
</div> </div>
......
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
.ant-menu-inline { .ant-menu-inline {
border: none; border: none;
} }
.ant-menu:not(.ant-menu-horizontal) .ant-menu-item-selected {
font-weight: bold;
}
} }
} }
.right { .right {
...@@ -31,6 +34,11 @@ ...@@ -31,6 +34,11 @@
margin-bottom: 12px; margin-bottom: 12px;
} }
} }
:global {
.ant-list-split .ant-list-item:last-child {
border-bottom: 1px solid #e8e8e8;
}
}
} }
:global { :global {
.ant-list-item-meta { .ant-list-item-meta {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment