Sin descripción

index.tsx 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import React from 'react';
  2. import classnames from 'classnames';
  3. import { Divider, Input, Button } from 'antd';
  4. import wantedCover from '../assets/cover_wanted@2x.png';
  5. import styles from './WantedPublishView.less';
  6. interface WantedPublishViewProps {
  7. type?: 'pop'|'modal';
  8. wrapperClass?: string;
  9. current_wanted: number|string|null;
  10. InputWantedValueChange: Function;
  11. InputWantedPressEnter: Function;
  12. InputWantedOnBlur: Function;
  13. InputWantedClear: Function;
  14. CloseFunction: Function;
  15. }
  16. interface WantedPublishViewState {
  17. payment?: number
  18. }
  19. class WantedPublishView extends React.Component<WantedPublishViewProps, WantedPublishViewState> {
  20. constructor(props: WantedPublishViewProps) {
  21. super(props);
  22. this.state = {};
  23. }
  24. render() {
  25. const { current_wanted, wrapperClass } = this.props;
  26. return (
  27. <div className={classnames(styles.wrapper, {
  28. [wrapperClass ? wrapperClass : '']: true
  29. })}>
  30. <header>设置悬赏金额</header>
  31. <section className={styles.wanted_middle}>
  32. <img className={styles.wanted_cover} src={wantedCover} alt="wanted_image"/>
  33. <div>悬赏提问</div>
  34. </section>
  35. <Divider style={{ minWidth: 'auto', marginLeft: 'auto', marginRight: 'auto', width: '266px'}} />
  36. <section className={styles.wanted_bottom}>
  37. <div className={styles.wanted_bottom_title}>设置悬赏金额范围¥5.00~¥10000</div>
  38. <Input
  39. className={styles.wanted_input_number}
  40. suffix="元"
  41. value={current_wanted || ''}
  42. onChange={v => {
  43. if (!/^[.0-9]*$/g.test(v.target.value)) return;
  44. this.props.InputWantedValueChange(v.target.value);
  45. }}
  46. onPressEnter={() => {
  47. this.props.InputWantedPressEnter(current_wanted);
  48. }}
  49. onBlur={() => {
  50. this.props.InputWantedOnBlur(current_wanted);
  51. }}
  52. autoFocus
  53. />
  54. <div className={styles.wanted_bottom_tips}>
  55. 若5天内没人回答该问题, 所支付的金额将退还至您的钱包
  56. </div>
  57. </section>
  58. <footer>
  59. <Button
  60. className={styles.wanted_confirm_button}
  61. onClick={() => this.props.CloseFunction()}
  62. >
  63. 确定
  64. </Button>
  65. <div
  66. role="button"
  67. tabIndex={-1}
  68. onClick={() => this.props.InputWantedClear()}
  69. className={styles.wanted_cancel_button}
  70. >
  71. 取消悬赏
  72. </div>
  73. </footer>
  74. </div>
  75. )
  76. }
  77. }
  78. export default WantedPublishView;