|
|
@@ -20,7 +20,9 @@ class NavBar extends Component {
|
|
|
super(props);
|
|
|
this.state = {
|
|
|
userInfo: {},
|
|
|
- openSubmenu: ["overview"]
|
|
|
+ openSubmenu: ["overview"],
|
|
|
+ stocks: null,
|
|
|
+ index: null
|
|
|
};
|
|
|
}
|
|
|
render() {
|
|
|
@@ -41,20 +43,30 @@ class NavBar extends Component {
|
|
|
style={{ height: "100%", borderRight: 0 }}
|
|
|
selectedKeys={pathNames}
|
|
|
onOpenChange={(item) => {
|
|
|
- console.log(item)
|
|
|
+ console.log(item);
|
|
|
if (item.length < this.state.openSubmenu.length) {
|
|
|
this.setState({
|
|
|
- openSubmenu: item
|
|
|
+ openSubmenu: item
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
this.setState({
|
|
|
- openSubmenu: item
|
|
|
+ openSubmenu: item
|
|
|
});
|
|
|
item.slice(-1)[0] === "indexApi"
|
|
|
+ ? this.state.index
|
|
|
+ ? this.props.history.push({
|
|
|
+ pathname: this.state.index.url,
|
|
|
+ state: this.state.index
|
|
|
+ })
|
|
|
+ : this.props.history.push({
|
|
|
+ pathname: indexApiList[0].url,
|
|
|
+ state: indexApiList[0]
|
|
|
+ })
|
|
|
+ : this.state.stocks
|
|
|
? this.props.history.push({
|
|
|
- pathname: indexApiList[0].url,
|
|
|
- state: indexApiList[0]
|
|
|
+ pathname: this.state.stocks.url,
|
|
|
+ state: this.state.stocks
|
|
|
})
|
|
|
: this.props.history.push({
|
|
|
pathname: stocksApiList[0].url,
|
|
|
@@ -68,7 +80,14 @@ class NavBar extends Component {
|
|
|
<SubMenu key="stocks" icon={<LaptopOutlined />} title="股票接口">
|
|
|
{stocksApiList.map((item) => {
|
|
|
return (
|
|
|
- <Menu.Item key={item.key}>
|
|
|
+ <Menu.Item
|
|
|
+ key={item.key}
|
|
|
+ onClick={() => {
|
|
|
+ this.setState({
|
|
|
+ stocks: item
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ >
|
|
|
<Link to={{ pathname: item.url, state: item }}>
|
|
|
{item.name}
|
|
|
</Link>
|
|
|
@@ -83,7 +102,14 @@ class NavBar extends Component {
|
|
|
>
|
|
|
{indexApiList.map((item) => {
|
|
|
return (
|
|
|
- <Menu.Item key={item.key}>
|
|
|
+ <Menu.Item
|
|
|
+ key={item.key}
|
|
|
+ onClick={() => {
|
|
|
+ this.setState({
|
|
|
+ index: item
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ >
|
|
|
<Link to={{ pathname: item.url, state: item }}>
|
|
|
{item.name}
|
|
|
</Link>
|