TencentAPIPath.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import React, {Component} from 'react';
  2. import {Input, Select, Button, Row, Col} from 'antd';
  3. const Option = Select.Option;
  4. class TencentAPIPath extends Component {
  5. constructor(props) {
  6. super(props);
  7. this.state = {
  8. configs: ['apiGWName', 'apiGWDesc', 'requestMethod'],
  9. apiGWName: props.apiPath.apiGWName,
  10. apiGWDesc: props.apiPath.apiGWDesc,
  11. requestMethod: props.apiPath.requestMethod,
  12. };
  13. }
  14. switchConfig = (label) => {
  15. return (e) => {
  16. this.setState({
  17. [label]: e.target.value
  18. })
  19. };
  20. };
  21. componentWillReceiveProps(next) {
  22. this.setState({
  23. apiGWName: next.apiPath.apiGWName,
  24. apiGWDesc: next.apiPath.apiGWDesc,
  25. requestMethod: next.apiPath.requestMethod,
  26. });
  27. };
  28. render() {
  29. return (
  30. <div style={{margin: 20}}>
  31. <div onClick={this.props.reDisplayChoosePath} style={{marginBottom: 30}}> back to choose</div>
  32. <div>
  33. {
  34. this.state.configs.map(config => (
  35. <div key={config} style={{marginBottom: 10}}>
  36. <span className='vice-title'>{config}: </span>
  37. <Input value={this.state[config]} style={{width: 200}}
  38. onChange={this.switchConfig(config)}/>
  39. </div>
  40. ))
  41. }
  42. </div>
  43. </div>
  44. )
  45. }
  46. }
  47. export default TencentAPIPath;