调整题库

yslnewtiku
杨树林 6 years ago
parent 4954d244b4
commit d6de7bf531

@ -429,7 +429,7 @@ class Questionitem_banks extends Component {
name: anserdata[0],
item_type: Getdatasdata[1].rbtx,
difficulty:Getdatasdata[0].rbnd,
analysis: anserdata[3],
analysis: anserdata[2],
choices: choices,
};
@ -507,6 +507,7 @@ class Questionitem_banks extends Component {
</Breadcrumb>
</div>
{/*题目头部操作*/}
<Itembankstop
{...this.state}

@ -81,6 +81,9 @@ class Headplugselection extends Component {
// console.log(this.props.disciplinesdata);
// disciplinesdatakc:kc,
// disciplinesdatazsd:zsd,
console.log(this.props.disciplinesdatakc);
console.log(this.props.disciplinesdatazsd);
return (
<div className=" clearfix mt21 ">
<div className="educontent w1200dbl">

@ -16,6 +16,7 @@ import {
Col, Row, InputNumber, DatePicker, AutoComplete, Button, Tag
} from "antd";
import './../questioncss/questioncom.css';
const InputGroup = Input.Group;
const {Option} = Select;
const options = [
@ -40,6 +41,7 @@ const options = [
],
},
];
class Itembankstop extends Component {
constructor(props) {
super(props);
@ -53,6 +55,7 @@ class Itembankstop extends Component {
options: [],
}
}
//初始化
componentDidMount() {
try {
@ -80,13 +83,9 @@ class Itembankstop extends Component {
// 题型
}
componentDidUpdate(prevProps) {
// //console.log("componentDidUpdate");
// //console.log(prevProps);
// //console.log(this.props.item_banksedit);
if (prevProps.item_banksedit !== this.props.item_banksedit) {
if (this.props.item_banksedit.item_type) {
@ -95,26 +94,89 @@ class Itembankstop extends Component {
if (this.props.item_banksedit.difficulty) {
this.handleFormLayoutChange(this.props.item_banksedit.difficulty);
}
if (this.props.item_banksedit.tag_disciplines) {
this.handletag_disciplinesChange(this.props.item_banksedit.tag_disciplines);
}
// if(prevProps.knowledgepoints !== this.props.knowledgepoints){
// this.setState({
// knowledgepoints:this.props.knowledgepoints
// })
// }
if (this.props.item_banksedit.discipline &&this.props.item_banksedit.sub_discipline) {
this.handdisciplinesChange(this.props.item_banksedit.discipline,this.props.item_banksedit.sub_discipline);
}
}
if (prevProps.disciplmy !== this.props.disciplmy) {
this.setState({
options: this.props.disciplmy
})
}
}
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) => {
////console.log(`checked = ${e.target.checked}`);
}
Getdatas = () => {
return this.handleSubmits();
@ -203,11 +265,16 @@ class Itembankstop extends Component {
}
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);
@ -311,7 +378,6 @@ class Itembankstop extends Component {
}
render() {
let {page, options} = this.state;
const {getFieldDecorator} = this.props.form;
@ -363,7 +429,8 @@ class Itembankstop extends Component {
)(
<div className="sortinxdirection">
<InputGroup compact>
<Cascader style={{ width: '258px' }} options={options} onChange={this.handleFormzhishidian} placeholder="请选择..." />
<Cascader style={{width: '258px'}} value={this.state.rbkc} options={options} onChange={this.handleFormzhishidian}
placeholder="请选择..."/>
</InputGroup>
@ -386,21 +453,18 @@ class Itembankstop extends Component {
{/*</div>*/}
</div>
)}
</Form.Item>
<Form onSubmit={this.handleSubmit}>
<Form.Item
label="知识点"
>
{getFieldDecorator("rbzsd",
{
rules: [{ required: true, message: '请选择知识点' }],
}
{getFieldDecorator("rbzsd"
)(
<div className="sortinxdirection">
<InputGroup compact>
<Select style={{ width: '258px' }} value={this.state.rbzsd} onChange={this.handleFormkechen} placeholder="请选择...">
<Select style={{width: '258px'}} value={this.state.rbzsd} onChange={this.handleFormkechen}
placeholder="请选择...">
{this.state.knowledgepoints && this.state.knowledgepoints.map((object, index) => {
return (
<Option value={object.id}>{object.name}</Option>
@ -420,7 +484,8 @@ class Itembankstop extends Component {
position: "relative",
}}>
<p className="w100s stestcen lh32">{object.name}</p>
<i className="iconfont icon-roundclose font-25 lg ml7 icondowncolorss" onClick={()=>this.deletesobject(object,index)}></i>
<i className="iconfont icon-roundclose font-25 lg ml7 icondowncolorss"
onClick={() => this.deletesobject(object, index)}></i>
</div>
)
})}
@ -439,7 +504,8 @@ class Itembankstop extends Component {
}
)(
<InputGroup compact>
<Select style={{ width: '258px' }} value={this.state.rbtx} onChange={this.handleFormtixing} placeholder="请选择...">
<Select style={{width: '258px'}} value={this.state.rbtx} onChange={this.handleFormtixing}
placeholder="请选择...">
<Option value="SINGLE">单选题</Option>
<Option value="MULTIPLE">多选题</Option>
<Option value="JUDGMENT">判断题</Option>
@ -510,7 +576,6 @@ class Itembankstop extends Component {
rules: [{required: true, message: '请选择难度'}],
}
)(
<Radio.Group value={this.state.rbnd} onChange={this.handleFormLayoutChange}>
<Radio.Button value="1">简单</Radio.Button>
<Radio.Button value="2">适中</Radio.Button>
@ -533,7 +598,7 @@ class Itembankstop extends Component {
}
}
const Itembankstops = Form.create({name: 'Itembankstops'})(Itembankstop);
export default Itembankstops;

Loading…
Cancel
Save