You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
163 lines
3.1 KiB
163 lines
3.1 KiB
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{
|
|
//教师正在签到
|
|
constructor(props){
|
|
super(props);
|
|
|
|
this.state={
|
|
mydatas:[]
|
|
}
|
|
}
|
|
|
|
componentDidMount() {
|
|
this.setState({
|
|
mydatas:this.props.datas
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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) {
|
|
// try {
|
|
// this.props.showNotification(`截止成功`);
|
|
// }catch (e) {
|
|
//
|
|
// }
|
|
this.props.getsetdatas();
|
|
}else{
|
|
this.props.showNotification(result.data.message);
|
|
|
|
}
|
|
}).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) {
|
|
// try {
|
|
// this.props.showNotification(`删除成功`);
|
|
// }catch (e) {
|
|
//
|
|
// }
|
|
|
|
this.props.getsetdatas();
|
|
}else{
|
|
this.props.showNotification(result.data.message);
|
|
|
|
}
|
|
}).catch((error) => {
|
|
//console.log(error);
|
|
})
|
|
}
|
|
|
|
//学生签到
|
|
Signin=(attendance_mode,attendance_id,code)=>{
|
|
const url = `/weapps/course_member_attendances.json`;
|
|
var data={
|
|
|
|
}
|
|
if(attendance_mode==="QUICK"){
|
|
//快捷签到
|
|
data={
|
|
attendance_mode:"QUICK",
|
|
attendance_id:attendance_id,
|
|
}
|
|
axios.post(url, data)
|
|
.then((result) => {
|
|
if (result.data.status === 0) {
|
|
try {
|
|
this.props.showNotification(`签到成功`);
|
|
}catch (e) {
|
|
|
|
}
|
|
|
|
this.props.getsetdatas();
|
|
}else{
|
|
this.props.showNotification(result.data.message);
|
|
|
|
}
|
|
}).catch((error) => {
|
|
})
|
|
}else if(attendance_mode==="QRCODE"){
|
|
//二维码签到
|
|
data={
|
|
attendance_mode:"QRCODE",
|
|
attendance_id:attendance_id,
|
|
code:code,
|
|
}
|
|
this.props.GotomQrcodesodesy(data,true)
|
|
}else if(attendance_mode==="NUMBER"){
|
|
//数字签到
|
|
data={
|
|
attendance_mode:"NUMBER",
|
|
attendance_id:attendance_id,
|
|
code:code,
|
|
}
|
|
this.props.Gotomodes(data,true)
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
render(){
|
|
let mydatas=this.props.datas?this.props.datas:[];
|
|
return(
|
|
<React.Fragment>
|
|
<div className="ws100s mt20 h500">
|
|
{
|
|
mydatas.length>0?
|
|
mydatas.map((object, index) => {
|
|
return (
|
|
<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>
|
|
|
|
)
|
|
})
|
|
:
|
|
<NoneDatas></NoneDatas>
|
|
}
|
|
</div>
|
|
</React.Fragment>
|
|
)
|
|
}
|
|
}
|
|
export default Teaccomponent;
|