stocksInfo.jsx 2.5 KB

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