dev_aliyun2
harry 5 years ago
parent 7c1afec61d
commit edd30558a4

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

Loading…
Cancel
Save