|
|
@@ -2,7 +2,7 @@ import React, { Component } from "react";
|
|
|
import { Route, Switch, Link, withRouter } from "react-router-dom";
|
|
|
import Overview from "../../components/Overview/overview";
|
|
|
import indexBasicInfo from "../../components/indexBasicInfo/indexBasicInfo";
|
|
|
-import stocksInfo from '../../components/StocksInfo/stocksInfo'
|
|
|
+import stocksInfo from "../../components/StocksInfo/stocksInfo";
|
|
|
import stocksApiList from "../../StocksApiList";
|
|
|
import indexApiList from "../../IndexApiList";
|
|
|
import "antd/dist/antd.css";
|
|
|
@@ -19,7 +19,8 @@ class NavBar extends Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
this.state = {
|
|
|
- userInfo: {}
|
|
|
+ userInfo: {},
|
|
|
+ opensubmenu: ["overview"]
|
|
|
};
|
|
|
}
|
|
|
render() {
|
|
|
@@ -39,6 +40,26 @@ class NavBar extends Component {
|
|
|
defaultOpenKeys={["overview"]}
|
|
|
style={{ height: "100%", borderRight: 0 }}
|
|
|
selectedKeys={pathNames}
|
|
|
+ onOpenChange={(item) => {
|
|
|
+ if (item.length < this.state.opensubmenu.length) {
|
|
|
+ this.setState({
|
|
|
+ opensubmenu: item
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.setState({
|
|
|
+ opensubmenu: item
|
|
|
+ });
|
|
|
+ item.slice(-1)[0] === "indexApi"
|
|
|
+ ? this.props.history.push({
|
|
|
+ pathname: indexApiList[0].url,
|
|
|
+ state: indexApiList[0]
|
|
|
+ })
|
|
|
+ : this.props.history.push({
|
|
|
+ pathname: stocksApiList[0].url,
|
|
|
+ state: stocksApiList[0]
|
|
|
+ });
|
|
|
+ }}
|
|
|
>
|
|
|
<Menu.Item key="overview" icon={<UserOutlined />}>
|
|
|
<Link to="/overview">总体说明</Link>
|