Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

courseware
cxt 5 years ago
commit c5ec70229a

@ -1515,7 +1515,7 @@ class CoursesController < ApplicationController
# 学生角度观看课堂视频的记录 # 学生角度观看课堂视频的记录
def own_watch_histories def own_watch_histories
@current_user = current_user @current_user = current_user
@videos = CourseVideo.joins(" @videos = CourseVideo.joins("
JOIN videos ON course_videos.course_id = #{@course.id} AND videos.id = course_videos.video_id JOIN videos ON course_videos.course_id = #{@course.id} AND videos.id = course_videos.video_id
JOIN watch_course_videos ON course_videos.id = watch_course_videos.course_video_id AND watch_course_videos.user_id = #{current_user.id} JOIN watch_course_videos ON course_videos.id = watch_course_videos.course_video_id AND watch_course_videos.user_id = #{current_user.id}
@ -1549,7 +1549,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

@ -4,7 +4,7 @@ class StudentJoinAttendanceRecordJob < ApplicationJob
def perform(member_id) def perform(member_id)
member = CourseMember.find_by(id: member_id) member = CourseMember.find_by(id: member_id)
course = member&.course course = member&.course
return if member.blank? || course.blank? return if member.blank? || member.role != "STUDENT" || course.blank?
current_date = Date.current current_date = Date.current
current_end_time = Time.current.strftime("%H:%M:%S") current_end_time = Time.current.strftime("%H:%M:%S")

@ -165,7 +165,9 @@ class CourseMember < ApplicationRecord
private private
def create_attendance_record def create_attendance_record
StudentJoinAttendanceRecordJob.perform_later(id) if role == "STUDENT"
StudentJoinAttendanceRecordJob.perform_later(id)
end
end end
end end

@ -970,6 +970,13 @@ class CoursesIndex extends Component{
} }
></Route> ></Route>
{/* 主签到 */}
<Route path="/classrooms/:coursesId/attendances"
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />)
}
></Route>
{/*/!*实训作业and课堂详情页*!/*/} {/*/!*实训作业and课堂详情页*!/*/}
<Route path="/classrooms/:coursesId" <Route path="/classrooms/:coursesId"
render={ render={

@ -177,6 +177,9 @@ export default ({ src, videoId, logWatchHistory, courseId = null }) => {
el.current.removeEventListener('seeking', onSeeking) el.current.removeEventListener('seeking', onSeeking)
el.current.removeEventListener('seeked', onSeeked) el.current.removeEventListener('seeked', onSeeked)
el.current.removeEventListener('timeupdate', onTimeupdate) el.current.removeEventListener('timeupdate', onTimeupdate)
if(el.current.playing) {
log()
}
} }
}, [el, src]) }, [el, src])

