3 Commits d978789534 ... a5ca08db02

Author SHA1 Message Date
  cl a5ca08db02 Merge branch 'master' of http://121.40.40.223:3000/zizhong.wang/boniuApi 4 years ago
  cl ce6f96b5e1 Merge branch 'master' of http://121.40.40.223:3000/zizhong.wang/boniuApi 4 years ago
  cl 33104cdec6 修改lu 4 years ago
2 changed files with 35 additions and 9 deletions
  1. 1 1
      boniu/.eslintcache
  2. 34 8
      boniu/src/components/Navbar/navbar.jsx

File diff suppressed because it is too large
+ 1 - 1
boniu/.eslintcache


+ 34 - 8
boniu/src/components/Navbar/navbar.jsx

@@ -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>