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

courseware
daiao 5 years ago
commit ee7b0f87ea

@ -106,7 +106,7 @@ class AttendancesController < ApplicationController
attrs = %i[course_attendance_id user_id course_member_id course_id course_group_id created_at updated_at] attrs = %i[course_attendance_id user_id course_member_id course_id course_group_id created_at updated_at]
same_attrs = {course_attendance_id: attendance.id, course_id: course.id} same_attrs = {course_attendance_id: @attendance.id, course_id: @course.id}
CourseMemberAttendance.bulk_insert(*attrs) do |worker| CourseMemberAttendance.bulk_insert(*attrs) do |worker|

@ -35,7 +35,7 @@ class CourseVideosController < ApplicationController
@watch_course_videos = @watch_course_videos.where("course_members.course_group_id = ?", params[:group_id]) @watch_course_videos = @watch_course_videos.where("course_members.course_group_id = ?", params[:group_id])
end end
@watch_course_videos = @watch_course_videos.select("count(watch_course_videos.course_video_id) AS freq, watch_course_videos.*") @watch_course_videos = @watch_course_videos.select("count(watch_course_videos.course_video_id) AS freq, watch_course_videos.id, watch_course_videos.user_id, watch_course_videos.start_at, watch_course_videos.end_at, watch_course_videos.is_finished, watch_course_videos.total_duration")
if params[:order].present? if params[:order].present?
key = params[:order].split("-") key = params[:order].split("-")

