diff --git a/public/react/src/modules/question/NewMyShixunModel.js b/public/react/src/modules/question/NewMyShixunModel.js index 676a78c0a..a733830d5 100644 --- a/public/react/src/modules/question/NewMyShixunModel.js +++ b/public/react/src/modules/question/NewMyShixunModel.js @@ -1,12 +1,23 @@ -import React, { Component } from "react"; +import React, {Component} from "react"; +import {Link, NavLink} from 'react-router-dom'; +import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl} from 'educoder'; import axios from 'axios'; import { + notification, + Spin, + Table, Pagination, + Drawer, + Input, + Tooltip } from "antd"; +import {parabola} from './animation/parabola' import Headplugselections from "./component/Headplugselections"; import QuestionModal from "./component/QuestionModal"; import QuestionModals from "./component/QuestionModals"; import Contentpart from "./component/Contentpart"; +import {TPMIndexHOC} from "../tpm/TPMIndexHOC"; +import NoneData from './component/NoneData'; import './questioncss/questioncom.css'; import Bottomsubmit from "../modals/Bottomsubmit"; import QuestionModalys from "./component/QuestionModalys"; @@ -20,16 +31,16 @@ class NewMyShixunModel extends Component { super(props); this.state = { count: 50, - defaultActiveKey: "1", + defaultActiveKey:"1", Headertop: "", Footerdown: "", visible: false, placement: 'right', modalsType: false, - modalsTypes: false, + modalsTypes:false, titilesm: "在平台审核后,所有成员均可使用试题", titiless: "是否设置为公开?", - titilesms: "单选题", + titilesms:"单选题", titbool: false, Contentdata: [], difficulty: null, @@ -47,17 +58,17 @@ class NewMyShixunModel extends Component { program_questions_count: 0, single_questions_count: 0, subjective_questions_count: 0, - page: 1, - per_page: 10, - disciplinesdata: [], - discipline_id: null, - sub_discipline_id: null, - tag_discipline_id: null, - booljupyterurls: false, - disciplinesdatakc: 0, - disciplinesdatazsd: 0, - selectallquestionsonthispages: false, - oj_status: null, + page:1, + per_page:10, + disciplinesdata:[], + discipline_id:null, + sub_discipline_id:null, + tag_discipline_id:null, + booljupyterurls:false, + disciplinesdatakc:0, + disciplinesdatazsd:0, + selectallquestionsonthispages:false, + oj_status:null, isVisible: false, selectionbools:false, chakanjiexiboolindex:"无", @@ -88,23 +99,23 @@ class NewMyShixunModel extends Component { oj_status:null }) var data = { - discipline_id: discipline_id, - sub_discipline_id: null, - tag_discipline_id: null, + discipline_id:discipline_id, + sub_discipline_id:null, + tag_discipline_id:null, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keyword: null, page: this.state.page, - per_page: 10, - oj_status: null, - item_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), + per_page:10, + oj_status:null, + exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), }; this.getdata(data); } - setsub_discipline_id = (discipline_id, sub_discipline_id) => { + setsub_discipline_id=(discipline_id,sub_discipline_id)=>{ this.setState({ sub_discipline_id:sub_discipline_id, tag_discipline_id:null, @@ -114,22 +125,22 @@ class NewMyShixunModel extends Component { oj_status:null }) var data = { - discipline_id: discipline_id, - sub_discipline_id: sub_discipline_id, - tag_discipline_id: null, + discipline_id:discipline_id, + sub_discipline_id:sub_discipline_id, + tag_discipline_id:null, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keyword:null, page: 1, - per_page: 10, - oj_status: null, - item_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), + per_page:10, + oj_status:null, + exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), }; this.getdata(data); } - settag_discipline_id = (tag_discipline_id) => { + settag_discipline_id=(tag_discipline_id)=>{ this.setState({ tag_discipline_id:tag_discipline_id, keyword:"", @@ -138,17 +149,17 @@ class NewMyShixunModel extends Component { oj_status:null }) var data = { - discipline_id: this.state.discipline_id, - sub_discipline_id: this.state.sub_discipline_id, - tag_discipline_id: tag_discipline_id, + discipline_id:this.state.discipline_id, + sub_discipline_id:this.state.sub_discipline_id, + tag_discipline_id:tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keyword: null, page: 1, - per_page: 10, - oj_status: null, - item_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), + per_page:10, + oj_status:null, + exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), }; this.getdata(data); } @@ -205,11 +216,9 @@ class NewMyShixunModel extends Component { //获取题库筛选资料 let urls = `/disciplines.json`; - axios.get(urls, { - params: { - source: "question" - } - }).then((response) => { + axios.get(urls, {params: { + source:"question" + }}).then((response) => { //console.log("Questiondisciplines"); //console.log(response.data); if (response) { @@ -262,22 +271,22 @@ class NewMyShixunModel extends Component { callback = (key) => { this.setState({ defaultActiveKey: key, - selectallquestionsonthispages: false, - difficulty: null, - page: 1, - oj_status: null + selectallquestionsonthispages:false, + difficulty:null, + page:1, + oj_status:null }) 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: key, item_type: this.state.item_type, difficulty: null, page: 1, - per_page: 10, - oj_status: null, - item_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), + per_page:10, + oj_status:null, + exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), }; this.getdata(data); @@ -287,15 +296,15 @@ class NewMyShixunModel extends Component { getdata = (data) => { const url = `/item_banks.json`; this.setState({ - booljupyterurls: true, - selectionbools: false, + booljupyterurls:true, + selectionbools:false, }) - axios.get((url), { params: data }).then((response) => { - setTimeout(() => { + axios.get((url), {params: data}).then((response) => { + setTimeout(()=>{ this.setState({ - booljupyterurls: false, + booljupyterurls:false, }) - }, 1000); + },1000); if (response === null || response === undefined) { return @@ -315,7 +324,7 @@ class NewMyShixunModel extends Component { }).catch((error) => { //////console.log(error) this.setState({ - booljupyterurls: false, + booljupyterurls:false, }) }); } @@ -324,12 +333,12 @@ class NewMyShixunModel extends Component { getdatasy = (data) => { const url = `/item_banks.json`; this.setState({ - selectionbools: false, + selectionbools:false, }) - axios.get((url), { params: data }).then((response) => { - setTimeout(() => { + axios.get((url), {params: data}).then((response) => { + setTimeout(()=>{ - }, 1000); + },1000); if (response === null || response === undefined) { return @@ -361,9 +370,9 @@ class NewMyShixunModel extends Component { for(let data of arr) { if(data.item_type==="PROGRAM"){ //编程题 - if (data.choosed === true) { + if(data.choosed===true){ - } else { + }else{ //未选用 if(data.program_attr.status===1){ //已发布1 未发布0 @@ -374,13 +383,13 @@ class NewMyShixunModel extends Component { } - } else { + }else{ //不是编程题 - if (data.choosed === true) { + if(data.choosed===true){ - } else { + }else{ //未选用 - contes = contes + 1; + contes=contes+1; } } @@ -414,28 +423,6 @@ class NewMyShixunModel extends Component { } } - else { - try { - if(arr.length===Grandtotal){ - myGrandtotal=true; - this.setState({ - selectionbools:false, - selectallquestionsonthispages:false, - }) - }else{ - this.setState({ - selectionbools:true, - selectallquestionsonthispages:true, - }) - } - }catch (e) { - this.setState({ - selectionbools:true, - selectallquestionsonthispages:true, - }) - } - - } } paginationonChange = (pageNumber) => { @@ -443,27 +430,27 @@ class NewMyShixunModel extends Component { page: pageNumber, }) 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: pageNumber, - per_page: 10, - oj_status: this.state.oj_status, - item_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), + per_page:10, + oj_status:this.state.oj_status, + exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), }; this.getdata(data); } showDrawer = () => { - if (this.state.visible === true) { + if(this.state.visible===true){ this.setState({ visible: false, }); - } else { + }else{ this.setState({ visible: true, }); @@ -519,19 +506,19 @@ class NewMyShixunModel extends Component { modalsType: false }) } - modalCancels = () => { + modalCancels=()=>{ this.setState({ modalsTypes: false }) } - showQuestionModals = (item_type) => { + showQuestionModals =(item_type)=>{ this.setState({ modalsTypes: true, - titilesms: item_type, + titilesms:item_type, }) } - setDownloads = (item_type) => { + setDownloads=(item_type)=>{ this.Deletebigquestiontype(item_type); this.setState({ modalsTypes: false @@ -562,9 +549,9 @@ class NewMyShixunModel extends Component { }) 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: difficulty, item_type: this.state.item_type, @@ -589,9 +576,9 @@ class NewMyShixunModel extends Component { }) 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: item_type, @@ -657,17 +644,17 @@ class NewMyShixunModel extends Component { keyword: 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, + 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: value, page: this.state.page, - per_page: 10, - oj_status: this.state.oj_status, - item_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), + per_page:10, + oj_status:this.state.oj_status, + exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), }; this.getdata(data); @@ -682,16 +669,16 @@ class NewMyShixunModel extends Component { // this.props.showNotification('删除试题成功') // props.history.push(response.data.right_url) 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, - item_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), + per_page:10, + exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), }; this.getdata(data); } @@ -708,23 +695,23 @@ class NewMyShixunModel extends Component { 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, - item_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), + per_page:10, + exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), }; this.getdata(data); } }).catch((error) => { - ////console.log(error); - }) + ////console.log(error); + }) } getbasket_listdata = () => { @@ -799,11 +786,6 @@ class NewMyShixunModel extends Component { } - - // 不选用 Question.js页面也有个 - NOgetitem_baskets=(data)=>{ - let url="/examination_banks/cancel_items.json"; - axios.post(url, data) .then((result) => { if (result.data.status == 0) { @@ -826,40 +808,6 @@ class NewMyShixunModel extends Component { ////console.log(error); }) } - - //选用 Question.js页面也有个 - getitem_baskets=(data)=>{ - //选用题型可以上传单个 或者多个题型 - let url = ""; - if (this.props.exam_id === undefined) { - url = "/item_baskets.json"; - } else { - url = "/examination_items.json"; - } - - - axios.post(url, data) - .then((result) => { - if (result.data.status == 0) { - 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, - keyword: this.state.keywords, - page: this.state.page, - per_page: 10, - item_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), - }; - this.getdatasy(data); - this.getbasket_listdata(); - } - }).catch((error) => { - ////console.log(error); - }) - } // 撤销 getitem_basketss=(id)=>{ @@ -946,9 +894,9 @@ class NewMyShixunModel extends Component { } var item_idsdata=[]; - var arr = this.state.Contentdata.items; - for (let data of arr) { - if (data.item_type === "PROGRAM") { + 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){ @@ -956,16 +904,16 @@ class NewMyShixunModel extends Component { item_idsdata.push(data.id); } - } else { + }else{ //未选用 - if (data.program_attr.status === 1) { + if(data.program_attr.status===1){ //已发布 item_idsdata.push(data.id); } } - } else { + }else{ //不是编程题 if(data.choosed===true){ item_idsdata.push(data.id); @@ -976,9 +924,9 @@ class NewMyShixunModel extends Component { } } - const data = { - item_ids: item_idsdata, - item_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), + const data={ + item_ids:item_idsdata, + exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), } @@ -1000,80 +948,63 @@ class NewMyShixunModel extends Component { //全选的状态 //删除大题型 - Deletebigquestiontype = (item_type) => { - const url = `/item_baskets/delete_item_type.json`; - axios.delete((url), { - data: { - item_type: item_type - } - }) + Deletebigquestiontype =(item_type)=>{ + const url=`/item_baskets/delete_item_type.json`; + axios.delete((url), { data: { + item_type:item_type + }}) .then((response) => { if (response.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, - item_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), + per_page:10, + exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), }; this.getdata(data); this.getbasket_listdata(); } }) - 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, - keyword: this.state.keywords, - page: this.state.page, - per_page: 10, - oj_status: oj_status, - exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), - }; - this.getdata(data); + .catch(function (error) { + ////console.log(error); + }); + } - render() { - 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 - } = this.state; + //跳转 + gotopaperreview=()=>{ this.props.history.replace("/paperreview"); } - setoj_status = (oj_status) => { + setoj_status=(oj_status)=>{ //编程题发布未发布 this.setState({ - selectallquestionsonthispages: false, - difficulty: null, - oj_status: oj_status + selectallquestionsonthispages:false, + difficulty:null, + oj_status:oj_status }) 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, - oj_status: oj_status, - item_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), + per_page:10, + oj_status:oj_status, + exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), }; this.getdata(data); } @@ -1081,7 +1012,7 @@ class NewMyShixunModel extends Component { render() { let { - page, per_page, items_count, Headertop, visible, placement, modalsType, modalsTypes, basket_list, + 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,Contentdata @@ -1098,11 +1029,11 @@ class NewMyShixunModel extends Component { // console.log(Contentdata) return ( -