stocksInfo.jsx 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. import React from "react"
  2. import "./stocksInfo.css"
  3. import { Typography, Table, Button } from "antd"
  4. const { Text, Title, Link } = Typography
  5. const StocksInfo = (props) => {
  6. const outPutList = props.location.state.data.outputResult
  7. const errorList = props.location.state.data.errorResult
  8. const title = props.location.state.name
  9. const params = props.location.state.data.params
  10. const paramsInfo = props.location.state.data.paramsInfo
  11. const url = props.location.state.data.url
  12. return (
  13. <div>
  14. <Title level={4}>{title}</Title>
  15. <div>
  16. <Title className="stocks-title" level={5}>
  17. 输入参数:
  18. </Title>
  19. <Text>
  20. { params }
  21. </Text>
  22. <div>
  23. {paramsInfo && '参数说明: '}
  24. {
  25. paramsInfo && paramsInfo.map(info => {
  26. return (
  27. <Text>{ info }</Text>
  28. )
  29. })
  30. }
  31. </div>
  32. </div>
  33. <div>
  34. <Title className="stocks-title" level={5}>
  35. 输出结果:
  36. </Title>
  37. {/* 这里需要二级表格 */}
  38. <Table
  39. columns={columns}
  40. // expandable
  41. dataSource={outPutList}
  42. pagination={false}
  43. size="small"
  44. />
  45. </div>
  46. <div>
  47. <Title className="stocks-title" level={5}>
  48. 输出结果异常:
  49. </Title>
  50. <Table
  51. columns={errColumns}
  52. dataSource={errorList}
  53. pagination={false}
  54. size="small"
  55. />
  56. </div>
  57. <div>
  58. <Title className="stocks-title" level={5}>
  59. 测试地址:
  60. </Title>
  61. <Button type="primary" className="stocks-button">
  62. <a href={ url }>API测试工具</a>
  63. </Button>
  64. </div>
  65. <div>
  66. <Title className="stocks-title" level={5}>
  67. SDK包:
  68. </Title>
  69. <Link href="http://boniu.xazhima.com/sdk/index_any_day.sdk">php程序包下载</Link>
  70. </div>
  71. </div>
  72. )
  73. }
  74. export default StocksInfo
  75. const columns = [
  76. {
  77. title: "名称",
  78. dataIndex: "name",
  79. key: "name",
  80. },
  81. {
  82. title: "说明",
  83. dataIndex: "desc",
  84. key: "desc",
  85. },
  86. ]
  87. const errColumns = [
  88. {
  89. title: "错误类型",
  90. dataIndex: "type",
  91. key: "type",
  92. },
  93. {
  94. title: "message_code",
  95. dataIndex: "code",
  96. key: "code",
  97. },
  98. {
  99. title: "message",
  100. dataIndex: "message",
  101. key: "message",
  102. },
  103. ]