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

schedule_job
杨树明 5 years ago
commit 738a988c31

@ -79,8 +79,26 @@ class AttendancesController < ApplicationController
new_end_time = "#{params[:attendance_date]} #{params[:end_time]}".to_time new_end_time = "#{params[:attendance_date]} #{params[:end_time]}".to_time
@attendance.update!(update_params) @attendance.update!(update_params)
# 如果历史签到变为了正在签到,将未创建的学生签到数据补上 old_group_ids = @attendance.course_attendance_groups.pluck(:course_group_id)
if a_end_time < Time.current && new_end_time > Time.current unless old_group_ids.include?(0)
all_groups_ids = old_group_ids + params[:group_ids]
# 如果新增的的分班加上之前的分班是课堂的全部分班,则只需创建一条记录
if all_groups_ids.uniq.count == @course.course_groups_count
@attendance.course_attendance_groups.destroy_all
@attendance.course_attendance_groups.create!(course_group_id: 0, course_id: @attendance.course_id)
new_group = true
else
new_group_ids = params[:group_ids] - old_group_ids
new_group_ids.each do |group_id|
@attendance.course_attendance_groups.create!(course_group_id: group_id, course_id: @attendance.course_id)
new_group = true
end
end
end
# 如果新增了分班或者历史签到变为了正在签到,将未创建的学生签到数据补上
if new_group || (a_end_time < Time.current && new_end_time > Time.current)
create_absence_student_data create_absence_student_data
end end
render_ok render_ok

@ -17,7 +17,7 @@ class SubjectsController < ApplicationController
include CustomSortable include CustomSortable
def index def index
subjects = Weapps::SubjectQuery.call(current_laboratory, params) subjects = Weapps::SubjectQuery.call(current_laboratory, params, "web")
@subject_count = subjects.map(&:id).size @subject_count = subjects.map(&:id).size
@subjects = paginate subjects.includes(:shixuns, :repertoire) @subjects = paginate subjects.includes(:shixuns, :repertoire)
end end

@ -12,7 +12,7 @@ class TidingsController < ApplicationController
case params[:type] case params[:type]
when 'notice' then 'System' when 'notice' then 'System'
when 'apply' then 'Apply' when 'apply' then 'Apply'
when 'course' then %w(HomeworkCommon Exercise Poll GraduationTask GraduationTopic) when 'course' then %w(HomeworkCommon Exercise Poll GraduationTask GraduationTopic PublishCourseVideo)
when 'project' then 'Project' when 'project' then 'Project'
when 'interaction' then %w(Comment Mentioned Praise Fan) when 'interaction' then %w(Comment Mentioned Praise Fan)
when 'project_package' then %w(Created Destroyed Bidding BiddingEnd BiddingWon BiddingLost) when 'project_package' then %w(Created Destroyed Bidding BiddingEnd BiddingWon BiddingLost)
@ -25,6 +25,8 @@ class TidingsController < ApplicationController
tidings = tidings.where(container_type: 'ProjectPackage') if params[:type] == 'project_package' tidings = tidings.where(container_type: 'ProjectPackage') if params[:type] == 'project_package'
@count = tidings.count @count = tidings.count
@tidings = paginate(tidings.order(created_at: :desc), per_page: 10) @tidings = paginate(tidings.order(created_at: :desc), per_page: 10)
end end

@ -4,7 +4,7 @@ class Weapps::SubjectsController < Weapps::BaseController
# 首页 # 首页
def index def index
subjects = Weapps::SubjectQuery.call(current_laboratory, params) subjects = Weapps::SubjectQuery.call(current_laboratory, params, "wechat")
@subject_count = subjects.map(&:id).size @subject_count = subjects.map(&:id).size
@subjects = paginate subjects @subjects = paginate subjects
end end

@ -403,6 +403,8 @@ module TidingDecorator
def video_content def video_content
if tiding_type == 'System' if tiding_type == 'System'
I18n.t(locale_format(tiding_type, status), reason: extra) % container.try(:title) I18n.t(locale_format(tiding_type, status), reason: extra) % container.try(:title)
elsif tiding_type == 'PublishCourseVideo'
I18n.t(locale_format(tiding_type)) % [belong_container&.name]
else else
I18n.t(locale_format(tiding_type)) % [container.try(:title) || extra] I18n.t(locale_format(tiding_type)) % [container.try(:title) || extra]
end end
@ -419,4 +421,5 @@ module TidingDecorator
def hack_content def hack_content
I18n.t(locale_format(parent_container_type)) % (container&.name || extra) I18n.t(locale_format(parent_container_type)) % (container&.name || extra)
end end
end end

@ -993,4 +993,11 @@ module ExercisesHelper
} }
exercise_user.update!(commit_option) exercise_user.update!(commit_option)
end end
def has_comment? exercise_user, question_ids
exercise_answer_ids = exercise_user.user.exercise_answers.where(exercise_question_id: question_ids).pluck(:id)
exercise_shixun_answer_ids = exercise_user.user.exercise_shixun_answers.where(exercise_question_id: question_ids).pluck(:id)
exercise_user.commit_status == 1 && (exercise_user.exercise_user_scores.size > 0 || exercise_user.subjective_score >= 0.0 ||
ExerciseAnswerComment.where(exercise_answer_id: exercise_answer_ids).or(ExerciseAnswerComment.where(exercise_shixun_answer_id: exercise_shixun_answer_ids)).exists?)
end
end end

