import React, { Component } from 'react'; import { Modal, Row, Col, Checkbox, Alert } from 'antd'; import './index.less'; class SimilarQuestionNo extends Component { constructor(props) { super(props); this.state = { show: !!props.modal, loading: false }; this.questionNos = []; } onConfirm() { const { questionNo } = this.state; if (!questionNo) { this.setState({ err: '请选择需要加载的题目' }); return; } if (this.props.onConfirm && this.props.modal) { this.setState({ loading: true }); this.props .onConfirm(questionNo) .then(() => { this.setState({ loading: false }); this.onCancel(); }) .catch(e => { this.setState({ loading: false, err: e.message }); }); } else { this.onCancel(); } } onCancel() { if (this.props.modal) this.setState({ show: false }); if (this.props.onCancel) this.props.onCancel(); } renderForm() { const { questionNos = [] } = this.props; const { questionNo } = this.state; return