diff --git a/public/react/src/modules/ecs/subroute/ecStudentList/EcStudentList.js b/public/react/src/modules/ecs/subroute/ecStudentList/EcStudentList.js index 9b3147ac3..de67972ac 100644 --- a/public/react/src/modules/ecs/subroute/ecStudentList/EcStudentList.js +++ b/public/react/src/modules/ecs/subroute/ecStudentList/EcStudentList.js @@ -31,7 +31,10 @@ class EcStudentList extends Component { student_id:undefined, Modallisttypess:0, ismanager:false, - isSpin:false + isSpin:false, + pages:1, + per_pages:20, + total_student:0, } } componentDidMount(){ @@ -39,25 +42,27 @@ class EcStudentList extends Component { let major_id=this.props.match.params.major_id; let year_id=this.props.match.params.year_id; - // const url ='/ec_major_schools/'+major_id+'/academic_years/'+year_id+'/student_lists_data'; - // axios.get(url, { - // withCredentials: true, - // }).then((response) => { - // if(response){ - // if(response.status){ - // if(response.status===200){ - // this.setState({ - // majorschoollist:response.data, - // ismanager:response.data.ismanager, - // }) - // } - // } - // } - // - // }) - // .catch(function (error) { - // console.log(error); - // }); + const url ='/ec_years/'+year_id+'/students.json'; + axios.get(url, { + page:this.state.pages, + per_page:this.state.per_pages, + }).then((response) => { + if(response){ + if(response.status){ + if(response.status===200){ + this.setState({ + total_student:response.data.count, + majorschoollist:response.data, + ismanager:response.data.ismanager, + }) + } + } + } + + }) + .catch(function (error) { + console.log(error); + }); // let majorschoollist={ // ec_students: [{index: 1, student_name: "同意", student_id: "s20111458"}, // {index: 1, student_name: "同意", student_id: "s20111458"}, @@ -85,16 +90,23 @@ class EcStudentList extends Component { uploadcomponentDidMount(){ let major_id=this.props.match.params.major_id; let year_id=this.props.match.params.year_id; - const url ='/ec_major_schools/'+major_id+'/academic_years/'+year_id+'/student_lists_data'; + const url ='/ec_years/'+year_id+'/students.json'; axios.get(url, { - withCredentials: true, - }).then((response) => { - if(response.status===200){ - this.setState({ - majorschoollist:response.data, - ismanager:response.data.ismanager, - }) - } + page:this.state.pages, + per_page:this.state.per_pages, + } + ).then((response) => { + if(response){ + if(response.status){ + if(response.status===200){ + this.setState({ + total_student:response.data.count, + majorschoollist:response.data, + ismanager:response.data.ismanager, + }) + } + } + } }) .catch(function (error) { console.log(error); @@ -152,17 +164,25 @@ class EcStudentList extends Component { } showecStudentList=(page)=>{ + let major_id=this.props.match.params.major_id; let year_id=this.props.match.params.year_id; - const url ='/ec_major_schools/'+major_id+'/academic_years/'+year_id+'/student_lists_data?page='+page; + const url ='/ec_years/'+year_id+'/students.json'; axios.get(url, { - withCredentials: true, + page:this.state.pages, + per_page:this.state.per_pages, }).then((response) => { - if(response.status===200){ - this.setState({ - majorschoollist:response.data, - ismanager:response.data.ismanager, - }) + if(response){ + if(response.status){ + if(response.status===200){ + this.setState({ + total_student:response.data.count, + majorschoollist:response.data, + ismanager:response.data.ismanager, + pages:page, + }) + } + } } }).catch(function (error) { console.log(error); @@ -261,6 +281,7 @@ class EcStudentList extends Component { studentall, student_id, Modallisttypess, + total_student, ismanager }=this.state; // ec_students: [] @@ -313,11 +334,11 @@ class EcStudentList extends Component { 返回 -
学生数据为空,请导入数据
-