@ -0,0 +1,25 @@
class CourseVideoUploadedJob < ApplicationJob
queue_as :notify
def perform(video_id)
video = Video.select("id, user_id").find_by(id: video_id)
course_ids = video&.course_videos&.pluck(:course_id)
return unless course_ids.present?
course_members = CourseMember.where(course_id: course_ids, role: 'STUDENT').select("user_id, course_id")
Tiding.bulk_insert do |worker|
course_members.find_each do |m|
worker.add(
user_id: m.user_id,
tiding_type: 'PublishCourseVideo',
trigger_user_id: video.user_id,
container_id: video.id,
container_type: 'Video',
belong_container_type: 'Course',
belong_container_id: m.course_id)
end
end
end
end

@ -1,4 +1,7 @@
class Collection < ApplicationRecord class Collection < ApplicationRecord
belongs_to :user belongs_to :user
belongs_to :container, polymorphic: true, optional: true belongs_to :container, polymorphic: true, optional: true
scope :shixuns, -> {where(container_type: 'Shixun')}
scope :subjects, -> {where(container_type: 'Subject')}
end end

@ -48,8 +48,6 @@ class User < ApplicationRecord
has_many :course_messages has_many :course_messages
has_many :courses, foreign_key: 'tea_id', dependent: :destroy has_many :courses, foreign_key: 'tea_id', dependent: :destroy
has_many :collections, dependent: :destroy
#试卷 #试卷
has_many :exercise_banks, :dependent => :destroy has_many :exercise_banks, :dependent => :destroy
has_many :exercise_users, :dependent => :destroy has_many :exercise_users, :dependent => :destroy
@ -119,6 +117,11 @@ class User < ApplicationRecord
has_many :manage_course_members, -> { teachers_and_admin }, class_name: 'CourseMember' has_many :manage_course_members, -> { teachers_and_admin }, class_name: 'CourseMember'
has_many :manage_courses, through: :manage_course_members, source: :course has_many :manage_courses, through: :manage_course_members, source: :course
has_many :collections, dependent: :destroy
has_many :shixun_collections, -> { shixuns }, class_name: 'Collection'
has_many :subject_collections, -> { subjects }, class_name: 'Collection'
# 关注 # 关注
# has_many :be_watchers, foreign_key: :user_id, dependent: :destroy # 我的关注 # has_many :be_watchers, foreign_key: :user_id, dependent: :destroy # 我的关注
# has_many :be_watcher_users, through: :be_watchers, dependent: :destroy # 我关注的用户 # has_many :be_watcher_users, through: :be_watchers, dependent: :destroy # 我关注的用户
@ -421,6 +424,10 @@ class User < ApplicationRecord
end end
end end
def is_collect? container
collections.where(container: container).exists?
end
# 实训用户身份 # 实训用户身份
def shixun_identity(shixun) def shixun_identity(shixun)
@identity = @identity =

@ -2,13 +2,20 @@ class Weapps::SubjectQuery < ApplicationQuery
include CustomSortable include CustomSortable
attr_reader :params attr_reader :params
def initialize(current_laboratory, params) def initialize(current_laboratory, params, device)
@current_laboratory = current_laboratory @current_laboratory = current_laboratory
@params = params @params = params
@device = device
end end
def call def call
subjects = @current_laboratory.subjects.unhidden.publiced.show_moblied Rails.logger.info("##### @device: #{@device}")
subjects =
if @device == "wechat"
@current_laboratory.subjects.unhidden.publiced.show_moblied
else
@current_laboratory.subjects.unhidden.publiced
end
# 课程体系的过滤 # 课程体系的过滤
if params[:sub_discipline_id].present? if params[:sub_discipline_id].present?

@ -12,6 +12,7 @@ class CreateShixunService < ApplicationService
identifier = Util::UUID.generate_identifier(Shixun, 8) identifier = Util::UUID.generate_identifier(Shixun, 8)
shixun.identifier= identifier shixun.identifier= identifier
shixun.user_id = user.id shixun.user_id = user.id
shixun.can_copy = 1
main_mirror = MirrorRepository.find params[:main_type] main_mirror = MirrorRepository.find params[:main_type]
sub_mirrors = MirrorRepository.where(id: params[:sub_type]) sub_mirrors = MirrorRepository.where(id: params[:sub_type])
begin begin

