Bladeren bron

指数部分属性参数待修改

chenlu 5 jaren geleden
bovenliggende
commit
3c5091386b

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


+ 8 - 0
boniu/package-lock.json

@@ -15642,6 +15642,7 @@
           "version": "2.3.2",
           "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz",
           "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==",
+          "optional": true,
           "requires": {
             "arr-flatten": "^1.1.0",
             "array-unique": "^0.3.2",
@@ -15659,6 +15660,7 @@
               "version": "2.0.1",
               "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
               "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+              "optional": true,
               "requires": {
                 "is-extendable": "^0.1.0"
               }
@@ -15689,6 +15691,7 @@
           "version": "4.0.0",
           "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
           "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=",
+          "optional": true,
           "requires": {
             "extend-shallow": "^2.0.1",
             "is-number": "^3.0.0",
@@ -15700,6 +15703,7 @@
               "version": "2.0.1",
               "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
               "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+              "optional": true,
               "requires": {
                 "is-extendable": "^0.1.0"
               }
@@ -15746,6 +15750,7 @@
           "version": "3.0.0",
           "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
           "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=",
+          "optional": true,
           "requires": {
             "kind-of": "^3.0.2"
           },
@@ -15754,6 +15759,7 @@
               "version": "3.2.2",
               "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
               "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
+              "optional": true,
               "requires": {
                 "is-buffer": "^1.1.5"
               }
@@ -15764,6 +15770,7 @@
           "version": "3.1.10",
           "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz",
           "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==",
+          "optional": true,
           "requires": {
             "arr-diff": "^4.0.0",
             "array-unique": "^0.3.2",
@@ -15819,6 +15826,7 @@
           "version": "2.1.1",
           "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz",
           "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=",
+          "optional": true,
           "requires": {
             "is-number": "^3.0.0",
             "repeat-string": "^1.6.1"

+ 19 - 10
boniu/src/IndexApiList.jsx

@@ -1,13 +1,22 @@
 const indexApiList = [
-    {
-        name: "指数基本信息", icon: "xx4", url: "/xx4", hidden: false,
-    },
-    {
-        name: "指数当天信息", icon: "xx5", url: "/xx5", hidden: false,
-    },
-    {
-        name: "指数回溯", icon: "xx6", url: "/xx6", hidden: true,
-    },
+  {
+    name: "指数基本信息",
+    icon: "xx4",
+    url: "/indexBasicInfo",
+    hidden: false
+  },
+  {
+    name: "指数当天信息",
+    icon: "xx5",
+    url: "/indexNow",
+    hidden: false
+  },
+  {
+    name: "指数回溯",
+    icon: "xx6",
+    url: "/indexBefore",
+    hidden: true
+  }
 ];
 
-export default indexApiList
+export default indexApiList;

+ 18 - 11
boniu/src/components/BasicRoute/router.js

@@ -1,20 +1,27 @@
-import React from 'react'
+import React from "react";
 import ReactDOM from "react-dom";
-import {Switch,Redirect, Route} from "react-router-dom";
-import Overview from '../Overview/overview'
-import Stocks from '../StocksApi/stocks'
-import IndexApi from '../IndexApi/indexApi'
+import { Switch, Redirect, Route } from "react-router-dom";
+import Overview from "../Overview/overview";
+import Stocks from "../StocksApi/stocks";
+import IndexApi from "../IndexApi/indexApi";
+import indexBasicInfo from "../indexBasicInfo/indexBasicInfo";
+
 const BasicRoute = () => (
   <div>
     <Switch>
       <Route exact path="/overview" component={Overview} />
       <Route path="/stocks" component={Stocks} />
-      <Route path="/indexApi" component={IndexApi}/>
-      <Route path="/error" render={(props) => <div><h1>404 Not Found!</h1></div>}/>
+      <Route path="/indexApi" component={IndexApi} />
+      <Route path="/indexBasicInfo" component={indexBasicInfo} />
+      <Route
+        path="/error"
+        render={(props) => (
+          <div>
+            <h1>404 Not Found!</h1>
+          </div>
+        )}
+      />
     </Switch>
   </div>
 );
-export default BasicRoute ;
-
-
-
+export default BasicRoute;

+ 3 - 12
boniu/src/components/IndexApi/indexApi.jsx

@@ -1,17 +1,8 @@
-import React from 'react';
-import './indexApi.css'
-
+import React from "react";
+import "./indexApi.css";
 
 const IndexApi = () => {
-
-    return (
-
-
-        <div>IndexApi</div>
-
-
-    )
-
+  return <div>IndexApi</div>;
 };
 
 export default IndexApi;

+ 9 - 4
boniu/src/components/Navbar/navbar.jsx

@@ -3,6 +3,8 @@ import { Route, Switch } from "react-router-dom";
 import Overview from "../../components/Overview/overview";
 import Stocks from "../../components/StocksApi/stocks";
 import IndexApi from "../../components/IndexApi/indexApi";
+import indexBasicInfo from "../../components/indexBasicInfo/indexBasicInfo";
+
 import { Link } from "react-router-dom";
 import stocksApiList from "../../StocksApiList";
 import indexApiList from "../../IndexApiList";
@@ -12,7 +14,7 @@ import { Layout, Menu } from "antd";
 import {
   UserOutlined,
   LaptopOutlined,
-  NotificationOutlined,
+  NotificationOutlined
 } from "@ant-design/icons";
 const { SubMenu } = Menu;
 const { Header, Content, Sider } = Layout;
@@ -20,7 +22,7 @@ export default class NavBar extends Component {
   constructor(props) {
     super(props);
     this.state = {
-      userInfo: {},
+      userInfo: {}
     };
   }
   render() {
@@ -62,7 +64,7 @@ export default class NavBar extends Component {
                 {indexApiList.map((item) => {
                   return (
                     <Menu.Item key={item.url}>
-                      <Link to="/indexApi">{item.name}</Link>
+                      <Link to={item.url}>{item.name}</Link>
                     </Menu.Item>
                   );
                 })}
@@ -75,13 +77,16 @@ export default class NavBar extends Component {
                 background: "#fff",
                 padding: 24,
                 margin: 0,
-                minHeight: 280,
+                minHeight: 280
               }}
             >
               <Switch>
                 <Route exact path="/overview" component={Overview} />
                 <Route path="/stocks" component={Stocks} />
                 <Route path="/indexApi" component={IndexApi} />
+                <Route path="/indexBasicInfo" component={indexBasicInfo} />
+                <Route path="/indexNow" component={indexBasicInfo} />
+                <Route path="/indexBefore" component={indexBasicInfo} />
               </Switch>
             </Content>
           </Layout>

+ 14 - 0
boniu/src/components/indexBasicInfo/indexBasicInfo.css

@@ -0,0 +1,14 @@
+.stocks-title {
+  margin-top: 30px;
+  display: flex;
+  align-items: center;
+}
+.stocks-title::before {
+  content: "";
+  margin-right: 10px;
+  display: block;
+  width: 6px;
+  height: 20px;
+  border-radius: 3px;
+  background-color: #00c0ff;
+}

+ 163 - 0
boniu/src/components/indexBasicInfo/indexBasicInfo.jsx

@@ -0,0 +1,163 @@
+import React from "react";
+import "./indexBasicInfo.css";
+import { Typography, Table, Button } from "antd";
+
+const { Text, Title, Link } = Typography;
+
+class indexBasicInfo extends React.Component {
+  constructor(props) {
+    super(props);
+    // this.title = title[props.location.pathname];
+  }
+  render() {
+    console.log(this.props);
+    return (
+      <div>
+        <Title level={4}>{title[this.props.location.pathname]}</Title>
+        <div>
+          <Title className="stocks-title" level={5}>
+            输入参数:
+          </Title>
+          <Text>
+            method=stock_info&code=股票代码&timestamp=时间戳&sign=签名值
+          </Text>
+        </div>
+
+        <div>
+          <Title className="stocks-title" level={5}>
+            输出结果:
+          </Title>
+          <Table
+            columns={columns}
+            dataSource={data}
+            pagination={false}
+            size="small"
+          />
+        </div>
+        <div>
+          <Title className="stocks-title" level={5}>
+            输出结果异常:
+          </Title>
+          <Table
+            columns={errcolumns}
+            dataSource={errdata}
+            pagination={false}
+            size="small"
+          />
+        </div>
+
+        <div>
+          <Title className="stocks-title" level={5}>
+            测试地址:
+          </Title>
+          <Button type="primary" className="stocks-button">
+            API测试工具
+          </Button>
+        </div>
+        <div>
+          <Title className="stocks-title" level={5}>
+            SDK包:
+          </Title>
+          <Link>php程序包下载</Link>
+        </div>
+      </div>
+    );
+  }
+}
+
+export default indexBasicInfo;
+var title = {
+  "/indexBasicInfo": "指数基本信息",
+  "/indexNow": "指数当天信息",
+  "/indexBefore": "指数回溯"
+};
+var columns = [
+  {
+    title: "名称",
+    dataIndex: "name",
+    key: "name",
+    render: (text) => <span>{text}</span>
+  },
+  {
+    title: "说明",
+    dataIndex: "desc",
+    key: "desc"
+  }
+];
+var data = [
+  {
+    key: "1",
+    name: "message_code",
+    desc: 200
+  },
+  {
+    key: "2",
+    name: "message",
+    desc: "success"
+  },
+  {
+    key: "3",
+    name: "code",
+    desc: "指数代码"
+  },
+  {
+    key: "4",
+    name: "name",
+    desc: "指数名称"
+  },
+  {
+    key: "5",
+    name: "sector",
+    desc: "交易板块"
+  },
+  {
+    key: "5",
+    name: "sector",
+    desc: "所属市场"
+  }
+];
+
+var errcolumns = [
+  {
+    title: "错误类型",
+    dataIndex: "type",
+    key: "type",
+    render: (text) => <span>{text}</span>
+  },
+  {
+    title: "message_code",
+    dataIndex: "code",
+    key: "code"
+  },
+  {
+    title: "message",
+    dataIndex: "message",
+    key: "message"
+  }
+];
+var errdata = [
+  {
+    key: "1",
+    type: "股票代码错误",
+    code: 301,
+    message: "股票代码不存在/错误"
+  },
+  {
+    key: "3",
+    type: "签名错误",
+    code: 304,
+    message: "非法签名"
+  },
+  {
+    key: "4",
+    type: "返回数据为空",
+    code: 401,
+    message: "股票数据为空"
+  },
+  {
+    key: "5",
+    type: "服务器错误",
+    code: 501,
+    message: "服务器错误"
+  }
+];