From ff7e8ba5b46d0b438762461853b9521ed248e913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 13 Mar 2020 14:30:07 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AD=BE=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 2 +- .../courses/signin/component/Teacherentry.js | 169 ++++++++++-------- .../teachercomponent/Teaccomponent.js | 53 +++++- .../modules/courses/signin/css/signincdi.css | 4 + .../courses/signin/teacher/Teachers_signin.js | 33 +++- 5 files changed, 174 insertions(+), 87 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index f5510a039..7a35aa116 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -46,7 +46,7 @@ if (isDev) { // 老师 // debugType="teacher"; // 学生 -// debugType="student"; +debugType="student"; diff --git a/public/react/src/modules/courses/signin/component/Teacherentry.js b/public/react/src/modules/courses/signin/component/Teacherentry.js index abd38e2dd..074845bc0 100644 --- a/public/react/src/modules/courses/signin/component/Teacherentry.js +++ b/public/react/src/modules/courses/signin/component/Teacherentry.js @@ -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 ( -
+
-

- { - item.name - } +

+ { + item.name + } -

+

-
-
- 签到人数: -
+
+
+ 签到人数: +
- +
- 已签到{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}
-
+
-
- 签到发起人: -
-
- {item.author.user_name} -
+
+ 签到发起人: +
+
+ {item.author.user_name} +
-
- 签到方式: -
-
- {item.mode? - item.mode==="QRCODE"? +
+ 签到方式: +
+
+ {item.mode ? + item.mode === "QRCODE" ? "二维码签到" - :item.mode==="NUMBER"? - "数字签到" - :item.mode==="QUICK"? - "快捷签到" - :"" - :""} -
- -
- 开始结束时间: -
-
- {item.attendance_date} {item.start_time}-{item.end_time} -
+ : item.mode === "NUMBER" ? + "数字签到" + : item.mode === "QUICK" ? + "快捷签到" + : "" + : ""} +
+ +
+ 开始结束时间: +
+
+ {item.attendance_date} {item.start_time}-{item.end_time} +
{ - isAdmin===true? - this.props.defaultActiveKey==="1"? -
-
截止
-
删除
-
- : + isAdmin === true ? + this.props.defaultActiveKey === "1" ?
-
编辑
-
删除
+
this.props.thisEnd(item.id)}>截止
+
this.props.thisdelete(item.id)}>删除
+ : + item.edit_auth === true ? +
+
编辑
+
this.props.thisdelete(item.id)}>删除
+
+ : +
+
this.props.thisdelete(item.id)}>删除
+
: ( - this.props.defaultActiveKey==="1"? + this.props.defaultActiveKey === "1" ?
-
- 签到 -
+
+ 签到 +
:
- {/*
*/} - {/* 正常签到*/} - {/*
*/} + { + item.attendance_status? + item.attendance_status === "NORMAL" ? +
+ 正常签到 +
+ : item.attendance_status === "LEAVE" ? +
+ 请假 +
+ : item.attendance_status === "ABSENCE" ? +
+ 旷课 +
+ : + "" + : + "" + } + + - {/*
*/} - {/* 请假*/} - {/*
*/} -
- 旷课 -
) @@ -142,4 +156,5 @@ class Teacherentry extends Component{ ) } } + export default Teacherentry; 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 08da61696..26a871416 100644 --- a/public/react/src/modules/courses/signin/component/teachercomponent/Teaccomponent.js +++ b/public/react/src/modules/courses/signin/component/teachercomponent/Teaccomponent.js @@ -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 ( - + this.thisdelete(id)} + thisEnd={(id)=>this.thisEnd(id)} + item={object} key={index} + index={index} + defaultActiveKey={this.props.defaultActiveKey} + {...this.props} + {...this.state} + > + ) }) : diff --git a/public/react/src/modules/courses/signin/css/signincdi.css b/public/react/src/modules/courses/signin/css/signincdi.css index b78bc0554..e6f4ccf21 100644 --- a/public/react/src/modules/courses/signin/css/signincdi.css +++ b/public/react/src/modules/courses/signin/css/signincdi.css @@ -320,3 +320,7 @@ .mr20r{ margin-right: 20px; } + +.color-reds{ + color:rgba(245,108,108,1) !important; +} 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 958fb331b..18f327485 100644 --- a/public/react/src/modules/courses/signin/teacher/Teachers_signin.js +++ b/public/react/src/modules/courses/signin/teacher/Teachers_signin.js @@ -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{

共{attendances_count}个签到正在进行

- + this.getsetdatas()} datas={datas} defaultActiveKey={defaultActiveKey} {...this.state} {...this.props} + + > @@ -170,9 +187,9 @@ class Students_signin extends Component{ { isAdmin===false?
-

旷课:2

-

请假:2

-

正常签到:10

+

旷课:{absence_count}

+

请假:{leave_count}

+

正常签到:{normal_count}

: @@ -182,7 +199,7 @@ class Students_signin extends Component{ - + this.getsetdatas()} datas={datas} defaultActiveKey={defaultActiveKey} {...this.state} {...this.props}>