@ -24,15 +24,17 @@ class Users::ShixunService
user.study_shixuns.where(shixuns: {id: laboratory.shixuns}) user.study_shixuns.where(shixuns: {id: laboratory.shixuns})
when 'manage' then when 'manage' then
laboratory.shixuns.where(id: user.shixuns) laboratory.shixuns.where(id: user.shixuns)
when 'collect' then
laboratory.shixuns.where(id: user.shixun_collections.pluck(:container_id))
else else
ids = user.study_shixuns.pluck(:id) + user.shixuns.pluck(:id) ids = user.study_shixuns.pluck(:id) + user.shixuns.pluck(:id) + user.shixun_collections.pluck(:container_id)
laboratory.shixuns.where(id: ids) laboratory.shixuns.where(id: ids)
end end
end end
def status_filter(relations) def status_filter(relations)
case params[:category] case params[:category]
when 'study' then when 'study', 'collect' then
study_shixun_status_filter(relations) study_shixun_status_filter(relations)
when 'manage' then when 'manage' then
manage_shixun_status_filter(relations) manage_shixun_status_filter(relations)
@ -97,7 +99,7 @@ class Users::ShixunService
end end
case params[:category] case params[:category]
when 'study' then when 'study', 'collect' then
relations.order("myshixuns.#{sort_by} #{sort_direction}") relations.order("myshixuns.#{sort_by} #{sort_direction}")
when 'manage' then when 'manage' then
relations.order("shixuns.#{sort_by} #{sort_direction}") relations.order("shixuns.#{sort_by} #{sort_direction}")

@ -25,10 +25,13 @@ class Users::SubjectService
Subject.joins(stage_shixuns: { shixun: :myshixuns }).where(myshixuns: { user_id: user.id }) Subject.joins(stage_shixuns: { shixun: :myshixuns }).where(myshixuns: { user_id: user.id })
when 'manage' then when 'manage' then
Subject.joins(:subject_members).where(subject_members: { user_id: user.id }) Subject.joins(:subject_members).where(subject_members: { user_id: user.id })
when 'collect' then
Subject.where(id: user.subject_collections.pluck(:container_id))
else else
study_subject_ids = StageShixun.where(shixun_id: user.myshixuns.pluck(:shixun_id)).pluck(:subject_id) study_subject_ids = StageShixun.where(shixun_id: user.myshixuns.pluck(:shixun_id)).pluck(:subject_id)
manage_subject_ids = user.subject_members.pluck(:subject_id) manage_subject_ids = user.subject_members.pluck(:subject_id)
Subject.where(id: study_subject_ids + manage_subject_ids) collect_subject_ids = user.subject_collections.pluck(:container_id)
Subject.where(id: study_subject_ids + manage_subject_ids + collect_subject_ids)
end end
end end
@ -45,7 +48,7 @@ class Users::SubjectService
return relations unless self_or_admin? return relations unless self_or_admin?
case params[:category] case params[:category]
when 'study' then when 'study', 'collect' then
study_subject_status_filter(relations) study_subject_status_filter(relations)
when 'manage' then when 'manage' then
manage_subject_status_filter(relations) manage_subject_status_filter(relations)

@ -52,6 +52,7 @@ class Videos::BatchPublishService < ApplicationService
if param[:course_id].present? if param[:course_id].present?
video.video_applies.create!(status: "agreed") video.video_applies.create!(status: "agreed")
CourseVideoUploadedJob.perform_later(video.id) if video.transcoded
else else
video.video_applies.create! video.video_applies.create!
end end

@ -22,6 +22,7 @@ class Videos::DispatchCallbackService < ApplicationService
when 'StreamTranscodeComplete' then # 转码完成 when 'StreamTranscodeComplete' then # 转码完成
#return if video.play_url.present? #return if video.play_url.present?
video.update!(play_url: params['FileUrl'], transcoded: true) video.update!(play_url: params['FileUrl'], transcoded: true)
CourseVideoUploadedJob.perform_later(video.id) if video.video_applies.exists?(status: 'agreed') #通过的情况基本上是课堂视频
when 'DeleteMediaComplete' #完成云端视频删除 when 'DeleteMediaComplete' #完成云端视频删除
video.update_column(:delete_state, Video::FINISH_DELETE) video.update_column(:delete_state, Video::FINISH_DELETE)
end end

@ -14,4 +14,5 @@ if subjective_type == 1
json.subjective_score ex_user_info[:ex_subject_score] json.subjective_score ex_user_info[:ex_subject_score]
end end
json.score ex_user_info[:score] json.score ex_user_info[:score]
json.review_status ex_user_info[:teacher_review] #教师是否评阅评阅则为true否则为false json.review_status ex_user_info[:teacher_review] #教师是否评阅评阅则为true否则为false
json.has_comment has_comment?(exercise_user, question_ids)

@ -37,7 +37,8 @@ end
if @current_user_ex_answers.present? if @current_user_ex_answers.present?
json.current_answer_user do json.current_answer_user do
json.partial! "exercises/exercise_user",locals: {exercise_user:@current_user_ex_answers.first, subjective_type:@subjective_type, json.partial! "exercises/exercise_user",locals: {exercise_user:@current_user_ex_answers.first, subjective_type:@subjective_type,
user_status:@exercise_current_user_status, exercise:@exercise} user_status:@exercise_current_user_status, exercise:@exercise,
question_ids: @exercise.exercise_questions.pluck(:id)}
end end
end end
@ -45,7 +46,8 @@ if @exercise_users_list.present?
json.exercise_users do json.exercise_users do
json.array! @exercise_users_list.each do |exercise_user| json.array! @exercise_users_list.each do |exercise_user|
json.partial! "exercises/exercise_user",locals: {exercise_user:exercise_user, subjective_type:@subjective_type, json.partial! "exercises/exercise_user",locals: {exercise_user:exercise_user, subjective_type:@subjective_type,
user_status:@exercise_current_user_status, exercise:@exercise} user_status:@exercise_current_user_status, exercise:@exercise,
question_ids: @exercise.exercise_questions.pluck(:id)}
end end
end end
else else

