Merge branches 'dev_aliyun' and 'newopenshixun0316' of https://bdgit.educoder.net/Hjqreturn/educoder into newopenshixun0316

courseware
杨树明 5 years ago
commit 309b9f2a4b

@ -1548,7 +1548,8 @@ class CoursesController < ApplicationController
render json: { render json: {
total_duration: @total_duration, total_duration: @total_duration,
freq: @frequencies, freq: @frequencies,
people_num: @people_num people_num: @people_num,
begin_at: '2020-03-13 24:00'
} }
end end

@ -36,7 +36,7 @@ class Videostatisticscom extends Component {
<div className="ws100s teacherentrydivs "> <div className="ws100s teacherentrydivs ">
<div className="ws100s sortinxdirection"> <div className="ws100s sortinxdirection">
<div className="ws50s sptits">视频统计总览</div> <div className="ws50s sptits">视频统计总览</div>
<div className="ws50s sptitss xaxisreverseorder">播放数据从2020-03-13 24:00开始统计</div> <div className="ws50s sptitss xaxisreverseorder">播放数据从{this.props.watch_staticsdata&&this.props.watch_staticsdata.begin_at?this.props.watch_staticsdata.begin_at:0}开始统计</div>
</div> </div>
<style> <style>
{ {

@ -7,9 +7,8 @@ import LoadingSpin from "../../../../common/LoadingSpin";
import NoneDatas from "../../signin/component/NoneDatas"; import NoneDatas from "../../signin/component/NoneDatas";
//条目 //条目
class Videostatisticscom extends Component { class Videostatisticscomtwo extends Component {
//条目组件 //条目组件
constructor(props) { constructor(props) {
super(props); super(props);
@ -181,7 +180,7 @@ class Videostatisticscom extends Component {
let datalists = []; let datalists = [];
for (var i = 0; i < response.data.data.length; i++) { for (var i = 0; i < response.data.data.length; i++) {
datalists.push({ datalists.push({
number: (parseInt(page) - 1) * parseInt(limit) + (i + 1), number: (parseInt(this.state.page) - 1) * parseInt(this.state.limit) + (i + 1),
user_name: response.data.data[i].user_name, user_name: response.data.data[i].user_name,
is_finished: response.data.data[i].is_finished, is_finished: response.data.data[i].is_finished,
total_duration: response.data.data[i].total_duration, total_duration: response.data.data[i].total_duration,
@ -209,7 +208,6 @@ class Videostatisticscom extends Component {
} }
} }
this.setState({ this.setState({
loading: false loading: false
@ -222,11 +220,28 @@ class Videostatisticscom extends Component {
} }
paginationonChange = (pageNumber) => { paginationonChange = (pageNumber) => {
this.setState({ this.setState({
page: pageNumber, 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 = () => { fenbanone = () => {
if (this.state.fbbool === false) { if (this.state.fbbool === false) {
@ -362,7 +377,6 @@ class Videostatisticscom extends Component {
} }
render() { render() {
let {loading, data, page, limit, members_count, columnsstu, fbbool, course_groups} = this.state; let {loading, data, page, limit, members_count, columnsstu, fbbool, course_groups} = this.state;
const isAdmin = this.props.isAdmin(); const isAdmin = this.props.isAdmin();
@ -405,8 +419,11 @@ class Videostatisticscom extends Component {
<div className="xiaoshou" onClick={() => this.props.tisticsbools(false, null)}> <div className="xiaoshou" onClick={() => this.props.tisticsbools(false, null)}>
<span className="mr5 xiaoshou">视频统计总览</span><i className="iconfont icon-fanhui font-13 xiaoshou"></i> <span className="mr5 xiaoshou">视频统计总览</span><i className="iconfont icon-fanhui font-13 xiaoshou"></i>
</div> </div>
{
isAdmin === true ?
<div className="xiaoshou" onClick={() => this.fenbanone()}> <div className="xiaoshou" onClick={() => this.fenbanone()}>
<Dropdown getPopupContainer={trigger => trigger.parentNode} overlay={menu} placement="bottomCenter" > <Dropdown getPopupContainer={trigger => trigger.parentNode} overlay={menu}
placement="bottomCenter">
<span> <span>
<span className="mr5 xiaoshou">分班</span> <span className="mr5 xiaoshou">分班</span>
{ {
@ -418,6 +435,10 @@ class Videostatisticscom extends Component {
</span> </span>
</Dropdown> </Dropdown>
</div> </div>
:
""
}
</div> </div>
</div> </div>
@ -480,4 +501,4 @@ class Videostatisticscom extends Component {
} }
} }
export default Videostatisticscom; export default Videostatisticscomtwo;

@ -1,7 +1,7 @@
import React, {Component} from "react"; import React, {Component} from "react";
import '../../signin/css/signincdi.css'; import '../../signin/css/signincdi.css';
import {Pagination,Table} from 'antd'; import {Pagination,Table} from 'antd';
import {getImageUrl} from 'educoder'; import {getImageUrl,sortDirections} from 'educoder';
import axios from 'axios'; import axios from 'axios';
import LoadingSpin from "../../../../common/LoadingSpin"; import LoadingSpin from "../../../../common/LoadingSpin";
import NoneDatas from "../../signin/component/NoneDatas"; import NoneDatas from "../../signin/component/NoneDatas";
@ -44,6 +44,8 @@ class Videostatisticslist extends Component {
align: "center", align: "center",
className: 'font-14', className: 'font-14',
width: '98px', width: '98px',
sorter: true,
sortDirections: sortDirections,
render: (text, record) => ( render: (text, record) => (
<span style={{width: '98px'}}>{record.people_num}</span> <span style={{width: '98px'}}>{record.people_num}</span>
), ),
@ -55,6 +57,8 @@ class Videostatisticslist extends Component {
align: "center", align: "center",
className: 'font-14 maxnamewidth150s', className: 'font-14 maxnamewidth150s',
width: '150px', width: '150px',
sorter: true,
sortDirections: sortDirections,
render: (text, record) => ( render: (text, record) => (
<span style={{width: '150px'}} className="maxnamewidth150s">{record.total_time}</span> <span style={{width: '150px'}} className="maxnamewidth150s">{record.total_time}</span>
), ),
@ -87,11 +91,16 @@ class Videostatisticslist extends Component {
page:1, page:1,
limit:10, limit:10,
members_count:0, members_count:0,
order:undefined,
} }
} }
componentDidMount() { 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({ this.setState({
page: pageNumber, page: pageNumber,
}) })
this.togetdatas(pageNumber); let data={
page:pageNumber,
order:this.state.order
}
this.togetdatas(data);
} }
togetdatas(page){ togetdatas(data){
this.setState({ this.setState({
loading:true loading:true
}) })
const CourseId=this.props.match.params.coursesId; const CourseId=this.props.match.params.coursesId;
let url=`/courses/${CourseId}/watch_video_histories.json`; let url=`/courses/${CourseId}/watch_video_histories.json`;
axios.get(url,{params:{ axios.get(url,{params:data
page:page
}
}).then((response) => { }).then((response) => {
if (response) { 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(this.state.spage) - 1) * parseInt(this.state.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,
})
}
this.setState({ this.setState({
data:response.data&&response.data.videos?response.data.videos:[], data: datalists,
members_count: response.data.count, 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({ this.setState({
loading:false 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() { render() {
@ -175,7 +267,13 @@ class Videostatisticslist extends Component {
<NoneDatas></NoneDatas> <NoneDatas></NoneDatas>
</div> </div>
: :
<Table columns={columnsstu} dataSource={data} pagination={false}/> <Table
columns={columnsstu}
dataSource={data}
pagination={false}
onChange={this.table1handleChange}
/>
} }

Loading…
Cancel
Save