|
|
|
@ -65,6 +65,7 @@ class Question extends Component {
|
|
|
|
|
selectallquestionsonthispages:false,
|
|
|
|
|
oj_status:null,
|
|
|
|
|
isVisible: false,
|
|
|
|
|
selectionbools:false,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -213,6 +214,7 @@ class Question extends Component {
|
|
|
|
|
const url = `/item_banks.json`;
|
|
|
|
|
this.setState({
|
|
|
|
|
booljupyterurls:true,
|
|
|
|
|
selectionbools:false,
|
|
|
|
|
})
|
|
|
|
|
axios.get((url), {params: data}).then((response) => {
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
@ -235,6 +237,7 @@ class Question extends Component {
|
|
|
|
|
Contentdata: response.data,
|
|
|
|
|
items_count: response.data.items_count,
|
|
|
|
|
})
|
|
|
|
|
this.getdataslen(response.data.items);
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
////console.log(error)
|
|
|
|
|
this.setState({
|
|
|
|
@ -246,7 +249,9 @@ class Question extends Component {
|
|
|
|
|
//不刷新加载
|
|
|
|
|
getdatasy = (data) => {
|
|
|
|
|
const url = `/item_banks.json`;
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
selectionbools:false,
|
|
|
|
|
})
|
|
|
|
|
axios.get((url), {params: data}).then((response) => {
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
|
|
|
|
@ -265,12 +270,57 @@ class Question extends Component {
|
|
|
|
|
this.setState({
|
|
|
|
|
Contentdata: response.data,
|
|
|
|
|
items_count: response.data.items_count,
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.getdataslen(response.data.items);
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//计算
|
|
|
|
|
getdataslen=(arr)=>{
|
|
|
|
|
var contes=0;
|
|
|
|
|
for(let data of arr) {
|
|
|
|
|
if(data.item_type==="PROGRAM"){
|
|
|
|
|
//编程题
|
|
|
|
|
if(data.choosed===true){
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
//未选用
|
|
|
|
|
if(data.program_attr.status===1){
|
|
|
|
|
//已发布
|
|
|
|
|
contes=contes+1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
//不是编程题
|
|
|
|
|
if(data.choosed===true){
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
//未选用
|
|
|
|
|
contes=contes+1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(contes>0){
|
|
|
|
|
this.setState({
|
|
|
|
|
selectionbools:false,
|
|
|
|
|
selectallquestionsonthispages:false,
|
|
|
|
|
})
|
|
|
|
|
}else {
|
|
|
|
|
this.setState({
|
|
|
|
|
selectionbools:true,
|
|
|
|
|
selectallquestionsonthispages:true,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
paginationonChange = (pageNumber) => {
|
|
|
|
|
this.setState({
|
|
|
|
|
page: pageNumber,
|
|
|
|
@ -466,19 +516,6 @@ class Question extends Component {
|
|
|
|
|
this.setState({
|
|
|
|
|
keywords: e.target.value
|
|
|
|
|
})
|
|
|
|
|
// var data = {
|
|
|
|
|
// 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,
|
|
|
|
|
// keywords: e.target.value,
|
|
|
|
|
// page: this.state.page,
|
|
|
|
|
// per_page:10,
|
|
|
|
|
// };
|
|
|
|
|
//
|
|
|
|
|
// this.getdata(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setdatafuns = (value) => {
|
|
|
|
@ -507,7 +544,7 @@ class Question extends Component {
|
|
|
|
|
axios.delete(url)
|
|
|
|
|
.then((response) => {
|
|
|
|
|
if (response.data.status == 0) {
|
|
|
|
|
this.props.showNotification('删除试题成功')
|
|
|
|
|
// this.props.showNotification('删除试题成功')
|
|
|
|
|
// props.history.push(response.data.right_url)
|
|
|
|
|
var data = {
|
|
|
|
|
discipline_id:this.state.discipline_id,
|
|
|
|
@ -533,7 +570,7 @@ class Question extends Component {
|
|
|
|
|
axios.post(url)
|
|
|
|
|
.then((result) => {
|
|
|
|
|
if (result.data.status == 0) {
|
|
|
|
|
this.props.showNotification(`公开题目成功`);
|
|
|
|
|
// this.props.showNotification(`公开题目成功`);
|
|
|
|
|
var data = {
|
|
|
|
|
discipline_id:this.state.discipline_id,
|
|
|
|
|
sub_discipline_id:this.state.sub_discipline_id,
|
|
|
|
@ -593,7 +630,7 @@ class Question extends Component {
|
|
|
|
|
axios.post(url, data)
|
|
|
|
|
.then((result) => {
|
|
|
|
|
if (result.data.status == 0) {
|
|
|
|
|
this.props.showNotification(`选用成功`);
|
|
|
|
|
// this.props.showNotification(`选用成功`);
|
|
|
|
|
var data = {
|
|
|
|
|
discipline_id:this.state.discipline_id,
|
|
|
|
|
sub_discipline_id:this.state.sub_discipline_id,
|
|
|
|
@ -623,7 +660,7 @@ class Question extends Component {
|
|
|
|
|
axios.delete(url)
|
|
|
|
|
.then((result) => {
|
|
|
|
|
if (result.data.status == 0) {
|
|
|
|
|
this.props.showNotification(`撤销成功`);
|
|
|
|
|
// this.props.showNotification(`撤销成功`);
|
|
|
|
|
var data = {
|
|
|
|
|
discipline_id:this.state.discipline_id,
|
|
|
|
|
sub_discipline_id:this.state.sub_discipline_id,
|
|
|
|
@ -635,7 +672,7 @@ class Question extends Component {
|
|
|
|
|
page: this.state.page,
|
|
|
|
|
per_page:10,
|
|
|
|
|
};
|
|
|
|
|
this.getdata(data);
|
|
|
|
|
this.getdatasy(data);
|
|
|
|
|
this.getbasket_listdata();
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
@ -648,8 +685,30 @@ class Question extends Component {
|
|
|
|
|
|
|
|
|
|
var arr= this.state.Contentdata.items;
|
|
|
|
|
for(let data of arr) {
|
|
|
|
|
if(data.item_type==="PROGRAM"){
|
|
|
|
|
//编程题
|
|
|
|
|
if(data.choosed===true){
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
//未选用
|
|
|
|
|
if(data.program_attr.status===1){
|
|
|
|
|
//已发布
|
|
|
|
|
item_idsdata.push(data.id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
//不是编程题
|
|
|
|
|
if(data.choosed===true){
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
//未选用
|
|
|
|
|
item_idsdata.push(data.id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
const data={
|
|
|
|
|
item_ids:item_idsdata
|
|
|
|
|
}
|
|
|
|
@ -669,7 +728,7 @@ class Question extends Component {
|
|
|
|
|
}})
|
|
|
|
|
.then((response) => {
|
|
|
|
|
if (response.data.status == 0) {
|
|
|
|
|
this.props.showNotification('删除成功');
|
|
|
|
|
// this.props.showNotification('删除成功');
|
|
|
|
|
var data = {
|
|
|
|
|
discipline_id:this.state.discipline_id,
|
|
|
|
|
sub_discipline_id:this.state.sub_discipline_id,
|
|
|
|
@ -728,7 +787,7 @@ 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
|
|
|
|
|
program_questions_count, single_questions_count, subjective_questions_count,selectionbools
|
|
|
|
|
} = this.state;
|
|
|
|
|
|
|
|
|
|
const Datacount = completion_questions_count + judgement_questions_count
|
|
|
|
@ -812,6 +871,7 @@ class Question extends Component {
|
|
|
|
|
|
|
|
|
|
<Headplugselections
|
|
|
|
|
disciplinesdata={this.state.disciplinesdata}
|
|
|
|
|
|
|
|
|
|
{...this.props}
|
|
|
|
|
{...this.state}
|
|
|
|
|
setdifficulty={(e) => this.setdifficulty(e)}
|
|
|
|
|