@ -1,5 +1,7 @@
json.fork_from @fork_from json.fork_from @fork_from
json.identity User.current.shixun_identity(@shixun) json.identity User.current.shixun_identity(@shixun)
json.is_collect User.current&.is_collect?(@shixun)
json.power @power json.power @power
json.partial! 'shixuns/top', locals: { shixun: @shixun, current_myshixun: @current_myshixun } json.partial! 'shixuns/top', locals: { shixun: @shixun, current_myshixun: @current_myshixun }
json.secret_repository @shixun.shixun_secret_repository.present? json.secret_repository @shixun.shixun_secret_repository.present?

@ -5,6 +5,8 @@ json.challenges_count @subject.subject_challenge_count
json.subject_score @subject.all_score json.subject_score @subject.all_score
json.member_count @subject.member_count json.member_count @subject.member_count
json.is_collect @user&.is_collect?(@subject)
json.allow_delete (@subject.status != 2 && @is_creator) || @user.admin? json.allow_delete (@subject.status != 2 && @is_creator) || @user.admin?
json.publish_status publish_status(@subject, @is_manager) json.publish_status publish_status(@subject, @is_manager)
json.public_status public_status(@subject, @is_manager, @user) json.public_status public_status(@subject, @is_manager, @user)

@ -236,6 +236,7 @@
System: System:
1_end: "你提交的发布视频申请:%s审核已通过" 1_end: "你提交的发布视频申请:%s审核已通过"
2_end: "你提交的发布视频申请:%s审核未通过<br/><span>原因:%{reason}</span>" 2_end: "你提交的发布视频申请:%s审核未通过<br/><span>原因:%{reason}</span>"
PublishCourseVideo_end: "在课堂 %s 发布了视频,观看视频可以增加平时分哦~"
PublicCourseStart_end: "你报名参与的开放课程:%s将于%s正式开课" PublicCourseStart_end: "你报名参与的开放课程:%s将于%s正式开课"
SubjectStartCourse_end: "您创建的开放课程:%s 已达到开课人数要求。您可以在24小时内自主开设新一期课程。如果超过24小时未开课平台将自动开课并复制您上一期的课程内容。" SubjectStartCourse_end: "您创建的开放课程:%s 已达到开课人数要求。您可以在24小时内自主开设新一期课程。如果超过24小时未开课平台将自动开课并复制您上一期的课程内容。"
LiveLink_end: "%s 直播将于30分钟后开始" LiveLink_end: "%s 直播将于30分钟后开始"

