diff --git a/public/react/src/modules/courses/signin/component/NoneDatas.js b/public/react/src/modules/courses/signin/component/NoneDatas.js new file mode 100644 index 000000000..c36cc29d1 --- /dev/null +++ b/public/react/src/modules/courses/signin/component/NoneDatas.js @@ -0,0 +1,36 @@ +import React, { Component } from 'react'; +import { getImageUrl , getUrl } from 'educoder'; + +class NoneDatas extends Component{ + constructor(props) { + super(props) + } + render(){ + const { style } = this.props; + return( +
+ + +

暂无相关数据

+
+ ) + } +} +export default NoneDatas; diff --git a/public/react/src/modules/courses/signin/component/teachercomponent/Teaccomponent.js b/public/react/src/modules/courses/signin/component/teachercomponent/Teaccomponent.js index 685bd11e9..fee014477 100644 --- a/public/react/src/modules/courses/signin/component/teachercomponent/Teaccomponent.js +++ b/public/react/src/modules/courses/signin/component/teachercomponent/Teaccomponent.js @@ -2,6 +2,9 @@ import React,{ Component } from "react"; import '../../css/signincdi.css'; import axios from 'axios'; import Teacherentry from "../Teacherentry"; +import NoneDatas from '../NoneDatas'; +import Listjihe from "../../../../question/component/Listjihe"; + //在线学习 class Teaccomponent extends Component{ //教师正在签到 @@ -9,21 +12,15 @@ class Teaccomponent extends Component{ super(props); this.state={ - + mydatas:[] } } componentDidMount() { - const coureid=this.props.match.params.coursesId; - let urls = `/courses/${coureid}/attendances.json`; - axios.get(urls, { - params: { - history: this.props.defaultActiveKey==="1"?undefined:true - } - }).then((response) => { - console.log(response); - + this.setState({ + mydatas:this.props.datas }) + } @@ -37,10 +34,20 @@ class Teaccomponent extends Component{ render(){ + let mydatas=this.props.datas?this.props.datas:[]; return(
- + { + mydatas.length>0? + mydatas.map((object, index) => { + return ( + + ) + }) + : + + }
) diff --git a/public/react/src/modules/courses/signin/teacher/Teachers_signin.js b/public/react/src/modules/courses/signin/teacher/Teachers_signin.js index 845bdf173..1cb3b7f79 100644 --- a/public/react/src/modules/courses/signin/teacher/Teachers_signin.js +++ b/public/react/src/modules/courses/signin/teacher/Teachers_signin.js @@ -15,14 +15,21 @@ class Students_signin extends Component{ this.state={ visible:false, page:1, - per_page:20, + limit:5, count:50, defaultActiveKey:"1", + attendances_count:0, + datas:[] } } componentDidMount() { - + let data={ + key:"1", + page:1, + limit:5 + } + this.gogetdatas(data); } componentDidUpdate = (prevProps) => { @@ -33,7 +40,48 @@ class Students_signin extends Component{ callback=(key)=> { console.log(key); this.setState({ - defaultActiveKey: key, + key: key, + page:1, + limit:5 + }) + let data={ + key:key, + page:1, + limit:5 + } + if(key==="1" || key ==="2"){ + this.gogetdatas(data); + } + } + + gogetdatas =(mydata)=>{ + const coureid=this.props.match.params.coursesId; + let urls = `/courses/${coureid}/attendances.json`; + let arry={} + if(mydata.key==="1" || mydata.key ===1){ + arry={ + page:mydata.page, + limit:mydata.limit, + }; + }else if(mydata.key==="2" || mydata.key ===2){ + arry={ + history:true, + page:mydata.page, + limit:mydata.limit, + } + } + axios.get(urls, { + params: arry + }).then((response) => { + console.log(response); + if(response){ + if(response.data){ + this.setState({ + attendances_count:response.data.attendances_count, + datas:response.data.attendances + }) + } + } }) } @@ -46,12 +94,20 @@ class Students_signin extends Component{ this.setState({ page: pageNumber, }) + + let data={ + key:this.state.defaultActiveKey, + page:pageNumber, + limit:5 + } + this.gogetdatas(data); + } render(){ - let {page,per_page,count,defaultActiveKey} =this.state; + let {page,per_page,count,defaultActiveKey,limit,attendances_count,datas} =this.state; const isAdmin =this.props.isAdmin(); return( @@ -69,14 +125,14 @@ class Students_signin extends Component{

共3个签到正在进行

- +
+ pageSize={limit} + total={attendances_count}>
@@ -97,13 +153,13 @@ class Students_signin extends Component{ - +
+ pageSize={limit} + total={attendances_count}>
{ diff --git a/public/react/src/modules/question/component/Contentpart.js b/public/react/src/modules/question/component/Contentpart.js index e3f5259e5..5cafe5937 100644 --- a/public/react/src/modules/question/component/Contentpart.js +++ b/public/react/src/modules/question/component/Contentpart.js @@ -429,7 +429,8 @@ class Contentpart extends Component { ) - })} + }) + }