dev_aliyun2
harry 5 years ago
parent 7c1afec61d
commit edd30558a4

@ -1,6 +1,10 @@
import React, { Component } from "react"; import React, { Component } from "react";
import { SnackbarHOC } from 'educoder';
import axios from 'axios'; import axios from 'axios';
import { Breadcrumb } from "antd"; import {
Breadcrumb
} from "antd";
import TPMIndexHOC from "../tpm/TPMIndexHOC"; import TPMIndexHOC from "../tpm/TPMIndexHOC";
import './questioncss/questioncom.css'; import './questioncss/questioncom.css';
import '../tpm/newshixuns/css/Newshixuns.css'; import '../tpm/newshixuns/css/Newshixuns.css';
@ -8,8 +12,9 @@ import Paperreview_item from "./Paperreview_item"
import Bottomsubmit from "../../modules/modals/Bottomsubmit"; import Bottomsubmit from "../../modules/modals/Bottomsubmit";
import Comthetestpaperst from "./comthetestpaper/Comthetestpaperst"; import Comthetestpaperst from "./comthetestpaper/Comthetestpaperst";
import NewMyShixunModel from "../question/NewMyShixunModel"; import NewMyShixunModel from "../question/NewMyShixunModel";
import IntelligentModel from "../question/component/IntelligentModel"
//人工组卷预览 //人工组卷预览
let Changes=true; let Changes = true;
class Paperreview extends Component { class Paperreview extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -35,6 +40,8 @@ class Paperreview extends Component {
name: null, name: null,
duration: null, duration: null,
newmyshixunmodelbool: false, newmyshixunmodelbool: false,
artificialtype: "artificial",
Intelligentformation: false,
} }
// single_questions:null, 单选题 // single_questions:null, 单选题
@ -192,35 +199,35 @@ class Paperreview extends Component {
} }
preservation = () => { preservation = () => {
//保存试卷 //保存试卷
if(this.state.artificialtype==="artificial"){ if (this.state.artificialtype === "artificial") {
if(this.state.Cohetepaperbool===true){ if (this.state.Cohetepaperbool === true) {
if (this.contentMdRef.Getdatas().length === 0) { if (this.contentMdRef.Getdatas().length === 0) {
this.scrollToAnchor("Itembankstopid"); this.scrollToAnchor("Itembankstopid");
return; return;
} }
var myrbkc=[]; var myrbkc = [];
var Getdatasdatas=this.contentMdRef.Getdatas()[2].rbzsd; var Getdatasdatas = this.contentMdRef.Getdatas()[2].rbzsd;
for(let myda of Getdatasdatas) { for (let myda of Getdatasdatas) {
myrbkc.push(myda.id); myrbkc.push(myda.id);
} }
const url = `/examination_banks.json`; const url = `/examination_banks.json`;
var data={ var data = {
difficulty:this.contentMdRef.Getdatas()[0].rbnd, difficulty: this.contentMdRef.Getdatas()[0].rbnd,
name:this.contentMdRef.Getdatas()[4].classroom, name: this.contentMdRef.Getdatas()[4].classroom,
duration:this.contentMdRef.Getdatas()[5].kssc, duration: this.contentMdRef.Getdatas()[5].kssc,
discipline_id: this.contentMdRef.Getdatas()[3].rbkc[0], discipline_id: this.contentMdRef.Getdatas()[3].rbkc[0],
sub_discipline_id: this.contentMdRef.Getdatas()[3].rbkc[1], sub_discipline_id: this.contentMdRef.Getdatas()[3].rbkc[1],
tag_discipline_id: myrbkc, tag_discipline_id: myrbkc,
} }
axios.post(url, data) axios.post(url, data)
.then((result) => { .then((result) => {
if (result.data.status === 0) { if (result.data.status === 0) {
// this.props.showNotification(`组卷成功`); // this.props.showNotification(`组卷成功`);
// console.log(result.data.exam_id); // console.log(result.data.exam_id);
//本来调试卷库首页的 //本来调试卷库首页的
this.props.history.replace('/paperlibrary/see/'+result.data.exam_id); this.props.history.replace('/paperlibrary/see/' + result.data.exam_id);
} }
}).catch((error) => { }).catch((error) => {
//console.log(error); //console.log(error);
}) })
@ -257,6 +264,7 @@ class Paperreview extends Component {
} }
setnewmyshixunmodelbool = (bool) => { setnewmyshixunmodelbool = (bool) => {
//人工组卷
if (bool === true) { if (bool === true) {
let scrollToTop = window.setInterval(function () { let scrollToTop = window.setInterval(function () {
let pos = window.pageYOffset; let pos = window.pageYOffset;
@ -265,17 +273,59 @@ class Paperreview extends Component {
} else { } else {
window.clearInterval(scrollToTop); window.clearInterval(scrollToTop);
} }
}).catch((error) => { }, 2);
//console.log(error); }
this.setState({
newmyshixunmodelbool: bool
}) })
var data = {}
this.getdata(data);
}
//换题型
Replacementtype = (value) => {
var item_types = "";
if (value === "单选题") {
item_types = "SINGLE";
}
else if (value === "多选题") {
item_types = "MULTIPLE";
}
else if (value === "判断题") {
item_types = "JUDGMENT";
}
else if (value === "编程题") {
item_types = "PROGRAM";
}
const url = `/examination_intelligent_settings/${this.props.match.params.id}/exchange_items.json`;
let data = {
item_type: item_types,
}
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
//console.log(result);
var data = {}
this.getdata(data);
}
}).catch((error) => {
//console.log(error);
})
} }
//换题 //换题
Changingtopics=(id)=>{ Changingtopics = (id) => {
if(Changes===true){ if (Changes === true) {
Changes=false; Changes = false;
const url=`/examination_intelligent_settings/${this.props.match.params.id}/exchange_one_item.json`; const url = `/examination_intelligent_settings/${this.props.match.params.id}/exchange_one_item.json`;
let data={ let data = {
item_id:id, item_id: id,
} }
axios.post(url, data) axios.post(url, data)
.then((result) => { .then((result) => {
@ -284,34 +334,43 @@ class Paperreview extends Component {
var data = {} var data = {}
this.getdata(data); this.getdata(data);
} }
setTimeout(()=>{ setTimeout(() => {
Changes=true; Changes = true;
},1000); }, 1000);
}).catch((error) => { }).catch((error) => {
//console.log(error); //console.log(error);
setTimeout(()=>{ setTimeout(() => {
Changes=true; Changes = true;
},1000); }, 1000);
}) })
} }
} }
setIntelligentformation=(bool)=>{ setIntelligentformation = (bool) => {
this.setState({ this.setState({
newmyshixunmodelbool: bool Intelligentformation: bool
}) })
var data = {} }
this.getdata(data); Confirmationofvolumeformations = () => {
this.setState({
Intelligentformation: false
})
} }
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, Intelligentformation } = 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 (
<div> <div>
<div id={"Itembankstopid"} className="newMain clearfix intermediatecenter " <div id={"Itembankstopid"} className="newMain clearfix intermediatecenter "
> >
{
Intelligentformation === true ?
<IntelligentModel getdata={(data) => this.getdata(data)} {...this.state} {...this.props} exam_id={this.props.match.params.id} Confirmationofvolumeformations={() => this.Confirmationofvolumeformations()}></IntelligentModel>
: ""
}
{ {
newmyshixunmodelbool === true ? newmyshixunmodelbool === true ?
<style>{ <style>{
@ -325,7 +384,7 @@ class Paperreview extends Component {
{ {
newmyshixunmodelbool === true ? newmyshixunmodelbool === true ?
<div className="fangdatwo"> <div className="fangdatwo">
<NewMyShixunModel {...this.props} {...this.state} Contentdata={this.state.Contentdata} exam_id={this.props.match.params.id} setnewmyshixunmodelbool={(e)=>this.setnewmyshixunmodelbool(e)}></NewMyShixunModel> <NewMyShixunModel {...this.props} {...this.state} Contentdata={this.state.Contentdata} exam_id={this.props.match.params.id} setnewmyshixunmodelbool={(e) => this.setnewmyshixunmodelbool(e)}></NewMyShixunModel>
</div> </div>
: :
"" ""
@ -354,7 +413,7 @@ class Paperreview extends Component {
: :
<Breadcrumb separator=">"> <Breadcrumb separator=">">
<Breadcrumb.Item >试卷库</Breadcrumb.Item> <Breadcrumb.Item >试卷库</Breadcrumb.Item>
<Breadcrumb.Item className={"/Integeneration"} href="/paperlibrary">智能组卷</Breadcrumb.Item> <Breadcrumb.Item className={"/Integeneration"} href="/paperlibrary">智能组卷</Breadcrumb.Item>
<Breadcrumb.Item className={"xiaoshout"}>试卷预览</Breadcrumb.Item> <Breadcrumb.Item className={"xiaoshout"}>试卷预览</Breadcrumb.Item>
</Breadcrumb> </Breadcrumb>
: :
@ -367,15 +426,15 @@ class Paperreview extends Component {
</div> </div>
{ {
Cohetepaperbool===false? Cohetepaperbool === false ?
<Paperreview_item {...this.state} {...this.props} artificialtype={artificialtype} Changingtopics={(e)=>this.Changingtopics(e)} Replacementtype={(e)=>this.Replacementtype(e)} getdata={(data)=>this.getdata(data)} setnewmyshixunmodelbool={(e)=>this.setnewmyshixunmodelbool(e)}> <Paperreview_item {...this.state} {...this.props} artificialtype={artificialtype} Changingtopics={(e) => this.Changingtopics(e)} Replacementtype={(e) => this.Replacementtype(e)} getdata={(data) => this.getdata(data)} setnewmyshixunmodelbool={(e) => this.setnewmyshixunmodelbool(e)}>
</Paperreview_item> </Paperreview_item>
: :
<Comthetestpaperst {...this.state} {...this.props} <Comthetestpaperst {...this.state} {...this.props}
getJudquestio={(ref) => this.getcontentMdRef(ref)} getJudquestio={(ref) => this.getcontentMdRef(ref)}
setitem_type={(item) => this.setitem_type(item)} setitem_type={(item) => this.setitem_type(item)}
></Comthetestpaperst> ></Comthetestpaperst>
} }
@ -389,10 +448,10 @@ class Paperreview extends Component {
</div> </div>
<Bottomsubmit {...this.props} {...this.state} bottomvalue={Cohetepaperbool===false?"保存组卷":"完成"} <Bottomsubmit {...this.props} {...this.state} bottomvalue={Cohetepaperbool === false ? "保存组卷" : "完成"}
setCohetepaperbool={(bool)=>this.setCohetepaperbool(bool)} setCohetepaperbool={(bool) => this.setCohetepaperbool(bool)}
Cohetepaperbool={this.state.Cohetepaperbool} Cohetepaperbool={this.state.Cohetepaperbool}
onSubmits={() => this.preservation()} url={ artificialtype==="artificial"?'/problemset':'/paperlibrary'}></Bottomsubmit> onSubmits={() => this.preservation()} url={artificialtype === "artificial" ? '/problemset' : '/paperlibrary'}></Bottomsubmit>
</div> </div>
) )

Loading…
Cancel
Save