@ -1244,19 +1244,19 @@ class Studentshavecompletedthelist extends Component {
(//助教是否有权限 (//助教是否有权限
this.props.assistant_auth&&this.props.assistant_auth===true? this.props.assistant_auth&&this.props.assistant_auth===true?
<a style={{textAlign: "center"}} className="color-blue" <a style={{textAlign: "center"}} className="color-blue"
target="_blank" onClick={() => this.Adjustment(record.user_id)}>评阅</a> target="_blank" onClick={() => this.Adjustment(record.user_id)}>{record.has_comment===true?"已评阅":"评阅"}</a>
: :
(//是否截止 (//是否截止
this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3? this.props.Commonheadofthetestpaper && this.props.Commonheadofthetestpaper.exercise_status===3?
<a style={{textAlign: "center"}} className="color-blue" <a style={{textAlign: "center"}} className="color-blue"
target="_blank" onClick={() => this.Adjustment(record.user_id)}>评阅</a> target="_blank" onClick={() => this.Adjustment(record.user_id)}>{record.has_comment===true?"已评阅":"评阅"}</a>
: :
<span style={{textAlign: "center", color: '#999999'}}>--</span> <span style={{textAlign: "center", color: '#999999'}}>--</span>
) )
) )
: :
<a style={{textAlign: "center"}} className="color-blue" <a style={{textAlign: "center"}} className="color-blue"
target="_blank" onClick={() => this.Adjustment(record.user_id)}>评阅</a> target="_blank" onClick={() => this.Adjustment(record.user_id)}>{record.has_comment===true?"已评阅":"评阅"}</a>
) )
:record.submitstate === "已提交"? :record.submitstate === "已提交"?
(//是否助教 (//是否助教
@ -1581,8 +1581,9 @@ class Studentshavecompletedthelist extends Component {
efficiencyscore: exercise_users[i].score === null ? "--" : exercise_users[i].score === "" ? "--" : exercise_users[i].score, efficiencyscore: exercise_users[i].score === null ? "--" : exercise_users[i].score === "" ? "--" : exercise_users[i].score,
objective_score: exercise_users[i].objective_score === null ? "--" : exercise_users[i].objective_score === "" ? "--" : exercise_users[i].objective_score, objective_score: exercise_users[i].objective_score === null ? "--" : exercise_users[i].objective_score === "" ? "--" : exercise_users[i].objective_score,
subjective_score:exercise_users[i].subjective_score === null ? "--" : exercise_users[i].subjective_score === "" ? "--" : exercise_users[i].subjective_score, subjective_score:exercise_users[i].subjective_score === null ? "--" : exercise_users[i].subjective_score === "" ? "--" : exercise_users[i].subjective_score,
operating: "评阅", operating:exercise_users[i].has_comment===true?"已评阅":"评阅",
commit_method:exercise_users[i].commit_method, commit_method:exercise_users[i].commit_method,
has_comment:exercise_users[i].has_comment
}) })
} else { } else {
datalist.push({ datalist.push({
@ -1599,8 +1600,9 @@ class Studentshavecompletedthelist extends Component {
efficiencyscore: exercise_users[i].score === null ? "--" : exercise_users[i].score === "" ? "--" : exercise_users[i].score, efficiencyscore: exercise_users[i].score === null ? "--" : exercise_users[i].score === "" ? "--" : exercise_users[i].score,
objective_score: exercise_users[i].objective_score === null ? "--" : exercise_users[i].objective_score === "" ? "--" : exercise_users[i].objective_score, objective_score: exercise_users[i].objective_score === null ? "--" : exercise_users[i].objective_score === "" ? "--" : exercise_users[i].objective_score,
subjective_score:exercise_users[i].subjective_score === null ? "--" : exercise_users[i].subjective_score === "" ? "--" : exercise_users[i].subjective_score, subjective_score:exercise_users[i].subjective_score === null ? "--" : exercise_users[i].subjective_score === "" ? "--" : exercise_users[i].subjective_score,
operating: "--", operating:exercise_users[i].has_comment===true?"已评阅":"--",
commit_method:exercise_users[i].commit_method commit_method:exercise_users[i].commit_method,
has_comment:exercise_users[i].has_comment
}) })
} }
@ -1670,8 +1672,9 @@ class Studentshavecompletedthelist extends Component {
efficiencyscore: exercise_users[i].score === null ? "--" : exercise_users[i].score === "" ? "--" : exercise_users[i].score, efficiencyscore: exercise_users[i].score === null ? "--" : exercise_users[i].score === "" ? "--" : exercise_users[i].score,
objective_score: exercise_users[i].objective_score === null ? "--" : exercise_users[i].objective_score === "" ? "--" : exercise_users[i].objective_score, objective_score: exercise_users[i].objective_score === null ? "--" : exercise_users[i].objective_score === "" ? "--" : exercise_users[i].objective_score,
subjective_score:exercise_users[i].subjective_score === null ? "--" : exercise_users[i].subjective_score === "" ? "--" : exercise_users[i].subjective_score, subjective_score:exercise_users[i].subjective_score === null ? "--" : exercise_users[i].subjective_score === "" ? "--" : exercise_users[i].subjective_score,
operating: "查看", operating:exercise_users[i].has_comment===true?"已评阅":"查看",
commit_method:exercise_users[i].commit_method, commit_method:exercise_users[i].commit_method,
has_comment:exercise_users[i].has_comment
}) })
noclassroom = exercise_users[i].user_group_name; noclassroom = exercise_users[i].user_group_name;
} }
@ -1817,9 +1820,10 @@ class Studentshavecompletedthelist extends Component {
efficiencyscore: exercise_users[i].score === undefined ? "--" : exercise_users[i].score === null ? "--" : exercise_users[i].score === "" ? "--" : exercise_users[i].score, efficiencyscore: exercise_users[i].score === undefined ? "--" : exercise_users[i].score === null ? "--" : exercise_users[i].score === "" ? "--" : exercise_users[i].score,
objective_score: exercise_users[i].objective_score === null ? "--" : exercise_users[i].objective_score === "" ? "--" : exercise_users[i].objective_score, objective_score: exercise_users[i].objective_score === null ? "--" : exercise_users[i].objective_score === "" ? "--" : exercise_users[i].objective_score,
subjective_score:exercise_users[i].subjective_score === null ? "--" : exercise_users[i].subjective_score === "" ? "--" : exercise_users[i].subjective_score, subjective_score:exercise_users[i].subjective_score === null ? "--" : exercise_users[i].subjective_score === "" ? "--" : exercise_users[i].subjective_score,
finalscore: "评阅", finalscore:exercise_users[i].has_comment===true?"已评阅":"评阅",
user_id: exercise_users[i].user_id, user_id: exercise_users[i].user_id,
commit_method:exercise_users[i].commit_method commit_method:exercise_users[i].commit_method,
has_comment:exercise_users[i].has_comment
}) })
} else { } else {
datalist.push({ datalist.push({
@ -1836,9 +1840,10 @@ class Studentshavecompletedthelist extends Component {
efficiencyscore: exercise_users[i].score === undefined ? "--" : exercise_users[i].score === null ? "--" : exercise_users[i].score === "" ? "--" : exercise_users[i].score, efficiencyscore: exercise_users[i].score === undefined ? "--" : exercise_users[i].score === null ? "--" : exercise_users[i].score === "" ? "--" : exercise_users[i].score,
objective_score: exercise_users[i].objective_score === null ? "--" : exercise_users[i].objective_score === "" ? "--" : exercise_users[i].objective_score, objective_score: exercise_users[i].objective_score === null ? "--" : exercise_users[i].objective_score === "" ? "--" : exercise_users[i].objective_score,
subjective_score:exercise_users[i].subjective_score === null ? "--" : exercise_users[i].subjective_score === "" ? "--" : exercise_users[i].subjective_score, subjective_score:exercise_users[i].subjective_score === null ? "--" : exercise_users[i].subjective_score === "" ? "--" : exercise_users[i].subjective_score,
finalscore: "--", finalscore:exercise_users[i].has_comment===true?"已评阅":"--",
user_id: exercise_users[i].user_id, user_id: exercise_users[i].user_id,
commit_method:exercise_users[i].commit_method commit_method:exercise_users[i].commit_method,
has_comment:exercise_users[i].has_comment
}) })
indexi++; indexi++;
} }

