dev_aliyun2
harry 5 years ago
parent edd30558a4
commit e67b131f5c

@ -1,7 +1,11 @@
import React, { Component } from "react";
import { SnackbarHOC } from 'educoder';
import axios from 'axios';
import { Pagination, Drawer } from "antd";
import {
Pagination,
Drawer,
} from "antd";
import Headplugselections from "./component/Headplugselections";
import QuestionModal from "./component/QuestionModal";
import QuestionModals from "./component/QuestionModals";
@ -13,8 +17,8 @@ import SiderBars from "../question/component/SiderBars";
import QuestionModalys from "./component/QuestionModalys";
import Certifiedprofessional from "../modals/Certifiedprofessional";
var Undoclickable=true;
var myGrandtotal=false;
var Undoclickable = true;
var myGrandtotal = false;
class Question extends Component {
constructor(props) {
super(props);
@ -60,10 +64,10 @@ class Question extends Component {
selectallquestionsonthispages: false,
oj_status: null,
isVisible: false,
selectionbools:false,
chakanjiexiboolindex:"无",
mydisplay:false,
occupation:2,
selectionbools: false,
chakanjiexiboolindex: "无",
mydisplay: false,
occupation: 2,
@ -115,13 +119,13 @@ class Question extends Component {
setsub_discipline_id = (discipline_id, sub_discipline_id) => {
this.setState({
sub_discipline_id:sub_discipline_id,
discipline_id:discipline_id,
tag_discipline_id:null,
keyword:"",
page:1,
per_page:10,
oj_status:null
sub_discipline_id: sub_discipline_id,
discipline_id: discipline_id,
tag_discipline_id: null,
keyword: "",
page: 1,
per_page: 10,
oj_status: null
})
var data = {
discipline_id: discipline_id,
@ -229,11 +233,10 @@ class Question extends Component {
})
}
axios.get((url), {params: data}).then((response) => {
this.setState({
booljupyterurls: false,
})
},500);
axios.get((url), { params: data }).then((response) => {
this.setState({
booljupyterurls: false,
})
if (response === null || response === undefined) {
return
@ -295,22 +298,22 @@ class Question extends Component {
}
//计算
getdataslen=(arr)=>{
myGrandtotal=false;
let contes=0;
let Grandtotal=0;
for(let data of arr) {
if(data.item_type==="PROGRAM"){
getdataslen = (arr) => {
myGrandtotal = false;
let contes = 0;
let Grandtotal = 0;
for (let data of arr) {
if (data.item_type === "PROGRAM") {
//编程题
if (data.choosed === true) {
} else {
//未选用
if(data.program_attr.status===1){
if (data.program_attr.status === 1) {
//已发布1 未发布0
contes=contes+1;
}else{
Grandtotal=Grandtotal+1;
contes = contes + 1;
} else {
Grandtotal = Grandtotal + 1;
}
}
@ -334,22 +337,22 @@ class Question extends Component {
})
} else {
try {
if(arr.length===Grandtotal){
myGrandtotal=true;
if (arr.length === Grandtotal) {
myGrandtotal = true;
this.setState({
selectionbools:false,
selectallquestionsonthispages:false,
selectionbools: false,
selectallquestionsonthispages: false,
})
}else{
} else {
this.setState({
selectionbools:true,
selectallquestionsonthispages:true,
selectionbools: true,
selectallquestionsonthispages: true,
})
}
}catch (e) {
} catch (e) {
this.setState({
selectionbools:true,
selectallquestionsonthispages:true,
selectionbools: true,
selectallquestionsonthispages: true,
})
}
@ -645,17 +648,17 @@ class Question extends Component {
const url = "/item_baskets/basket_list.json";
axios.get(url)
.then((result) => {
// ////console.log("getbasket_listdata");
// ////console.log(result.data);
this.setState({
completion_questions_count: result.data.completion_questions_count,
judgement_questions_count: result.data.judgement_questions_count,
multiple_questions_count: result.data.multiple_questions_count,
practical_questions_count: result.data.practical_questions_count,
program_questions_count: result.data.program_questions_count,
single_questions_count: result.data.single_questions_count,
subjective_questions_count: result.data.subjective_questions_count,
})
// ////console.log("getbasket_listdata");
// ////console.log(result.data);
this.setState({
completion_questions_count: result.data.completion_questions_count,
judgement_questions_count: result.data.judgement_questions_count,
multiple_questions_count: result.data.multiple_questions_count,
practical_questions_count: result.data.practical_questions_count,
program_questions_count: result.data.program_questions_count,
single_questions_count: result.data.single_questions_count,
subjective_questions_count: result.data.subjective_questions_count,
})
// Undoclickable=true;
}).catch((error) => {
@ -669,29 +672,28 @@ class Question extends Component {
single_questions_count: 0,
subjective_questions_count: 0,
})
// Undoclickable=true;
})
// Undoclickable=true;
})
}
// 不选用 NewMyShixunModel.js 页面也有个
NOgetitem_baskets=(data)=>{
let url="/examination_banks/cancel_items.json";
// 不选用 NewMyShixunModel.js 页面也有个
NOgetitem_baskets = (data) => {
let url = "/examination_banks/cancel_items.json";
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
// this.props.showNotification(`选用成功`);
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
tag_discipline_id:this.state.tag_discipline_id,
discipline_id: this.state.discipline_id,
sub_discipline_id: this.state.sub_discipline_id,
tag_discipline_id: this.state.tag_discipline_id,
public: this.state.defaultActiveKey,
difficulty: this.state.difficulty,
item_type: this.state.item_type,
keyword: this.state.keywords,
page: this.state.page,
per_page:10,
per_page: 10,
};
this.getdatasy(data);
this.getbasket_listdata();
@ -700,12 +702,12 @@ class Question extends Component {
// })
}
}).catch((error) => {
////console.log(error);
})
////console.log(error);
})
}
//选用 NewMyShixunModel.js 页面也有个
getitem_baskets=(data)=>{
//选用 NewMyShixunModel.js 页面也有个
getitem_baskets = (data) => {
//选用题型可以上传单个 或者多个题型
let url = "/item_baskets.json";
@ -734,52 +736,52 @@ class Question extends Component {
////console.log(error);
})
}
// 撤销
getitem_basketss=(id)=>{
if(Undoclickable===true){
Undoclickable=false;
// 撤销
getitem_basketss = (id) => {
if (Undoclickable === true) {
Undoclickable = false;
//选用题型可以上传单个 或者多个题型
let url=`/item_baskets/${id}.json`;
let url = `/item_baskets/${id}.json`;
axios.delete(url)
.then((result) => {
if (result.data.status == 0) {
// this.props.showNotification(`撤销成功`);
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
tag_discipline_id:this.state.tag_discipline_id,
discipline_id: this.state.discipline_id,
sub_discipline_id: this.state.sub_discipline_id,
tag_discipline_id: this.state.tag_discipline_id,
public: this.state.defaultActiveKey,
difficulty: this.state.difficulty,
item_type: this.state.item_type,
keyword: this.state.keywords,
page: this.state.page,
per_page:10,
per_page: 10,
};
this.getdatasy(data);
this.getbasket_listdata();
}
setTimeout(()=>{
Undoclickable=true;
},1000);
setTimeout(() => {
Undoclickable = true;
}, 1000);
}).catch((error) => {
////console.log(error);
setTimeout(()=>{
Undoclickable=true;
},1000);
////console.log(error);
setTimeout(() => {
Undoclickable = true;
}, 1000);
})
})
}else{
} else {
return
return
}
}
//全选试题库
selectallquestionsonthispage=(bool)=>{
if(bool===true){
selectallquestionsonthispage = (bool) => {
if (bool === true) {
//bool 是选中状态
let {
completion_questions_count, judgement_questions_count, multiple_questions_count, practical_questions_count,
@ -793,7 +795,7 @@ class Question extends Component {
+ subjective_questions_count;
if(Datacount===100){
if (Datacount === 100) {
this.props.showNotification(`已选100个试题不能在选用更多试题`);
return;
}
@ -802,7 +804,7 @@ class Question extends Component {
if(myGrandtotal===true){
if (myGrandtotal === true) {
this.props.showNotification(`本页全部试题未发布,不能选择`);
return
}
@ -810,18 +812,18 @@ class Question extends Component {
var item_idsdata=[];
var item_idsdata = [];
var arr = this.state.Contentdata.items;
for (let data of arr) {
if (data.item_type === "PROGRAM") {
//编程题
if(data.choosed===true){
if(data.program_attr.status===1){
if (data.choosed === true) {
if (data.program_attr.status === 1) {
//已发布
item_idsdata.push(data.id);
}
}else{
} else {
//未选用
if (data.program_attr.status === 1) {
//已发布
@ -832,9 +834,9 @@ class Question extends Component {
} else {
//不是编程题
if(data.choosed===true){
if (data.choosed === true) {
item_idsdata.push(data.id);
}else{
} else {
//未选用
item_idsdata.push(data.id);
}
@ -844,15 +846,15 @@ class Question extends Component {
const data = {
item_ids: item_idsdata
}
if(bool===false){
if (bool === false) {
this.getitem_baskets(data);
this.setState({
selectallquestionsonthispages:true,
selectallquestionsonthispages: true,
})
}else{
} else {
this.NOgetitem_baskets(data);
this.setState({
selectallquestionsonthispages:false,
selectallquestionsonthispages: false,
})
}
@ -891,35 +893,35 @@ class Question extends Component {
});
}
HideAddcoursestypess=(i)=>{
HideAddcoursestypess = (i) => {
console.log("调用了");
this.setState({
mydisplay:true,
occupation:i,
mydisplay: true,
occupation: i,
})
}
mydisplayHidedel=()=>{
mydisplayHidedel = () => {
this.setState({
mydisplay:false,
mydisplay: false,
})
}
//跳转
gotopaperreview=()=>{
let isysladmins=false;
if(this.props){
if(this.props.current_user){
if(this.props.current_user.admin){
isysladmins=true;
gotopaperreview = () => {
let isysladmins = false;
if (this.props) {
if (this.props.current_user) {
if (this.props.current_user.admin) {
isysladmins = true;
}
else if(this.props.current_user.business){
isysladmins=true;
else if (this.props.current_user.business) {
isysladmins = true;
}
}
}
if(this.props.current_user.professional_certification===false&&isysladmins===false){
if (this.props.current_user.professional_certification === false && isysladmins === false) {
this.HideAddcoursestypess(2);
return
}
@ -956,8 +958,8 @@ class Question extends Component {
let {
page, per_page, items_count, Headertop, visible, placement, modalsType, modalsTypes, basket_list,
completion_questions_count, judgement_questions_count, multiple_questions_count, practical_questions_count,
program_questions_count, single_questions_count, subjective_questions_count,selectionbools,
modalsTypeInaudit,mydisplay
program_questions_count, single_questions_count, subjective_questions_count, selectionbools,
modalsTypeInaudit, mydisplay
} = this.state;
const Datacount = completion_questions_count + judgement_questions_count
@ -965,26 +967,26 @@ class Question extends Component {
+ program_questions_count
+ single_questions_count
+ subjective_questions_count;
let isysladmins=false;
const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false;
const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false;
let isysladmins = false;
const is_teacher = this.props && this.props.current_user && this.props.current_user.is_teacher ? this.props.current_user.is_teacher : false;
const professional_certification = this.props && this.props.current_user && this.props.current_user.professional_certification ? this.props.current_user.professional_certification : false;
try {
if(this.props){
if(this.props.current_user){
if(this.props.current_user.admin){
isysladmins=true;
if (this.props) {
if (this.props.current_user) {
if (this.props.current_user.admin) {
isysladmins = true;
}
else if(this.props.current_user.business){
isysladmins=true;
else if (this.props.current_user.business) {
isysladmins = true;
}
}
}
}catch (e) {
} catch (e) {
}
return (
<div className="newMain clearfix" ref={this.saveContainer}>
<div className="newMain clearfix" ref={this.saveContainer}>
<style>{
`
.newHeaders{
@ -995,13 +997,13 @@ class Question extends Component {
`
}</style>
{
mydisplay===true?
<Certifiedprofessional {...this.props} {...this.state} ModalCancelsy={this.mydisplayHidedel} />
mydisplay === true ?
<Certifiedprofessional {...this.props} {...this.state} ModalCancelsy={this.mydisplayHidedel} />
:""
: ""
}
{
mydisplay===true?
mydisplay === true ?
<style>
{
`
@ -1013,10 +1015,10 @@ class Question extends Component {
}
</style>
:""
: ""
}
{
visible===true?
visible === true ?
<style>
{
`
@ -1040,9 +1042,9 @@ class Question extends Component {
}
<div
style={{
marginTop: "81px"
}}></div>
style={{
marginTop: "81px"
}}></div>
{
modalsTypes === true ?
<QuestionModals {...this.props}{...this.state} modalsTypes={modalsTypes} modalCancels={() => this.modalCancels()}
@ -1073,15 +1075,16 @@ class Question extends Component {
`
}
</style>
<SiderBars
Datacount={Datacount}
myvisible={visible}
{...this.props}
{...this.state}
showDrawer={() => this.showDrawer()}
Headertop={Headertop}
/>
<SiderBars
Datacount={Datacount}
myvisible={visible}
{...this.props}
{...this.state}
showDrawer={() => this.showDrawer()}
Headertop={Headertop}
/>
{/*顶部*/}
@ -1098,24 +1101,24 @@ class Question extends Component {
/>
{/*头部*/}
<Contentpart {...this.state} {...this.props}
pages={this.state.page}
Isitapopup={"false"}
Datacount={Datacount}
Datacountbool={true}
chakanjiexiboolindex={this.state.chakanjiexiboolindex}
chakanjiexibool={(e)=>this.chakanjiexibool(e)}
getitem_basketss={(id)=>this.getitem_basketss(id)}
selectallquestionsonthispage={(bool)=>this.selectallquestionsonthispage(bool)}
getitem_baskets={(e)=>this.getitem_baskets(e)}
setdatafuns={(e) => this.setdatafuns(e)}
setdatafunsval={(e) => this.setdatafunsval(e)}
handleVisibleChanges={(e) => this.handleVisibleChanges(e)}
handleVisibleChange={(e) => this.handleVisibleChange(e)}
showmodels={(e) => this.showmodels(e)}
showmodelysl={(e) => this.showmodelysl(e)}
callback={(e) => this.callback(e)}
setoj_status={(e)=>this.setoj_status(e)}
showmodelsInaudit={(e)=>this.showmodelsInaudit(e)}
pages={this.state.page}
Isitapopup={"false"}
Datacount={Datacount}
Datacountbool={true}
chakanjiexiboolindex={this.state.chakanjiexiboolindex}
chakanjiexibool={(e) => this.chakanjiexibool(e)}
getitem_basketss={(id) => this.getitem_basketss(id)}
selectallquestionsonthispage={(bool) => this.selectallquestionsonthispage(bool)}
getitem_baskets={(e) => this.getitem_baskets(e)}
setdatafuns={(e) => this.setdatafuns(e)}
setdatafunsval={(e) => this.setdatafunsval(e)}
handleVisibleChanges={(e) => this.handleVisibleChanges(e)}
handleVisibleChange={(e) => this.handleVisibleChange(e)}
showmodels={(e) => this.showmodels(e)}
showmodelysl={(e) => this.showmodelysl(e)}
callback={(e) => this.callback(e)}
setoj_status={(e) => this.setoj_status(e)}
showmodelsInaudit={(e) => this.showmodelsInaudit(e)}
></Contentpart>
{
@ -1186,7 +1189,7 @@ class Question extends Component {
<p
className="w80s intermediatecenterysls sortinxdirection font-14 xiaoshou xiaoshoums">单选题{'('}{single_questions_count}{')'}</p>
<p className="w20s intermediatecenterysls xaxisreverseorder"><i
className="iconfont icon-shanchu1 font-14 lg lh30 icondrawercolor " onClick={()=>this.showQuestionModals("SINGLE")}></i></p>
className="iconfont icon-shanchu1 font-14 lg lh30 icondrawercolor " onClick={() => this.showQuestionModals("SINGLE")}></i></p>
</div>
}
{
@ -1197,7 +1200,7 @@ class Question extends Component {
<p
className="w80s intermediatecenterysls sortinxdirection font-14 xiaoshou xiaoshoums">多选题{'('}{multiple_questions_count}{')'}</p>
<p className="w20s intermediatecenterysls xaxisreverseorder"><i
className="iconfont icon-shanchu1 font-14 lg lh30 icondrawercolor " onClick={()=>this.showQuestionModals("MULTIPLE")}></i></p>
className="iconfont icon-shanchu1 font-14 lg lh30 icondrawercolor " onClick={() => this.showQuestionModals("MULTIPLE")}></i></p>
</div>
}
{
@ -1208,7 +1211,7 @@ class Question extends Component {
<p
className="w80s intermediatecenterysls sortinxdirection font-14 xiaoshou xiaoshoums">判断题{'('}{judgement_questions_count}{')'}</p>
<p className="w20s intermediatecenterysls xaxisreverseorder"><i
className="iconfont icon-shanchu1 font-14 lg lh30 icondrawercolor " onClick={()=>this.showQuestionModals("JUDGMENT")}></i></p>
className="iconfont icon-shanchu1 font-14 lg lh30 icondrawercolor " onClick={() => this.showQuestionModals("JUDGMENT")}></i></p>
</div>
}
{
@ -1219,7 +1222,7 @@ class Question extends Component {
<p
className="w80s intermediatecenterysls sortinxdirection font-14 xiaoshou xiaoshoums">填空题{'('}{completion_questions_count}{')'}</p>
<p className="w20s intermediatecenterysls xaxisreverseorder"><i
className="iconfont icon-shanchu1 font-14 lg lh30 icondrawercolor " onClick={()=>this.showQuestionModals("COMPLETION")}></i></p>
className="iconfont icon-shanchu1 font-14 lg lh30 icondrawercolor " onClick={() => this.showQuestionModals("COMPLETION")}></i></p>
</div>
}
{
@ -1230,7 +1233,7 @@ class Question extends Component {
<p
className="w80s intermediatecenterysls sortinxdirection font-14 xiaoshou xiaoshoums">简答题{'('}{subjective_questions_count}{')'}</p>
<p className="w20s intermediatecenterysls xaxisreverseorder"><i
className="iconfont icon-shanchu1 font-14 lg lh30 icondrawercolor " onClick={()=>this.showQuestionModals("SUBJECTIVE")}></i></p>
className="iconfont icon-shanchu1 font-14 lg lh30 icondrawercolor " onClick={() => this.showQuestionModals("SUBJECTIVE")}></i></p>
</div>
}
{
@ -1252,7 +1255,7 @@ class Question extends Component {
<p
className="w80s intermediatecenterysls sortinxdirection font-14 xiaoshou xiaoshoums">编程题{'('}{program_questions_count}{')'}</p>
<p className="w20s intermediatecenterysls xaxisreverseorder"><i
className="iconfont icon-shanchu1 font-14 lg lh30 icondrawercolor " onClick={()=>this.showQuestionModals("PROGRAM")}></i></p>
className="iconfont icon-shanchu1 font-14 lg lh30 icondrawercolor " onClick={() => this.showQuestionModals("PROGRAM")}></i></p>
</div>
}

Loading…
Cancel
Save