+
this.props.qiandaoxiangq(false)}>
-
-
返回
+
+
正在签到
diff --git a/public/react/src/modules/courses/videostatistics/Videostatistics.js b/public/react/src/modules/courses/videostatistics/Videostatistics.js
index 93c9f57e6..52d69b0fb 100644
--- a/public/react/src/modules/courses/videostatistics/Videostatistics.js
+++ b/public/react/src/modules/courses/videostatistics/Videostatistics.js
@@ -3,6 +3,7 @@ import axios from 'axios';
import '../signin/css/signincdi.css';
import Videostatisticscom from './component/Videostatisticscom';
import Videostatisticslist from './component/Videostatisticslist';
+import Videostatisticscomtwo from './component/Videostatisticscomtwo';
//在线学习
@@ -11,6 +12,8 @@ class Videostatistics extends Component{
super(props);
this.state={
watch_staticsdata:[],
+ tisticsbool:false,
+ tisid:null,
}
@@ -40,41 +43,49 @@ class Videostatistics extends Component{
});
}
-
+ tisticsbools=(bool,id)=>{
+ this.setState({
+ tisticsbool:bool,
+ tisid:id,
+ })
+ }
render(){
- let {watch_staticsdata}= this.state;
+ let {watch_staticsdata,tisticsbool,tisid}= this.state;
+
return(
-
-
-
this.props.statisticsy(false)}>
-
-
返回
-
-
-
-
-
-
+ {
+ tisticsbool===false?
+
+
+
this.props.statisticsy(false)}>
+
+
返回
+
-
- this.details()}>
+
+
+
+ this.tisticsbools(b,id)}>
+
+
+ :
+
this.tisticsbools(b,id)}>
+ }
-
-
)
diff --git a/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js b/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js
new file mode 100644
index 000000000..ab8d6c957
--- /dev/null
+++ b/public/react/src/modules/courses/videostatistics/component/Videostatisticscomtwo.js
@@ -0,0 +1,504 @@
+import React, {Component} from "react";
+import '../../signin/css/signincdi.css';
+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";
+
+
+//条目
+class Videostatisticscomtwo extends Component {
+ //条目组件
+ constructor(props) {
+ super(props);
+
+ this.state = {
+ data: [],
+ page: 1,
+ limit: 10,
+ members_count: 0,
+ columnsstu: [
+ {
+ title: '序号',
+ dataIndex: 'number',
+ key: 'number',
+ align: "center",
+ className: 'font-14',
+ width: '50px',
+ render: (text, record) => (
+
{record.number}
+ ),
+ },
+ {
+ title: '用户',
+ dataIndex: 'user_name',
+ key: 'user_name',
+ align: "center",
+ className: 'font-14 maxnamewidth100s',
+ width: '100px',
+ render: (text, record) => (
+
{record.user_name}
+ ),
+ },
+ {
+ title: '视频是否看完',
+ dataIndex: 'is_finished',
+ key: 'is_finished',
+ align: "center",
+ className: 'font-14',
+ width: '98px',
+ render: (text, record) => (
+
{record.is_finished === true ?
+ 是 : 否}
+ ),
+ },
+ {
+ title: '视频累计观看时长',
+ dataIndex: 'total_duration',
+ key: 'total_duration',
+ align: "center",
+ className: 'font-14 maxnamewidth150s',
+ width: '150px',
+ sorter: true,
+ sortDirections: sortDirections,
+ render: (text, record) => (
+
{record.total_duration}
+ ),
+ },
+ {
+ title: '累计观看次数(次)',
+ dataIndex: 'feq',
+ key: 'feq',
+ align: "center",
+ className: 'font-14 maxnamewidth100s',
+ width: '100px',
+ sorter: true,
+ sortDirections: sortDirections,
+ render: (text, record) => (
+
{record.feq}
+ ),
+ },
+ {
+ title: '最早观看时间',
+ dataIndex: 'start_at',
+ key: 'start_at',
+ align: "center",
+ className: 'font-14 maxnamewidth100s',
+ width: '100px',
+ render: (text, record) => (
+
{record.start_at}
+ ),
+ },
+ {
+ title: '最后观看时间',
+ dataIndex: 'end_at',
+ key: 'end_at',
+ align: "center",
+ className: 'font-14 maxnamewidth100s',
+ width: '100px',
+ render: (text, record) => (
+
{record.end_at}
+ ),
+ }
+ ],
+ 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;
+
+ var data = {
+ id: CourseId,
+ page: this.state.page,
+ }
+ this.getdatas(data);
+
+ } else {
+ //学生
+ var data = {
+ page: this.state.page,
+ }
+ this.getdatas(data);
+ }
+ this.fenbans();
+ }
+
+ componentDidUpdate = (prevProps) => {
+
+
+ }
+
+ //分班
+ fenbans = () => {
+ const CourseId = this.props.match.params.coursesId;
+ let url = `/courses/${CourseId}/course_groups.json`;
+ axios.get(url).then((response) => {
+ if (response) {
+ console.log("分班");
+ console.log("response");
+ console.log(response);
+ this.setState({
+ course_groups: response.data.course_groups,
+ current_group_id: response.data.current_group_id,
+ none_group_member_count: response.data.none_group_member_count,
+ group_count: response.data.group_count,
+ })
+ }
+
+ }).catch((error) => {
+
+ });
+ }
+
+ //学生
+ getdatas = (data) => {
+ this.setState({
+ loading: true
+ })
+ const CourseId = this.props.match.params.coursesId;
+ let url = "";
+ if (this.props.isAdmin()) {
+ url = `/course_videos/${this.props.tisid}/watch_histories.json`;
+ } else {
+ url = `/courses/${CourseId}/own_watch_histories.json`;
+ }
+ axios.get(url, {params: data}).then((response) => {
+ if (response) {
+ if (response.data) {
+ if (response.data.data.length > 0) {
+ let datalists = [];
+ for (var i = 0; i < response.data.data.length; i++) {
+ datalists.push({
+ number: (parseInt(page) - 1) * parseInt(limit) + (i + 1),
+ user_name: response.data.data[i].user_name,
+ is_finished: response.data.data[i].is_finished,
+ total_duration: response.data.data[i].total_duration,
+ feq: response.data.data[i].feq,
+ start_at: response.data.data[i].start_at,
+ end_at: response.data.data[i].end_at,
+ })
+ }
+
+ this.setState({
+ data: datalists,
+ members_count: response.data.count,
+ })
+ } else {
+ this.setState({
+ data: [],
+ members_count: response.data.count,
+ })
+ }
+ } else {
+ this.setState({
+ data: [],
+ members_count: response.data.count,
+ })
+ }
+
+
+ }
+ this.setState({
+ loading: false
+ })
+ }).catch((error) => {
+ this.setState({
+ loading: false
+ })
+ });
+ }
+
+
+ paginationonChange = (pageNumber) => {
+ this.setState({
+ page: pageNumber,
+ })
+ let data = {}
+ if (this.props.isAdmin()) {
+ //老师
+ const CourseId = this.props.match.params.coursesId;
+ data = {
+ id: CourseId,
+ page: pageNumber,
+ group_id: this.state.groupsid,
+ order: this.state.order,
+ }
+ } else {
+ //学生
+ data = {
+ page: pageNumber,
+ order: this.state.order,
+ }
+ }
+ this.getdatas(data);
+ }
+ 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, fbbool, course_groups} = this.state;
+ const isAdmin = this.props.isAdmin();
+
+ const menu = (
+
+ );
+ return (
+
+
+
+
+
视频名称视频名称…
+
+
this.props.tisticsbools(false, null)}>
+ 视频统计总览
+
+ {
+ isAdmin === true ?
+
this.fenbanone()}>
+ trigger.parentNode} overlay={menu}
+ placement="bottomCenter">
+
+ 分班
+ {
+ fbbool === true ?
+
+ :
+
+ }
+
+
+
+ :
+ ""
+ }
+
+
+
+
+
+
+ {
+ loading === true ?
+
+
+
+ :
+
+ {
+ data.length === 0 ?
+
+
+
+ :
+
+ }
+
+
+
+ }
+
+
+
+
+
+ {
+ data && data.length > 0 ?
+
+ : ""
+ }
+
+
+
+
+
+ )
+ }
+}
+
+export default Videostatisticscomtwo;
diff --git a/public/react/src/modules/courses/videostatistics/component/Videostatisticslist.js b/public/react/src/modules/courses/videostatistics/component/Videostatisticslist.js
index 692958517..a879e39da 100644
--- a/public/react/src/modules/courses/videostatistics/component/Videostatisticslist.js
+++ b/public/react/src/modules/courses/videostatistics/component/Videostatisticslist.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 {getImageUrl,sortDirections} from 'educoder';
import axios from 'axios';
import LoadingSpin from "../../../../common/LoadingSpin";
import NoneDatas from "../../signin/component/NoneDatas";
@@ -44,6 +44,8 @@ class Videostatisticslist extends Component {
align: "center",
className: 'font-14',
width: '98px',
+ sorter: true,
+ sortDirections: sortDirections,
render: (text, record) => (
{record.people_num}
),
@@ -55,6 +57,8 @@ class Videostatisticslist extends Component {
align: "center",
className: 'font-14 maxnamewidth150s',
width: '150px',
+ sorter: true,
+ sortDirections: sortDirections,
render: (text, record) => (
{record.total_time}
),
@@ -78,7 +82,7 @@ class Videostatisticslist extends Component {
className: 'font-14',
width: '90px',
render: (text, record) => (
-
this.props.details()}>详情
+
this.props.tisticsbools(true,record.id)}>详情
),
}
],
@@ -87,11 +91,16 @@ class Videostatisticslist extends Component {
page:1,
limit:10,
members_count:0,
+ order:undefined,
}
}
componentDidMount() {
- this.togetdatas(1);
+ let data={
+ page:1,
+ order:this.state.order
+ }
+ this.togetdatas(data);
}
@@ -103,27 +112,59 @@ class Videostatisticslist extends Component {
this.setState({
page: pageNumber,
})
- this.togetdatas(pageNumber);
+ let data={
+ page:pageNumber,
+ order:this.state.order
+ }
+ this.togetdatas(data);
}
- togetdatas(page){
+ togetdatas(data){
this.setState({
loading:true
})
const CourseId=this.props.match.params.coursesId;
let url=`/courses/${CourseId}/watch_video_histories.json`;
- axios.get(url,{params:{
- page:page
- }
+ axios.get(url,{params:data
}).then((response) => {
- if(response){
- this.setState({
- data:response.data&&response.data.videos?response.data.videos:[],
- members_count:count,
- })
+ if (response) {
+ if (response.data) {
+ if (response.data.videos.length > 0) {
+ let datalists = [];
+ for (var i = 0; i < response.data.videos.length; i++) {
+ datalists.push({
+ number: (parseInt(page) - 1) * parseInt(limit) + (i + 1),
+ title: response.data.videos[i].title,
+ people_num: response.data.videos[i].people_num,
+ total_time: response.data.videos[i].total_time,
+ user_name: response.data.videos[i].user_name,
+ id: response.data.videos[i].id,
+x })
+ }
+
+ this.setState({
+ data: datalists,
+ members_count: response.data.count,
+ })
+ } else {
+ this.setState({
+ data: [],
+ members_count: response.data.count,
+ })
+ }
+ } else {
+ this.setState({
+ data: [],
+ members_count: response.data.count,
+ })
+ }
+
}
+
+
+
this.setState({
loading:false
})
@@ -135,6 +176,57 @@ class Videostatisticslist extends Component {
}
+ //实训作业tbale 列表塞选数据
+ table1handleChange = (pagination, filters, sorter) => {
+ if (JSON.stringify(sorter) === "{}") {
+ //没有选择
+ } else {
+ try {
+ //学生学号排序
+ if (sorter.columnKey === "people_num"||sorter.columnKey === "total_time") {
+ let mysorder="";
+ if (sorter.order === "ascend") {
+ if(sorter.columnKey === "people_num"){
+ mysorder="people_num-asc";
+ }else{
+ mysorder="total_time-asc";
+
+ }
+ //升序
+ let data={
+ page:this.state.page,
+ order:mysorder
+ }
+ this.togetdatas(data);
+ this.setState({
+ order: mysorder,
+ })
+ } else if (sorter.order === "descend") {
+ if(sorter.columnKey === "people_num"){
+ mysorder="people_num-desc";
+ }else{
+ mysorder="total_time-desc";
+
+ }
+ //降序
+ let data={
+ page:this.state.page,
+ order:mysorder
+ }
+ this.togetdatas(data);
+ this.setState({
+ order: mysorder,
+ })
+ }
+ }
+ } catch (e) {
+
+ }
+
+ }
+
+ }
+
render() {
@@ -175,7 +267,13 @@ class Videostatisticslist extends Component {