@ -89,7 +89,6 @@ class CoursesBanner extends Component {
} }
HideAddcoursestypess=(i)=>{ HideAddcoursestypess=(i)=>{
console.log("调用了");
this.setState({ this.setState({
Addcoursestypes:false, Addcoursestypes:false,
mydisplay:true, mydisplay:true,

@ -933,7 +933,7 @@ class CoursesNew extends Component {
> >
{getFieldDecorator("checkboxgroup", { {getFieldDecorator("checkboxgroup", {
initialValue: [ initialValue: [
"shixun_homework", "common_homework", "group_homework", "exercise", "attachment", "course_group","video" "shixun_homework", "common_homework", "group_homework", "exercise", "attachment", "course_group","video","attendance"
], ],
})( })(
<Checkbox.Group style={{ marginTop: "10px"}}> <Checkbox.Group style={{ marginTop: "10px"}}>
@ -949,6 +949,7 @@ class CoursesNew extends Component {
<Checkbox value={"board"} className="fl">讨论</Checkbox> <Checkbox value={"board"} className="fl">讨论</Checkbox>
<Checkbox value={"course_group"} className="fl">分班</Checkbox> <Checkbox value={"course_group"} className="fl">分班</Checkbox>
<Checkbox value={"statistics"} className="fl">统计</Checkbox> <Checkbox value={"statistics"} className="fl">统计</Checkbox>
<Checkbox value={"attendance"} className="fl">签到</Checkbox>
</Checkbox.Group> </Checkbox.Group>
)} )}
</Form.Item> </Form.Item>

@ -989,7 +989,7 @@ class Goldsubject extends Component {
{getFieldDecorator("checkboxgroup", { {getFieldDecorator("checkboxgroup", {
initialValue: [ initialValue: [
"announcement","online_learning","shixun_homework","common_homework", "announcement","online_learning","shixun_homework","common_homework","attendance"
], ],
})( })(
<Checkbox.Group style={{ marginTop: "10px"}}> <Checkbox.Group style={{ marginTop: "10px"}}>
@ -1003,6 +1003,7 @@ class Goldsubject extends Component {
<Checkbox value={"board"} className="fl">讨论</Checkbox> <Checkbox value={"board"} className="fl">讨论</Checkbox>
<Checkbox value={"course_group"} className="fl">分班</Checkbox> <Checkbox value={"course_group"} className="fl">分班</Checkbox>
<Checkbox value={"statistics"} className="fl">统计</Checkbox> <Checkbox value={"statistics"} className="fl">统计</Checkbox>
<Checkbox value={"attendance"} className="fl">签到</Checkbox>
</Checkbox.Group> </Checkbox.Group>
)} )}
</Form.Item> </Form.Item>

@ -109,11 +109,12 @@ class Signinstatistics extends Component {
const cols = { const cols = {
month: { month: {
type: 'linear', type: 'pow',
nice:[1,10], // nice: true,
min:1, exponent:1,
minLimit:1, // minLimit:1,
minTickInterval:2 // tickInterval:1,
// minTickInterval:2
}, },
temperature:{ temperature:{
type: 'linear', type: 'linear',

@ -77,7 +77,7 @@ class Detailss extends Component {
<Progress percent={jdt} showInfo={false} strokeColor="#1890ff"/> <Progress percent={jdt} showInfo={false} strokeColor="#1890ff"/>
</div> </div>
<div className="progressivpss h28s"> <div className="progressivpss h28s">
已签到{item && item.normal_count ? item.normal_count : 0} / 已签到 {item && item.normal_count ? item.normal_count : 0} /
应签到 {item && item.all_count ? item.all_count : 0} 应签到 {item && item.all_count ? item.all_count : 0}
</div> </div>
</div> </div>

@ -34,9 +34,9 @@ class Teacherentry extends Component {
} }
return ( return (
<React.Fragment> <React.Fragment>
<div className={index===0?"ws100s edu-back-white ": "ws100s edu-back-white mt20"}> <div className={index===0?"ws100s edu-back-white xiaoshou": "ws100s edu-back-white mt20 xiaoshou"}>
<div className="ws100s teacherentrydiv "> <div className="ws100s teacherentrydiv" onClick={isAdmin?(e)=>{e.stopPropagation();this.props.qiandaoxiangq(true,item.id)}:""}>
<p className={isAdmin?"ws100s teachedivp ymaxnamewidthdivp xiaoshou":"ws100s teachedivp ymaxnamewidthdivp"} onClick={isAdmin?()=>this.props.qiandaoxiangq(true,item.id):""}> <p className={isAdmin?"ws100s teachedivp ymaxnamewidthdivp xiaoshou color-blue":"ws100s teachedivp ymaxnamewidthdivp"} >
{ {
item.name item.name
} }
@ -51,7 +51,7 @@ class Teacherentry extends Component {
<Progress percent={jdt} showInfo={false} strokeColor="#1890ff"/> <Progress percent={jdt} showInfo={false} strokeColor="#1890ff"/>
</div> </div>
<div className="progressivpss"> <div className="progressivpss">
已签到{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}
</div> </div>
</div> </div>
@ -95,18 +95,18 @@ class Teacherentry extends Component {
isAdmin === true ? isAdmin === true ?
this.props.defaultActiveKey === "1" ? this.props.defaultActiveKey === "1" ?
<div className="ws100s xaxisreverseorder"> <div className="ws100s xaxisreverseorder">
<div className="jiezhis h40s xiaoshou" onClick={()=>this.props.thisEnd(item.id)}>截止</div> <div className="jiezhis h40s xiaoshou" onClick={(e)=>{e.stopPropagation();this.props.thisEnd(item.id)}}>截止</div>
<div className="shanchu h40s xiaoshou" onClick={()=>this.props.thisdelete(item.id)}>删除</div> <div className="shanchu h40s xiaoshou" onClick={(e)=>{e.stopPropagation();this.props.thisdelete(item.id)}}>删除</div>
</div> </div>
: :
item.edit_auth === true ? item.edit_auth === true ?
<div className="ws100s xaxisreverseorder"> <div className="ws100s xaxisreverseorder">
<div className="jiezhis h40s xiaoshou" onClick={()=>this.props.Signinnamestypes(item.id,true,item.name)}>编辑</div> <div className="jiezhis h40s xiaoshou" onClick={(e)=>{e.stopPropagation();this.props.Signinnamestypes(item.id,true,item.name)}}>编辑</div>
<div className="shanchu h40s xiaoshou" onClick={()=>this.props.thisdelete(item.id)}>删除</div> <div className="shanchu h40s xiaoshou" onClick={(e)=>{e.stopPropagation();this.props.thisdelete(item.id)}}>删除</div>
</div> </div>
: :
<div className="ws100s xaxisreverseorder"> <div className="ws100s xaxisreverseorder">
<div className="jiezhis h40s color-reds xiaoshou" onClick={()=>this.props.thisdelete(item.id)}>删除</div> <div className="jiezhis h40s color-reds xiaoshou" onClick={(e)=>{e.stopPropagation();this.props.thisdelete(item.id)}}>删除</div>
</div> </div>
: :
( (
@ -116,7 +116,7 @@ class Teacherentry extends Component {
item.attendance_status? item.attendance_status?
( (
item.attendance_status==="ABSENCE"? item.attendance_status==="ABSENCE"?
<div className="qiandaobutton xiaoshou" onClick={()=>this.props.Signin(item.mode,item.id,item.attendance_code)}> <div className="qiandaobutton xiaoshou" onClick={(e)=>{e.stopPropagation();this.props.Signin(item.mode,item.id,item.attendance_code)}}>
签到 签到
</div> </div>
: :

@ -210,4 +210,24 @@
height: auto !important; height: auto !important;
padding: 0px !important; padding: 0px !important;
white-space: nowrap !important; white-space: nowrap !important;
} }
.color26C7C9 .ant-select-selection-selected-value{
margin: 0 30% !important;
}
.colorEAAE4E .ant-select-selection-selected-value{
margin: 0 40% !important;
}
.color909399 .ant-select-selection-selected-value{
margin: 0 37% !important;
}
.colorFF835C .ant-select-selection-selected-value{
margin: 0 37% !important;
}
/*.allSignedinlistbox .ant-select-selection-selected-value{*/
/* margin: 0 30% !important;*/
/*}*/

@ -358,6 +358,11 @@
} }
.colorbluesigin{
font-size:16px;
font-weight:bold;
color:rgba(51,51,51,1);
}
.sptits{ .sptits{
font-size:20px; font-size:20px;
font-family:MicrosoftYaHeiSemibold; font-family:MicrosoftYaHeiSemibold;
@ -394,6 +399,15 @@
white-space:nowrap; white-space:nowrap;
cursor: default; cursor: default;
} }
.maxnamewidth200s{
text-align: center;
width: 200px;
max-width:200px;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
cursor: default;
}
.maxnamewidth100s{ .maxnamewidth100s{
width: 100px; width: 100px;
max-width: 100px; max-width: 100px;

@ -260,9 +260,10 @@ class Signedinlist extends Component {
className: "textcenter", className: "textcenter",
render: (text, record) => ( render: (text, record) => (
<span> <span>
<Select key={record.index} defaultValue={record.attendance_status} <Select key={record.index} defaultValue={record.attendance_status}
// className={"Signedinlistbox"} // className={"Signedinlistbox"}
className={record.attendance_status==="NORMAL"?"color26C7C9 Signedinlistbox sginboxcolor26C7C9":record.attendance_status==="LEAVE"?"colorEAAE4E Signedinlistbox sginboxcolorEAAE4E":record.attendance_status==="ABSENCE"?this.props.defaultActiveKey==="2"?"colorFF835C Signedinlistbox sginboxcolorFF835C":"color909399 Signedinlistbox sginboxcolor909399":"Signedinlistbox"} className={record.attendance_status==="NORMAL"?"color26C7C9 Signedinlistbox sginboxcolor26C7C9 marginleft10":record.attendance_status==="LEAVE"?"colorEAAE4E Signedinlistbox sginboxcolorEAAE4E marginleft10":record.attendance_status==="ABSENCE"?this.props.defaultActiveKey==="2"?"colorFF835C Signedinlistbox sginboxcolorFF835C marginleft10":"color909399 Signedinlistbox sginboxcolor909399 marginleft10":"Signedinlistbox"}
style={{ width: 167 }} onChange={(e)=>this.handleChange(e,record.user_id)}> style={{ width: 167 }} onChange={(e)=>this.handleChange(e,record.user_id)}>
{ {
@ -339,6 +340,15 @@ class Signedinlist extends Component {
</Col> </Col>
</Row> </Row>
<style>
{
`
.marginleft10{
margin-left: 10px !important;
}
`
}
</style>
<div className={"backfff mt10"}> <div className={"backfff mt10"}>
{ {
this.state.loading===true? this.state.loading===true?

@ -43,13 +43,10 @@ class Signindetails extends Component{
<div className="ws100s" style={{ <div className="ws100s" style={{
position: "relative", position: "relative",
}}> }}>
<div className="ws100s xaxisreverseorder" style={{ <div className="ws100s mb20">
position: "absolute", <p className="sortinxdirection" >
top: "-29px", <i className="iconfont icon-zuojiantou posiivsiconmyss mr5 colorbluesigin xiaoshou" onClick={()=>this.props.qiandaoxiangq(false)}></i>
}}> <p className="fh mr20 colorbluesigin xiaoshou" onClick={()=>this.props.qiandaoxiangq(false)}>正在签到</p>
<p className="sortinxdirection xiaoshou" onClick={()=>this.props.qiandaoxiangq(false)}>
<i className="iconfont icon-zuojiantou posiivsiconmyss mr5"></i>
<p className="fh mr20"> 返回</p>
</p> </p>
</div> </div>

@ -12,8 +12,8 @@ class Videostatistics extends Component{
super(props); super(props);
this.state={ this.state={
watch_staticsdata:[], watch_staticsdata:[],
tisticsbool:true, tisticsbool:false,
tisid:0, tisid:null,
} }

@ -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>
{ {

@ -1,24 +1,23 @@
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, Menu, Dropdown} 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";
//条目 //条目
class Videostatisticscom extends Component { class Videostatisticscomtwo extends Component {
//条目组件 //条目组件
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
data:[], data: [],
page:1, page: 1,
limit:10, limit: 10,
members_count:0, members_count: 0,
columnsstu: [ columnsstu: [
{ {
title: '序号', title: '序号',
@ -50,7 +49,8 @@ class Videostatisticscom extends Component {
className: 'font-14', className: 'font-14',
width: '98px', width: '98px',
render: (text, record) => ( render: (text, record) => (
<span style={{width: '98px'}}>{record.is_finished}</span> <span style={{width: '98px'}}>{record.is_finished === true ?
<span style={{color: "#5091FF"}}></span> : <span style={{color: "#E02020"}}></span>}</span>
), ),
}, },
{ {
@ -60,6 +60,8 @@ class Videostatisticscom 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_duration}</span> <span style={{width: '150px'}} className="maxnamewidth150s">{record.total_duration}</span>
), ),
@ -71,6 +73,8 @@ class Videostatisticscom extends Component {
align: "center", align: "center",
className: 'font-14 maxnamewidth100s', className: 'font-14 maxnamewidth100s',
width: '100px', width: '100px',
sorter: true,
sortDirections: sortDirections,
render: (text, record) => ( render: (text, record) => (
<span style={{width: '100px'}} className="maxnamewidth100s">{record.feq}</span> <span style={{width: '100px'}} className="maxnamewidth100s">{record.feq}</span>
), ),
@ -83,7 +87,7 @@ class Videostatisticscom extends Component {
className: 'font-14 maxnamewidth100s', className: 'font-14 maxnamewidth100s',
width: '100px', width: '100px',
render: (text, record) => ( render: (text, record) => (
<span style={{width: '100px',color:'#5091FF'}} className="xiaoshou" >{record.start_at}</span> <span style={{width: '100px', color: '#5091FF'}} className="xiaoshou">{record.start_at}</span>
), ),
}, },
{ {
@ -94,35 +98,40 @@ class Videostatisticscom extends Component {
className: 'font-14 maxnamewidth100s', className: 'font-14 maxnamewidth100s',
width: '100px', width: '100px',
render: (text, record) => ( render: (text, record) => (
<span style={{width: '100px',color:'#5091FF'}} className="xiaoshou" >{record.end_at}</span> <span style={{width: '100px', color: '#5091FF'}} className="xiaoshou">{record.end_at}</span>
), ),
} }
], ],
loading:false, loading: false,
order:undefined, order: undefined,
course_groups:[], course_groups: [],
fbbool: false,
groupsid: null,
} }
} }
componentDidMount() { componentDidMount() {
if(this.props.isAdmin()){ this.setState({
//老师 order: undefined
const CourseId=this.props.match.params.coursesId; })
if (this.props.isAdmin()) {
//老师
const CourseId = this.props.match.params.coursesId;
var data={ var data = {
id:CourseId, id: CourseId,
page:this.state.page, page: this.state.page,
} }
this.getdatas(data); this.getdatas(data);
}else{ } else {
//学生 //学生
var data={ var data = {
page:this.state.page, page: this.state.page,
} }
this.getdatas(data); this.getdatas(data);
} }
this.fenbans(); this.fenbans();
} }
componentDidUpdate = (prevProps) => { componentDidUpdate = (prevProps) => {
@ -131,21 +140,21 @@ class Videostatisticscom extends Component {
} }
//分班 //分班
fenbans=()=>{ fenbans = () => {
const CourseId=this.props.match.params.coursesId; const CourseId = this.props.match.params.coursesId;
let url=`/courses/${CourseId}/course_groups.json`; let url = `/courses/${CourseId}/course_groups.json`;
axios.get(url).then((response) => { axios.get(url).then((response) => {
if(response){ if (response) {
console.log("分班"); console.log("分班");
console.log("response"); console.log("response");
console.log(response); console.log(response);
this.setState({ this.setState({
course_groups:response.data.course_groups, course_groups: response.data.course_groups,
current_group_id:response.data.current_group_id, current_group_id: response.data.current_group_id,
none_group_member_count:response.data.none_group_member_count, none_group_member_count: response.data.none_group_member_count,
group_count:response.data.group_count, group_count: response.data.group_count,
}) })
} }
}).catch((error) => { }).catch((error) => {
@ -153,92 +162,283 @@ class Videostatisticscom extends Component {
} }
//学生 //学生
getdatas=(data)=>{ getdatas = (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=""; let url = "";
if(this.props.isAdmin()){ if (this.props.isAdmin()) {
url=`/course_videos/${this.props.tisid}/watch_histories.json`; url = `/course_videos/${this.props.tisid}/watch_histories.json`;
}else { } else {
url=`/courses/${CourseId}/own_watch_histories.json`; url = `/courses/${CourseId}/own_watch_histories.json`;
} }
axios.get(url,{params:data}).then((response) => { axios.get(url, {params: data}).then((response) => {
if(response){ if (response) {
if(response.data){ if (response.data) {
if(response.data.data.length>0){ if (response.data.data.length > 0) {
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,
feq:response.data.data[i].feq, feq: response.data.data[i].feq,
start_at:response.data.data[i].start_at, start_at: response.data.data[i].start_at,
end_at:response.data.data[i].end_at, end_at: response.data.data[i].end_at,
}) })
} }
this.setState({ this.setState({
data:datalists, data: datalists,
members_count:response.data.count, members_count: response.data.count,
}) })
}else{ } else {
this.setState({ this.setState({
data:[], data: [],
members_count:response.data.count, members_count: response.data.count,
}) })
} }
}else{ } else {
this.setState({ this.setState({
data:[], data: [],
members_count:response.data.count, members_count: response.data.count,
}) })
} }
}
}
this.setState({ this.setState({
loading:false loading: false
}) })
}).catch((error) => { }).catch((error) => {
this.setState({ this.setState({
loading:false loading: false
}) })
}); });
} }
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 = () => {
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);
} }
render() { //实训作业tbale 列表塞选数据
let {loading,data,page,limit,members_count,columnsstu}=this.state; table1handleChange = (pagination, filters, sorter) => {
const isAdmin =this.props.isAdmin(); 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 (this.state.groupsid) {
data = {
id: CourseId,
page: this.state.page,
group_id: this.state.groupsid,
order: mysorder,
}
} else {
data = {
id: CourseId,
page: this.state.page,
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 (this.state.groupsid) {
data = {
id: CourseId,
page: this.state.page,
group_id: this.state.groupsid,
order: mysorder,
}
} else {
data = {
id: CourseId,
page: this.state.page,
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 = (
<Menu>
<Menu.Item>
<a onClick={() => this.setcourse_groups(null)}>
<p className="maxnamewidth200s">全部</p>
</a>
</Menu.Item>
{
course_groups && course_groups.length > 0 ?
(
course_groups.map((item, key) => {
return (
<Menu.Item>
<a onClick={() => this.setcourse_groups(item.id)} key={key}>
<p className="maxnamewidth200s">{item.name}</p>
</a>
</Menu.Item>
)
})
)
:
""
}
</Menu>
);
return ( return (
<React.Fragment> <React.Fragment>
<div className="ws100s" > <div className="ws100s">
<div className="ws100s teacherentrydivs edu-back-white "> <div className="ws100s teacherentrydivs edu-back-white ">
<div className="ws100s sortinxdirection"> <div className="ws100s sortinxdirection">
<div className="ws50s sptits">视频名称视频名称</div> <div className="ws50s sptits">视频名称视频名称</div>
<div className="ws50s sptitss xaxisreverseorder font-14" style={{ <div className="ws50s sptitss xaxisreverseorder font-14" style={{
color:"#5091FF", color: "#5091FF",
lineHeight: "42px", lineHeight: "42px",
}}> }}>
<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 className="xiaoshou">
<span className="mr5 xiaoshou">分班</span><i className="iconfont icon-sanjiaoxing-up font-13 mr32 xiaoshou"></i>
</div> </div>
{
isAdmin === true ?
<div className="xiaoshou" onClick={() => this.fenbanone()}>
<Dropdown getPopupContainer={trigger => trigger.parentNode} overlay={menu}
placement="bottomCenter">
<span>
<span className="mr5 xiaoshou">分班</span>
{
fbbool === true ?
<i className="iconfont icon-sanjiaoxing-down font-13 mr32 xiaoshou"></i>
:
<i className="iconfont icon-sanjiaoxing-up font-13 mr32 xiaoshou"></i>
}
</span>
</Dropdown>
</div>
:
""
}
</div> </div>
</div> </div>
@ -253,7 +453,7 @@ class Videostatisticscom extends Component {
} }
</style> </style>
{ {
loading===true? loading === true ?
<div style={{ <div style={{
minHeight: "400px", minHeight: "400px",
}} className="ws100s"> }} className="ws100s">
@ -262,14 +462,19 @@ class Videostatisticscom extends Component {
: :
<div className="ws100s ysltableo teacherentrydivs"> <div className="ws100s ysltableo teacherentrydivs">
{ {
data.length===0? data.length === 0 ?
<div style={{ <div style={{
minHeight: "400px", minHeight: "400px",
}} className="ws100s"> }} className="ws100s">
<NoneDatas></NoneDatas> <NoneDatas></NoneDatas>
</div> </div>
: :
<Table columns={columnsstu} dataSource={data} pagination={false}/> <Table
columns={columnsstu}
dataSource={data}
pagination={false}
onChange={this.table1handleChange}
/>
} }
@ -281,11 +486,11 @@ class Videostatisticscom extends Component {
<div className="mb30 clearfix educontent mt40 intermediatecenter"> <div className="mb30 clearfix educontent mt40 intermediatecenter">
{ {
data&&data.length>0? data && data.length > 0 ?
<Pagination showQuickJumper current={this.state.page} onChange={this.paginationonChange} <Pagination showQuickJumper current={this.state.page} onChange={this.paginationonChange}
pageSize={this.state.limit} pageSize={this.state.limit}
total={this.state.members_count}></Pagination> total={this.state.members_count}></Pagination>
:"" : ""
} }
</div> </div>
@ -296,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) {
this.setState({ if (response.data) {
data:response.data&&response.data.videos?response.data.videos:[], if (response.data.videos.length > 0) {
members_count:response.data.count, 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({
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({ 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}
/>
} }

@ -6,6 +6,6 @@ export default ({
callback(id) callback(id)
} }
return ( return (
<a className={id === activeId ? "shaiItems shixun_repertoire active" : "shaiItems shixun_repertoire"} onClick={onClickHandler}>{text}</a> <a className={id == activeId ? "shaiItems shixun_repertoire active" : "shaiItems shixun_repertoire"} onClick={onClickHandler}>{text}</a>
) )
} }

@ -12,13 +12,13 @@ const DiffObject = [
{ id: 3, text: '中高级' }, { id: 3, text: '中高级' },
{ id: 4, text: '高级' } { id: 4, text: '高级' }
] ]
export default ({ StatusEnquiry, allUpdatashixunlist, Updatasearchlist }) => { export default ({ StatusEnquiry, allUpdatashixunlist, Updatasearchlist,parsedid,newpalce }) => {
const [data, setData] = useState({ const [data, setData] = useState({
diff: 0, diff: 0,
searchValue: 'a', searchValue: newpalce || 'a',
navs: [], navs: [],
searchKey: '', searchKey: '',
childValue: '' childValue:parsedid
}) })
const { diff, searchValue, navs, childValue, searchKey } = data const { diff, searchValue, navs, childValue, searchKey } = data
function diffSearch(diff) { function diffSearch(diff) {
@ -28,6 +28,15 @@ export default ({ StatusEnquiry, allUpdatashixunlist, Updatasearchlist }) => {
}) })
StatusEnquiry([{ 'type': 2 }, { 'value': diff }]) StatusEnquiry([{ 'type': 2 }, { 'value': diff }])
} }
useEffect(() => {
setData({
...data,
searchValue: newpalce || 'a',
childValue: parsedid
})
},[
newpalce,navs,parsedid
])
function onSearchAll() { function onSearchAll() {
if (searchValue !== 'a') { if (searchValue !== 'a') {
setData({ ...data, searchValue: 'a', childValue: '' }) setData({ ...data, searchValue: 'a', childValue: '' })
@ -61,12 +70,12 @@ export default ({ StatusEnquiry, allUpdatashixunlist, Updatasearchlist }) => {
function overlayMenu(item, id) { function overlayMenu(item, id) {
return <Menu> return <Menu>
{ {
item.map((list, k) => <Menu.Item> item.map((list, k) => <Menu.Item key={list.id}>
<div className="mt5 subshaicontent-part" key={k} > <div className="mt5 subshaicontent-part" >
<a style={{ height: '20px' }} className={"mb15 shixun_repertoire color-dark"} name={list.id} id={id} onClick={getChildValue}>{list.name}</a> <a style={{ height: '20px' }} className={"mb15 shixun_repertoire color-dark"} name={list.id} id={id} onClick={getChildValue}>{list.name}</a>
<div className="sub-Item clearfix"> <div className="sub-Item clearfix">
{ {
list.tags.map((tag, e) => <a className={childValue === tag.id ? "shixun_repertoire active" : "shixun_repertoire"} key={e} id={tag.id} name={id} rel="subshaicontent" onClick={getChildValues}>{tag.name}</a> list.tags.map((tag, e) => <a className={childValue == tag.id ? "shixun_repertoire color-blue" : "shixun_repertoire"} key={e} id={tag.id} name={id} rel="subshaicontent" onClick={getChildValues}>{tag.name}</a>
) )
} }
</div> </div>
@ -84,7 +93,6 @@ export default ({ StatusEnquiry, allUpdatashixunlist, Updatasearchlist }) => {
} }
init() init()
}, []) }, [])
// item.id < 4 ? "bottomRight" : item.id >= 8 ? "bottomLeft" : "bottomCenter"
return ( return (
<div className="edu-back-white shixun-search-bar" > <div className="edu-back-white shixun-search-bar" >
<div className="educontent"> <div className="educontent">
@ -111,7 +119,7 @@ export default ({ StatusEnquiry, allUpdatashixunlist, Updatasearchlist }) => {
<div className="clearfix"> <div className="clearfix">
<span className="shaiTitle fl">筛选</span> <span className="shaiTitle fl">筛选</span>
<div className="fl pr shaiAllItem mt1"> <div className="fl pr shaiAllItem mt1">
{DiffObject.map(item => <A {...item} callback={diffSearch} activeId={diff} />)} {DiffObject.map(item => <A key={item.id} {...item} callback={diffSearch} activeId={diff} />)}
</div> </div>
</div> </div>

Loading…
Cancel
Save