mock平台

GuideBtns.js 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import React, { PureComponent as Component } from 'react';
  2. import PropTypes from 'prop-types';
  3. import { Button } from 'antd';
  4. import { connect } from 'react-redux';
  5. import { changeStudyTip, finishStudy } from '../../reducer/modules/user.js';
  6. @connect(
  7. null,
  8. {
  9. changeStudyTip,
  10. finishStudy
  11. }
  12. )
  13. class GuideBtns extends Component {
  14. constructor(props) {
  15. super(props);
  16. }
  17. static propTypes = {
  18. changeStudyTip: PropTypes.func,
  19. finishStudy: PropTypes.func,
  20. isLast: PropTypes.bool
  21. };
  22. // 点击下一步
  23. nextStep = () => {
  24. this.props.changeStudyTip();
  25. if (this.props.isLast) {
  26. this.props.finishStudy();
  27. }
  28. };
  29. // 点击退出指引
  30. exitGuide = () => {
  31. this.props.finishStudy();
  32. };
  33. render() {
  34. return (
  35. <div className="btn-container">
  36. <Button className="btn" type="primary" onClick={this.nextStep}>
  37. {this.props.isLast ? '完 成' : '下一步'}
  38. </Button>
  39. <Button className="btn" type="dashed" onClick={this.exitGuide}>
  40. 退出指引
  41. </Button>
  42. </div>
  43. );
  44. }
  45. }
  46. export default GuideBtns;