import React,{ Component } from "react"; import { Input, Checkbox, Menu, Pagination,Table } from "antd"; import '../../css/members.css' import '../../css/busyWork.css' import '../style.css' import { WordsBtn } from 'educoder' import NoneData from '../../coursesPublic/NoneData' import axios from 'axios' import DetailTable from './GraduateTopicDetailTable' import DetailInfo from './GraduateTopicDetailInfo' import CoursesListType from '../../coursesPublic/CoursesListType'; class GraduateTopicDetail extends Component{ constructor(props){ super(props); this.state={ tableData:[], tablePage:1, tablePageSize:15, tab:1 } } componentDidMount(){ let{tablePage}=this.state; this.getDetailList(tablePage); } // 获取详情列表 getDetailList=(page)=>{ let course_id=this.props.match.params.course_id; let graduation_topic_id=this.props.match.params.graduation_topic_id; let{tablePageSize}=this.state; let url=`/courses/${course_id}/graduation_topics/${graduation_topic_id}.json?page=`+page+`&limit=`+tablePageSize; axios.get(url).then((result)=>{ if(result.status==200){ this.setState({ tableData:result.data }) } }).catch((error)=>{ console.log(error); }) } //详情列表翻页 changeTablePag=(pageNumber)=>{ this.setState({ tablePage:pageNumber }) this.getDetailList(pageNumber); } // 切换tab onChangeStatus=(e)=>{ this.setState({ tab:e.key }) } actionTopic=()=>{ let graduation_topic_id=this.props.match.params.graduation_topic_id; let course_id=this.props.match.params.course_id; let {tableData}=this.state; this.props.confirm({ content: tableData.user_selected_topic==0?`是否确认取消选题?`:"是否确认选题?", onOk: () => { let url="/courses/"+course_id+"/graduation_topics/"+graduation_topic_id+"/" if(tableData.user_selected_topic==0){ url+="student_cancel_topic.json" }else if(tableData.user_selected_topic==null || tableData.user_selected_topic==2){ url+="student_select_topic.json" } axios.post((url)).then((result)=>{ // console.log(result); if(result.data.status == 0){ this.getDetailList(); this.props.showNotification(`${result.data.message}`); } }).catch((error)=>{ console.log(error); }) } }) } render(){ let { tableData, tablePage, tablePageSize, tab, }=this.state const { current_user } = this.props let {course_id,graduation_topic_id}=this.props.match.params; const isStudent =this.props.isStudent(); const isAdmin =this.props.isAdmin(); return(

{tableData && tableData.course_name} > {tableData.graduation_name} > 选题详情

{tableData && tableData.graduation_topic_name} this.props.history.goBack()}>返回

选题列表 选题问答
{/* null: 未选题 0:待确认 1:已同意 2:已拒绝 */} { isStudent && tableData.user_selected == false && (tableData.user_selected_topic==null || tableData.user_selected_topic==2) && 选题 } { isStudent && tableData.user_selected == true && tableData.user_selected_topic==0 && 取消选题 } { isAdmin && 编辑 }
{ tab && tab==1&&
{ tableData && tableData.users_count>tablePageSize &&
}
} { tab && tab==2&& }
) } } export default GraduateTopicDetail;