PCqiandao
杨树林 5 years ago
parent fe33db3d43
commit ff7e8ba5b4

@ -46,7 +46,7 @@ if (isDev) {
// 老师 // 老师
// debugType="teacher"; // debugType="teacher";
// 学生 // 学生
// debugType="student"; debugType="student";

@ -9,9 +9,7 @@ class Teacherentry extends Component{
constructor(props) { constructor(props) {
super(props); super(props);
this.state={ this.state = {}
}
} }
componentDidMount() { componentDidMount() {
@ -24,20 +22,19 @@ class Teacherentry extends Component{
} }
render() { render() {
let isAdmin = this.props.isAdmin(); let isAdmin = this.props.isAdmin();
let item = this.props.item; let item = this.props.item;
let index =this.props.index;
let jdt; let jdt;
try { try {
jdt = item.normal_count / item.all_count * 100; jdt = item.normal_count / item.all_count * 100;
} catch (e) { } catch (e) {
jdt = 100; jdt = 100;
} }
console.log(jdt);
return ( return (
<React.Fragment> <React.Fragment>
<div className="ws100s edu-back-white " > <div className={index===0?"ws100s edu-back-white ": "ws100s edu-back-white mt20"}>
<div className="ws100s teacherentrydiv "> <div className="ws100s teacherentrydiv ">
<p className="ws100s teachedivp ymaxnamewidthdivp"> <p className="ws100s teachedivp ymaxnamewidthdivp">
{ {
@ -98,13 +95,18 @@ class Teacherentry extends Component{
isAdmin === true ? isAdmin === true ?
this.props.defaultActiveKey === "1" ? this.props.defaultActiveKey === "1" ?
<div className="ws100s xaxisreverseorder"> <div className="ws100s xaxisreverseorder">
<div className="jiezhis h40s">截止</div> <div className="jiezhis h40s xiaoshou" onClick={()=>this.props.thisEnd(item.id)}>截止</div>
<div className="shanchu h40s">删除</div> <div className="shanchu h40s xiaoshou" onClick={()=>this.props.thisdelete(item.id)}>删除</div>
</div>
:
item.edit_auth === true ?
<div className="ws100s xaxisreverseorder">
<div className="jiezhis h40s xiaoshou">编辑</div>
<div className="shanchu h40s xiaoshou" onClick={()=>this.props.thisdelete(item.id)}>删除</div>
</div> </div>
: :
<div className="ws100s xaxisreverseorder"> <div className="ws100s xaxisreverseorder">
<div className="jiezhis h40s">编辑</div> <div className="jiezhis h40s color-reds xiaoshou" onClick={()=>this.props.thisdelete(item.id)}>删除</div>
<div className="shanchu h40s">删除</div>
</div> </div>
: :
( (
@ -117,17 +119,29 @@ class Teacherentry extends Component{
</div> </div>
: :
<div className="ws100s xaxisreverseorder"> <div className="ws100s xaxisreverseorder">
{/*<div className="zcqiandao xiaoshou">*/} {
{/* 正常签到*/} item.attendance_status?
{/*</div>*/} item.attendance_status === "NORMAL" ?
<div className="zcqiandao xiaoshou">
{/*<div className="qjqiandao xiaoshou">*/} 正常签到
{/* 请假*/} </div>
{/*</div>*/} : item.attendance_status === "LEAVE" ?
<div className="qjqiandao xiaoshou">
请假
</div>
: item.attendance_status === "ABSENCE" ?
<div className="kkqiandao xiaoshou"> <div className="kkqiandao xiaoshou">
旷课 旷课
</div> </div>
:
""
:
""
}
</div> </div>
) )
@ -142,4 +156,5 @@ class Teacherentry extends Component{
) )
} }
} }
export default Teacherentry; export default Teacherentry;

@ -29,6 +29,48 @@ class Teaccomponent extends Component{
componentDidUpdate = (prevProps) => { componentDidUpdate = (prevProps) => {
}
//截止
thisEnd=(attendance_id)=>{
const url = `/weapps/attendances/${attendance_id}/end.json`;
var data={
}
axios.post(url, data)
.then((result) => {
if (result.data.status === 0) {
// this.props.showNotification(`组卷成功`);
// console.log(result.data.exam_id);
//本来调试卷库首页的
this.props.getsetdatas();
}
}).catch((error) => {
//console.log(error);
})
}
//删除
thisdelete=(attendance_id)=>{
const url = `/weapps/attendances/${attendance_id}.json`;
var data={
}
axios.delete(url, data)
.then((result) => {
if (result.data.status === 0) {
// this.props.showNotification(`组卷成功`);
// console.log(result.data.exam_id);
//本来调试卷库首页的
this.props.getsetdatas();
}
}).catch((error) => {
//console.log(error);
})
}
//学生签到
Signin=(type,)=>{
} }
@ -42,7 +84,16 @@ class Teaccomponent extends Component{
mydatas.length>0? mydatas.length>0?
mydatas.map((object, index) => { mydatas.map((object, index) => {
return ( return (
<Teacherentry item={object} key={index} index={index} defaultActiveKey={this.props.defaultActiveKey}{...this.props} {...this.state}></Teacherentry> <Teacherentry
thisdelete={(id)=>this.thisdelete(id)}
thisEnd={(id)=>this.thisEnd(id)}
item={object} key={index}
index={index}
defaultActiveKey={this.props.defaultActiveKey}
{...this.props}
{...this.state}
></Teacherentry>
) )
}) })
: :

@ -320,3 +320,7 @@
.mr20r{ .mr20r{
margin-right: 20px; margin-right: 20px;
} }
.color-reds{
color:rgba(245,108,108,1) !important;
}

@ -21,7 +21,10 @@ class Students_signin extends Component{
count:50, count:50,
defaultActiveKey:"1", defaultActiveKey:"1",
attendances_count:0, attendances_count:0,
datas:[] datas:[],
normal_count:0,
leave_count:0,
absence_count:0,
} }
} }
@ -80,7 +83,10 @@ class Students_signin extends Component{
if(response.data){ if(response.data){
this.setState({ this.setState({
attendances_count:response.data.attendances_count, attendances_count:response.data.attendances_count,
datas:response.data.attendances datas:response.data.attendances,
normal_count:response.data.normal_count,
leave_count:response.data.leave_count,
absence_count:response.data.absence_count,
}) })
} }
} }
@ -121,10 +127,19 @@ class Students_signin extends Component{
} }
getsetdatas=()=>{
let data={
key:this.state.defaultActiveKey,
page:this.state.page,
limit:5
}
this.gogetdatas(data);
}
render(){ render(){
let {page,per_page,count,defaultActiveKey,limit,attendances_count,datas} =this.state; let {page,per_page,count,defaultActiveKey,limit,attendances_count,datas,absence_count,leave_count,normal_count} =this.state;
const isAdmin =this.props.isAdmin(); const isAdmin =this.props.isAdmin();
return( return(
@ -154,7 +169,9 @@ class Students_signin extends Component{
<Tabs defaultActiveKey="1" onChange={this.callback}> <Tabs defaultActiveKey="1" onChange={this.callback}>
<TabPane tab="正在签到" key="1"> <TabPane tab="正在签到" key="1">
<p className="mt20 mysligtes">{attendances_count}个签到正在进行</p> <p className="mt20 mysligtes">{attendances_count}个签到正在进行</p>
<Teaccomponent datas={datas} defaultActiveKey={defaultActiveKey} {...this.state} {...this.props}></Teaccomponent> <Teaccomponent getsetdatas={()=>this.getsetdatas()} datas={datas} defaultActiveKey={defaultActiveKey} {...this.state} {...this.props}
></Teaccomponent>
@ -170,9 +187,9 @@ class Students_signin extends Component{
{ {
isAdmin===false? isAdmin===false?
<div className="ws50s xaxisreverseorder"> <div className="ws50s xaxisreverseorder">
<p className="kkp pr32 " style={{color:"#FF835C"}}>旷课2</p> <p className="kkp pr32 " style={{color:"#FF835C"}}>旷课{absence_count}</p>
<p className="kkp mr20r" style={{color:"#EAAE4E"}}>请假2</p> <p className="kkp mr20r" style={{color:"#EAAE4E"}}>请假{leave_count}</p>
<p className="kkp mr20r" style={{color:"#26C7C9"}}>正常签到10</p> <p className="kkp mr20r" style={{color:"#26C7C9"}}>正常签到{normal_count}</p>
</div> </div>
: :
@ -182,7 +199,7 @@ class Students_signin extends Component{
<Teaccomponent datas={datas} defaultActiveKey={defaultActiveKey} {...this.state} {...this.props}></Teaccomponent> <Teaccomponent getsetdatas={()=>this.getsetdatas()} datas={datas} defaultActiveKey={defaultActiveKey} {...this.state} {...this.props}></Teaccomponent>
<div className="mb30 clearfix educontent mt40 intermediatecenter"> <div className="mb30 clearfix educontent mt40 intermediatecenter">

Loading…
Cancel
Save