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

 Conflicts:
	public/react/src/modules/courses/signin/css/Signinstatistics.css
PCqiandao
杨树明 5 years ago
commit 25a9ea8b51

3
.gitignore vendored

@ -7,6 +7,7 @@
# Ignore bundler config.
/.bundle
/bundle
/node_modules
# Ignore lock config file
*.lock
@ -46,6 +47,8 @@
/public/h5build
/public/npm-debug.log
/dist
# avatars
/public/images/avatars

@ -8,23 +8,38 @@ class AttendancesController < ApplicationController
current_date = Date.current
current_end_time = Time.current.strftime("%H:%M:%S")
member = @course.students.find_by(user_id: current_user.id)
if params[:history]
@attendances = @course.course_attendances.where("attendance_date < '#{current_date}' or
(attendance_date = '#{current_date}' and end_time < '#{current_end_time}')")
if @user_course_identity == Course::STUDENT
member = @course.students.find_by(user_id: current_user.id)
group_ids = [member&.course_group_id.to_i, 0]
@attendances = @attendances.joins(:course_attendance_groups).where(course_attendance_groups: {course_group_id: group_ids})
history_attendance_ids = member.course_member_attendances.where(course_id: @course.id).pluck(:course_attendance_id)
@attendances = @course.course_attendances.where(id: history_attendance_ids.uniq).
where("attendance_date < '#{current_date}' or (attendance_date = '#{current_date}' and end_time < '#{current_end_time}')")
else
@attendances = @course.course_attendances.where("attendance_date < '#{current_date}' or
(attendance_date = '#{current_date}' and end_time < '#{current_end_time}')")
end
else
@attendances = @course.course_attendances.where("attendance_date > '#{current_date}' or
(attendance_date = '#{current_date}' and end_time > '#{current_end_time}')")
end
if @user_course_identity == Course::STUDENT
group_ids = [member&.course_group_id.to_i, 0]
@attendances = @attendances.joins(:course_attendance_groups).where(course_attendance_groups: {course_group_id: group_ids})
if params[:history]
attendance_ids = @attendances.pluck(:id)
@normal_count = @course.course_member_attendances.where(course_member_id: member&.id, course_attendance_id: attendance_ids, attendance_status: "NORMAL").size
@leave_count = @course.course_member_attendances.where(course_member_id: member&.id, course_attendance_id: attendance_ids, attendance_status: "LEAVE").size
@absence_count = @course.course_member_attendances.where(course_member_id: member&.id, course_attendance_id: attendance_ids, attendance_status: "ABSENCE").size
else
@attendances = @attendances.where("attendance_date = '#{current_date}' and start_time <= '#{current_end_time}' and end_time > '#{current_end_time}'")
end
else
@attendances = @course.course_attendances.where("attendance_date > '#{current_date}' or
(attendance_date = '#{current_date}' and end_time > '#{current_end_time}')")
end
@attendances_count = @attendances.size
@attendances = @attendances.order("attendance_date desc, start_time desc")

@ -30,7 +30,7 @@ class CoursesController < ApplicationController
:informs, :update_informs, :online_learning, :update_task_position, :tasks_list,
:join_excellent_course, :export_couser_info, :export_member_act_score, :new_informs,
:delete_informs, :change_member_role, :course_groups, :join_course_group, :statistics,
:work_score, :act_score, :calculate_all_shixun_scores, :move_to_category]
:work_score, :act_score, :calculate_all_shixun_scores, :move_to_category, :watch_video_histories]
before_action :user_course_identity, except: [:join_excellent_course, :index, :create, :new, :apply_to_join_course,
:search_course_list, :get_historical_course_students, :mine, :search_slim, :board_list]
before_action :teacher_allowed, only: [:update, :destroy, :settings, :search_teacher_candidate,
@ -114,11 +114,12 @@ class CoursesController < ApplicationController
#sql = "left join videos on videos.id=course_videos.video_id AND (videos.transcoded=1 OR videos.user_id = #{current_user.id})"
#@videos = paginate videos.joins(sql).includes(video: [user: :user_extension], user: :user_extension)
videos = videos.includes(video: [user: :user_extension], user: :user_extension)
videos = videos.joins(:video).select("course_videos.id, course_videos.title, course_videos.link, course_videos.is_link,course_videos.user_id, course_videos.video_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
.or(videos.where(course_videos: {is_link: true})).includes(video: [user: :user_extension], user: :user_extension)
@count = videos.count("course_videos.id")
logger.info("#######count:#{@count}")
@videos = paginate videos
end
@ -1481,6 +1482,23 @@ class CoursesController < ApplicationController
end
end
def watch_video_histories
@videos = CourseVideo.find_by_sql("
SELECT course_videos.id, videos.user_id, videos.title, IFNULL(hisotries.time,0) AS time, IFNULL(hisotries.num,0) AS num
FROM course_videos
JOIN videos ON course_videos.course_id = #{@course.id} AND videos.id = course_videos.video_id
LEFT JOIN (
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
JOIN course_videos ON course_videos.id = watch_course_videos.course_video_id
WHERE course_videos.course_id = #{@course.id}
GROUP BY watch_course_videos.course_video_id
) AS hisotries ON hisotries.course_video_id = course_videos.id
")
@count = @videos.count
@videos = paginate @videos
end
private
# Use callbacks to share common setup or constraints between actions.

@ -367,9 +367,9 @@ class FilesController < ApplicationController
@category_name = category.try(:module_name)
else
@category = CourseSecondCategory.find category_id
@category_id = category.try(:id)
@category_name = category.try(:name)
@parent_category_id = category&.parent_id.to_i
@category_id = @category.try(:id)
@category_name = @category.try(:name)
@parent_category_id = @category&.parent_id.to_i
end
end

@ -12,7 +12,14 @@ class MemosController < ApplicationController
def index
@user = current_user
@memos = Memo.all
s_order = (params[:order] == "replies_count" ? "all_replies_count" : params[:order]) || "updated_at"
# replies_count created_at updated_at
s_order =
case params[:order]
when 'replies_count' then 'all_replies_count'
when 'created_at' then 'created_at'
else
'updated_at'
end
# @tidding_count = unviewed_tiddings(current_user) if current_user.present?
page = params[:page] || 1
limit = params[:limit] || 15

@ -70,7 +70,7 @@ class ShixunsController < ApplicationController
end
## 排序参数
bsort = params[:sort] || 'desc'
bsort = (params[:sort] == "desc" ? "desc" : "asc")
case params[:order_by] || 'new'
when 'hot'
@shixuns = @shixuns.order("shixuns.public = 2 desc, shixuns.myshixuns_count #{bsort}")

@ -5,6 +5,6 @@ class WatchVideoHistoriesController < ApplicationController
watch_log = CreateWatchVideoService.new(current_user, request, params).call
render_ok(log_id: watch_log&.id)
rescue CreateWatchVideoService::Error => ex
render_error(ex.message)
render_ok(log_id: watch_log&.id)
end
end

@ -9,8 +9,10 @@ class Weapps::AttendancesController < ApplicationController
def create
ActiveRecord::Base.transaction do
attendance = @course.course_attendances.create!(create_params.merge(user_id: current_user.id))
unless params[:group_ids].blank? || @course.course_groups.where(id: params[:group_ids]).count == @course.course_groups.count
group_ids = @course.charge_group_ids(current_user) & params[:group_ids].map(&:to_i)
group_ids = params[:group_ids] || []
group_ids = group_ids.blank? ? @course.charge_group_ids(current_user) : @course.charge_group_ids(current_user) & params[:group_ids].map(&:to_i)
unless group_ids.blank? || @course.course_groups.where(id: group_ids).count == @course.course_groups.count
# group_ids = @course.charge_group_ids(current_user) & params[:group_ids].map(&:to_i)
group_ids.each do |group_id|
@course.course_attendance_groups.create!(course_group_id: group_id, course_attendance: attendance)
end

@ -14,6 +14,9 @@ class Weapps::CourseMemberAttendancesController < ApplicationController
@members = @members.where(course_group_id: params[:group_ids])
end
@page = params[:page] || 1
@limit = params[:limit] || 5
if params[:attendance_status].present?
@members = @members.joins(:course_member_attendances).where(course_member_attendances: {course_attendance_id: attendance.id, attendance_status: params[:attendance_status]})
end
@ -34,7 +37,7 @@ class Weapps::CourseMemberAttendancesController < ApplicationController
if params[:attendance_mode] == "QUICK"
attendance = CourseAttendance.find_by(id: params[:attendance_id])
else
attendance = CourseAttendance.find_by(attendance_code: params[:code])
attendance = CourseAttendance.find_by(id: params[:attendance_id], attendance_code: params[:code])
end
tip_exception("该签到不存在") if attendance.blank? || attendance.course.blank?

@ -82,7 +82,7 @@ module CoursesHelper
when "video"
"/classrooms/#{course.id}/course_videos"
when "attendance"
"/classrooms/#{course.id}/signin"
"/classrooms/#{course.id}/attendances"
end
end

@ -392,7 +392,7 @@ class Course < ApplicationRecord
# 课堂实训作业的评测次数
def evaluate_count
course_user_ids = students.pluck(:user_id)
shixun_ids = homework_commons.joins(:homework_commons_shixun).where(homework_type: 4).pluck(:shixun_id)
shixun_ids = homework_commons.joins(:homework_commons_shixun).where(homework_type: "practice").pluck(:shixun_id)
return 0 if shixun_ids.blank?
Game.joins(:challenge).where(challenges: {shixun_id: shixun_ids}, games: {user_id: course_user_ids}).sum(:evaluate_count)
end

@ -8,7 +8,7 @@ class Weapps::SubjectQuery < ApplicationQuery
end
def call
subjects = @current_laboratory.subjects.unhidden.publiced
subjects = @current_laboratory.subjects.unhidden.publiced.show_moblied
# 课程体系的过滤
if params[:sub_discipline_id].present?
@ -21,7 +21,7 @@ class Weapps::SubjectQuery < ApplicationQuery
# 搜索
if params[:keyword].present?
subjects = subjects.where("subjects.name like '%#{params[:keyword]}%'")
subjects = subjects.where("subjects.name like :keyword", keyword: "%#{params[:keyword]}%")
end
subjects = subjects.left_joins(:shixuns, :repertoire).select('subjects.id, subjects.name, subjects.excellent, subjects.stages_count, subjects.status, subjects.homepage_show,
@ -33,10 +33,10 @@ class Weapps::SubjectQuery < ApplicationQuery
private
def order_type
params[:order] || "updated_at"
params[:order] == "updated_at" ? "updated_at" : "myshixuns_count"
end
def sort_type
params[:sort] || "desc"
params[:sort] == "desc" ? "desc" : "asc"
end
end

@ -10,29 +10,36 @@ class CreateWatchVideoService < ApplicationService
def call
ActiveRecord::Base.transaction do
current_time = Time.now
params[:watch_duration] = params[:watch_duration].to_f.round(2)
params[:total_duration] = params[:total_duration].to_f.round(2)
params[:duration] = params[:duration].to_f.round(2)
if params[:log_id].present?
if params[:total_duration].to_f < params[:watch_duration].to_f || params[:watch_duration].to_f < 0
raise Error, '观看时长错误'
watch_video_history = user.watch_video_histories.find(params[:log_id])
if params[:total_duration] < params[:watch_duration]
return watch_video_history
end
# 更新观看时长
watch_video_history = user.watch_video_histories.find(params[:log_id])
if watch_video_history.present? && watch_video_history.watch_duration <= params[:watch_duration].to_f && params[:total_duration].to_f > watch_video_history.total_duration
if watch_video_history.present? && !watch_video_history.is_finished && watch_video_history.watch_duration <= params[:watch_duration] && watch_video_history.total_duration <= params[:total_duration]
# 如果观看总时长没变,说明视频没有播放,无需再去记录
watch_video_history.end_at = current_time
watch_video_history.total_duration = params[:total_duration]
watch_video_history.watch_duration = params[:watch_duration].to_f > watch_video_history.duration ? watch_video_history.duration : params[:watch_duration]
watch_video_history.is_finished = (watch_video_history.duration <= params[:watch_duration].to_f)
watch_video_history.watch_duration = params[:watch_duration] > watch_video_history.duration ? watch_video_history.duration : params[:watch_duration]
watch_video_history.is_finished = params[:ed].present?
watch_video_history.save!
watch_course_video = watch_video_history.watch_course_video
if watch_course_video.present? && !watch_course_video.is_finished && watch_course_video.watch_duration < params[:watch_duration].to_f
# 更新课程视频的时长及是否看完状态
watch_course_video.watch_duration = params[:watch_duration]
watch_course_video.is_finished = (watch_course_video.duration <= params[:watch_duration].to_f)
if watch_course_video.present?
watch_course_video.total_duration = watch_course_video.watch_video_histories.sum(:total_duration)
watch_course_video.end_at = current_time
if !watch_course_video.is_finished && watch_course_video.watch_duration < params[:watch_duration]
# 更新课程视频的时长及是否看完状态
watch_course_video.watch_duration = params[:watch_duration]
if params[:ed].present?
watch_course_video.is_finished = watch_course_video.total_duration >= watch_course_video.duration
end
end
watch_course_video.save!
end
end
@ -45,11 +52,10 @@ class CreateWatchVideoService < ApplicationService
d.start_at = current_time
d.duration = params[:duration]
end
watch_video_history = build_video_log(current_time, course_video.video_id, watch_course_video.id)
watch_video_history.save!
watch_course_video.save! unless watch_course_video.persisted?
watch_video_history = build_video_log(current_time, course_video.video_id, watch_course_video.id)
watch_video_history.save!
else
# 非课堂视频
video = Video.find(params[:video_id])

@ -34,11 +34,18 @@ class Weapps::ShixunSearchService < ApplicationService
unless params[:keyword].blank?
keyword = params[:keyword].strip
shixuns = shixuns.joins(:user).
where("concat(lastname, firstname) like :keyword or shixuns.name like :keyword",
keyword: "%#{keyword}%", name: "%#{keyword.split(" ").join("%")}%").distinct
where("concat(lastname, firstname) like :keyword or shixuns.name like :keyword",
keyword: "%#{keyword}%", name: "%#{keyword.split(" ").join("%")}%").distinct
end
shixuns.order("#{sort_str} #{order_str}")
order =
if sort_str == "wechat_myshixuns_count"
"is_wechat_support desc, myshixuns_count #{order_str}"
else
"#{sort_str} #{order_str}"
end
shixuns.order(order)
end
private

@ -5,9 +5,9 @@
</td>
<td><%= course.course_members_count %></td>
<td><%= get_attachment_count(course, 0) %></td>
<td><%= course.course_homework_count(1) %></td>
<td><%= course.course_homework_count(3) %></td>
<td><%= course.course_homework_count(4) %></td>
<td><%= course.course_homework_count("normal") %></td>
<td><%= course.course_homework_count("group") %></td>
<td><%= course.course_homework_count("practice") %></td>
<td><%= course.exercises_count %></td>
<td><%= course.evaluate_count %></td>
<td><%= course.is_public == 1 ? "--" : "√" %></td>

@ -1,5 +1,5 @@
json.attendances @attendances do |attendance|
json.(attendance, :id, :name, :normal_count, :all_count, :mode)
json.(attendance, :id, :name, :normal_count, :all_count, :mode, :attendance_code)
json.author do
user = attendance.user
json.user_name user.real_name

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

@ -0,0 +1,10 @@
json.videos do
json.array! @videos do |v|
json.id v.id
json.title v.title
json.user_name v.user&.real_name
json.people_num v.num
json.total_time v.time
end
end
json.count @count

@ -4,8 +4,9 @@
# json.student_id member.user&.student_id
# end
json.member_attendances @members.each do |member|
json.member_attendances @members.each_with_index.to_a do |member, index|
json.(member, :user_id)
json.index (@page.to_i - 1) * @limit.to_i + index + 1
json.user_name member.user&.real_name
json.student_id member.user&.student_id
json.attendance_status @member_attendances.select{|attendance| attendance.course_member_id == member.id}.first&.attendance_status || "ABSENCE"

@ -5,5 +5,6 @@ json.shixun_list @results do |obj|
json.study_count obj.myshixuns_count
json.author_name obj.user.real_name
json.author_img url_to_avatar(obj.user)
json.pic url_to_avatar(obj)
end
json.shixuns_count @total_count

@ -531,6 +531,7 @@ Rails.application.routes.draw do
post :inform_up
post :inform_down
get :calculate_all_shixun_scores
get :watch_video_histories
end
collection do

@ -0,0 +1,8 @@
class AddTotalDurationToWatchCourseDuration < ActiveRecord::Migration[5.2]
def change
#add_column :watch_course_videos, :total_duration, :float, default: 0
#WatchVideoHistory.where("created_at < '2020-03-14 00:00:00'").each do |d|
# d.watch_course_video.increment!(:total_duration, d.total_duration) if d.watch_course_video.present?
#end
end
end

@ -3,17 +3,18 @@ namespace :video_transcode do
desc "视频转码成h264"
task :submit => :environment do
i = []
Video.where.not(uuid: nil, file_url: nil).where(transcoded: false, status: "published").find_each do |v|
Video.where.not(uuid: nil, file_url: nil).where(transcoded: false).find_each do |v|
code_info = AliyunVod::Service.get_meta_code_info(v.uuid)
if v.file_url.include?('.mp4') && code_info[:codecnamne]&.include?("h264")
v.update(transcoded: true)
else
puts("uuid: #{v.uuid}")
i << "#{v.id}, #{v.file_url}, #{code_info[:codecnamne]}"
AliyunVod::Service.submit_transcode_job(v.uuid, 'a0277c5c0c7458458e171b0cee6ebf5e')
AliyunVod::Service.submit_transcode_job(v.uuid, 'a0277c5c0c7458458e171b0cee6ebf5e') rescue nil
end
end
puts "###########转码个数:#{i.size}"
puts "###########id,file_url, codecnamne:#{i}"
Video.where(transcoded: false).update_all(transcoded: true)
end
end

@ -13577,6 +13577,21 @@
"resolved": "http://registry.npm.taobao.org/q/download/q-1.5.1.tgz",
"integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc="
},
"qr.js": {
"version": "0.0.0",
"resolved": "https://registry.npm.taobao.org/qr.js/download/qr.js-0.0.0.tgz",
"integrity": "sha1-ys6GOG9ZoNuAUPqQ2baw6IoeNk8="
},
"qrcode.react": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/qrcode.react/download/qrcode.react-1.0.0.tgz",
"integrity": "sha1-foiJ2zt2nlVejrRj1MbeIhw21d4=",
"requires": {
"loose-envify": "^1.4.0",
"prop-types": "^15.6.0",
"qr.js": "0.0.0"
}
},
"qs": {
"version": "6.7.0",
"resolved": "http://registry.npm.taobao.org/qs/download/qs-6.7.0.tgz",

@ -38,6 +38,36 @@ export function getNextHalfHourOfMoment(moment) {
return moment
}
 export function formatSeconds(value) {
        var theTime = parseInt(value);// 秒
        var middle= 0;// 分
        var hour= 0;// 小时
    
        if(theTime > 60) {
            middle= parseInt(theTime/60);
            theTime = parseInt(theTime%60);
            if(middle> 60) {
                hour= parseInt(middle/60);
                middle= parseInt(middle%60);
            }
        }
        var result = ""+parseInt(theTime)+"秒";
        if(middle > 0) {
if(hour>0){
result = ""+parseInt(middle)+"分";
}else{
result = ""+parseInt(middle)+"分"+result;
}
            
        }
        if(hour> 0) {
            result = ""+parseInt(hour)+"小时"+result;
        }
        return result;
    }
export function formatDuring(mss){
var days = parseInt(mss / (1000 * 60 * 60 * 24));
var hours = parseInt((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));

@ -20,7 +20,7 @@ export { bytesToSize as bytesToSize } from './UnitUtil';
export { markdownToHTML, uploadNameSizeSeperator, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll, isImageExtension,
downloadFile, sortDirections } from './TextUtil'
export { handleDateString, getNextHalfHourOfMoment,formatDuring } from './DateUtil'
export { handleDateString, getNextHalfHourOfMoment,formatDuring,formatSeconds} from './DateUtil'
export { configShareForIndex, configShareForPaths, configShareForShixuns, configShareForCourses, configShareForCustom } from './util/ShareUtil'

@ -240,8 +240,12 @@ class Video extends Component {
{
videos && videos.length > 0 ?
<React.Fragment>
<div style={{display:'flex'}}>
<p className="font-grey-9 mt20 mb20 pl5"> <span className="color-orange">{videoData && videoData.count}</span> </p>
<p className="mt20 mb20 pl5" style={{marginLeft:'auto',color:'#C0C4CC'}}>播放数据从2020-03-13 24:00开始统计</p>
</div>
<div className="videoContent">
{
videos.map((item, key) => {

@ -43,7 +43,7 @@ export default ({ src, videoId, logWatchHistory, courseId = null }) => {
let isSeeking = false
let pos = []//
const log = useCallback((callback) => {
const log = useCallback((callback, isEnd = false) => {
let params = {}
if (logId) {
params['log_id'] = logId
@ -59,6 +59,9 @@ export default ({ src, videoId, logWatchHistory, courseId = null }) => {
params['duration'] = totalDuration
params['device'] = device
}
if (isEnd) {
params['ed'] = "1"
}
async function getLogId() {
isLoging = true
let id = await logWatchHistory(params)
@ -108,18 +111,15 @@ export default ({ src, videoId, logWatchHistory, courseId = null }) => {
log()
}
}
//
async function onEnded() {
log(() => {
logId = null
logCount = 1
lastUpdatedTime = 0
sumTimePlayed = 0
initLog = false
isLoging = false
isSeeking = false
pos = []
})
}, true)
}
function onTimeupdate() {
@ -137,6 +137,8 @@ export default ({ src, videoId, logWatchHistory, courseId = null }) => {
log()
}
}
}else {
lastUpdatedTime = newTime
}
}

@ -19,11 +19,11 @@ const { Option } = Select;
class NullChildEditor extends Component{
constructor(props){
super(props);
this.state = {
}
}
// toMDMode = (that) => {
// if (this.mdReactObject) {
// let mdReactObject = this.mdReactObject;
@ -41,7 +41,7 @@ class NullChildEditor extends Component{
render() {
let { question_title, question_score, question_type, question_choices, standard_answers } = this.state;
let { question_id, index, onAnswerChange, addChildAnswer, toMDMode, exerciseIsPublish,
let { question_id, index, onAnswerChange, addChildAnswer, toMDMode, exerciseIsPublish,
answers } = this.props;
// marginTop: '18px'
return(
@ -57,18 +57,24 @@ class NullChildEditor extends Component{
className={'nullChildEditor'}
placeholder={`请输入参考答案${itemIndex == 0 ?'':'(可选)'}`}
toMDMode={toMDMode} noStorage={true}
mdID={`answer_${index}${itemIndex}`} height={155}
mdID={`answer_${index}${itemIndex}`} height={155}
initValue={item} onChange={(val) => onAnswerChange(index, itemIndex, val)}
></DMDEditor>
</div>
{!exerciseIsPublish &&
{!exerciseIsPublish &&
<React.Fragment>
{itemIndex != 0 && <Tooltip title="删除">
<i className="iconfont icon-htmal5icon19 font-18 color-grey-c ml10"
<i className="iconfont icon-htmal5icon19 font-18 color-grey-c ml10"
onClick={() => this.props.deleteChildAnswer(index, itemIndex)}
style={{float: 'right'}}
></i>
</Tooltip> }
{itemIndex === 0 && <Tooltip title="删除">
<i className="iconfont icon-htmal5icon19 font-18 color-grey-c ml10"
onClick={() => this.props.deleteChildAnswermain(index, itemIndex)}
style={{float: 'right'}}
></i>
</Tooltip> }
{ <Tooltip title={`新增参考答案`}>
<i className="color-green font-16 iconfont icon-roundaddfill ml6"
onClick={() => addChildAnswer(index)}

@ -38,7 +38,7 @@ class NullEditor extends Component{
answers.answer_text.forEach((item, itemIndex) => {
_standard_answers[index].push(item)
})
})
}
this.state = {
@ -53,7 +53,7 @@ class NullEditor extends Component{
this.setState({ is_ordered: e.target.checked})
}
onSave = () => {
const {question_title, question_score, question_type, question_choices, standard_answers, is_ordered } = this.state;
const { question_id_to_insert_after, question_id } = this.props
@ -78,8 +78,8 @@ class NullEditor extends Component{
this.props.showNotification('分值必须大于0'); return;
} else if(!question_score || intScore == NaN) {
this.props.showNotification('分值:不能为空'); return;
}
}
let isEmpty = false;
standard_answers.forEach((answers, index) => {
@ -91,8 +91,8 @@ class NullEditor extends Component{
answerArray[index].answer_text.push(item)
if(!item) {
this.refs[`nullChildEditor${index}`].showError(itemIndex)
// this.props.showNotification(`请先输入第${index+1}个填空的第${itemIndex+1}参考答案。`);
this.props.showNotification(`答案:不能为空`);
// this.props.showNotification(`请先输入第${index+1}个填空的第${itemIndex+1}参考答案。`);
this.props.showNotification(`答案:不能为空`);
isEmpty = true;
}
})
@ -122,7 +122,7 @@ class NullEditor extends Component{
"is_ordered":true
}
}*/
const Id = this.props.match.params.Id
const Id = this.props.match.params.Id
if (question_id) {
const editUrl = this.props.getEditQuestionUrl(question_id);
axios.put(editUrl, {
@ -146,7 +146,7 @@ class NullEditor extends Component{
});
} else {
const url = this.props.getAddQuestionUrl();
axios.post(url, {
exercise_bank_id: Id,
question_title,
@ -165,13 +165,13 @@ class NullEditor extends Component{
.catch(function (error) {
console.log(error);
});
}
}
}
onCancel = () => {
this.props.onEditorCancel()
}
componentDidMount = () => {
}
on_question_score_change = (e) => {
this.setState({ question_score: e })
@ -195,13 +195,13 @@ class NullEditor extends Component{
this.mdReactObject.toShowMode()
}
})
}
onAnswerChange = (index, itemIndex, val) => {
if (this.state.standard_answers[index]) {
this.setState(
(prevState) => ({
(prevState) => ({
standard_answers : update(prevState.standard_answers
, {[index]: {$splice: [[itemIndex, 1, val]]}}),
})
@ -217,6 +217,21 @@ class NullEditor extends Component{
)
}
deleteChildAnswermain=(index, childIndex)=>{
let newstandard_answers=this.state.standard_answers
this.props.confirm({
content: `确认要删除这个参考答案吗?`,
onOk: () => {
newstandard_answers.splice(index,1)
this.setState({
standard_answers:newstandard_answers
})
}
})
}
deleteChildAnswer = (index, childIndex) => {
if(!this.state.standard_answers[index][childIndex]) {
this.setState(
@ -258,16 +273,16 @@ class NullEditor extends Component{
}
this.mdReactObject = that;
}
render() {
let { question_title, question_score, question_type, question_choices, standard_answers
, is_ordered } = this.state;
let { question_id, index, exerciseIsPublish,
// question_title,
// question_type,
// question_title,
// question_type,
// question_score,
isNew } = this.props;
// const { getFieldDecorator } = this.props.form;
const isAdmin = this.props.isAdmin()
@ -302,17 +317,17 @@ class NullEditor extends Component{
<span className="color-grey-9 font-12 fl">客观题由系统自动评分允许手动调分请设置标准答案 支持最多5个空每空得分按照本题的总分平均计算</span>
</p>
<NullMDEditor {...this.props} mdID={`question_${question_id}`} placeholder="请您输入题目" height={155}
<NullMDEditor {...this.props} mdID={`question_${question_id}`} placeholder="请您输入题目" height={155}
initValue={question_title} onChange={(val) => this.setState({ question_title: val})}
onPlaceholderChange={this.onPlaceholderChange} showNullButton={exerciseIsPublish ? false : true}
ref="titleEditor"
></NullMDEditor>
<div className="clearfix">
{
standard_answers.map((answers, index) => {
return <NullChildEditor
return <NullChildEditor
ref={`nullChildEditor${index}`}
{...this.props}
toMDMode={this.toMDMode}
@ -321,6 +336,7 @@ class NullEditor extends Component{
onAnswerChange={this.onAnswerChange}
addChildAnswer={this.addChildAnswer}
deleteChildAnswer={this.deleteChildAnswer}
deleteChildAnswermain={this.deleteChildAnswermain}
></NullChildEditor>
// answer.map((item, itemIndex) => {
// return <DMDEditor
@ -331,7 +347,7 @@ class NullEditor extends Component{
// })
})
}
</div>
<div className="clearfix ">
@ -346,16 +362,16 @@ class NullEditor extends Component{
<InputNumber step={0.1} precision={1} min={0} max={100} style={{width: 100}} value={question_score} onChange={this.on_question_score_change}
disabled={exerciseIsPublish} placeholder="请填写分数"
></InputNumber >
<span className="fr">
<ActionBtn style="greyBack" className="middle mr20" onClick={this.onCancel}
>取消</ActionBtn>
<ActionBtn style="blue" className="middle" onClick={this.onSave}>保存</ActionBtn>
</span>
</div>
</div>
)
}

@ -1061,14 +1061,14 @@ class Listofworksstudentone extends Component {
}>
{record.cost_time === null ? "--" : record.cost_time === undefined ? "--" : record.cost_time === "--" ? "--" :
<a style={
<span style={
{
color: '#747A7F',
textAlign: "center"
}
}
>{record.cost_time === null ? "--" : record.cost_time === undefined ? "--" : record.cost_time}
</a>
</span>
}
</span>
// <a style={
@ -1300,7 +1300,7 @@ class Listofworksstudentone extends Component {
// onClick={() => this.Viewstudenttraininginformationt(record)}
>{record.has_comment===true?"详情":"评阅 "}</a> :
<span>
<a style={{textAlign: "center"}} className="color-blue maxnamewidth120"
<a style={{textAlign: "center"}} className="color-blue"
onMouseDown={(e) => this.Viewstudenttraininginformationtysl2(e, record)}
// onClick={() => this.Viewstudenttraininginformationt(record)}
>{record.has_comment===true?"详情":"评阅 "}</a>
@ -1446,14 +1446,14 @@ class Listofworksstudentone extends Component {
}
}>
{record.cost_time === null ? "--" : record.cost_time === undefined ? "--" : record.cost_time === "--" ? "--" :
<a style={
<span style={
{
color: '#747A7F',
textAlign: "center"
}
}
>{record.cost_time === null ? "--" : record.cost_time === undefined ? "--" : record.cost_time}
</a>
</span>
}
</span>
)

@ -3,6 +3,7 @@ import React,{ Component } from "react";
import { Row, Col,Card,Select} from 'antd';
import {getImageUrl} from 'educoder';
import axios from 'axios';
import NoneDatas from "../component/NoneDatas";
import {
Chart,
Geom,
@ -17,15 +18,13 @@ class Signinstatistics extends Component {
super(props)
this.state={
datas:null,
newlist:[],
newlist:undefined,
course_groups:[{id:"全部",name:"全部"}],
spal:false,
}
}
getdata=(group_id)=>{
this.setState({
spal:true
})
const coursesId=this.props.match.params.coursesId;
let url=`/weapps/courses/${coursesId}/attendances.json`
axios.get(url,{params:{
@ -41,18 +40,24 @@ class Signinstatistics extends Component {
response.data.history_attendances.map((item,key)=>{
newlists.push({
month: item.index,
name: item.name+" "+item.attendance_date+" "+item.start_time+"-"+item.end_time,
// month:item.name,
city:"到课率",
temperature: (item.normal_rate).toFixed(0)
temperature: (item.normal_rate*100).toFixed(0)
})
newlists.push({
month: item.index,
name: item.name+" "+item.attendance_date+" "+item.start_time+"-"+item.end_time,
// month:item.name,
city: "旷课率",
temperature: (item.absence_rate).toFixed(0)
temperature: (item.absence_rate*100).toFixed(0)
})
newlists.push({
month: item.index,
name: item.name+" "+item.attendance_date+" "+item.start_time+"-"+item.end_time,
// month:item.name,
city: "请假率",
temperature: (item.leave_rate).toFixed(0)
temperature: (item.leave_rate*100).toFixed(0)
})
})
}
@ -77,6 +82,9 @@ class Signinstatistics extends Component {
}
componentDidMount() {
this.setState({
spal:true
})
const coursesId=this.props.match.params.coursesId;
let newurl=`/courses/${coursesId}/all_course_groups.json`;
axios.get(newurl).then((response) => {
@ -101,7 +109,16 @@ class Signinstatistics extends Component {
const cols = {
month: {
range: [0, 1]
type: 'linear',
nice:[1,10],
min:1,
minLimit:1,
minTickInterval:2
},
temperature:{
type: 'linear',
nice:[0,100],
minTickInterval:2
}
};
@ -125,16 +142,16 @@ class Signinstatistics extends Component {
{
`
.lishiqiandao{
background-image: url(${getImageUrl(`/images/qiandao/lishi.png`)});
background-image: url(${getImageUrl(`images/qiandao/lishi.png`)});
}
.daokeqiandao{
background-image: url(${getImageUrl(`/images/qiandao/daoke.png`)});
background-image: url(${getImageUrl(`images/qiandao/daoke.png`)});
}
.kuangkeqiandao{
background-image: url(${getImageUrl(`/images/qiandao/kuangke.png`)});
background-image: url(${getImageUrl(`images/qiandao/kuangke.png`)});
}
.qingjiaqiandao{
background-image: url(${getImageUrl(`/images/qiandao/qingjia.png`)});
background-image: url(${getImageUrl(`images/qiandao/qingjia.png`)});
}
`
}
@ -161,7 +178,7 @@ class Signinstatistics extends Component {
</Col>
</Row>
<div className={"SigninstatisticsChart mt20"}>
{newlist&&newlist.length>0?<div className={"SigninstatisticsChart mt20"}>
<div className={"pd30"}>
<Row>
<Col span={14}>
@ -189,7 +206,7 @@ class Signinstatistics extends Component {
<Col span={10}><Row type="flex" justify="end">
<Col span={8} className={"Signinstatisticsfont"}>显示最近十次签到</Col>
<Col span={10}>
<Select defaultValue={"全部"} onChange={(e)=>this.handleChange(e)} style={{width:"130px"}}>
<Select defaultValue={"全部"} onChange={(e)=>this.handleChange(e)} style={{width:"130px"}} className={"Signinstatisticsfontselect"}>
{course_groups&&course_groups.map((item,key)=>{
return(
<Option value={item.id} title={item.name} >{item.name}</Option>
@ -202,7 +219,7 @@ class Signinstatistics extends Component {
</div>
<div className={"padding03000"}>
<Chart height={400} data={newlist} scale={cols} forceFit>
<Chart height={400} data={newlist} scale={cols} forceFit>
{/*<Legend />*/}
<Axis name="month" />
<Axis
@ -223,6 +240,14 @@ class Signinstatistics extends Component {
// color={"city"}
shape={"smooth"}
color={["city", ["#26C7C9", "#FF835C","#EDBA6F"]]}
tooltip={['name*temperature*city', (name, temperature,city) => {
return {
//自定义 tooltip 上显示的 title 显示内容等。
name: city,
title: name,
value: temperature+"%"
};
}]}
/>
<Geom
type="point"
@ -234,11 +259,23 @@ class Signinstatistics extends Component {
stroke: "#fff",
lineWidth: 1
}}
// tooltip={['month*sold', (month, temperature) => {
// return {
// //自定义 tooltip 上显示的 title 显示内容等。
// name: 'sold1',
// title: 'dddd' + month,
// value: temperature
// };
// }]}
/>
</Chart>
</div>
</div>
</div>:<div style={{
minHeight:"400px",
}}>
<NoneDatas></NoneDatas>
</div>}
</div>
}
</div>

@ -118,9 +118,11 @@ class Detailss extends Component {
</div>
{
defaultActiveKey === "1" ?
<div className="ws25s" style={{
<div className="ws25s" style={item && item.mode === "NUMBER"?{
position: "relative",
overflow: 'hidden',
}:{
position: "relative",
}}>
{
item && item.mode === "NUMBER" ?

@ -36,7 +36,7 @@ class Teacherentry extends Component {
<React.Fragment>
<div className={index===0?"ws100s edu-back-white ": "ws100s edu-back-white mt20"}>
<div className="ws100s teacherentrydiv ">
<p className="ws100s teachedivp ymaxnamewidthdivp xiaoshou" onClick={()=>this.props.qiandaoxiangq(true,item.id)}>
<p className={isAdmin?"ws100s teachedivp ymaxnamewidthdivp xiaoshou":"ws100s teachedivp ymaxnamewidthdivp"} onClick={isAdmin?()=>this.props.qiandaoxiangq(true,item.id):""}>
{
item.name
}

@ -14,21 +14,21 @@ class Signedinlist extends Component {
limit:5,
page:1,
loading:false,
attendanceslist:[{id:undefined,name:"全部分班"}],
attendanceslist:[],
data:null,
group_ids:[],
members_count:0,
attendance_status:undefined,
state:[
{id:undefined,name:"全部状态"},
{id:"NORMAL",name:"正常出勤"},
{id:"LEAVE",name:"请假"},
{id:"ABSENCE",name:"旷课"},
{id:"NORMAL",name:"正常签到"},
{id:"LEAVE",name:"请 假"},
{id:"ABSENCE",name:this.props.defaultActiveKey ==="2"?"旷 ":"未签到"},
],
newstate:[
{id:"NORMAL",name:"正常出勤"},
{id:"LEAVE",name:"请假"},
{id:"ABSENCE",name:"旷课"},
{id:"NORMAL",name:"正常签到"},
{id:"LEAVE",name:"请 假"},
{id:"ABSENCE",name:this.props.defaultActiveKey ==="2"?"旷 ":"未签到"},
],
course_members_count:'--',
attendance_count:'--',
@ -36,31 +36,34 @@ class Signedinlist extends Component {
}
componentDidMount() {
let {attendanceslist}=this.state;
if(this.props.headdata){
let listattendanceslist=attendanceslist;
if(headdata.course_groups){
if(headdata.course_groups.length>0){
headdata.course_groups.map((item,key)=>{
listattendanceslist.push(item)
})
this.getdatas(this.props&&this.props.switattendance_id,1,[],undefined)
// this.getpath()
}
componentDidUpdate(prevProps, prevState) {
if(prevProps.headdata!=this.props.headdata){
if(this.props.headdata){
let listattendanceslist=[];
listattendanceslist.push({id:undefined,name:"全部分班"})
if(this.props.headdata.course_groups){
if(this.props.headdata.course_groups.length>0){
this.props.headdata.course_groups.map((item,key)=>{
listattendanceslist.push(item)
})
}
}
this.setState({
attendanceslist:listattendanceslist,
data:this.props.headdata,
course_members_count:this.props.headdata.normal_count,
attendance_count:this.props.headdata.all_count
})
}
this.setState({
listattendanceslist:listattendanceslist,
data:response.data,
course_members_count:headdata.all_count,
attendance_count:headdata.normal_count
})
}
this.getdatas(this.props&&this.props.switattendance_id,1,[],undefined)
// this.getpath()
}
}
getdatas=(id,page,group_ids,attendance_status)=>{
this.setState({
loading:true,
@ -101,28 +104,29 @@ class Signedinlist extends Component {
neval=[]
this.setState({
group_ids: [],
page:1
})
}else{
neval=[value]
this.setState({
group_ids: [value],
page:1
})
}
let {page,attendance_status}=this.state;
this.getdatas(this.props&&this.props.switattendance_id,page,neval,attendance_status)
this.getdatas(this.props&&this.props.switattendance_id,1,neval,attendance_status)
if(this.props.defaultActiveKey==="1"){
this.getpath(value)
}
}
getpath=(id)=>{
let {attendanceslist}=this.state;
let listattendanceslist=attendanceslist
let listattendanceslist=[]
let url=`/weapps/attendances/${this.props&&this.props.switattendance_id}.json`;
axios.get(url).then((response) => {
if(response.data){
listattendanceslist.push({id:undefined,name:"全部分班"})
if(response.data.course_groups.length>0){
response.data.course_groups.map((item,key)=>{
listattendanceslist.push(item)
@ -140,12 +144,12 @@ class Signedinlist extends Component {
})
}else{
this.setState({
course_members_count:response.data.all_count,
attendance_count: response.data.normal_count
course_members_count:response.data.normal_count,
attendance_count: response.data.all_count
})
}
this.setState({
listattendanceslist:attendanceslist,
attendanceslist:listattendanceslist,
data:response.data
})
@ -155,21 +159,22 @@ class Signedinlist extends Component {
}
handleChangestate=(value)=>{
let neval
if(!value){
neval=undefined
this.setState({
attendance_status:undefined,
page:1
})
}else{
neval=value
this.setState({
attendance_status: value,
page:1
})
}
let {page,group_ids}=this.state;
this.getdatas(this.props&&this.props.switattendance_id,page,group_ids,neval)
this.getdatas(this.props&&this.props.switattendance_id,1,group_ids,neval)
}
paginationonChange = (pageNumber) => {
this.setState({
@ -181,6 +186,17 @@ class Signedinlist extends Component {
}
handleChange=(attendance_status,value)=>{
let {member_attendances}=this.state;
let newmember_attendances=member_attendances;
newmember_attendances.map((item,key)=>{
if(item.user_id===value){
item.attendance_status=attendance_status
}
})
let url=`/weapps/course_member_attendances/update_status.json`;
axios.post(url, {
@ -192,7 +208,10 @@ class Signedinlist extends Component {
.then((response) => {
if (response.data.status == 0) {
this.props.showNotification(`修改状态成功`);
this.setState({
member_attendances:newmember_attendances
})
this.props.mygetdatas()
}
})
.catch(function (error) {
@ -203,38 +222,54 @@ class Signedinlist extends Component {
}
render() {
let {attendanceslist,state,data,member_attendances,newstate}=this.state;
let {attendanceslist,state,data,member_attendances,newstate,attendance_status}=this.state;
const columns = [
{
title: '序号',
dataIndex: 'index',
key: 'index',
width:300,
className: "textcenter",
},
{
title: '姓名',
dataIndex: 'user_name',
key: 'user_name',
width:300,
className: "textcenter",
render: (text, record) => (
<span>{record.user_name===null?"--":record.user_name}</span>
)
},
{
title: '学号',
dataIndex: 'student_id',
key: 'student_id',
width:300,
className: "textcenter",
render: (text, record) => (
<span>{record.student_id===null?"--":record.student_id}</span>
)
},
{
title: '状态',
key: 'attendance_status',
width:300,
dataIndex: 'attendance_status',
className: "textcenter",
render: (text, record) => (
<span>
<Select key={record.index} defaultValue={record.attendance_status} className={"Signedinlistbox"} style={{ width: 167 }} onChange={(e)=>this.handleChange(e,record.user_id)}>
<Select key={record.index} defaultValue={record.attendance_status}
// 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"}
style={{ width: 167 }} onChange={(e)=>this.handleChange(e,record.user_id)}>
{
newstate&&newstate.map((item,key)=>{
return(
<Option value={item.id} key={key}>{item.name}</Option>
<Option value={item.id} key={key}
className={item.name==="正常签到"?"color26C7C9 sginbox":item.name==="请 假"?"colorEAAE4E sginbox":item.name==="旷 课"?"colorFF835C sginbox": item.name ==="未签到"?"color909399 sginbox":""}>{item.name}</Option>
)
})
}
@ -265,11 +300,18 @@ class Signedinlist extends Component {
<Col className="gutter-row ml20" span={6}>
<Select defaultValue="全部状态" className={"Signedinlistbox"} style={{ width: 167 }} onChange={this.handleChangestate}>
<Select defaultValue="全部状态"
className={"Signedinlistbox"}
//className={attendance_status&&attendance_status==="NORMAL"?"color26C7C9 Signedinlistbox sginboxcolor26C7C9":attendance_status&&attendance_status==="LEAVE"?"colorEAAE4E Signedinlistbox sginboxcolorEAAE4E":attendance_status&&attendance_status==="ABSENCE"?"colorFF835C Signedinlistbox sginboxcolorFF835C":"Signedinlistbox"}
style={{ width: 167 }} onChange={this.handleChangestate}>
{
state&&state.map((item,key)=>{
return(
<Option value={item.id} key={key}>{item.name}</Option>
<Option value={item.id} key={key}
//className={item.name==="正常签到"?"color26C7C9":item.name==="请假"?"colorEAAE4E":item.name==="旷课"?"colorFF835C":""}
>
{item.name}
</Option>
)
})
}

@ -25,8 +25,6 @@ class Signindetails extends Component{
//.log(response);
if(response){
if(response.data){
console.log("头部数据")
console.log(response.data)
this.setState({
headdata:response.data
})
@ -37,12 +35,6 @@ class Signindetails extends Component{
}
componentDidUpdate = (prevProps) => {
console.log("componentDidUpdate");
}
render(){
let {headdata}= this.state;

@ -307,9 +307,9 @@ class Students_signin extends Component{
<div className="mb30 clearfix educontent mt40 intermediatecenter">
<Pagination showQuickJumper current={page} onChange={this.paginationonChange}
{attendances_count>0?<Pagination showQuickJumper current={page} onChange={this.paginationonChange}
pageSize={limit}
total={attendances_count}></Pagination>
total={attendances_count}></Pagination>:''}
</div>
</TabPane>
<TabPane tab="历史签到" key="2">
@ -345,18 +345,18 @@ class Students_signin extends Component{
<div className="mb30 clearfix educontent mt40 intermediatecenter">
<Pagination showQuickJumper current={page} onChange={this.paginationonChange}
{attendances_count>0?<Pagination showQuickJumper current={page} onChange={this.paginationonChange}
pageSize={limit}
total={attendances_count}></Pagination>
</div>
total={attendances_count}></Pagination>:''
}</div>
</TabPane>
{
isAdmin===true?
<TabPane tab="签到统计" key="3">
<Signinstatistics
{defaultActiveKey&&defaultActiveKey==="3"?<Signinstatistics
{...this.props}
{...this.state}
/>
/>:""}
</TabPane>
:
""

@ -30,7 +30,7 @@ class ShixunPathSearch extends Component {
//适配器
onChangeLabel(value) {
let rs = value === 'new' ? 'updated_at' : 'myshixuns_scount'
let rs = value === 'new' ? 'updated_at' : 'myshixuns_count'
let { discipline_id, sub_discipline_id } = this.state;
this.setState({
order: rs,
@ -170,7 +170,7 @@ class ShixunPathSearch extends Component {
<div className="sub-Item clearfix">
{
list.map((tag, e) => {
return (
return (
<a className={parseInt(this.state.sub_discipline_id) === tag.id ? "shixun_repertoire mr20 color-blue" : "shixun_repertoire mr20"}
key={e} id={tag.id} name={tag.id} rel="subshaicontent" onClick={(e) => this.getshixunchildValues(e, tag.id, item)}>{tag.name}</a>
)
@ -242,7 +242,7 @@ class ShixunPathSearch extends Component {
sortList && sortList.map((item, key) => {
return (
<li className={discipline_id == `${item.id}` ? "active" : ""} onClick={(e) => this.changeSelect(e, `${item.id}`, item.sub_disciplines.length)} key={key}>
<Dropdown disabled={item.sub_disciplines.length === 0} overlay={() => this.getmenu(item.sub_disciplines, item)} placement="bottomCenter">
<Dropdown disabled={item.sub_disciplines.length === 0} overlay={() => this.getmenu(item.sub_disciplines, item)} placement="bottomLeft">
<a value={item.id}>{item.name}</a>
</Dropdown>
</li>

@ -62,7 +62,7 @@ export default ({ StatusEnquiry, allUpdatashixunlist, Updatasearchlist }) => {
return <Menu>
{
item.map((list, k) => <Menu.Item>
<div className="mt5 subshaicontent-part" key={k}>
<div className="mt5 subshaicontent-part" key={k} >
<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">
{
@ -84,6 +84,7 @@ export default ({ StatusEnquiry, allUpdatashixunlist, Updatasearchlist }) => {
}
init()
}, [])
// item.id < 4 ? "bottomRight" : item.id >= 8 ? "bottomLeft" : "bottomCenter"
return (
<div className="edu-back-white shixun-search-bar" >
<div className="educontent">
@ -95,7 +96,7 @@ export default ({ StatusEnquiry, allUpdatashixunlist, Updatasearchlist }) => {
{
navs.map((item, key) => {
return (
<Dropdown overlay={overlayMenu(item.sub_repertoires, item.id)} key={key} placement={item.id < 4 ? "bottomRight" : item.id >= 8 ? "bottomLeft" : "bottomCenter"}>
<Dropdown overlayStyle={{width:400}} overlay={overlayMenu(item.sub_repertoires, item.id)} key={key} placement={"bottomLeft"}>
<li key={item.id} className={searchValue == item.id ? "shaiItem shixun_repertoire active" : "shaiItem shixun_repertoire"} value={item.id} onClick={onSearchBranch}>
{item.name}
</li>

@ -70,6 +70,7 @@
}
.videoItem .time {
height: 15px;
color: #C0C4CC;
}
.videoItem .square-main .buttonRow .dianjilianicon{

@ -1,6 +1,6 @@
import React, { useState, useEffect, useContext, memo } from 'react';
import { Progress, Input, Tooltip , Spin } from 'antd'
import { getUrl2, isDev, CBreadcrumb, ActionBtn, ThemeContext } from 'educoder'
import { getUrl2, isDev, CBreadcrumb, ActionBtn, ThemeContext,formatSeconds} from 'educoder'
import axios from 'axios'
import moment from 'moment'
import playIcon from './images/play.png'
@ -21,7 +21,7 @@ const clipboardMap = {}
function VideoInReviewItem (props) {
const theme = useContext(ThemeContext);
const { history, file_url , play_url , cover_url , transcoded , title, created_at, published_at, isReview, id
, onEditVideo, onMaskClick, getCopyText, showNotification,vv,play_duration,operation , deleteVideo , moveVideo ,link} = props;
, onEditVideo, onMaskClick, getCopyText, showNotification,vv,play_duration,operation , deleteVideo , moveVideo ,link, people_num,total_time} = props;
useEffect(()=> {
if (!isReview) {
_clipboard = new ClipboardJS(`.copybtn_item_${id}`);
@ -37,6 +37,9 @@ function VideoInReviewItem (props) {
}
}
}, [])
const username = props.match.params.username
function toList() {
history.push(`/users/${username}/videos`)
@ -60,7 +63,7 @@ function VideoInReviewItem (props) {
{!isReview && !link && transcoded &&
<div className="playWrap" onClick={() => onMaskClick(props)}>
<img className="play mp23" src={playIcon}></img>
{play_duration===0?"":<div className={"play_duration"}>累计学习时长{play_duration} h</div>}
{/* {play_duration===0?"":<div className={"play_duration"}>累计学习时长:{play_duration} h</div>} */}
</div>
}
</Spin>
@ -69,16 +72,22 @@ function VideoInReviewItem (props) {
title={title && title.length > 20 ? title : ''}
>{title}</div>
<div className="df buttonRow mb10">
<span className="time">{moment(published_at || created_at).format('YYYY-MM-DD HH:mm:ss')}</span>
{/* <div className={"play_duration"}>累计学习时长:{play_duration} h</div> */}
{/* <span className="time">{moment(published_at || created_at).format('YYYY-MM-DD HH:mm:ss')}{people_num}</span> */}
{link ?<span className="time"> </span>:<span className="time">{
formatSeconds(total_time)}
{/* total_time<60?total_time+' s':total_time/60<60?(total_time/60).toFixed(0)+' min':(total_time/3600).toFixed(1)+ ' h' */}
</span>}
</div>
<div className="df buttonRow">
{/* 2019-09-01 10:00:22 */}
<span className={"dianjilianicon"}>
{!vv || (vv && vv)===0 ? "" : <Tooltip title="播放次数" placement="bottom">
<i className={`icon-dianjiliang iconfont dianjilianicon`}></i>
</Tooltip> } {!vv || (vv && vv)===0?"":vv}
{!people_num || (people_num && people_num)===0 ? "" : <Tooltip title="观看人数" placement="bottom">
<i className={`icon-dianjiliang iconfont dianjilianicon font-12`}> {!people_num || (people_num && people_num)===0?"":people_num}</i>
</Tooltip> }
</span>
<div>
{
isReview !== true && moveVideo &&

Loading…
Cancel
Save