PCqiandao
杨树林 5 years ago
parent fe33db3d43
commit ff7e8ba5b4

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

@ -1,17 +1,15 @@
import React,{ Component } from "react";
import React, {Component} from "react";
import '../css/signincdi.css';
import { Progress } from 'antd';
import {Progress} from 'antd';
import axios from 'axios';
//条目
class Teacherentry extends Component{
class Teacherentry extends Component {
//条目组件
constructor(props){
constructor(props) {
super(props);
this.state={
}
this.state = {}
}
componentDidMount() {
@ -24,110 +22,126 @@ class Teacherentry extends Component{
}
render(){
let isAdmin =this.props.isAdmin();
let item= this.props.item;
render() {
let isAdmin = this.props.isAdmin();
let item = this.props.item;
let index =this.props.index;
let jdt;
try {
jdt=item.normal_count/item.all_count * 100;
}catch (e) {
jdt=100;
jdt = item.normal_count / item.all_count * 100;
} catch (e) {
jdt = 100;
}
console.log(jdt);
return(
return (
<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 ">
<p className="ws100s teachedivp ymaxnamewidthdivp">
{
item.name
}
<p className="ws100s teachedivp ymaxnamewidthdivp">
{
item.name
}
</p>
</p>
<div className="ws100s sortinxdirection mt17">
<div className="teachedivps">
签到人数
</div>
<div className="ws100s sortinxdirection mt17">
<div className="teachedivps">
签到人数
</div>
<div className="progressivps">
<Progress percent={jdt} showInfo={false} strokeColor="#1890ff" />
<Progress percent={jdt} showInfo={false} strokeColor="#1890ff"/>
</div>
<div className="progressivpss">
已签到{item.normal_count?item.normal_count:0} / 应签到 {item.all_count?item.all_count:0}
已签到{item.normal_count ? item.normal_count : 0} / 应签到 {item.all_count ? item.all_count : 0}
</div>
</div>
<div className="ws100s sortinxdirection mt5">
<div className="ws100s sortinxdirection mt5">
<div className="ws80s sortinxdirection">
<div className="teachedivps h40s">
签到发起人
</div>
<div className="teachedivpsy ymaxnamewidth60 h40s">
{item.author.user_name}
</div>
<div className="teachedivps h40s">
签到发起人
</div>
<div className="teachedivpsy ymaxnamewidth60 h40s">
{item.author.user_name}
</div>
<div className="teachedivps ml20 h40s">
签到方式
</div>
<div className="teachedivpsy ymaxnamewidth80 h40s">
{item.mode?
item.mode==="QRCODE"?
<div className="teachedivps ml20 h40s">
签到方式
</div>
<div className="teachedivpsy ymaxnamewidth80 h40s">
{item.mode ?
item.mode === "QRCODE" ?
"二维码签到"
:item.mode==="NUMBER"?
"数字签到"
:item.mode==="QUICK"?
"快捷签到"
:""
:""}
</div>
<div className="teachedivps ml20 h40s">
开始结束时间
</div>
<div className="teachedivpsy h40s">
{item.attendance_date} {item.start_time}-{item.end_time}
</div>
: item.mode === "NUMBER" ?
"数字签到"
: item.mode === "QUICK" ?
"快捷签到"
: ""
: ""}
</div>
<div className="teachedivps ml20 h40s">
开始结束时间
</div>
<div className="teachedivpsy h40s">
{item.attendance_date} {item.start_time}-{item.end_time}
</div>
</div>
<div className="ws20s sortinxdirection">
{
isAdmin===true?
this.props.defaultActiveKey==="1"?
<div className="ws100s xaxisreverseorder">
<div className="jiezhis h40s">截止</div>
<div className="shanchu h40s">删除</div>
</div>
:
isAdmin === true ?
this.props.defaultActiveKey === "1" ?
<div className="ws100s xaxisreverseorder">
<div className="jiezhis h40s">编辑</div>
<div className="shanchu h40s">删除</div>
<div className="jiezhis h40s xiaoshou" onClick={()=>this.props.thisEnd(item.id)}>截止</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 className="ws100s xaxisreverseorder">
<div className="jiezhis h40s color-reds xiaoshou" onClick={()=>this.props.thisdelete(item.id)}>删除</div>
</div>
:
(
this.props.defaultActiveKey==="1"?
this.props.defaultActiveKey === "1" ?
<div className="ws100s xaxisreverseorder">
<div className="qiandaobutton xiaoshou">
签到
</div>
<div className="qiandaobutton xiaoshou">
签到
</div>
</div>
:
<div className="ws100s xaxisreverseorder">
{/*<div className="zcqiandao xiaoshou">*/}
{/* 正常签到*/}
{/*</div>*/}
{
item.attendance_status?
item.attendance_status === "NORMAL" ?
<div className="zcqiandao xiaoshou">
正常签到
</div>
: item.attendance_status === "LEAVE" ?
<div className="qjqiandao xiaoshou">
请假
</div>
: item.attendance_status === "ABSENCE" ?
<div className="kkqiandao xiaoshou">
旷课
</div>
:
""
:
""
}
{/*<div className="qjqiandao xiaoshou">*/}
{/* 请假*/}
{/*</div>*/}
<div className="kkqiandao xiaoshou">
旷课
</div>
</div>
)
@ -142,4 +156,5 @@ class Teacherentry extends Component{
)
}
}
export default Teacherentry;

@ -29,6 +29,48 @@ class Teaccomponent extends Component{
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.map((object, index) => {
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{
margin-right: 20px;
}
.color-reds{
color:rgba(245,108,108,1) !important;
}

@ -21,7 +21,10 @@ class Students_signin extends Component{
count:50,
defaultActiveKey:"1",
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){
this.setState({
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(){
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();
return(
@ -154,7 +169,9 @@ class Students_signin extends Component{
<Tabs defaultActiveKey="1" onChange={this.callback}>
<TabPane tab="正在签到" key="1">
<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?
<div className="ws50s xaxisreverseorder">
<p className="kkp pr32 " style={{color:"#FF835C"}}>旷课2</p>
<p className="kkp mr20r" style={{color:"#EAAE4E"}}>请假2</p>
<p className="kkp mr20r" style={{color:"#26C7C9"}}>正常签到10</p>
<p className="kkp pr32 " style={{color:"#FF835C"}}>旷课{absence_count}</p>
<p className="kkp mr20r" style={{color:"#EAAE4E"}}>请假{leave_count}</p>
<p className="kkp mr20r" style={{color:"#26C7C9"}}>正常签到{normal_count}</p>
</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">

Loading…
Cancel
Save