import React, {Component} from "react"; import {Link, NavLink} from 'react-router-dom'; import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl} from 'educoder'; import axios from 'axios'; import { notification, Spin, Table, Pagination, Radio, Checkbox, Form, Input, Select, Cascader, AutoComplete, Col, Row, InputNumber, DatePicker, Button, Tag } from "antd"; import './../questioncss/questioncom.css'; const InputGroup = Input.Group; const {Option} = Select; class Comthetestpapers extends Component { constructor(props) { super(props); this.contentMdRef = React.createRef() this.state = { page: 1, Knowpoints: [], rbtx: undefined, rbkc: undefined, knowledgepoints: [], options: [], } } //初始化 componentDidMount() { try { this.props.getcontentMdRef(this); } catch (e) { } this.setState({ options: this.props.disciplmy, knowledgepoints: this.props.knowledgepoints, }) } handdisciplinesChange =(name,title)=>{ this.setState({ rbkc:[name.id,title.id] }) this.props.form.setFieldsValue({ rbkc: [name.id,title.id], }); if(this.props.item_banksedit.tag_disciplines.length===0){ const didata = this.props.disciplinesdata; const knowledgepointsdata = []; for (var i = 0; i < didata.length; i++) { //方向 if (name.id === didata[i].id) { const fxdidata = didata[i].sub_disciplines; for (var j = 0; j < fxdidata.length; j++) { //课程 if (title.id === fxdidata[j].id) { const zsddata = fxdidata[j].tag_disciplines; for (var k = 0; k < zsddata.length; k++) { //知识点 knowledgepointsdata.push(zsddata[k]); } } } } } this.setState({ Knowpoints: [], knowledgepoints: knowledgepointsdata, }) } } handletag_disciplinesChange = (data) => { try { var sju=data[data.length-1].name; this.setState({ rbzsd:sju, Knowpoints:data, }) this.props.form.setFieldsValue({ rbzsd: sju, }); }catch (e) { } } onChange = (e) => { } Getdatas = () => { return this.handleSubmits(); } handleSubmits = () => { var data = []; this.props.form.validateFields((err, values) => { data = []; if (!err) { data.push({ rbnd: parseInt(values.rbnd) }) data.push({ rbtx: values.rbtx }) data.push({ rbzsd: this.state.Knowpoints }) data.push({ rbkc: values.rbkc }) data.push({ classroom:values.classroom }) data.push({ kssc:values.kssc }) } }); return data; } handleSubmit = (e) => { e.preventDefault(); this.props.form.validateFields((err, values) => { if (!err) { ////console.log("获取的form 数据"); ////console.log(values); } }); } handleFormLayoutChange = (value) => { //难度塞选 ////console.log("难度塞选"); ////console.log(value); this.props.form.setFieldsValue({ rbnd: value + "", }); this.setState({ rbnd: value + "", }) } handleFormkechen = (value) => { //课程 ////console.log("课程"); ////console.log(value); var valuename = undefined; this.props.form.setFieldsValue({ rbzsd: value, }); var arr = this.state.knowledgepoints; for (let data of arr) { if (data.id === value) { this.state.Knowpoints.push(data); valuename = data.name; } } var tmp = JSON.parse(JSON.stringify(this.state.knowledgepoints)); for (var i = 0; i < tmp.length; i++) { if (tmp[i].id === value) { this.state.knowledgepoints.splice(i, 1); } } this.setState({ rbzsd: valuename, Knowpoints: this.state.Knowpoints, knowledgepoints: this.state.knowledgepoints, }) } handleFormzhishidian = (value) => { console.log("handleFormzhishidian 课程"); console.log(value); //课程 this.props.form.setFieldsValue({ rbkc: value, }); this.setState({ rbkc:value, }) // console.log("handleFormzhishidian"); // console.log(this.props.disciplinesdata); const didata = this.props.disciplinesdata; const knowledgepointsdata = []; for (var i = 0; i < didata.length; i++) { //方向 if (value[0] === didata[i].id) { const fxdidata = didata[i].sub_disciplines; for (var j = 0; j < fxdidata.length; j++) { //课程 if (value[1] === fxdidata[j].id) { const zsddata = fxdidata[j].tag_disciplines; for (var k = 0; k < zsddata.length; k++) { //知识点 knowledgepointsdata.push(zsddata[k]); } } } } } this.setState({ Knowpoints: [], knowledgepoints: knowledgepointsdata, }) this.props.form.setFieldsValue({ rbzsd: undefined, }); this.setState({ rbzsd: undefined, }) } handleFormtixing = (value) => { //题型 //console.log("题型"); //console.log(value); this.setState({ rbtx: value + "", }) this.props.form.setFieldsValue({ rbtx: value + "", }); this.props.setitem_type(value); } preventDefault = (e) => { e.preventDefault(); ////console.log('Clicked! But prevent default.'); } deletesobject = (item, index) => { var arr = this.state.Knowpoints; for (let data of arr) { if (data.id === item.id) { this.state.knowledgepoints.push(data); } } var tmp = JSON.parse(JSON.stringify(this.state.Knowpoints)); for (var i = 0; i < tmp.length; i++) { if (i >= index) { var pos = this.state.Knowpoints.indexOf(tmp[i]); this.state.Knowpoints.splice(pos, 1); } } this.props.form.setFieldsValue({ rbzsd: this.state.Knowpoints, }); this.setState({ Knowpoints: this.state.Knowpoints, }) if (this.state.Knowpoints.length === 0) { this.setState({ rbzsd: undefined, }) } else if (this.state.Knowpoints.length > 0) { try { const myknowda = this.state.Knowpoints; this.setState({ rbzsd: myknowda[this.state.Knowpoints.length - 1].name, }) } catch (e) { } } } handleSearch=(value)=>{ if(value!=""){ this.props.form.setFieldsValue({ classroom:value, // course:value }); // this.Searchvalue(value) } }; handleChange=(e)=>{ console.log(e); this.props.form.setFieldsValue({ // course:value, classroom:e.target.value, }) if(e.target.value){ if(e.target.value.length>60){ this.setState({ bordebool:true, }) }else if(e.target.value.length===0){ this.setState({ bordebool:true, }) }else{ this.setState({ bordebool:false, }) } }else{ this.setState({ bordebool:true }) } }; render() { let {page,options} = this.state; const {getFieldDecorator} = this.props.form; const optionss = this.state.searchlist && this.state.searchlist.map(d => ); var addonAfterthree=this.props.form&&this.props.form.getFieldValue('classroom'); var addonAfteronelens3=0; if(addonAfterthree){ addonAfteronelens3=String(addonAfterthree).length; } console.log("Comthetestpapers.js"); console.log(this.props); return (