indexBasicInfo.jsx 2.5 KB

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