@ -103,25 +103,37 @@ class CoursesController < ApplicationController
end end
def course_videos def course_videos
videos = @course.course_videos course_videos = @course.course_videos
course_videos = course_videos.joins("
JOIN videos ON course_videos.video_id = videos.id
LEFT JOIN (
SELECT watch_course_videos.course_video_id,
SUM(watch_course_videos.total_duration) AS total_duration,
count(watch_course_videos.course_video_id) AS count
FROM watch_course_videos
JOIN course_videos ON watch_course_videos.course_video_id = course_videos.id AND watch_course_videos.end_at IS NOT NULL
JOIN course_members ON course_members.user_id = watch_course_videos.user_id AND course_members.course_id = #{@course.id} AND role = 4
WHERE course_videos.course_id = #{@course.id}
GROUP BY watch_course_videos.course_video_id
) AS watch_courses ON watch_courses.course_video_id = course_videos.id
").where("((videos.transcoded = TRUE OR videos.user_id = #{current_user.id}) OR course_videos.is_link = TRUE)")
@video_module = @course.course_modules.find_by(module_type: "video") @video_module = @course.course_modules.find_by(module_type: "video")
if params[:category_id].present? && params[:category_id].to_i != 0 if params[:category_id].present? && params[:category_id].to_i != 0
@category = @video_module&.course_second_categories.find_by(id: params[:category_id]) @category = @video_module&.course_second_categories.find_by(id: params[:category_id])
tip_exception("子目录id有误") if !@category.present? tip_exception("子目录id有误") if !@category.present?
videos = videos.where(course_second_category_id: params[:category_id].to_i) course_videos = course_videos.where(course_second_category_id: params[:category_id].to_i)
end end
videos = custom_sort(videos, params[:sort_by], params[:sort_direction]) course_videos = custom_sort(course_videos, params[:sort_by], params[:sort_direction])
course_videos = course_videos.includes(video: [user: :user_extension], user: :user_extension)
#sql = "left join videos on videos.id=course_videos.video_id AND (videos.transcoded=1 OR videos.user_id = #{current_user.id})" @count = course_videos.count("course_videos.id")
#@videos = paginate videos.joins(sql).includes(video: [user: :user_extension], user: :user_extension)
videos = videos.includes(video: [user: :user_extension],user: :user_extension).select("course_videos.id, course_videos.title, course_videos.link, course_videos.user_id")
videos = videos.where(videos: {transcoded: true})
.or(videos.where(videos: {user_id: current_user.id}))
.or(videos.where(course_videos: {is_link: true}))
@count = videos.count("course_videos.id")
logger.info("#######count:#{@count}") logger.info("#######count:#{@count}")
@videos = paginate videos course_videos = course_videos.select("IFNULL(watch_courses.total_duration, 0) AS total_duration, IFNULL(watch_courses.count,0) AS count, course_videos.video_id, course_videos.title, course_videos.is_link, course_videos.user_id")
@videos = paginate course_videos
end end
def delete_course_video def delete_course_video
@ -1491,11 +1503,10 @@ class CoursesController < ApplicationController
@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
LEFT JOIN ( LEFT JOIN (
SELECT watch_course_videos.course_video_id, SUM(watch_course_videos.total_duration) AS time, COUNT(watch_video_histories.watch_course_video_id) AS num SELECT watch_course_videos.course_video_id, SUM(watch_course_videos.total_duration) AS time, COUNT(watch_course_videos.course_video_id) AS num
FROM watch_course_videos FROM watch_course_videos
JOIN course_videos ON course_videos.id = watch_course_videos.course_video_id AND watch_course_videos.end_at IS NOT NULL JOIN course_videos ON course_videos.id = watch_course_videos.course_video_id AND watch_course_videos.end_at IS NOT NULL
JOIN course_members ON course_members.user_id = watch_course_videos.user_id AND course_members.course_id = #{@course.id} AND role = 4 JOIN course_members ON course_members.user_id = watch_course_videos.user_id AND course_members.course_id = #{@course.id} AND role = 4
JOIN watch_video_histories ON watch_course_videos.id = watch_video_histories.watch_course_video_id AND watch_video_histories.end_at IS NOT NULL
WHERE course_videos.course_id = #{@course.id} WHERE course_videos.course_id = #{@course.id}
GROUP BY watch_course_videos.course_video_id GROUP BY watch_course_videos.course_video_id
) AS hisotries ON hisotries.course_video_id = course_videos.id").select("course_videos.id") ) AS hisotries ON hisotries.course_video_id = course_videos.id").select("course_videos.id")
@ -1509,7 +1520,7 @@ class CoursesController < ApplicationController
end end
end end
@videos = @videos.select("course_videos.id, videos.user_id, videos.title, IFNULL(hisotries.time,0) AS total_time, IFNULL(hisotries.num,0) AS people_num") @videos = @videos.select("course_videos.id, videos.user_id, videos.title AS video_title, IFNULL(hisotries.time,0) AS total_time, IFNULL(hisotries.num,0) AS people_num")
@videos = paginate @videos @videos = paginate @videos
end end
@ -1522,14 +1533,14 @@ class CoursesController < ApplicationController
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}
JOIN ( JOIN (
SELECT watch_course_videos.course_video_id, COUNT(watch_video_histories.watch_course_video_id) AS num SELECT watch_course_videos.id, COUNT(watch_video_histories.watch_course_video_id) AS num
FROM watch_course_videos FROM watch_course_videos
JOIN course_videos ON course_videos.id = watch_course_videos.course_video_id JOIN course_videos ON course_videos.id = watch_course_videos.course_video_id
JOIN course_members ON course_members.user_id = watch_course_videos.user_id AND course_members.course_id = #{@course.id} AND role = 4 JOIN course_members ON course_members.user_id = watch_course_videos.user_id AND course_members.course_id = #{@course.id} AND role = 4
JOIN watch_video_histories ON watch_course_videos.id = watch_video_histories.watch_course_video_id AND watch_video_histories.end_at IS NOT NULL JOIN watch_video_histories ON watch_course_videos.id = watch_video_histories.watch_course_video_id AND watch_video_histories.end_at IS NOT NULL
WHERE course_videos.course_id = #{@course.id} AND watch_course_videos.user_id = #{current_user.id} AND watch_course_videos.end_at IS NOT NULL WHERE course_videos.course_id = #{@course.id} AND watch_course_videos.user_id = #{current_user.id} AND watch_course_videos.end_at IS NOT NULL
GROUP BY watch_course_videos.course_video_id GROUP BY watch_course_videos.id
) AS hisotries ON hisotries.course_video_id = course_videos.id").select("course_videos.id") ) AS hisotries ON hisotries.id = watch_course_videos.id ").select("course_videos.id")
@count = @videos.count @count = @videos.count
@ -1542,7 +1553,7 @@ class CoursesController < ApplicationController
end end
end end
@videos = @videos.select("course_videos.id, course_videos.video_id, watch_course_videos.start_at, watch_course_videos.total_duration, watch_course_videos.end_at, watch_course_videos.is_finished, videos.title, IFNULL(hisotries.num,0) AS freq") @videos = @videos.select("course_videos.id, watch_course_videos.id AS watch_course_video_id, course_videos.video_id, watch_course_videos.start_at, watch_course_videos.total_duration, watch_course_videos.end_at, watch_course_videos.is_finished, videos.title, IFNULL(hisotries.num,0) AS freq")
@videos = paginate @videos @videos = paginate @videos
end end

@ -32,8 +32,7 @@ class FilesController < ApplicationController
end end
end end
@attachments = @attachments.includes(author: [:user_extension, :course_members]) @attachments = @attachments.ordered(sort: sort.to_i, sort_type: sort_type.strip)
.ordered(sort: sort.to_i, sort_type: sort_type.strip)
@total_count = @attachments.size @total_count = @attachments.size
@unlink_count = @attachments.no_link.size @unlink_count = @attachments.no_link.size
@ -59,7 +58,8 @@ class FilesController < ApplicationController
@attachments = @attachments.no_link @attachments = @attachments.no_link
end end
@attachments = @attachments.page(@page).per(@page_size) @attachments = @attachments.includes(:course_second_category, author: [:user_extension, :course_members])
.page(@page).per(@page_size)
end end
def bulk_publish def bulk_publish

@ -477,6 +477,8 @@ class StudentWorksController < ApplicationController
@user_evaluate_count = 0 @user_evaluate_count = 0
end end
@view_tpi = ((@user_course_identity < Course::STUDENT && current_user.is_certification_teacher) || current_user.admin_or_business?) && @work.myshixun.present?
# 图形效率图的数据 # 图形效率图的数据
@echart_data = student_efficiency(@homework, @work) if @work.myshixun @echart_data = student_efficiency(@homework, @work) if @work.myshixun
end end

@ -115,7 +115,7 @@ class Attachment < ApplicationRecord
def become_history def become_history
history = self.attachment_histories.first history = self.attachment_histories.first
new_attachment_history = AttachmentHistory.new(self.attributes.except("id", "resource_bank_id", "unified_setting", "course_second_category_id", "delay_publish").merge( new_attachment_history = AttachmentHistory.new(self.attributes.except("id", "resource_bank_id", "unified_setting", "course_second_category_id", "delay_publish", "link").merge(
attachment_id: self.id, attachment_id: self.id,
version: history.nil? ? 1 : history.version + 1, version: history.nil? ? 1 : history.version + 1,
)) ))
@ -123,7 +123,7 @@ class Attachment < ApplicationRecord
end end
def copy_attributes_from_new_attachment(new_attachment) def copy_attributes_from_new_attachment(new_attachment)
self.attributes = new_attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads", "quotes",'is_publish','publish_time', "delay_publish") self.attributes = new_attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads", "quotes",'is_publish','publish_time', "delay_publish", "link")
end end
def set_public(is_public) def set_public(is_public)

@ -1,5 +1,6 @@
json.data do json.data do
json.array! @watch_course_videos do |d| json.array! @watch_course_videos do |d|
json.id d.id
json.user_name d.user&.real_name json.user_name d.user&.real_name
json.is_finished d.is_finished ? true : false json.is_finished d.is_finished ? true : false
json.total_duration d.total_duration.round(0) json.total_duration d.total_duration.round(0)

@ -10,8 +10,8 @@ json.videos @videos do |video|
json.user_login user&.login json.user_login user&.login
else else
json.partial! 'users/videos/video', locals: { video: video.video } json.partial! 'users/videos/video', locals: { video: video.video }
json.total_time video.watch_course_videos.sum(:total_duration).round(0) json.total_time video['total_duration'].round(0)
json.people_num video.watch_course_videos.count(:user_id) json.people_num video['count']
end end
end end

@ -1,8 +1,9 @@
json.data do json.data do
json.array! @videos.each do |d| json.array! @videos.each do |d|
json.watch_course_video_id d['watch_course_video_id']
json.title d.title json.title d.title
json.user_name d.video.user&.real_name json.user_name d.video.user&.real_name
json.is_finished d.is_finished ? true : false json.is_finished d.is_finished == 1 ? true : false
json.total_duration d.total_duration.round(0) json.total_duration d.total_duration.round(0)
json.freq d['freq'] json.freq d['freq']
json.start_at d.start_at.to_s json.start_at d.start_at.to_s

@ -1,7 +1,7 @@
json.videos do json.videos do
json.array! @videos do |v| json.array! @videos do |v|
json.id v.id json.id v.id
json.title v.title json.title v['video_title']
json.user_name v.user&.real_name json.user_name v.user&.real_name
json.people_num v['people_num'] json.people_num v['people_num']
json.total_time v['total_time'].round(0) json.total_time v['total_time'].round(0)

@ -17,8 +17,9 @@ json.data do
end end
# json.partial! "files/course_groups", attachment_group_settings: attachment.attachment_group_settings # json.partial! "files/course_groups", attachment_group_settings: attachment.attachment_group_settings
json.category_id attachment.course_second_category_id json.category_id attachment.course_second_category_id
unless @parent_category_id.present? && @parent_category_id != 0 if (@course_second_category_id.to_i == 0 && attachment.course_second_category.present?) || (@parent_category_id == 0 && attachment.course_second_category&.parent_id.to_i != 0)
json.category_name attachment.course_second_category&.name json.category_name attachment.course_second_category&.name
json.parent_category_name attachment.course_second_category&.parent&.name
end end
end end
end end

@ -87,4 +87,6 @@ if @shixun
end end
end end
json.view_tpi @view_tpi

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

@ -268,7 +268,6 @@ class VideoIndex extends Component {
const newOperation = flag; const newOperation = flag;
const new_upload = flag && (is_teacher && this.props.checkIfProfessionalCertification()); const new_upload = flag && (is_teacher && this.props.checkIfProfessionalCertification());
const isAdmin = this.props&& this.props.isAdmin();
return ( return (
@ -378,12 +377,9 @@ class VideoIndex extends Component {
</div> </div>
</div> </div>
: :
(
isAdmin?
<Videostatistics {...this.props} {...this.state} statisticsy={(b) => this.statisticsy(b)}></Videostatistics> <Videostatistics {...this.props} {...this.state} statisticsy={(b) => this.statisticsy(b)}></Videostatistics>
:
<Videostatisticscomtwo {...this.props} {...this.state} mytitle={""} ></Videostatisticscomtwo>
)
} }
{ {
statistics === false ? statistics === false ?

@ -38,7 +38,8 @@ class ShixunWorkReport extends Component {
work_comment_hidden:undefined, work_comment_hidden:undefined,
work_comment:undefined, work_comment:undefined,
has_commit: false, has_commit: false,
shixun_detail:[] shixun_detail:[],
view_tpi:false
} }
} }
@ -115,7 +116,8 @@ class ShixunWorkReport extends Component {
work_comment:result.data.work_comment, work_comment:result.data.work_comment,
spinning: false, spinning: false,
has_commit: result.data.has_commit, has_commit: result.data.has_commit,
shixun_detail:result.data.shixun_detail shixun_detail:result.data.shixun_detail,
view_tpi:result.data.view_tpi
}) })
} }
@ -307,7 +309,7 @@ class ShixunWorkReport extends Component {
} }
render() { render() {
let {data, showAppraiseModaltype, work_comment_hidden, work_comment, has_commit,shixun_detail} = this.state; let {data, showAppraiseModaltype, work_comment_hidden, work_comment, has_commit,shixun_detail,view_tpi} = this.state;
let category_id=data===undefined?"":data.category===null?"":data.category.category_id; let category_id=data===undefined?"":data.category===null?"":data.category.category_id;
let homework_common_id=data===undefined?"":data.homework_common_id; let homework_common_id=data===undefined?"":data.homework_common_id;
@ -315,7 +317,8 @@ class ShixunWorkReport extends Component {
const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />; const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />;
// let showAppraiseModals=this.props&&this.props.isAdminOrTeacher()===true?work_comment===null||work_comment===undefined?false:true:work_comment===null||work_comment===undefined?false:true; // let showAppraiseModals=this.props&&this.props.isAdminOrTeacher()===true?work_comment===null||work_comment===undefined?false:true:work_comment===null||work_comment===undefined?false:true;
let showAppraiseModals=work_comment===null||work_comment===undefined?false:true; // let showAppraiseModals=work_comment===null||work_comment===undefined?false:true;
// console.log(this.props.isAdmin())
document.title=data&&data.course_name; document.title=data&&data.course_name;
return ( return (
@ -460,13 +463,13 @@ class ShixunWorkReport extends Component {
<div className={"fl"}>总体评价</div> <div className={"fl"}>总体评价</div>
<div className={"fr"}> <div className={"fr"}>
{ {
shixun_detail&&shixun_detail.map((item,key)=>{ view_tpi&&view_tpi===true?shixun_detail&&shixun_detail.map((item,key)=>{
if(key===0){ if(key===0){
return( return(
<a className={"color-blue font-16"} href={/tasks/+item.game_identifier} target="_blank" >查看学员实训</a> <a className={"color-blue font-16"} href={/tasks/+item.game_identifier} target="_blank" >查看学员实训</a>
) )
} }
}) }):""
} }
</div> </div>
</div> </div>

@ -2,14 +2,17 @@ import React, {Component} from "react";
import '../css/signincdi.css'; import '../css/signincdi.css';
import {Progress} from 'antd'; import {Progress} from 'antd';
import axios from 'axios'; import axios from 'axios';
import Createsignmodel from '../model/Createsignmodel';
//条目 //条目
class Teacherentry extends Component { class Teacherentry extends Component {
//条目组件 //条目组件
constructor(props) { constructor(props) {
super(props); super(props);
this.state = {} this.state = {
editvisible:false,
attendancesid:null
}
} }
componentDidMount() { componentDidMount() {
@ -21,7 +24,30 @@ class Teacherentry extends Component {
} }
getdatalist=(id)=>{
let urls = `/attendances/${id}/edit.json`;
axios.get(urls).then((response) => {
//console.log(response);
if(response){
if(response.data){
this.setState({
editvisible:true,
attendancesdata:response.data,
attendancesid:id
})
}
}
}).catch((error) => {
console.log(error);
})
}
hideCreatesign=()=>{
this.setState({
editvisible:false
})
}
render() { render() {
let isAdmin = this.props.isAdmin(); let isAdmin = this.props.isAdmin();
let item = this.props.item; let item = this.props.item;
@ -32,9 +58,18 @@ class Teacherentry extends Component {
} catch (e) { } catch (e) {
jdt = 100; jdt = 100;
} }
return ( return (
<React.Fragment> <React.Fragment>
<div className={index===0?"ws100s edu-back-white xiaoshou": "ws100s edu-back-white mt20 xiaoshou"}> <div className={index===0?"ws100s edu-back-white xiaoshou": "ws100s edu-back-white mt20 xiaoshou"}>
{/*修改实训*/}
{this.state.editvisible===true?<Createsignmodel
{...this.state}
{...this.props}
hideCreatesign={()=>this.hideCreatesign()}
settabsdata={()=>this.props.getsetdatas()}
type={"edit"}
/>:""}
<div className="ws100s teacherentrydiv" onClick={isAdmin?(e)=>{e.stopPropagation();this.props.qiandaoxiangq(true,item.id)}:""}> <div className="ws100s teacherentrydiv" onClick={isAdmin?(e)=>{e.stopPropagation();this.props.qiandaoxiangq(true,item.id)}:""}>
<p className={isAdmin?"ws100s teachedivp ymaxnamewidthdivp xiaoshou color-blue":"ws100s teachedivp ymaxnamewidthdivp"} > <p className={isAdmin?"ws100s teachedivp ymaxnamewidthdivp xiaoshou color-blue":"ws100s teachedivp ymaxnamewidthdivp"} >
{ {
@ -97,17 +132,21 @@ class Teacherentry extends Component {
<div className="ws100s xaxisreverseorder"> <div className="ws100s xaxisreverseorder">
<div className="jiezhis h40s xiaoshou" onClick={(e)=>{e.stopPropagation();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={(e)=>{e.stopPropagation();this.props.thisdelete(item.id)}}>删除</div> <div className="shanchu h40s xiaoshou" onClick={(e)=>{e.stopPropagation();this.props.thisdelete(item.id)}}>删除</div>
<div className="shanchu h40s color-blue" onClick={(e)=>{e.stopPropagation();this.getdatalist(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={(e)=>{e.stopPropagation();this.props.Signinnamestypes(item.id,true,item.name)}}>编辑</div>
<div className="shanchu h40s xiaoshou" onClick={(e)=>{e.stopPropagation();this.props.thisdelete(item.id)}}>删除</div> <div className="shanchu h40s xiaoshou" onClick={(e)=>{e.stopPropagation();this.props.thisdelete(item.id)}}>删除</div>
<div className="shanchu h40s color-blue" onClick={(e)=>{e.stopPropagation();this.getdatalist(item.id,true,item.name)}}>编辑</div>
</div> </div>
: :
<div className="ws100s xaxisreverseorder"> <div className="ws100s xaxisreverseorder">
<div className="jiezhis h40s color-reds xiaoshou" onClick={(e)=>{e.stopPropagation();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>
)
: :
( (
this.props.defaultActiveKey === "1" ? this.props.defaultActiveKey === "1" ?

@ -34,7 +34,9 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })(
type:false, type:false,
dateString:null, dateString:null,
start_time:"", start_time:"",
end_time:"" end_time:"",
attendance_date:"",
newmode:null
} }
} }
@ -53,6 +55,43 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })(
}); });
} }
componentDidMount() { componentDidMount() {
if(this.props.type==="edit"){
let newlist=[]
if(this.props.attendancesdata.groups.length>0){
this.props.attendancesdata.groups.map((item,key)=>{
newlist.push(item.id)
})
}
console.log(this.props.attendancesdata.start_time)
// console.log()
this.setState({
attendance_date: this.props.attendancesdata.attendance_date,
start_time:new Date(this.props.attendancesdata.start_time),
end_time:new Date(this.props.attendancesdata.end_time),
newmode:this.props.attendancesdata.mode,
})
this.props.form.setFieldsValue({
name: this.props.attendancesdata.name,
group_ids:newlist,
mode:this.props.attendancesdata.mode,
start_time:new Date(this.props.attendancesdata.start_time),
end_time:new Date(this.props.attendancesdata.end_time),
});
}else{
this.setState({
start_time: new Date("2000-01-01T09:00:00.000+08:00"),
})
this.props.form.setFieldsValue({
start_time:new Date("2000-01-01T09:00:00.000+08:00"),
});
}
const coursesId=this.props.match.params.coursesId; const coursesId=this.props.match.params.coursesId;
let newurl=`/courses/${coursesId}/all_course_groups.json`; let newurl=`/courses/${coursesId}/all_course_groups.json`;
axios.get(newurl).then((response) => { axios.get(newurl).then((response) => {
@ -73,6 +112,7 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })(
type:true type:true
}) })
this.props.form.validateFields((err, values) => { this.props.form.validateFields((err, values) => {
if (!err) { if (!err) {
if(moment(values.end_time).format('HH:mm')<moment(values.start_time).format('HH:mm')){ if(moment(values.end_time).format('HH:mm')<moment(values.start_time).format('HH:mm')){
this.props.showNotification(`结束时间不能小于起始时间`); this.props.showNotification(`结束时间不能小于起始时间`);
@ -88,6 +128,34 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })(
}) })
return return
} }
if(this.props.type==="edit"){
const attendancesid=this.props.attendancesid;
let url=`/attendances/${attendancesid}.json`
axios.put(url,{
attendance_date:moment(values.attendance_date).format('YYYY-MM-DD'),
end_time: moment(values.end_time).format('HH:mm'),
group_ids:values.group_ids,
mode: values.mode,
name: values.name,
start_time:moment(values.start_time).format('HH:mm'),
}
).then((response) => {
if (response.data.status == 0) {
this.props.showNotification(`创建签到成功`);
this.setState({
type:false
})
hideCreatesign()
settabsdata()
}
}).catch((error) => {
console.log(error)
})
}else{
let url=`/weapps/courses/${coursesId}/attendances.json`; let url=`/weapps/courses/${coursesId}/attendances.json`;
axios.post(url, { axios.post(url, {
@ -111,6 +179,10 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })(
.catch(function (error) { .catch(function (error) {
console.log(error); console.log(error);
}); });
}
}else{ }else{
this.setState({ this.setState({
type:false type:false
@ -153,8 +225,8 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })(
}) })
} }
render() { render() {
const { visible, form ,setRadio,Radiolist,hideCreatesign} = this.props; const { visible,form ,setRadio,Radiolist,hideCreatesign,editvisible} = this.props;
let {course_groups}=this.state; let {course_groups,newmode}=this.state;
const { getFieldDecorator } = form; const { getFieldDecorator } = form;
const { Option } = Select; const { Option } = Select;
const formItemLayout = { const formItemLayout = {
@ -175,12 +247,12 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })(
"background":"#4CACFF", "background":"#4CACFF",
"borderRadius":"4px", "borderRadius":"4px",
} }
const format = 'HH:mm';
return ( return (
<Modal <Modal
visible={visible} visible={editvisible?editvisible:visible}
title="创建签到" title={this.props&&this.props.type==="edit"?"编辑签到":"创建签到"}
closable={false} closable={false}
footer={null} footer={null}
width={600} width={600}
@ -196,7 +268,9 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })(
<Form.Item label="签到班级:"> <Form.Item label="签到班级:">
{getFieldDecorator('group_ids')( {getFieldDecorator('group_ids')(
<Select mode="multiple" placeholder={course_groups.length>0?"不选择分班时默认选择全部学生":'暂无分班,将默认选择课堂全部学生'} getPopupContainer={trigger => trigger.parentNode}> <Select mode="multiple" placeholder={course_groups.length>0?"不选择分班时默认选择全部学生":'暂无分班,将默认选择课堂全部学生'} getPopupContainer={trigger => trigger.parentNode}
disabled={this.props&&this.props.type==="edit"?true:false}
>
{course_groups.map((item,key)=>{ {course_groups.map((item,key)=>{
return( return(
@ -218,18 +292,18 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })(
<Radio value="QRCODE">二维码签到</Radio> <Radio value="QRCODE">二维码签到</Radio>
</Radio.Group>, </Radio.Group>,
)} )}
{Radiolist==="QUICK"?<div {Radiolist==="QUICK"||!Radiolist&&newmode==="QUICK"?<div
style={{color:"#E6A23C", style={{color:"#E6A23C",
height:"15px", height:"15px",
lineHeight: "15px"}}>学生点击签到按钮即可完成签到</div>:""} lineHeight: "15px"}}>学生点击签到按钮即可完成签到</div>:""}
{Radiolist==="NUMBER"?<div {Radiolist==="NUMBER"||!Radiolist&&newmode==="NUMBER"?<div
style={{color:"#E6A23C", style={{color:"#E6A23C",
height:"15px", height:"15px",
lineHeight: "15px"}} lineHeight: "15px"}}
>学生需要输入签到码才能完成签到</div>:""} >学生需要输入签到码才能完成签到</div>:""}
{Radiolist==="QRCODE"?<div {Radiolist==="QRCODE"||!Radiolist&&newmode==="QRCODE"?<div
style={{color:"#E6A23C", style={{color:"#E6A23C",
height:"15px", height:"15px",
lineHeight: "15px"}} lineHeight: "15px"}}
@ -238,11 +312,13 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })(
<Form.Item label="签到日期:"> <Form.Item label="签到日期:">
{getFieldDecorator('attendance_date', { {getFieldDecorator('attendance_date', {
rules: [{ type: 'object', required: true, message: '请选择签到日期',}], initialValue:this.props.type==="edit"?moment(this.state.attendance_date,'YYYY-MM-DD'):"",
rules: [{required: true, message: '请选择签到日期',}],
})(<DatePicker style={{width:"413px"}} getPopupContainer={trigger => trigger.parentNode} })(<DatePicker style={{width:"413px"}} getPopupContainer={trigger => trigger.parentNode}
disabledTime={disabledDateTime} disabledTime={disabledDateTime}
disabledDate={disabledDate} disabledDate={disabledDate}
onChange={this.onChange} onChange={this.onChange}
// value={moment('2015-01-01', 'YYYY-MM-DD')}
/>)} />)}
</Form.Item> </Form.Item>
<style> <style>
@ -332,7 +408,7 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })(
class Createsignmodel extends React.Component { class Createsignmodel extends React.Component {
state = { state = {
Radiolist: "", Radiolist: null,
}; };
setRadio=(e)=>{ setRadio=(e)=>{
@ -341,6 +417,7 @@ class Createsignmodel extends React.Component {
}) })
} }
render() { render() {
return ( return (
<React.Fragment> <React.Fragment>
<CollectionCreateForm <CollectionCreateForm

@ -4,6 +4,8 @@ import '../signin/css/signincdi.css';
import Videostatisticscom from './component/Videostatisticscom'; import Videostatisticscom from './component/Videostatisticscom';
import Videostatisticslist from './component/Videostatisticslist'; import Videostatisticslist from './component/Videostatisticslist';
import Videostatisticscomtwo from './component/Videostatisticscomtwo'; import Videostatisticscomtwo from './component/Videostatisticscomtwo';
import Studenticscom from './component/Studenticscom';
import Studentstatistics from './component/Studentstatistics';
//在线学习 //在线学习
@ -21,13 +23,38 @@ class Videostatistics extends Component{
} }
componentDidMount() { componentDidMount() {
const myisAdmin= this.props&& this.props.isAdmin();
if(myisAdmin===true){
this.togetdatas(); this.togetdatas();
}else{
this.togetdataStudent();
}
} }
details=()=>{ details=()=>{
} }
togetdatas(){ togetdatas(){
console.log("视频统计老师");
const CourseId=this.props.match.params.coursesId;
let url=`/courses/${CourseId}/watch_statics.json`;
axios.get(url,{params: {all:true}}).then((response) => {
if(response){
this.setState({
watch_staticsdata:response.data,
})
}
}).catch((error) => {
});
}
togetdataStudent(){
console.log("视频统计学生数据");
const CourseId=this.props.match.params.coursesId; const CourseId=this.props.match.params.coursesId;
let url=`/courses/${CourseId}/watch_statics.json`; let url=`/courses/${CourseId}/watch_statics.json`;
axios.get(url).then((response) => { axios.get(url).then((response) => {
@ -55,6 +82,7 @@ class Videostatistics extends Component{
render(){ render(){
let {watch_staticsdata,tisticsbool,tisid,mytitle}= this.state; let {watch_staticsdata,tisticsbool,tisid,mytitle}= this.state;
const isAdmin = this.props&& this.props.isAdmin();
return( return(
<React.Fragment> <React.Fragment>
@ -64,13 +92,22 @@ class Videostatistics extends Component{
<div className="ws100s" style={{ <div className="ws100s" style={{
position: "relative", position: "relative",
}}> }}>
{
isAdmin?
<Videostatisticscom {...this.state} {...this.props} watch_staticsdata={watch_staticsdata} statisticsy={(b)=>this.props.statisticsy(b)}></Videostatisticscom> <Videostatisticscom {...this.state} {...this.props} watch_staticsdata={watch_staticsdata} statisticsy={(b)=>this.props.statisticsy(b)}></Videostatisticscom>
:
<Studenticscom {...this.state} {...this.props} watch_staticsdata={watch_staticsdata} statisticsy={(b)=>this.props.statisticsy(b)}></Studenticscom>
}
<div> <div>
{ isAdmin?
<Videostatisticslist {...this.state} {...this.props} tisticsbools={(b,id,t)=>this.tisticsbools(b,id,t)}></Videostatisticslist> <Videostatisticslist {...this.state} {...this.props} tisticsbools={(b,id,t)=>this.tisticsbools(b,id,t)}></Videostatisticslist>
:
<Studentstatistics {...this.state} {...this.props} tisticsbools={(b,id,t)=>this.tisticsbools(b,id,t)}></Studentstatistics>
}
</div> </div>

@ -0,0 +1,108 @@
import React, {Component} from "react";
import '../../signin/css/signincdi.css';
import {Progress, message} from 'antd';
import {getImageUrl,formatSeconds} from 'educoder';
import axios from 'axios';
//条目
class Studenticscom extends Component {
//条目组件
constructor(props) {
super(props);
this.state = {}
}
componentDidMount() {
}
componentDidUpdate = (prevProps) => {
}
render() {
return (
<React.Fragment>
<div className="ws100s edu-back-white sortinxdirection" style={{
position: "relative"
}}>
<div className="ws100s teacherentrydivss ">
<div className="ws100s sortinxdirection">
<p className="sortinxdirection h40s" onClick={()=>this.props.statisticsy(false)} >
<i className="iconfont icon-zuojiantou1 font-14 posiivsiconmyss mr5 colorbluesigin xiaoshou h36s" style={{color:'#BBBBBB'}} onClick={()=>this.props.statisticsy(false)} ></i>
</p>
<div className="ws47s sptits font-18" style={{
color:"#333333"
}}><span className="ml10">视频统计总览</span></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>
<style>
{
`
.yslsprenshu{
background-image: url(${getImageUrl(`images/qiandao/studentbz1.png`)});
background-repeat:no-repeat;
-moz-background-size:100% 100%;
background-size:100% 100%;
}
.yslspcishu{
background-image: url(${getImageUrl(`images/qiandao/studentbz2.png`)});
background-repeat:no-repeat;
-moz-background-size:100% 100%;
background-size:100% 100%;
}
.yslshipingshi{
background-image: url(${getImageUrl(`images/qiandao/studentbz3.png`)});
background-repeat:no-repeat;
-moz-background-size:100% 100%;
background-size:100% 100%;
}
`
}
</style>
<div className="ws100s spacearound mt10">
<div className="yslsprenshu mr30" style={{width:260,height:100}}>
<div className="ws100s verticallayout tbrt">
<div className="ws100s ts">观看总次数</div>
<div className="ws100s tss">{this.props.watch_staticsdata&&this.props.watch_staticsdata.freq?this.props.watch_staticsdata.freq:0}</div>
</div>
</div>
<div className="yslspcishu mr30" style={{width:260,height:100}}>
<div className="ws100s verticallayout tbrt">
<div className="ws100s ts">观看总个数</div>
<div className="ws100s tss">{this.props.watch_staticsdata&&this.props.watch_staticsdata.num?this.props.watch_staticsdata.num:0}</div>
</div>
</div>
<div className="yslshipingshi" style={{width:260,height:100}}>
<div className="ws100s verticallayout tbrt">
<div className="ws100 ts">总观看时长</div>
<div className="ws100s tss">{this.props.watch_staticsdata&&this.props.watch_staticsdata.total_duration?formatSeconds(this.props.watch_staticsdata.total_duration):0}</div>
</div>
</div>
</div>
</div>
</div>
</React.Fragment>
)
}
}
export default Studenticscom;

@ -0,0 +1,318 @@
import React, {Component} from "react";
import '../../signin/css/signincdi.css';
import {Pagination,Table,Spin} from 'antd';
import {getImageUrl,sortDirections,formatSeconds} from 'educoder';
import axios from 'axios';
import LoadingSpin from "../../../../common/LoadingSpin";
import NoneDatas from "../../signin/component/NoneDatas";
//条目
class Studentstatistics extends Component {
//条目组件
constructor(props) {
super(props);
this.state = {
columnsstu: [
{
title: '序号',
dataIndex: 'number',
key: 'number',
align: "center",
className: 'font-14',
width: '90px',
render: (text, record) => (
<span style={{width: '90px'}}>{record.number}</span>
),
},
{
title: '视频名称',
dataIndex: 'title',
key: 'title',
align: "center",
className: 'font-14 maxnamewidth150s',
width: '150px',
render: (text, record) => (
<span style={{width: '150px'}} className="maxnamewidth150s">
<a className="maxnamewidth150s" style={{
color:"#333333"
}} title={record.title}>{record.title}</a>
</span>
),
},
{
title: '观看次数(次)',
dataIndex: 'feq',
key: 'feq',
align: "center",
className: 'font-14',
width: '98px',
sorter: true,
sortDirections: sortDirections,
render: (text, record) => (
<span style={{width: '98px'}}>{record.feq}</span>
),
},
{
title: '观看时长',
dataIndex: 'total_duration',
key: 'total_duration',
align: "center",
className: 'font-14 maxnamewidth100s',
width: '100px',
sorter: true,
sortDirections: sortDirections,
render: (text, record) => (
<span style={{width: '100px'}} className="maxnamewidth100s">
<a className="maxnamewidth100s" style={{
color:"#333333"
}} title={record.total_duration}>{record.total_duration}</a>
</span>
),
},
{
title: '发布人',
dataIndex: 'user_name',
key: 'user_name',
align: "center",
className: 'font-14 maxnamewidth100s',
width: '100px',
render: (text, record) => (
<span style={{width: '100px'}} className="maxnamewidth100s">
<a className="maxnamewidth100s" style={{
color:"#333333"
}} title={record.user_name}>{record.user_name}</a>
</span>
),
},
{
title: '是否看完',
dataIndex: 'is_finished',
key: 'is_finished',
align: "center",
className: 'font-14',
width: '90px',
render: (text, record) => (
<span style={{width: '90px'}}>{record.is_finished === true ?
<span style={{color: "#5091FF"}}></span> : <span style={{color: "#E02020"}}></span>}</span>
),
},
],
loading:false,
data:[],
page:1,
limit:20,
members_count:0,
order:undefined,
}
}
componentDidMount() {
let data={
page:1,
order:this.state.order
}
this.togetdatas(data);
}
componentDidUpdate = (prevProps) => {
}
paginationonChange = (pageNumber) => {
this.setState({
page: pageNumber,
})
let data={
page:pageNumber,
order:this.state.order
}
this.togetdatas(data);
}
togetdatas(data){
this.setState({
loading:true
})
const CourseId=this.props.match.params.coursesId;
let 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(this.state.page) - 1) * parseInt(this.state.limit) + (i + 1),
title: response.data.data[i].title,
user_name: response.data.data[i].user_name,
is_finished: response.data.data[i].is_finished,
total_duration:response.data.data[i].total_duration?formatSeconds(response.data.data[i].total_duration):0,
feq:response.data.data[i].freq,
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
})
});
}
//实训作业tbale 列表塞选数据
table1handleChange = (pagination, filters, sorter) => {
if (JSON.stringify(sorter) === "{}") {
//没有选择
} else {
try {
//学生学号排序
if (sorter.columnKey === "feq"||sorter.columnKey === "total_duration") {
let mysorder="";
if (sorter.order === "ascend") {
if(sorter.columnKey === "feq"){
mysorder="freq-asc";
}else{
mysorder="total_duration-asc";
}
//升序
let data={
page:this.state.page,
order:mysorder
}
this.togetdatas(data);
this.setState({
order: mysorder,
})
} else if (sorter.order === "descend") {
if(sorter.columnKey === "feq"){
mysorder="freq-desc";
}else{
mysorder="total_duration-desc";
}
//降序
let data={
page:this.state.page,
order:mysorder
}
this.togetdatas(data);
this.setState({
order: mysorder,
})
}
}
} catch (e) {
}
}
}
render() {
let {loading,data,columnsstu,page,members_count,limit}=this.state;
return (
<React.Fragment>
<div className="ws100s mt20">
<div className="ws100s edu-back-white">
<div className="ws100s teacherentrydivss pd15s">
<div className="ws100s sortinxdirection">
<div className="ws100s sptits font-18">统计列表</div>
</div>
</div>
<style>
{
`
.ysltableo .ant-table-thead > tr > th, .ant-table-tbody > tr > td {
padding: 10px 5px;
}
`
}
</style>
<div className="ws100s ysltableo teacherentrydivs pdinstop0" style={{ minHeight: "400px"}}>
{
data&&data.length===0?
<div style={{
minHeight: "400px",
}} className="ws100s">
<NoneDatas></NoneDatas>
</div>
: data&&data.length>0?
<Spin spinning={loading}>
<Table
columns={columnsstu}
dataSource={data}
pagination={false}
onChange={this.table1handleChange}
/>
</Spin>:
<div style={{
minHeight: "400px",
}} className="ws100s">
<NoneDatas></NoneDatas>
</div>
}
</div>
</div>
<div className="mb30 clearfix educontent mt40 intermediatecenter">
{
data&&data.length>0?
<Pagination showQuickJumper current={this.state.page} onChange={this.paginationonChange}
pageSize={this.state.limit}
total={this.state.members_count}></Pagination>
:""
}
</div>
</div>
</React.Fragment>
)
}
}
export default Studentstatistics;

@ -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 {Progress, message} from 'antd'; import {Progress, message} from 'antd';
import {getImageUrl} from 'educoder'; import {getImageUrl,formatSeconds} from 'educoder';
import axios from 'axios'; import axios from 'axios';
@ -40,7 +40,7 @@ class Videostatisticscom extends Component {
</p> </p>
<div className="ws47s sptits font-18" style={{ <div className="ws47s sptits font-18" style={{
color:"#333333" color:"#333333"
}}>视频统计总览</div> }}><span className="ml10">视频统计总览</span></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 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>
@ -72,7 +72,7 @@ class Videostatisticscom extends Component {
<div className="yslsprenshu mr30" style={{width:260,height:100}}> <div className="yslsprenshu mr30" style={{width:260,height:100}}>
<div className="ws100s verticallayout tbrt"> <div className="ws100s verticallayout tbrt">
<div className="ws100s ts">观看总人数</div> <div className="ws100s ts">观看总人数</div>
<div className="ws100s tss">{this.props.watch_staticsdata&&this.props.watch_staticsdata.people_num?this.props.watch_staticsdata.people_num:0}</div> <div className="ws100s tss">{this.props.watch_staticsdata&&this.props.watch_staticsdata.num?this.props.watch_staticsdata.num:0}</div>
</div> </div>
@ -88,7 +88,7 @@ class Videostatisticscom extends Component {
<div className="yslshipingshi" style={{width:260,height:100}}> <div className="yslshipingshi" style={{width:260,height:100}}>
<div className="ws100s verticallayout tbrt"> <div className="ws100s verticallayout tbrt">
<div className="ws100 ts">总观看时长</div> <div className="ws100 ts">总观看时长</div>
<div className="ws100s tss">{this.props.watch_staticsdata&&this.props.watch_staticsdata.total_duration?this.props.watch_staticsdata.total_duration:0}</div> <div className="ws100s tss">{this.props.watch_staticsdata&&this.props.watch_staticsdata.total_duration?formatSeconds(this.props.watch_staticsdata.total_duration):0}</div>
</div> </div>
</div> </div>

@ -268,13 +268,13 @@ class Videostatisticslist extends Component {
<div className="ws100s ysltableo teacherentrydivs pdinstop0" style={{ minHeight: "400px"}}> <div className="ws100s ysltableo teacherentrydivs pdinstop0" style={{ minHeight: "400px"}}>
{ {
data.length===0? data&&data.length===0?
<div style={{ <div style={{
minHeight: "400px", minHeight: "400px",
}} className="ws100s"> }} className="ws100s">
<NoneDatas></NoneDatas> <NoneDatas></NoneDatas>
</div> </div>
: : data&&data.length>0?
<Spin spinning={loading}> <Spin spinning={loading}>
<Table <Table
columns={columnsstu} columns={columnsstu}
@ -284,6 +284,12 @@ class Videostatisticslist extends Component {
/> />
</Spin> </Spin>
:
<div style={{
minHeight: "400px",
}} className="ws100s">
<NoneDatas></NoneDatas>
</div>
} }

Loading…
Cancel
Save