调整题库

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

@ -32,8 +32,8 @@ class Questionitem_banks extends Component {
this.Choques= React.createRef(); this.Choques= React.createRef();
this.Judquestio= React.createRef(); this.Judquestio= React.createRef();
this.state = { 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("塞选的数据");
////console.log(item_type); ////console.log(item_type);
const params= this.props&&this.props.match&&this.props.match.params;
// console.log(params);
return ( return (
<div className="newMain clearfix intermediatecenter " <div className="newMain clearfix intermediatecenter "
style={{ style={{
@ -308,8 +343,8 @@ class Questionitem_banks extends Component {
<div className="w1200mss"> <div className="w1200mss">
<div className="w100s mt30"> <div className="w100s mt30">
<Breadcrumb separator=">"> <Breadcrumb separator=">">
<Breadcrumb.Item>试题库</Breadcrumb.Item> <Breadcrumb.Item href="/question">试题库</Breadcrumb.Item>
<Breadcrumb.Item href="">新增试题</Breadcrumb.Item> <Breadcrumb.Item >{JSON.stringify(params)==="{}"?"新增":"编辑"}试题</Breadcrumb.Item>
</Breadcrumb> </Breadcrumb>
</div> </div>

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

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

Loading…
Cancel
Save