indexBasicInfo.jsx 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. import React from "react";
  2. import "./indexBasicInfo.css";
  3. import { Typography, Table, Button } from "antd";
  4. const { Text, Title, Link } = Typography;
  5. class indexBasicInfo extends React.Component {
  6. constructor(props) {
  7. super(props);
  8. // this.title = title[props.location.pathname];
  9. }
  10. render() {
  11. console.log(this.props.location.state);
  12. const outPutList = this.props.location.state.outputResult;
  13. const errorList = this.props.location.state.errorResult;
  14. return (
  15. <div>
  16. <Title level={4}>{title[this.props.location.pathname]}</Title>
  17. <div>
  18. <Title className="stocks-title" level={5}>
  19. 输入参数:
  20. </Title>
  21. <Text>
  22. method=stock_info&code=股票代码&timestamp=时间戳&sign=签名值
  23. </Text>
  24. </div>
  25. <div>
  26. <Title className="stocks-title" level={5}>
  27. 输出结果:
  28. </Title>
  29. <Table
  30. columns={columns}
  31. dataSource={outPutList}
  32. pagination={false}
  33. size="small"
  34. />
  35. </div>
  36. <div>
  37. <Title className="stocks-title" level={5}>
  38. 输出结果异常:
  39. </Title>
  40. <Table
  41. columns={errColumns}
  42. dataSource={errorList}
  43. pagination={false}
  44. size="small"
  45. />
  46. </div>
  47. <div>
  48. <Title className="stocks-title" level={5}>
  49. 测试地址:
  50. </Title>
  51. <Button type="primary" className="stocks-button">
  52. API测试工具
  53. </Button>
  54. </div>
  55. <div>
  56. <Title className="stocks-title" level={5}>
  57. SDK包:
  58. </Title>
  59. <Link>php程序包下载</Link>
  60. </div>
  61. </div>
  62. );
  63. }
  64. }
  65. export default indexBasicInfo;
  66. var title = {
  67. "/indexBasicInfo": "指数基本信息",
  68. "/indexNow": "指数当天信息",
  69. "/indexBefore": "指数回溯"
  70. };
  71. const columns = [
  72. {
  73. title: "名称",
  74. dataIndex: "name",
  75. key: "name",
  76. render: (text) => <span>{text}</span>
  77. },
  78. {
  79. title: "说明",
  80. dataIndex: "desc",
  81. key: "desc"
  82. }
  83. ];
  84. // var data = [
  85. // {
  86. // key: "1",
  87. // name: "message_code",
  88. // desc: 200
  89. // },
  90. // {
  91. // key: "2",
  92. // name: "message",
  93. // desc: "success"
  94. // },
  95. // {
  96. // key: "3",
  97. // name: "code",
  98. // desc: "指数代码"
  99. // },
  100. // {
  101. // key: "4",
  102. // name: "name",
  103. // desc: "指数名称"
  104. // },
  105. // {
  106. // key: "5",
  107. // name: "sector",
  108. // desc: "交易板块"
  109. // },
  110. // {
  111. // key: "6",
  112. // name: "sector",
  113. // desc: "所属市场"
  114. // }
  115. // ];
  116. const errColumns = [
  117. {
  118. title: "错误类型",
  119. dataIndex: "type",
  120. key: "type",
  121. render: (text) => <span>{text}</span>
  122. },
  123. {
  124. title: "message_code",
  125. dataIndex: "code",
  126. key: "code"
  127. },
  128. {
  129. title: "message",
  130. dataIndex: "message",
  131. key: "message"
  132. }
  133. ];
  134. // var errdata = [
  135. // {
  136. // key: "1",
  137. // type: "股票代码错误",
  138. // code: 301,
  139. // message: "股票代码不存在/错误"
  140. // },
  141. // {
  142. // key: "3",
  143. // type: "签名错误",
  144. // code: 304,
  145. // message: "非法签名"
  146. // },
  147. // {
  148. // key: "4",
  149. // type: "返回数据为空",
  150. // code: 401,
  151. // message: "股票数据为空"
  152. // },
  153. // {
  154. // key: "5",
  155. // type: "服务器错误",
  156. // code: 501,
  157. // message: "服务器错误"
  158. // }
  159. // ];