From 499c26050a69691eb94a0c913784a0ff579cd6e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 16 Mar 2020 19:39:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/signin/css/signincdi.css | 9 + .../component/Videostatisticscomtwo.js | 195 +++++++++++++++++- 2 files changed, 198 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/courses/signin/css/signincdi.css b/public/react/src/modules/courses/signin/css/signincdi.css index 867dff40d..b712aa94d 100644 --- a/public/react/src/modules/courses/signin/css/signincdi.css +++ b/public/react/src/modules/courses/signin/css/signincdi.css @@ -394,6 +394,15 @@ white-space:nowrap; cursor: default; } +.maxnamewidth200s{ + text-align: center; + width: 200px; + max-width:200px; + overflow:hidden; + text-overflow:ellipsis; + white-space:nowrap; + cursor: default; +} .maxnamewidth100s{ width: 100px; max-width: 100px; diff --git a/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js b/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js index d6b9a4fcb..4432f36c5 100644 --- a/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js +++ b/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js @@ -1,7 +1,7 @@ import React, {Component} from "react"; import '../../signin/css/signincdi.css'; -import {Pagination,Table} from 'antd'; -import {getImageUrl} from 'educoder'; +import {Pagination,Table, Menu, Dropdown} from 'antd'; +import {getImageUrl,sortDirections} from 'educoder'; import axios from 'axios'; import LoadingSpin from "../../../../common/LoadingSpin"; import NoneDatas from "../../signin/component/NoneDatas"; @@ -60,6 +60,8 @@ class Videostatisticscom extends Component { align: "center", className: 'font-14 maxnamewidth150s', width: '150px', + sorter: true, + sortDirections: sortDirections, render: (text, record) => ( {record.total_duration} ), @@ -71,6 +73,8 @@ class Videostatisticscom extends Component { align: "center", className: 'font-14 maxnamewidth100s', width: '100px', + sorter: true, + sortDirections: sortDirections, render: (text, record) => ( {record.feq} ), @@ -101,10 +105,15 @@ class Videostatisticscom extends Component { loading:false, order:undefined, course_groups:[], + fbbool:false, + groupsid:null, } } componentDidMount() { + this.setState({ + order:undefined + }) if(this.props.isAdmin()){ //老师 const CourseId=this.props.match.params.coursesId; @@ -218,11 +227,170 @@ class Videostatisticscom extends Component { page: pageNumber, }) } + fenbanone=()=>{ + if(this.state.fbbool===false){ + this.setState({ + fbbool:true + }) + }else{ + this.setState({ + fbbool:false + }) + } + } + setcourse_groups=(id)=>{ + this.setState({ + groupsid:id + }) +//老师 + const CourseId=this.props.match.params.coursesId; + + var data={}; + if(id){ + data={ + id:CourseId, + page:this.state.page, + group_id:id + } + + }else { + data={ + id:CourseId, + page:this.state.page + } + } + this.getdatas(data); + } + + //实训作业tbale 列表塞选数据 + table1handleChange = (pagination, filters, sorter) => { + if (JSON.stringify(sorter) === "{}") { + //没有选择 + } else { + try { + //学生学号排序 + if (sorter.columnKey === "total_duration"||sorter.columnKey === "feq") { + let mysorder=""; + if (sorter.order === "ascend") { + if(sorter.columnKey === "total_duration"){ + mysorder="total_duration-asc"; + }else{ + mysorder="freq-asc"; + + } + //升序 + let data={} + if(this.props.isAdmin()){ + //老师 + const CourseId=this.props.match.params.coursesId; + if(groupsid){ + data={ + id:CourseId, + page:this.state.page, + order:mysorder, + } + }else{ + data={ + id:CourseId, + page:this.state.page, + group_id:this.state.groupsid, + order:mysorder, + } + } + }else{ + //学生 + data={ + page:this.state.page, + order:mysorder, + } + } + + this.getdatas(data); + this.setState({ + order: mysorder, + }) + } else if (sorter.order === "descend") { + if(sorter.columnKey === "total_duration"){ + mysorder="total_duration-desc"; + + }else{ + mysorder="freq-desc"; + + } + //降序 + let data={} + if(this.props.isAdmin()){ + //老师 + const CourseId=this.props.match.params.coursesId; + if(groupsid){ + data={ + id:CourseId, + page:this.state.page, + order:mysorder, + } + }else{ + data={ + id:CourseId, + page:this.state.page, + group_id:this.state.groupsid, + order:mysorder, + } + } + }else{ + //学生 + data={ + page:this.state.page, + order:mysorder, + } + } + + this.getdatas(data); + this.setState({ + order:mysorder, + }) + + + } + } + } catch (e) { + + } + + } + + } + + render() { - let {loading,data,page,limit,members_count,columnsstu}=this.state; + let {loading,data,page,limit,members_count,columnsstu,fbbool,course_groups}=this.state; const isAdmin =this.props.isAdmin(); + const menu = ( + + + this.setcourse_groups(null)}> +

全部

+
+
+ { + course_groups&&course_groups.length>0? + ( + course_groups.map((item,key) => { + return ( + + this.setcourse_groups(item.id)} key={key}> +

{item.name}

+
+
+ ) + }) + ) + : + "" + } +
+ ); return (
@@ -236,8 +404,18 @@ class Videostatisticscom extends Component {
this.props.tisticsbools(false,null)}> 视频统计总览
-
- 分班 +
this.fenbanone()}> + trigger.parentNode} overlay={menu} placement="bottomCenter" > + + 分班 + { + fbbool===true? + + : + + } + +
@@ -269,7 +447,12 @@ class Videostatisticscom extends Component { : - +
}