import React,{ Component } from "react"; import '../../css/members.css' import '../../css/busyWork.css' import '../style.css' import { WordsBtn } from 'educoder' import NoneData from '../../coursesPublic/NoneData' import Modals from "../../../modals/Modals" import axios from 'axios' import { Modal,Select,Input } from "antd"; const Option = Select.Option class GraduateTopicDetailTable extends Component{ constructor(props){ super(props); this.state={ modalsType:false, modalsTopval:'', operationId:undefined, agreeFlag:false, classesId:undefined, agreeCheck:false, visible:false, un_addClass:undefined, un_addClass_notice:"", un_choose_notice:"" } } // 拒绝 aboutTopic=(id)=>{ this.setState({ modalsType:true, modalsTopval:'是否确认拒绝学生选题?', operationId:id }) } cancelAboutTopic=()=>{ this.setState({ modalsType:false, modalsTopval:'' }) } sureAboutTopic=()=>{ let{operationId}=this.state let courseId=this.props.match.params.course_id; let graduation_topic_id=this.props.match.params.graduation_topic_id; let url =`/courses/${courseId}/graduation_topics/${graduation_topic_id}/refuse_student_topic.json?student_graduation_topic=`+operationId; axios.post(url).then((result)=>{ if(result.data.status==0){ this.props.showNotification(`${result.data.message}`); this.setState({ modalsType:false, modalsTopval:'' }) //成功后调用列表接口,刷新 this.props.getDetailList(this.props.page); } }).catch((error)=>{ console.log(error); }) this.setState({ modalsType:false, modalsTopval:'' }) } //同意 agreeTopic=(id)=>{ this.setState({ agreeFlag:true, operationId:id }) } hideAgreeTopic=()=>{ this.setState({ agreeFlag:false, classesId:undefined }) } sureAgreeTopic=(count)=>{ let{tableData}=this.props; let{operationId,classesId}=this.state let courseId=this.props.match.params.course_id; if(classesId!=undefined){ let name=tableData.group_list.filter(item=>item.group_id==classesId)[0].group_name; this.agreeChoose(courseId,operationId,classesId,name); }else{ this.agreeChoose(courseId,operationId,classesId); } } agreeChoose=(courseId,operationId,classesId,courseName)=>{ let graduation_topic_id=this.props.match.params.graduation_topic_id; let url =`/courses/${courseId}/graduation_topics/${graduation_topic_id}/accept_student_topic.json`; axios.post(url,{ student_graduation_topic_id:operationId, group_id:classesId, course_group_name:courseName }).then((result)=>{ if(result.data.status==0){ this.props.showNotification(`${result.data.message}`); this.setState({ agreeFlag:false, agreeCheck:true, visible:false }) //成功后调用列表接口,刷新 this.props.getDetailList(this.props.page); } }).catch((error)=>{ console.log(error); }) } //切换分班 changeClasses=(value)=>{ this.setState({ classesId:value }) } //新增分班 topicAddClasses=()=>{ this.setState({ visible:true, agreeFlag:false }) } hideClasses=()=>{ this.setState({ visible:false, classesId:undefined }) } //新建分班--输入分班 inputClasses=(e)=>{ this.setState({ un_addClass:e.target.value }) } // 新建分班---确定 sureAddClass=()=>{ let {un_addClass}=this.state; if(!un_addClass){ this.setState({ un_addClass_notice:"请输入分班名称" }) return; } console.log(this.props) let{operationId}=this.state let courseId=this.props.match.params.course_id; this.agreeChoose(courseId,operationId,-1,un_addClass); } render(){ let {page,tableData}=this.props let { modalsType,modalsTopval,agreeFlag,classesId,visible ,un_addClass_notice ,un_addClass, un_choose_notice } = this.state const isAdmin =this.props.isAdmin(); const isStudent =this.props.isStudent(); const isNotMember=this.props.isNotMember(); console.log(un_addClass_notice) return(
序号 姓名 {isNotMember ?"" :学号} 分班 选题时间 操作 { isAdmin && 确认结果 }
{/* 拒绝弹框 */} {/* 同意弹框 */}

确认同意学生的选题,将学生加入我的分班

{ tableData.group_list && tableData.group_list.length===0?"":
选择:

{un_choose_notice}

}
取消 this.sureAgreeTopic(tableData.group_list.length)}>确定
分班:

{un_addClass_notice}

取消 确定
{ tableData.users_list && tableData.users_list.length > 0 && tableData.users_list.map((item,key)=>{ return(
  • {parseInt(key+1)+(parseInt(page-1)*15)} {item.student_name} {isNotMember ?"" :{item.student_id}} {item.class_group_name || "--"} {item.selected_time} { isAdmin && { item.result == "待确认" ? this.aboutTopic(`${item.id}`)}>拒绝 this.agreeTopic(`${item.id}`)}>同意 : ( item.result === "已拒绝" ? -- : this.aboutTopic(`${item.id}`)}>拒绝 ) } } { isStudent && {item.result} } { isAdmin && {item.result=== "待确认"?"--":item.result} } { isNotMember && -- }
  • ) }) } { tableData.users_list && tableData.users_list.length == 0 && }
    ) } } export default GraduateTopicDetailTable;