import React,{ Component } from "react"; import {Checkbox,Input,Table, Pagination,Menu} from "antd"; import {Link,NavLink} from 'react-router-dom'; import { WordsBtn ,ActionBtn} from 'educoder'; import CoursesListType from '../coursesPublic/CoursesListType'; import '../css/members.css'; import '../css/busyWork.css'; import axios from 'axios'; import Modals from '../../modals/Modals'; import DownloadMessageysl from "../../modals/DownloadMessageysl"; import Studentshavecompletedthelist from './Studentshavecompletedthelist'; import WrappedExercisesetting from './Exercisesetting'; import ExerciseDisplay from './ExerciseDisplay' import Exercisestatisticalresult from './Exercisestatisticalresult'; import ImmediatelyPublish from "../poll/pollPublicBtn/ImmediatelyPublish"; import ImmediatelyEnd from "../poll/pollPublicBtn/ImmediatelyEnd"; import Ecerciseallbackagain from './Ecerciseallbackagain'; const polls_status={1:"未发布",2:"提交中",3:"已截止",4:"已结束"} const start_Value={0:"继续答题",1:"查看答题",2:"开始答题"} //试卷主要设置页面 class Testpapersettinghomepage extends Component{ constructor(props) { super(props); this.state={ tab:["0"], searchtext:"", Commonheadofthetestpaper:undefined, visible:false, groupyslsval:"", current_status:undefined, DownloadType:false, DownloadMessageval:undefined, } } //切换tab changeTab=(e)=>{ this.setState({ tab:e.key }) // this.props.history.push(`/courses/${this.props.match.params.coursesId}/exercises/${this.props.match.params.Id}/student_exercise_list?tab=`+e.key) } componentDidMount(){ const query =this.props.location.search; const type = query.split('?tab='); let sum = [] sum.push(type[1]) // console.log("componentDidMountcomponentDidMount"); // console.log(sum); this.setState({ tab:sum, }) this.Commonheadofthetestpaper(); } //试卷公用头部 Commonheadofthetestpaper=()=>{ // console.log("Commonheadofthetestpaper"); var exercise_id = this.props.match.params.Id; var url = `/exercises/${exercise_id}/common_header.json`; axios.get(url).then((response) => { // console.log(JSON.stringify(response)); try { if(response.status === 200){ this.setState({ Commonheadofthetestpaper:response.data, current_status:response.data.user_permission.current_status }) // console.log(JSON.stringify(response.data.show_statistic)); } }catch (e) { } }).catch((error) => { console.log(error) }); } Ecerciseacallagain=()=>{ this.setState({ visible:true }) } callback=(val)=>{ this.setState({ visible:false }) if(val===1){ window.location.reload() } } moveTos=(val)=>{ if(val===0){ } } setcourse_groupysls=(val)=>{ let list=""; val.map((item,key)=>{ if(item!=undefined){ list=list+"&exercise_group_id[]="+item } }) this.setState({ groupyslsval:list }) } // experiment=(url)=>{ // // axios.get(url).then((response) => { // console.log(response); // if(response.data.status&&response.data.status===-1){ // // }else if(response.data.status&&response.data.status===-2){ // if(response.data.messages === "100"){ // // 已超出文件导出的上限数量(100 ),建议: // this.setState({ // DownloadType:true, // DownloadMessageval:100 // }) // }else { // //因附件资料超过500M // this.setState({ // DownloadType:true, // DownloadMessageval:500 // }) // } // }else { // window.open("/api"+url, '_blank'); // } // }).catch((error) => { // console.log(error) // }); // // } setgameexercise=(url)=>{ let{Commonheadofthetestpaper}=this.state; if(Commonheadofthetestpaper.time>0){ this.setState({ Modalstype:true, ModalSave:()=>this.props.history.push(url), Modalstopval:`答题时长限制${Commonheadofthetestpaper.time}分钟,从首次答题开始实行不间断计时方法`, modalsBottomval:'请确认是否有充足的答题时间?', }); }else{ this.setState({ Modalstype:true, ModalSave:()=>this.props.history.push(url), Modalstopval:"是否确认开始答题?", modalsBottomval:' ', }) } } /// 确认是否下载 confirmysl(url){ axios.get(url).then((response) => { if(response.data.status&&response.data.status===-1){ }else if(response.data.status&&response.data.status===-2){ if(response.data.messages === "100"){ // 已超出文件导出的上限数量(100 ),建议: this.setState({ DownloadType:true, DownloadMessageval:100 }) }else { //因附件资料超过500M this.setState({ DownloadType:true, DownloadMessageval:500 }) } }else { this.props.showNotification(`正在下载中`); window.open("/api"+url, '_blank'); } }).catch((error) => { console.log(error) }); } Downloadcal=()=>{ this.setState({ DownloadType:false, DownloadMessageval:undefined }) } cancelmodel=()=>{ this.setState({ Modalstype:false, ModalSave:' ', Modalstopval:' ', modalsBottomval:' ', Loadtype:false }) } // DownloadType=()=>{ // this.setState({ // DownloadType:false, // DownloadMessageval:undefined // }) // } // Downloadcal=()=>{ // this.setState({ // DownloadType:false, // DownloadMessageval:undefined // }) // } render(){ let {tab,visible,Commonheadofthetestpaper}=this.state; const isAdmin =this.props.isAdmin(); const isStudent = this.props.isStudent(); return(
{/**/}
{/* 公用的提示弹框 */} {this.state.Modalstype===true?:""} {visible===true?:""}

{this.props.coursedata.name} > 试卷 > 试卷详情

{Commonheadofthetestpaper === undefined?"":Commonheadofthetestpaper.exercise_name}

返回

{this.props.isAdmin()===true? 答题列表 统计结果 试卷预览 设置 : 答题列表 {Commonheadofthetestpaper&&Commonheadofthetestpaper.show_statistic===true? 统计结果:""} 设置 }
{/*导出这块应该是下拉 因为需要前端导出,目前就只导出学生成绩*/} {/*{isAdmin === true? 导出成绩:""}*/} { isAdmin === true &&Commonheadofthetestpaper && Commonheadofthetestpaper.user_permission.user_commit_counts>0? 打回重做:"" } {isAdmin === true? Commonheadofthetestpaper!==undefined&&Commonheadofthetestpaper.user_permission.exercise_publish_count>0? :"":""} {isAdmin === true?Commonheadofthetestpaper!==undefined&&Commonheadofthetestpaper.user_permission.exercise_unpublish_count>0? :"":""} {isAdmin === true? 编辑试卷:""} {isAdmin === false && this.props.current_user !== undefined? Commonheadofthetestpaper&&Commonheadofthetestpaper.user_permission.current_status===2? this.setgameexercise(`/courses/${this.props.match.params.coursesId}/exercises/${this.props.match.params.Id}/users/${this.props.current_user.login}`)}>开始答题: {start_Value[Commonheadofthetestpaper&&Commonheadofthetestpaper.user_permission.current_status]} :""}
{ // 教师列表 parseInt(tab[0])==0 && this.setcourse_groupysls(value)} current_status = {this.state.current_status}> } {/*统计结果*/} { parseInt(tab[0])==1 && } { parseInt(tab[0])==2 && } { parseInt(tab[0])==3 && }
) } } export default Testpapersettinghomepage;