调整题库

yslnewtiku
杨树林 5 years ago
parent 056282cc7a
commit 2a256ee057

@ -32,8 +32,8 @@ class Questionitem_banks extends Component {
this.Choques= React.createRef();
this.Judquestio= React.createRef();
this.state = {
item_type:null
item_type:null,
item_banksedit:[]
}
}
@ -60,6 +60,39 @@ class Questionitem_banks extends Component {
// }
// }
// });
const params= this.props&&this.props.match&&this.props.match.params;
if(JSON.stringify(params)==="{}"){
//新增
}else{
//编辑
const url=`/item_banks/${this.props.match.params.id}/edit.json`;
axios.get((url)).then((response) => {
if(response===null||response===undefined){
return
}
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
}else{
}
////console.log("item_banks");
console.log("Questionitem_banks");
console.log(response.data);
this.setState({
item_banksedit:response.data,
})
}).catch((error) => {
////console.log(error)
});
}
}
@ -289,6 +322,8 @@ class Questionitem_banks extends Component {
////console.log("塞选的数据");
////console.log(item_type);
const params= this.props&&this.props.match&&this.props.match.params;
// console.log(params);
return (
<div className="newMain clearfix intermediatecenter "
style={{
@ -308,8 +343,8 @@ class Questionitem_banks extends Component {
<div className="w1200mss">
<div className="w100s mt30">
<Breadcrumb separator=">">
<Breadcrumb.Item>试题库</Breadcrumb.Item>
<Breadcrumb.Item href="">新增试题</Breadcrumb.Item>
<Breadcrumb.Item href="/question">试题库</Breadcrumb.Item>
<Breadcrumb.Item >{JSON.stringify(params)==="{}"?"新增":"编辑"}试题</Breadcrumb.Item>
</Breadcrumb>
</div>

@ -59,6 +59,7 @@ class Itembankstop extends Component {
this.state = {
page:1,
Knowpoints:[],
rbtx:"",
}
}
//初始化
@ -79,8 +80,23 @@ class Itembankstop extends Component {
// }
// }).catch((error) => {
// //console.log(error)
// });
// });()
// 题型
}
componentDidUpdate(prevProps) {
console.log("componentDidUpdate");
console.log(prevProps);
console.log(this.props.item_banksedit);
if(prevProps.item_banksedit !== this.props.item_banksedit){
debugger
this.handleFormtixing(this.props.item_banksedit.item_type);
this.handleFormLayoutChange(this.props.item_banksedit.difficulty);
}
}
onChange=(e)=> {
//console.log(`checked = ${e.target.checked}`);
@ -122,6 +138,9 @@ class Itembankstop extends Component {
this.props.form.setFieldsValue({
rbnd:value,
});
this.setState({
rbnd:value,
})
}
handleFormkechen=(value)=>{
@ -148,11 +167,14 @@ class Itembankstop extends Component {
handleFormtixing=(value)=>{
//题型
//console.log("题型");
//console.log(value);
console.log("题型");
console.log(value);
this.props.form.setFieldsValue({
rbtx:value,
});
this.setState({
rbtx:value,
})
this.props.setitem_type(value);
}
preventDefault=(e)=> {
@ -188,7 +210,8 @@ class Itembankstop extends Component {
render() {
let {page}=this.state;
const { getFieldDecorator } = this.props.form;
console.log("renderrenderrender");
console.log(this.props.item_banksedit);
return (
<div className=" clearfix educontent Contentquestionbankstyle w100s w1200fpx mt19" >
@ -234,6 +257,7 @@ class Itembankstop extends Component {
<InputGroup compact >
<Select style={{ width: '258px' }} onChange={this.handleFormkechen} placeholder="请选择...">
<Option value="Home">Home</Option>
<Option value="Company">Company</Option>
</Select>
@ -286,7 +310,7 @@ class Itembankstop extends Component {
}
)(
<InputGroup compact>
<Select style={{ width: '258px' }} onChange={this.handleFormtixing} placeholder="请选择...">
<Select style={{ width: '258px' }} defaultValue onChange={this.handleFormtixing} placeholder="请选择...">
<Option value="SINGLE">单选题</Option>
<Option value="MULTIPLE">多选题</Option>
<Option value="JUDGMENT">判断题</Option>
@ -357,7 +381,7 @@ class Itembankstop extends Component {
}
)(
<Radio.Group onChange={this.handleFormLayoutChange} >
<Radio.Group defaultValue={this.state.rbnd} onChange={this.handleFormLayoutChange} >
<Radio.Button value="1">简单</Radio.Button>
<Radio.Button value="2">适中</Radio.Button>
<Radio.Button value="3">困难</Radio.Button>

@ -45,6 +45,7 @@ class Listjihe extends Component {
}
render() {
let {page,name,nd,chakanjiexibool}=this.state;
let {defaultActiveKey,items}=this.props;
@ -112,10 +113,12 @@ class Listjihe extends Component {
<i className="iconfont icon-shanchu1 font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>删除</span>
</p>
<a href={`/question/edit/${items.id}`}>
<p className="viewparsings xiaoshou mr25" >
<i className="iconfont icon-bianji2 font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>编辑</span>
</p>
</a>
<p className="viewparsings xiaoshou mr25" onClick={()=>this.props.showmodels(items.id)}>
<i className="iconfont icon-gongkai font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>公开</span>

Loading…
Cancel
Save