|
|
|
@ -52,6 +52,7 @@ class Itembankstop extends Component {
|
|
|
|
|
rbtx: undefined,
|
|
|
|
|
rbkc: undefined,
|
|
|
|
|
knowledgepoints: [],
|
|
|
|
|
knowledgepoints2:[],
|
|
|
|
|
options: [],
|
|
|
|
|
NewknTypedel:false
|
|
|
|
|
}
|
|
|
|
@ -65,30 +66,14 @@ class Itembankstop extends Component {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
this.setState({
|
|
|
|
|
options: this.props.disciplmy
|
|
|
|
|
})
|
|
|
|
|
// knowledgepoints:this.props.knowledgepoints,
|
|
|
|
|
|
|
|
|
|
////console.log("componentDidMount");
|
|
|
|
|
////console.log(this.state);
|
|
|
|
|
////console.log(this.props);
|
|
|
|
|
// let homeworkid = this.props.match.params.homeworkid;
|
|
|
|
|
// let url = "/homework_commons/" + homeworkid + "/end_groups.json";
|
|
|
|
|
// axios.get(url).then((response) => {
|
|
|
|
|
// if (response.status === 200) {
|
|
|
|
|
// this.setState({})
|
|
|
|
|
// }
|
|
|
|
|
// }).catch((error) => {
|
|
|
|
|
// ////console.log(error)
|
|
|
|
|
// });()
|
|
|
|
|
// 题型
|
|
|
|
|
options: this.props.disciplmy,
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidUpdate(prevProps) {
|
|
|
|
|
//编辑的时候
|
|
|
|
|
|
|
|
|
|
if (prevProps.item_banksedit !== this.props.item_banksedit) {
|
|
|
|
|
if (this.props.item_banksedit.item_type) {
|
|
|
|
|
this.handleFormtixing(this.props.item_banksedit.item_type);
|
|
|
|
@ -99,9 +84,10 @@ class Itembankstop extends Component {
|
|
|
|
|
if (this.props.item_banksedit.tag_disciplines) {
|
|
|
|
|
this.handletag_disciplinesChange(this.props.item_banksedit.tag_disciplines);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.props.item_banksedit.discipline &&this.props.item_banksedit.sub_discipline) {
|
|
|
|
|
try {
|
|
|
|
|
this.handdisciplinesChange(this.props.item_banksedit.discipline,this.props.item_banksedit.sub_discipline);
|
|
|
|
|
}catch (e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (prevProps.disciplmy !== this.props.disciplmy) {
|
|
|
|
@ -109,65 +95,63 @@ class Itembankstop extends Component {
|
|
|
|
|
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]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 把知识点放进塞选中 ,如果是编辑 已经选中就不放进去
|
|
|
|
|
if(prevProps.disciplinesdata!== this.props.disciplinesdata){
|
|
|
|
|
try {
|
|
|
|
|
if(this.props.item_banksedit.discipline &&this.props.item_banksedit.sub_discipline){
|
|
|
|
|
const didata = this.props.disciplinesdata;
|
|
|
|
|
const knowledgepointsdata = [];
|
|
|
|
|
for (var i = 0; i < didata.length; i++) {
|
|
|
|
|
//方向
|
|
|
|
|
if (this.props.item_banksedit.discipline.id === didata[i].id) {
|
|
|
|
|
const fxdidata = didata[i].sub_disciplines;
|
|
|
|
|
for (var j = 0; j < fxdidata.length; j++) {
|
|
|
|
|
//课程
|
|
|
|
|
if (this.props.item_banksedit.sub_discipline.id === fxdidata[j].id) {
|
|
|
|
|
const zsddata = fxdidata[j].tag_disciplines;
|
|
|
|
|
for (var k = 0; k < zsddata.length; k++) {
|
|
|
|
|
//知识点
|
|
|
|
|
knowledgepointsdata.push(zsddata[k]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
const _result =[];
|
|
|
|
|
knowledgepointsdata.filter(item => {
|
|
|
|
|
if (this.props.item_banksedit.tag_disciplines.findIndex(t => t.id === item.id) === -1) {
|
|
|
|
|
_result.push(item);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.setState({
|
|
|
|
|
knowledgepoints:knowledgepointsdata,
|
|
|
|
|
knowledgepoints2: _result,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}catch (e) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
Knowpoints: [],
|
|
|
|
|
knowledgepoints: knowledgepointsdata,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handdisciplinesChange =(name,title)=>{
|
|
|
|
|
this.setState({
|
|
|
|
|
rbkc:[name.id,title.id]
|
|
|
|
|
})
|
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
|
rbkc: [name.id,title.id],
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
handletag_disciplinesChange = (data) => {
|
|
|
|
|
//是否选中的知识点
|
|
|
|
|
try {
|
|
|
|
|
var sju=data[data.length-1].name;
|
|
|
|
|
this.setState({
|
|
|
|
|
rbzsd:sju,
|
|
|
|
|
Knowpoints:data,
|
|
|
|
|
})
|
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
@ -176,6 +160,8 @@ class Itembankstop extends Component {
|
|
|
|
|
}catch (e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
onChange = (e) => {
|
|
|
|
|
|
|
|
|
@ -238,7 +224,6 @@ class Itembankstop extends Component {
|
|
|
|
|
//课程
|
|
|
|
|
////console.log("课程");
|
|
|
|
|
////console.log(value);
|
|
|
|
|
// console.log("handleFormkechen");
|
|
|
|
|
if(this.state.Knowpoints.length>4){
|
|
|
|
|
this.props.showNotification(`知识点最多选择5个`);
|
|
|
|
|
return
|
|
|
|
@ -256,17 +241,20 @@ class Itembankstop extends Component {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
const _result =[];
|
|
|
|
|
this.state.knowledgepoints.filter(item => {
|
|
|
|
|
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
|
|
|
|
|
console.log("guonue");
|
|
|
|
|
console.log(item);
|
|
|
|
|
_result.push(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
rbzsd: valuename,
|
|
|
|
|
Knowpoints: this.state.Knowpoints,
|
|
|
|
|
knowledgepoints: this.state.knowledgepoints,
|
|
|
|
|
knowledgepoints2: _result,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -314,6 +302,7 @@ class Itembankstop extends Component {
|
|
|
|
|
this.setState({
|
|
|
|
|
Knowpoints: [],
|
|
|
|
|
knowledgepoints: knowledgepointsdata,
|
|
|
|
|
knowledgepoints2:knowledgepointsdata,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
@ -341,19 +330,11 @@ class Itembankstop extends Component {
|
|
|
|
|
////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));
|
|
|
|
|
var tmp = 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);
|
|
|
|
|
if (i ===index) {
|
|
|
|
|
tmp.splice(i,1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -361,11 +342,16 @@ class Itembankstop extends Component {
|
|
|
|
|
rbzsd: this.state.Knowpoints,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const _result =[];
|
|
|
|
|
this.state.knowledgepoints.filter(item => {
|
|
|
|
|
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
|
|
|
|
|
_result.push(item);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.setState({
|
|
|
|
|
Knowpoints: this.state.Knowpoints,
|
|
|
|
|
knowledgepoints2:_result,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
if (this.state.Knowpoints.length === 0) {
|
|
|
|
|
this.setState({
|
|
|
|
|
rbzsd: undefined,
|
|
|
|
@ -389,7 +375,6 @@ class Itembankstop extends Component {
|
|
|
|
|
NewknTypedel:bool
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NewknTypedeltyoedel=(value)=>{
|
|
|
|
@ -422,8 +407,17 @@ class Itembankstop extends Component {
|
|
|
|
|
name:value,
|
|
|
|
|
}
|
|
|
|
|
this.state.knowledgepoints.push(leydata);
|
|
|
|
|
const _result =[];
|
|
|
|
|
this.state.knowledgepoints.filter(item => {
|
|
|
|
|
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
|
|
|
|
|
_result.push(item);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
knowledgepoints:this.state.knowledgepoints
|
|
|
|
|
Knowpoints: this.state.Knowpoints,
|
|
|
|
|
knowledgepoints: this.state.knowledgepoints,
|
|
|
|
|
knowledgepoints2: _result,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
@ -435,13 +429,11 @@ class Itembankstop extends Component {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
let {page, options,NewknTypedel} = this.state;
|
|
|
|
|
let {page, options,NewknTypedel,knowledgepoints,knowledgepoints2,Knowpoints} = this.state;
|
|
|
|
|
const {getFieldDecorator} = this.props.form;
|
|
|
|
|
//console.log("renderrenderrender");
|
|
|
|
|
//console.log(this.props.item_banksedit);
|
|
|
|
|
//console.log("renderrenderrendersssss");
|
|
|
|
|
//console.log(this.state.rbtx);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
|
|
<div className=" clearfix educontent Contentquestionbankstyle w100s w1200fpx mt19">
|
|
|
|
@ -500,25 +492,6 @@ class Itembankstop extends Component {
|
|
|
|
|
placeholder="请选择..."/>
|
|
|
|
|
</InputGroup>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{/*<div className="sortinxdirection" style={{*/}
|
|
|
|
|
{/* height: "33px",*/}
|
|
|
|
|
{/* lineHeight: "28px",*/}
|
|
|
|
|
|
|
|
|
|
{/*}}>*/}
|
|
|
|
|
|
|
|
|
|
{/* {this.state.Knowpoints === undefined ? "" : this.state.Knowpoints.map((object, index) => {*/}
|
|
|
|
|
{/* return (*/}
|
|
|
|
|
{/* <div className="mytags" style={{*/}
|
|
|
|
|
{/* position: "relative",*/}
|
|
|
|
|
{/* }}>*/}
|
|
|
|
|
{/* <p className="w100s stestcen lh32">{object}</p>*/}
|
|
|
|
|
{/* <i className="iconfont icon-roundclose font-25 lg ml7 icondowncolorss" onClick={()=>this.deletesobject(object,index)}></i>*/}
|
|
|
|
|
{/* </div>*/}
|
|
|
|
|
{/* )*/}
|
|
|
|
|
{/* })}*/}
|
|
|
|
|
|
|
|
|
|
{/*</div>*/}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</Form.Item>
|
|
|
|
@ -529,17 +502,18 @@ class Itembankstop extends Component {
|
|
|
|
|
)(
|
|
|
|
|
<div className="sortinxdirection">
|
|
|
|
|
<InputGroup compact>
|
|
|
|
|
<Select style={{width: '258px'}} value={this.state.rbzsd} onChange={this.handleFormkechen}
|
|
|
|
|
<Select style={{width: '258px'}} value={undefined} onChange={this.handleFormkechen}
|
|
|
|
|
placeholder="请选择...">
|
|
|
|
|
{this.state.knowledgepoints && this.state.knowledgepoints.map((object, index) => {
|
|
|
|
|
{knowledgepoints2 && knowledgepoints2.map((object, index) => {
|
|
|
|
|
return (
|
|
|
|
|
<Option value={object.id}>{object.name}</Option>
|
|
|
|
|
<Option key={object.id} value={object.id}>{object.name}</Option>
|
|
|
|
|
)
|
|
|
|
|
})}
|
|
|
|
|
</Select>
|
|
|
|
|
</InputGroup>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<img className=" ml22 zjzsdian xiaoshou" src={getImageUrl("/images/educoder/zjzsd.png")} onClick={()=>this.NewknTypedeldel(true)}/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -562,6 +536,9 @@ class Itembankstop extends Component {
|
|
|
|
|
)
|
|
|
|
|
})}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
@ -656,12 +633,6 @@ class Itembankstop extends Component {
|
|
|
|
|
)}
|
|
|
|
|
</Form.Item>
|
|
|
|
|
</div>
|
|
|
|
|
{/*<Form.Item>*/}
|
|
|
|
|
{/* <Button type="primary" htmlType="submit" className="login-form-button">*/}
|
|
|
|
|
{/* 提交*/}
|
|
|
|
|
{/* </Button>*/}
|
|
|
|
|
{/*</Form.Item>*/}
|
|
|
|
|
|
|
|
|
|
</Form>
|
|
|
|
|
<div className="h20"></div>
|
|
|
|
|
</div>
|
|
|
|
|