题库智能组卷

dev_jupyter
杨树林 5 years ago
parent e7c1dd122d
commit 710a04162e

@ -758,6 +758,7 @@ class App extends Component {
} }
} }
/> />
<Route path="/myproblems/record_detail/:id" <Route path="/myproblems/record_detail/:id"
render={ render={
(props) => (<RecordDetail {...this.props} {...props} {...this.state} />) (props) => (<RecordDetail {...this.props} {...props} {...this.state} />)
@ -768,7 +769,14 @@ class App extends Component {
render={ render={
(props) => (<NewOrEditTask {...this.props} {...props} {...this.state} />) (props) => (<NewOrEditTask {...this.props} {...props} {...this.state} />)
} /> } />
<Route path="/IntegenerationSee/:type/:id"
render={
(props) => (<Paperreview {...this.props} {...props} {...this.state} />)
}/>
<Route path="/paperreview/:type"
render={
(props) => (<Paperreview {...this.props} {...props} {...this.state} />)
}/>
<Route path="/paperlibrary/edit/:id" <Route path="/paperlibrary/edit/:id"
render={ render={
(props) => (<Paperlibraryeditid {...this.props} {...props} {...this.state} />) (props) => (<Paperlibraryeditid {...this.props} {...props} {...this.state} />)
@ -778,6 +786,7 @@ class App extends Component {
render={ render={
(props) => (<Paperlibraryseeid {...this.props} {...props} {...this.state} />) (props) => (<Paperlibraryseeid {...this.props} {...props} {...this.state} />)
}/> }/>
<Route path="/myproblems/:id/:tab?" <Route path="/myproblems/:id/:tab?"
render={ render={
(props) => (<StudentStudy {...this.props} {...props} {...this.state} />) (props) => (<StudentStudy {...this.props} {...props} {...this.state} />)
@ -805,11 +814,6 @@ class App extends Component {
(props) => (<Integeneration {...this.props} {...props} {...this.state} />) (props) => (<Integeneration {...this.props} {...props} {...this.state} />)
}/> }/>
<Route path="/paperreview"
render={
(props) => (<Paperreview {...this.props} {...props} {...this.state} />)
}/>
<Route path="/problems" <Route path="/problems"
render={ render={
(props) => (<Developer {...this.props} {...props} {...this.state} />) (props) => (<Developer {...this.props} {...props} {...this.state} />)

@ -51,6 +51,7 @@ class Paperreview extends Component {
name:null, name:null,
duration:null, duration:null,
newmyshixunmodelbool:false, newmyshixunmodelbool:false,
artificialtype:"artificial",
} }
// single_questions:null, 单选题 // single_questions:null, 单选题
@ -64,10 +65,27 @@ class Paperreview extends Component {
//初始化 //初始化
componentDidMount() { componentDidMount() {
console.log("Paperreview.js");
console.log(this.props.match.params.type);
this.setState({
artificialtype:this.props.match.params.type
})
if(this.props.match.params.type==="artificial"){
//人工组卷
var data = {}
this.getdata(data);
}else{
//智能组卷
//
var data = {
exam_setting_id:this.props.match.params.id
}
this.getdata(data);
}
var data = {}
this.getdata(data);
let urls = `/disciplines.json`; let urls = `/disciplines.json`;
axios.get(urls, { axios.get(urls, {
params: { params: {
@ -193,43 +211,51 @@ class Paperreview extends Component {
} }
preservation = () => { preservation = () => {
//保存试卷 //保存试卷
if(this.state.Cohetepaperbool===true){ if(this.state.artificialtype==="artificial"){
if (this.contentMdRef.Getdatas().length === 0) { if(this.state.Cohetepaperbool===true){
this.scrollToAnchor("Itembankstopid"); if (this.contentMdRef.Getdatas().length === 0) {
return; this.scrollToAnchor("Itembankstopid");
} return;
var myrbkc=[]; }
var Getdatasdatas=this.contentMdRef.Getdatas()[2].rbzsd; var myrbkc=[];
for(let myda of Getdatasdatas) { var Getdatasdatas=this.contentMdRef.Getdatas()[2].rbzsd;
myrbkc.push(myda.id); for(let myda of Getdatasdatas) {
} myrbkc.push(myda.id);
const url = `/examination_banks.json`; }
var data={ const url = `/examination_banks.json`;
difficulty:this.contentMdRef.Getdatas()[0].rbnd, var data={
name:this.contentMdRef.Getdatas()[4].classroom, difficulty:this.contentMdRef.Getdatas()[0].rbnd,
duration:this.contentMdRef.Getdatas()[5].kssc, name:this.contentMdRef.Getdatas()[4].classroom,
discipline_id: this.contentMdRef.Getdatas()[3].rbkc[0], duration:this.contentMdRef.Getdatas()[5].kssc,
sub_discipline_id: this.contentMdRef.Getdatas()[3].rbkc[1], discipline_id: this.contentMdRef.Getdatas()[3].rbkc[0],
tag_discipline_id: myrbkc, sub_discipline_id: this.contentMdRef.Getdatas()[3].rbkc[1],
tag_discipline_id: myrbkc,
}
axios.post(url, data)
.then((result) => {
if (result.data.status === 0) {
// this.props.showNotification(`组卷成功`);
this.props.history.replace('/paperlibrary');
}
}).catch((error) => {
console.log(error);
})
}else{
this.setCohetepaperbool(true);
} }
axios.post(url, data)
.then((result) => {
if (result.data.status === 0) {
// this.props.showNotification(`组卷成功`);
this.props.history.replace('/paperlibrary');
}
}).catch((error) => {
console.log(error);
})
}else{ }else{
this.setCohetepaperbool(true); //智能组卷
} }
} }
@ -265,7 +291,7 @@ class Paperreview extends Component {
this.getdata(data); this.getdata(data);
} }
render() { render() {
let {page, limit, count, Headertop, visible, placement, modalsType, item_type,Cohetepaperbool,newmyshixunmodelbool} = this.state; let {page, limit, count, Headertop, visible, placement, modalsType, item_type,artificialtype,Cohetepaperbool,newmyshixunmodelbool} = this.state;
const params = this.props && this.props.match && this.props.match.params; const params = this.props && this.props.match && this.props.match.params;
// //console.log(params); // //console.log(params);
return ( return (
@ -305,11 +331,18 @@ class Paperreview extends Component {
<div className="w100s mt30"> <div className="w100s mt30">
{ {
Cohetepaperbool===false? Cohetepaperbool===false?
<Breadcrumb separator=">"> artificialtype==="artificial"?
<Breadcrumb.Item href="/question">试题库</Breadcrumb.Item> <Breadcrumb separator=">">
<Breadcrumb.Item className={"xiaoshou"}>人工组卷</Breadcrumb.Item> <Breadcrumb.Item href="/question">试题库</Breadcrumb.Item>
<Breadcrumb.Item className={"xiaoshout"}>试卷预览</Breadcrumb.Item> <Breadcrumb.Item className={"xiaoshou"}>人工组卷</Breadcrumb.Item>
</Breadcrumb> <Breadcrumb.Item className={"xiaoshout"}>试卷预览</Breadcrumb.Item>
</Breadcrumb>
:
<Breadcrumb separator=">">
<Breadcrumb.Item href="/paperlibrary">试卷库</Breadcrumb.Item>
<Breadcrumb.Item className={"/Integeneration"}>智能组卷</Breadcrumb.Item>
<Breadcrumb.Item className={"xiaoshout"}>试卷预览</Breadcrumb.Item>
</Breadcrumb>
: :
<Breadcrumb separator=">"> <Breadcrumb separator=">">
<Breadcrumb.Item href="/question">试题库</Breadcrumb.Item> <Breadcrumb.Item href="/question">试题库</Breadcrumb.Item>

@ -759,7 +759,7 @@ class Question extends Component {
//跳转 //跳转
gotopaperreview=()=>{ gotopaperreview=()=>{
this.props.history.replace("/paperreview"); this.props.history.replace("/paperreview/artificial");
} }

@ -367,15 +367,15 @@ class Itembankstop extends Component {
}); });
} }
handleFormLayoutChange = (value) => { handleFormLayoutChange = (e) => {
//难度塞选 //难度塞选
////console.log("难度塞选"); ////console.log("难度塞选");
////console.log(value); ////console.log(value);
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
rbnd: value + "", rbnd: e.target.value + "",
}); });
this.setState({ this.setState({
rbnd: value + "", rbnd: e.target.value + "",
}) })
} }

@ -331,15 +331,15 @@ class Comthetestpaperst extends Component {
}); });
} }
handleFormLayoutChange = (value) => { handleFormLayoutChange = (e) => {
//难度塞选 //难度塞选
////console.log("难度塞选"); ////console.log("难度塞选");
////console.log(value); ////console.log(value);
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
rbnd: value + "", rbnd: e.target.value + "",
}); });
this.setState({ this.setState({
rbnd: value + "", rbnd: e.target.value + "",
}) })
} }

@ -217,32 +217,38 @@ class Intelligentcomponents extends Component {
}); });
} }
handleFormLayoutChanges = (value) => { handleFormLayoutChanges = (e) => {
// console.log("handleFormLayoutChanges");
// console.log(value);
// debugger
//来源 //来源
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
rbly: value + "", rbly: e.target.value + "",
}); });
this.setState({ this.setState({
rbly: value + "", rbly: e.target.value + "",
}) })
} }
handleFormLayoutChange = (value) => { handleFormLayoutChange = (e) => {
// console.log("handleFormLayoutChange");
// console.log(value);
// debugger
//难度塞选 //难度塞选
////console.log("难度塞选");
////console.log(value);
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
rbnd: value + "", rbnd: e.target.value + "",
}); });
this.setState({ this.setState({
rbnd: value + "", rbnd: e.target.value + "",
}) });
try {
this.props.getdatass(parseInt(e.target.value));
}catch (e) {
}
} }
handleFormkechen = (value) => { handleFormkechen = (value) => {
//课程 //课程
////console.log("课程");
////console.log(value);
if(this.state.Knowpoints.length>4){ if(this.state.Knowpoints.length>4){
this.props.showNotification(`知识点最多选择5个`); this.props.showNotification(`知识点最多选择5个`);
return return
@ -263,8 +269,6 @@ class Intelligentcomponents extends Component {
const _result =[]; const _result =[];
this.state.knowledgepoints.filter(item => { this.state.knowledgepoints.filter(item => {
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) { if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
console.log("guonue");
console.log(item);
_result.push(item); _result.push(item);
} }
}); });
@ -762,16 +766,16 @@ class Intelligentcomponents extends Component {
</Form> </Form>
<p className={"conditionsettings mt40"}>题型及数量</p> <p className={"conditionsettings mt40"}>题型及数量</p>
<div className={"hengxians mt13"}></div> <div className={"hengxians mt13"}></div>
<Ldanxuan dxtx={"单选题:"} getdatas={()=>this.props.getdatas()} ref={dom => { <Ldanxuan {...this.state} {...this.props} dxtx={"单选题:"} mycount={this.props.single_question_count} getdatas={()=>this.props.getdatas()} ref={dom => {
this.$dxt = dom; this.$dxt = dom;
}}></Ldanxuan> }}></Ldanxuan>
<Ldanxuan dxtx={"多选题:"} getdatas={()=>this.props.getdatas()} ref={dom => { <Ldanxuan {...this.state} {...this.props} dxtx={"多选题:"} mycount={this.props.multiple_question_count} getdatas={()=>this.props.getdatas()} ref={dom => {
this.$ddxt = dom; this.$ddxt = dom;
}}></Ldanxuan> }}></Ldanxuan>
<Ldanxuan dxtx={"判断题:"} getdatas={()=>this.props.getdatas()} ref={dom => { <Ldanxuan {...this.state} {...this.props} dxtx={"判断题:"} mycount={this.props.judgement_question_count} getdatas={()=>this.props.getdatas()} ref={dom => {
this.$pdt = dom; this.$pdt = dom;
}}></Ldanxuan> }}></Ldanxuan>
<Ldanxuan dxtx={"编程题:"} getdatas={()=>this.props.getdatas()} ref={dom => { <Ldanxuan {...this.state} {...this.props} dxtx={"编程题:"} mycount={this.props.program_question_count} getdatas={()=>this.props.getdatas()} ref={dom => {
this.$bct = dom; this.$bct = dom;
}}></Ldanxuan> }}></Ldanxuan>

@ -12,7 +12,8 @@ import {
Button, Button,
Breadcrumb, Breadcrumb,
Icon, Icon,
InputNumber InputNumber,
Tooltip
} from "antd"; } from "antd";
import '../questioncss/questioncom.css'; import '../questioncss/questioncom.css';
@ -35,13 +36,33 @@ class lntlligentpone extends Component {
} }
increase = () => { increase = () => {
this.props.getdatas();
const datasbool=this.props.getdatas();
// if(datasbool===undefined || datasbool===null){
// if(this.props.mycount===0){
// this.props.showNotification(`题数为0无法增加题目`);
// return
// }
//
// }
const count = this.state.count + 1; const count = this.state.count + 1;
this.setState({count: count, countbool: false}); if(count<=this.props.mycount){
this.setState({count: count, countbool: false});
}
}; };
decline = () => { decline = () => {
this.props.getdatas(); const datasbool=this.props.getdatas();
// if(datasbool===undefined || datasbool===null){
// if(this.props.mycount===0){
// this.props.showNotification(`题数为0无法减少题目`);
// return
// }
// }
let count = this.state.count - 1; let count = this.state.count - 1;
if (count < 0) { if (count < 0) {
count = 0; count = 0;
@ -49,8 +70,21 @@ class lntlligentpone extends Component {
this.setState({count: count, countbool: false}); this.setState({count: count, countbool: false});
}; };
inputsnumber = (value) => { inputsnumber = (value) => {
this.props.getdatas(); const datasbool=this.props.getdatas();
this.setState({count: value, countbool: false}); // if(datasbool===undefined || datasbool===null){
// if(this.props.mycount===0){
// this.setState({count: 0, countbool: false});
// this.props.showNotification(`题数为0无法输入`);
// return
// }
// }
if(this.props.mycount===0){
this.setState({count: 0, countbool: false});
}else {
this.setState({count: value, countbool: false});
}
} }
@ -73,23 +107,55 @@ class lntlligentpone extends Component {
return ( return (
<div> <div>
<p className="dxuantitie mt19">{this.props.dxtx}</p> <p className="dxuantitie mt19">{this.props.dxtx}</p>
<div className="sortinxdirection mt10 inpustredssdiv"> {
<Button onClick={this.decline}> this.props.mycount===0?
<Icon type="minus"/> <div className="sortinxdirection mt10 inpustredssdiv">
</Button> <Tooltip placement="top" title={"题数为0无法减少"}>
<div className={this.state.countbool === true ? "inpustredss ml12 mr12" : "ml12 mr12"}> <Button disabled={this.props.mycount===0?true:false} onClick={this.decline}>
<InputNumber <Icon type="minus"/>
min={0} </Button>
step={0.1} </Tooltip>
value={this.state.count} <div className={this.state.countbool === true ? "inpustredss ml12 mr12" : "ml12 mr12"}>
onChange={this.inputsnumber}
></InputNumber> <Tooltip placement="top" title={"题数为0无法输入"}>
</div> <InputNumber
<Button onClick={this.increase}> disabled={this.props.mycount===0?true:false}
<Icon type="plus"/> min={0}
</Button> value={this.state.count}
<p className="ml23 lh32">{this.props.dxgt}</p> onChange={this.inputsnumber}
</div> ></InputNumber>
</Tooltip>
</div>
<Tooltip placement="top" title={"题数为0无法增加"}>
<Button disabled={this.props.mycount===0?true:false} onClick={this.increase}>
<Icon type="plus"/>
</Button>
</Tooltip>
<p className={"ml23 lh32"}>{this.props.mycount}</p>
</div>
:
<div className="sortinxdirection mt10 inpustredssdiv">
<Button onClick={this.decline}>
<Icon type="minus"/>
</Button>
<div className={this.state.countbool === true ? "inpustredss ml12 mr12" : "ml12 mr12"}>
<InputNumber
min={0}
value={this.state.count}
onChange={this.inputsnumber}
></InputNumber>
</div>
<Button onClick={this.increase}>
<Icon type="plus"/>
</Button>
<p className={"ml23 lh32"}>{this.props.mycount}</p>
</div>
}
</div> </div>
) )

@ -1000,6 +1000,7 @@
.inpustredssdiv button { .inpustredssdiv button {
border-radius: 50%; border-radius: 50%;
width: 38px; width: 38px;
height: 38px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;

@ -30,6 +30,10 @@ class Intecomponents extends Component {
disciplmy: [], disciplmy: [],
item_banksedit: [], item_banksedit: [],
newmyshixunmodelbool:false, newmyshixunmodelbool:false,
single_question_count:0,
multiple_question_count:0,
judgement_question_count:0,
program_question_count:0,
} }
@ -107,12 +111,17 @@ class Intecomponents extends Component {
} }
getdatas=()=>{ getdatas=()=>{
if (this.Judquestio.Getdatas().length === 0) {
this.scrollToAnchor("Itembankstopid");
return false;
}
console.log(this.Judquestio.Getdatas());
var myrbkc=[]; var myrbkc=[];
var Getdatasdatas=this.Judquestio.Getdatas()[1].rbzsd; var Getdatasdatas=this.Judquestio.Getdatas()[1].rbzsd;
for(let myda of Getdatasdatas) { for(let myda of Getdatasdatas) {
myrbkc.push(myda.id); myrbkc.push(myda.id);
} }
const url="/examination_intelligent_settings/optinal_items.jso"; const url="/examination_intelligent_settings/optinal_items.json";
var data={ var data={
sub_discipline_id:this.Judquestio.Getdatas()[2].rbkc[1], sub_discipline_id:this.Judquestio.Getdatas()[2].rbkc[1],
tag_discipline_id:myrbkc, tag_discipline_id:myrbkc,
@ -124,13 +133,63 @@ class Intecomponents extends Component {
data data
}}).then((response) => { }}).then((response) => {
if (response) { if (response) {
console.log("智能组卷");
console.log(response); console.log(response);
if(response.data){
this.setState({
single_question_count:response.data.single_question_count,
multiple_question_count:response.data.multiple_question_count,
judgement_question_count:response.data.judgement_question_count,
program_question_count:response.data.program_question_count,
})
}
} }
}); });
} }
getdatass=(nandu)=>{
debugger
if (this.Judquestio.Getdatas().length === 0) {
this.scrollToAnchor("Itembankstopid");
return false;
}
console.log(this.Judquestio.Getdatas());
var myrbkc=[];
var Getdatasdatas=this.Judquestio.Getdatas()[1].rbzsd;
for(let myda of Getdatasdatas) {
myrbkc.push(myda.id);
}
const url="/examination_intelligent_settings/optinal_items.json";
var data={
sub_discipline_id:this.Judquestio.Getdatas()[2].rbkc[1],
tag_discipline_id:myrbkc,
source:this.Judquestio.Getdatas()[7].rbly,
difficulty:nandu,
}
axios.get(url, {params: {
data
}}).then((response) => {
if (response) {
console.log("智能组卷");
console.log(response);
if(response.data){
this.setState({
single_question_count:response.data.single_question_count,
multiple_question_count:response.data.multiple_question_count,
judgement_question_count:response.data.judgement_question_count,
program_question_count:response.data.program_question_count,
})
}
}
});
}
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
@ -203,6 +262,7 @@ class Intecomponents extends Component {
.then((result) => { .then((result) => {
if (result.data.status == 0) { if (result.data.status == 0) {
console.log("组卷成功"); console.log("组卷成功");
this.props.history.push(`/IntegenerationSee/Intelligence/${result.data.exam_setting_id}`);
} }
}).catch((error) => { }).catch((error) => {
console.log(error); console.log(error);
@ -228,7 +288,7 @@ class Intecomponents extends Component {
} }
render() { render() {
let {paperlibrartdata,newmyshixunmodelbool} = this.state; let {paperlibrartdata,newmyshixunmodelbool,single_question_count,multiple_question_count,judgement_question_count,program_question_count} = this.state;
const params = this.props && this.props.match && this.props.match.params; const params = this.props && this.props.match && this.props.match.params;
return ( return (
<div> <div>
@ -252,7 +312,12 @@ class Intecomponents extends Component {
</Breadcrumb> </Breadcrumb>
</div> </div>
<Intelligentcomponents {...this.state} {...this.props} <Intelligentcomponents {...this.state} {...this.props}
single_question_count={this.state.single_question_count}
multiple_question_count={this.state.multiple_question_count}
judgement_question_count={this.state.judgement_question_count}
program_question_count={this.state.program_question_count}
getdatas={()=>this.getdatas()} getdatas={()=>this.getdatas()}
getdatass={(nd)=>this.getdatass(nd)}
getJudquestio={(ref) => this.getJudquestio(ref)} getJudquestio={(ref) => this.getJudquestio(ref)}
></Intelligentcomponents> ></Intelligentcomponents>

@ -161,7 +161,7 @@ class Contentpart extends Component {
width:"50%" width:"50%"
}}> }}>
<a href={'/question/newitem'}> <a href={'/Integeneration'}>
<div className="newbutoonss"> <div className="newbutoonss">
<p className="newbutoontess" >智能组卷</p> <p className="newbutoontess" >智能组卷</p>
</div> </div>

Loading…
Cancel
Save