@ -36,7 +36,8 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })(
start_time:"", start_time:"",
end_time:"", end_time:"",
attendance_date:"", attendance_date:"",
newmode:null newmode:null,
groupstype:false
} }
} }
@ -54,7 +55,8 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })(
end_time: date end_time: date
}); });
} }
componentDidMount() { getgroup_idss=(course_groups)=>{
let newcourse_groups=course_groups;
if(this.props.type==="edit"){ if(this.props.type==="edit"){
let newlist=[] let newlist=[]
if(this.props.attendancesdata.groups.length>0){ if(this.props.attendancesdata.groups.length>0){
@ -63,15 +65,26 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })(
}) })
} }
console.log(this.props.attendancesdata.start_time) newlist.map((item,key)=>{
// console.log() newcourse_groups.map((i,k)=>{
if(i.id===item){
i.disabled=true
}
})
})
// console.log(newlist)
// this.setState({
//
// })
this.setState({ this.setState({
attendance_date: this.props.attendancesdata.attendance_date, attendance_date: this.props.attendancesdata.attendance_date,
start_time:new Date(this.props.attendancesdata.start_time), start_time:new Date(this.props.attendancesdata.start_time),
end_time:new Date(this.props.attendancesdata.end_time), end_time:new Date(this.props.attendancesdata.end_time),
newmode:this.props.attendancesdata.mode, newmode:this.props.attendancesdata.mode,
course_groups:newcourse_groups,
groupstype:newlist.length===0?true:false
}) })
@ -85,6 +98,8 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })(
}else{ }else{
this.setState({ this.setState({
start_time: new Date("2000-01-01T09:00:00.000+08:00"), start_time: new Date("2000-01-01T09:00:00.000+08:00"),
course_groups:newcourse_groups,
groupstype:false
}) })
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
@ -92,15 +107,15 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })(
}); });
} }
}
componentDidMount() {
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) => {
this.getgroup_idss(response.data.course_groups)
})
this.setState({
course_groups:response.data.course_groups
})
})
} }
@ -226,7 +241,7 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })(
} }
render() { render() {
const { visible,form ,setRadio,Radiolist,hideCreatesign,editvisible} = this.props; const { visible,form ,setRadio,Radiolist,hideCreatesign,editvisible} = this.props;
let {course_groups,newmode}=this.state; let {course_groups,newmode,groupstype}=this.state;
const { getFieldDecorator } = form; const { getFieldDecorator } = form;
const { Option } = Select; const { Option } = Select;
const formItemLayout = { const formItemLayout = {
@ -268,13 +283,13 @@ 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={this.props&&this.props.type==="edit"&&this.state.groupstype===true?"已选择全部分班":course_groups.length>0?"不选择分班时默认选择全部学生":'暂无分班,将默认选择课堂全部学生'} getPopupContainer={trigger => trigger.parentNode}
disabled={this.props&&this.props.type==="edit"?true:false} disabled={this.props&&this.props.type==="edit"&&this.state.groupstype===true?true:false}
> >
{course_groups.map((item,key)=>{ {course_groups.map((item,key)=>{
return( return(
<Option value={item.id} key={key}>{item.name}</Option> <Option value={item.id} key={key} disabled={item.disabled?item.disabled:false}>{item.name}</Option>
) )
})} })}

@ -441,6 +441,40 @@ class DetailTop extends Component{
}) })
} }
setCollect=()=>{
let pathid=this.props.match.params.pathId;
let url ="/collections.json";
axios.post(url,{
container_id:pathid,
container_type:"Subject"
}).then((result)=>{
const status = result.data.status
if(status===0){
this.props.getlistdatas()
this.props.showNotification(result.data.message);
}
}).catch((error)=>{
console.log(error);
})
}
cancelCollect=()=>{
let pathid=this.props.match.params.pathId;
let url=`/collections/cancel.json`;
axios.delete(url,{ data:{
container_id:pathid,
container_type:"Subject"
}}).then((response) => {
const status = response.data.status
if(status===0){
this.props.getlistdatas()
this.props.showNotification(response.data.message);
}
}).catch((error) => {
console.log(error)
})
}
render(){ render(){
let{detailInfoList}=this.props; let{detailInfoList}=this.props;
let{Modalstype,Modalstopval,cardsModalcancel,putappointmenttype,Modalsbottomval,cardsModalsavetype,loadtype,getappointmenttype,openpathss,cancel_publics,cancel_has_publics,applyissuePaths}=this.state; let{Modalstype,Modalstopval,cardsModalcancel,putappointmenttype,Modalsbottomval,cardsModalsavetype,loadtype,getappointmenttype,openpathss,cancel_publics,cancel_has_publics,applyissuePaths}=this.state;
@ -628,6 +662,8 @@ class DetailTop extends Component{
style={{'width':'65px'}} style={{'width':'65px'}}
>删除</a>:""} >删除</a>:""}
{detailInfoList===undefined?"":detailInfoList.allow_statistics===true? {detailInfoList===undefined?"":detailInfoList.allow_statistics===true?
<Link to={"/paths/"+this.props.match.params.pathId+"/edit"} <Link to={"/paths/"+this.props.match.params.pathId+"/edit"}
style={{'width':'65px'}} style={{'width':'65px'}}
@ -636,6 +672,20 @@ class DetailTop extends Component{
</Link> </Link>
:"" :""
} }
{this.props&&this.props.user.login=== ""?"":detailInfoList&&detailInfoList.is_collect===false?<a onClick={()=>this.setCollect()}
style={{'width':'65px'}}
className="fr font-18 color-white kaike mr20 kkbths" >
收藏
</a>:""}
{
this.props&&this.props.user.login=== ""?"":detailInfoList&&detailInfoList.is_collect===true?
<a className="fr font-18 color-white kaike mr20 kkbths" onClick={()=>this.cancelCollect()}> 取消收藏
</a>:""
}
</div> </div>

@ -116,9 +116,9 @@ class PathDetailIndex extends Component{
members:items, members:items,
items items
}); });
console.log(this.state.members) // console.log(this.state.members)
console.log("items 数组数组数组数组") // console.log("items 数组数组数组数组")
console.log(items) // console.log(items)
} }
cardsModalcancel=()=>{ cardsModalcancel=()=>{
this.setState({ this.setState({

@ -806,6 +806,43 @@ class TPMBanner extends Component {
} }
} }
setCollect=()=>{
let id = this.props.match.params.shixunId;
let url ="/collections.json";
axios.post(url,{
container_id:id,
container_type:"Shixun"
}).then((result)=>{
const status = result.data.status
if(status===0){
debugger
this.props.getcomponentdidmount()
this.props.showNotification(result.data.message);
}
}).catch((error)=>{
console.log(error);
})
}
cancelCollect=()=>{
let id = this.props.match.params.shixunId;
let url=`/collections/cancel.json`;
axios.delete(url,{ data:{
container_id:id,
container_type:"Shixun"
}}).then((response) => {
const status = response.data.status
if(status===0){
debugger
this.props.getcomponentdidmount()
this.props.showNotification(response.data.message);
}
}).catch((error) => {
console.log(error)
})
}
render() { render() {
let { let {
Forkvisible, Forkvisible,
@ -1235,6 +1272,23 @@ class TPMBanner extends Component {
</Tooltip> </Tooltip>
</a> </a>
} }
{console.log(this.props)}
{this.props&&this.props.user&&this.props.user.login=== ""?"":shixunsDetails&&shixunsDetails.is_collect===false?
<a onClick={()=>this.setCollect()}
className="fr kaike kkbths mr20 font-18"
// style={{'width':'65px'}}
>
收藏
</a>:""
}
{this.props&&this.props.user&&this.props.user.login=== ""?"":shixunsDetails&&shixunsDetails.is_collect===true?
<a onClick={()=>this.cancelCollect()}
className="fr kaike kkbths mr20 font-18"
>
取消收藏
</a>:""
}
<Modal <Modal
keyboard={false} keyboard={false}
@ -1326,7 +1380,7 @@ class TPMBanner extends Component {
onClick={this.copyForkvisible} onClick={this.copyForkvisible}
style={{display: shixunsDetails.can_copy === false || shixunsDetails.can_copy === null ? "none" : "inline-block"}} style={{display: shixunsDetails.can_copy === false || shixunsDetails.can_copy === null ? "none" : "inline-block"}}
> >
Fork 复制实训
</span> </span>
</Tooltip> </Tooltip>
@ -1357,7 +1411,7 @@ class TPMBanner extends Component {
} }
{Forkvisible===true?<Modal {Forkvisible===true?<Modal
keyboard={false} keyboard={false}
title="Fork原因" title="复制原因"
visible={Forkvisible} visible={Forkvisible}
closable={false} closable={false}
footer={null} footer={null}
@ -1420,7 +1474,7 @@ class TPMBanner extends Component {
</div> </div>
</Modal> </Modal>
{!!shixunsDetails.fork_num && {!!shixunsDetails.fork_num &&
<Link to={"/shixuns/" + shixunId + "/fork_list"} className="forkNumst" data-tip-down="Fork实训列表"> <Link to={"/shixuns/" + shixunId + "/fork_list"} className="forkNumst" data-tip-down="复制实训列表">
{shixunsDetails.fork_num} {shixunsDetails.fork_num}
</Link> </Link>
} }

@ -192,6 +192,7 @@ class TPMIndex extends Component {
} }
getcomponentdidmount=()=>{ getcomponentdidmount=()=>{
let userid=this.props.user&&this.props.user.user_id; let userid=this.props.user&&this.props.user.user_id;
let getnewTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings'; let getnewTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings';
let newTPMsettings=window.localStorage.getItem(getnewTPMsettings) let newTPMsettings=window.localStorage.getItem(getnewTPMsettings)

@ -222,6 +222,9 @@ class InfosPath extends Component{
<li className={category == "study" ? "active font-16 whitepanelysllis" : "font-16 whitepanelysllis"}><a <li className={category == "study" ? "active font-16 whitepanelysllis" : "font-16 whitepanelysllis"}><a
href="javascript:void(0)" onClick={() => this.changeCategory("study")} href="javascript:void(0)" onClick={() => this.changeCategory("study")}
className={is_current ? "font-16 w66" : "font-16 w80"}>{is_current ? "我" : "TA"}学习的</a></li> className={is_current ? "font-16 w66" : "font-16 w80"}>{is_current ? "我" : "TA"}学习的</a></li>
<li className={category == "collect" ? "active font-16 whitepanelysllis" : "font-16 whitepanelysllis"}><a
href="javascript:void(0)" onClick={() => this.changeCategory("collect")}
className={is_current ? "font-16 w66" : "font-16 w80"}>{is_current ? "我" : "TA"}收藏的</a></li>
</div> </div>
<style> <style>
@ -268,6 +271,20 @@ class InfosPath extends Component{
href="javascript:void(0)" onClick={() => this.changeStatus("finished")} className="w60">已完成</a></li> href="javascript:void(0)" onClick={() => this.changeStatus("finished")} className="w60">已完成</a></li>
</div> </div>
} }
{
category && category == "collect" && is_current &&
<div className="edu-back-white padding10-30 clearfix secondNavs bor-top-greyE">
<li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a href="javascript:void(0)"
onClick={() => this.changeStatus()}
className="w32">全部</a></li>
<li className={status == "unfinished" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
href="javascript:void(0)" onClick={() => this.changeStatus("unfinished")} className="w60">未完成</a></li>
<li className={status == "finished" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
href="javascript:void(0)" onClick={() => this.changeStatus("finished")} className="w60">已完成</a></li>
</div>
}
<div className="clearfix font-12 " style={{ <div className="clearfix font-12 " style={{
lineHeight: "41px", lineHeight: "41px",
marginTop: "10px", marginTop: "10px",

@ -240,6 +240,10 @@ class InfosShixun extends Component{
onClick={() => this.changeCategory("study")} onClick={() => this.changeCategory("study")}
href="javascript:void(0)" href="javascript:void(0)"
className={is_current ? "font-16 w66" : "font-16 w80"}>{is_current ? "我" : "TA"}学习的</a></li> className={is_current ? "font-16 w66" : "font-16 w80"}>{is_current ? "我" : "TA"}学习的</a></li>
<li className={category == "collect" ? "active font-16 whitepanelysllis" : "font-16 whitepanelysllis"}><a
onClick={() => this.changeCategory("collect")}
href="javascript:void(0)"
className={is_current ? "font-16 w66" : "font-16 w80"}>{is_current ? "我" : "TA"}学习的</a></li>
</div> </div>
<style> <style>
{ {
@ -275,18 +279,32 @@ class InfosShixun extends Component{
onClick={() => this.changeStatus("closed")} className="w60" href="javascript:void(0)">已关闭</a></li> onClick={() => this.changeStatus("closed")} className="w60" href="javascript:void(0)">已关闭</a></li>
</div> </div>
} }
{
category && category == "study" && is_current && {
<div className="edu-back-white padding10-30 clearfix secondNavs bor-top-greyE"> category && category == "study" && is_current &&
<li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a href="javascript:void(0)" <div className="edu-back-white padding10-30 clearfix secondNavs bor-top-greyE">
onClick={() => this.changeStatus()} <li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a href="javascript:void(0)"
className="w32">全部</a></li> onClick={() => this.changeStatus()}
<li className={status == "processing" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a className="w32">全部</a></li>
onClick={() => this.changeStatus("processing")} className="w60" href="javascript:void(0)">未通关</a></li> <li className={status == "processing" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
<li className={status == "passed" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a onClick={() => this.changeStatus("processing")} className="w60" href="javascript:void(0)">未通关</a></li>
onClick={() => this.changeStatus("passed")} className="w60" href="javascript:void(0)">已通关</a></li> <li className={status == "passed" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
</div> onClick={() => this.changeStatus("passed")} className="w60" href="javascript:void(0)">已通关</a></li>
} </div>
}
{
category && category == "collect" && is_current &&
<div className="edu-back-white padding10-30 clearfix secondNavs bor-top-greyE">
<li className={status ? "whitepanelyslliss" : "active whitepanelyslliss"}><a href="javascript:void(0)"
onClick={() => this.changeStatus()}
className="w32">全部</a></li>
<li className={status == "processing" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
onClick={() => this.changeStatus("processing")} className="w60" href="javascript:void(0)">未通关</a></li>
<li className={status == "passed" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
onClick={() => this.changeStatus("passed")} className="w60" href="javascript:void(0)">已通关</a></li>
</div>
}
<div className=" clearfix font-12 " style={{ <div className=" clearfix font-12 " style={{
lineHeight: "41px", lineHeight: "41px",
marginTop: "10px", marginTop: "10px",

Loading…
Cancel
Save