PCqiandao
杨树林 5 years ago
parent 64f7475d59
commit 42067b1690

@ -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(
<div className="edu-tab-con-box clearfix edu-txt-center intermediatecenter" style={ style || { width:"100%",height:"100%"}}>
<style>
{`
.edu-tab-con-box{
padding:100px 0px;
}
.ant-modal-body .edu-tab-con-box{
padding:0px!important;
}
img.edu-nodata-img{
margin: 40px auto 20px;
}
.zenwuxgsj{
font-size:17px;
font-family:MicrosoftYaHei;
color:rgba(136,136,136,1);
}
`}
</style>
<img className="edu-nodata-img mb20" src={getUrl("/images/educoder/nodata.png")}/>
<p className="edu-nodata-p mb10 zenwuxgsj">暂无相关数据</p>
</div>
)
}
}
export default NoneDatas;

@ -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(
<React.Fragment>
<div className="ws100s mt20 h500">
<Teacherentry defaultActiveKey={this.props.defaultActiveKey}{...this.props} {...this.state}></Teacherentry>
{
mydatas.length>0?
mydatas.map((object, index) => {
return (
<Teacherentry item={object} defaultActiveKey={this.props.defaultActiveKey}{...this.props} {...this.state}></Teacherentry>
)
})
:
<NoneDatas></NoneDatas>
}
</div>
</React.Fragment>
)

@ -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{
<Tabs defaultActiveKey="1" onChange={this.callback}>
<TabPane tab="正在签到" key="1">
<p className="mt20 mysligtes">共3个签到正在进行</p>
<Teaccomponent defaultActiveKey={defaultActiveKey} {...this.state} {...this.props}></Teaccomponent>
<Teaccomponent datas={datas} defaultActiveKey={defaultActiveKey} {...this.state} {...this.props}></Teaccomponent>
<div className="mb30 clearfix educontent mt40 intermediatecenter">
<Pagination showQuickJumper current={page} onChange={this.paginationonChange}
pageSize={per_page}
total={count}></Pagination>
pageSize={limit}
total={attendances_count}></Pagination>
</div>
</TabPane>
<TabPane tab="历史签到" key="2">
@ -97,13 +153,13 @@ class Students_signin extends Component{
<Teaccomponent defaultActiveKey={defaultActiveKey} {...this.state} {...this.props}></Teaccomponent>
<Teaccomponent datas={datas} defaultActiveKey={defaultActiveKey} {...this.state} {...this.props}></Teaccomponent>
<div className="mb30 clearfix educontent mt40 intermediatecenter">
<Pagination showQuickJumper current={page} onChange={this.paginationonChange}
pageSize={per_page}
total={count}></Pagination>
pageSize={limit}
total={attendances_count}></Pagination>
</div>
</TabPane>
{

@ -429,7 +429,8 @@ class Contentpart extends Component {
</Listjihe>
)
})}
})
}

Loading…
Cancel
Save