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

PCqiandao
anke1460 5 years ago
commit 699062840b

@ -0,0 +1,59 @@
class AttendancesController < ApplicationController
before_action :require_login
before_action :find_course, only: [:index, :statistics]
before_action :user_course_identity
def index
current_date = Date.current
current_end_time = Time.current.strftime("%H:%M:%S")
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})
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
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")
@attendances = paginate @attendances.includes(:user, :course_member_attendances)
end
def statistics
current_date = Date.current
current_end_time = Time.current.strftime("%H:%M:%S")
history_attendances = @course.course_attendances.where("attendance_date < '#{current_date}' or
(attendance_date = '#{current_date}' and end_time < '#{current_end_time}')")
all_member_attendances = CourseMemberAttendance.where(course_attendance_id: history_attendances)
if params[:group_id].present?
history_attendances = history_attendances.joins(:course_attendance_groups).where(course_attendance_groups: {course_group_id: [params[:group_id], 0]})
all_member_attendances = all_member_attendances.joins(:course_member).where(course_members: {course_group_id: params[:group_id]})
end
history_attendances = history_attendances.order("attendance_date desc, start_time desc")
data = AttendanceStatisticsService.call history_attendances, all_member_attendances
@all_history_count = data[:all_history_count]
@history_attendances = data[:history_attendances]
@avg_normal_rate = data[:avg_normal_rate]
@avg_absence_rate = data[:avg_absence_rate]
@avg_leave_rate = data[:avg_leave_rate]
end
private
def find_attendance
@attendance = CourseAttendance.find params[:id]
@course = @attendance.course
end
end

@ -162,7 +162,7 @@ class ChallengesController < ApplicationController
#@pass_games_map = @shixun.challenges.joins(:games).where(games: {status:2}).group(:challenge_id).reorder(nil).count #@pass_games_map = @shixun.challenges.joins(:games).where(games: {status:2}).group(:challenge_id).reorder(nil).count
#@play_games_map = @shixun.challenges.joins(:games).where(games: {status:[0,1]}).group(:challenge_id).reorder(nil).count #@play_games_map = @shixun.challenges.joins(:games).where(games: {status:[0,1]}).group(:challenge_id).reorder(nil).count
@challenges = @shixun.challenges.joins(join_sql).select(base_columns) @challenges = @shixun.challenges.joins(join_sql).select(base_columns).uniq
#@challenges = @shixun.challenges.fields_for_list #@challenges = @shixun.challenges.fields_for_list
@editable = @shixun.status == 0 # before_action有判断权限如果没发布则肯定是管理人员 @editable = @shixun.status == 0 # before_action有判断权限如果没发布则肯定是管理人员

@ -43,6 +43,12 @@ class CourseSecondCategoriesController < ApplicationController
elsif @course_module.module_type == "video" elsif @course_module.module_type == "video"
@course.course_videos.where(course_second_category_id: @category.id).update_all(course_second_category_id: 0) @course.course_videos.where(course_second_category_id: @category.id).update_all(course_second_category_id: 0)
@right_url = "/classrooms/#{@course.id}/course_videos" @right_url = "/classrooms/#{@course.id}/course_videos"
elsif @course_module.module_type == "common_homework"
@category.homework_commons.update_all(course_second_category_id: 0)
@right_url = "/classrooms/#{@course.id}/common_homeworks/#{@course_module.id}"
elsif @course_module.module_type == "group_homework"
@category.homework_commons.update_all(course_second_category_id: 0)
@right_url = "/classrooms/#{@course.id}/group_homeworks/#{@course_module.id}"
end end
@category.destroy @category.destroy

@ -560,6 +560,8 @@ class CoursesController < ApplicationController
member = CourseMember.create(course_id: @course.id, graduation_group_id: @graduation_group_id, user_id: user_id, role: role, is_active: is_active) member = CourseMember.create(course_id: @course.id, graduation_group_id: @graduation_group_id, user_id: user_id, role: role, is_active: is_active)
member.teacher_course_groups << TeacherCourseGroup.new(course_group_id: @course_group_id, user_id: user_id, course_id: @course.id) if @course_group_id != 0 member.teacher_course_groups << TeacherCourseGroup.new(course_group_id: @course_group_id, user_id: user_id, course_id: @course.id) if @course_group_id != 0
@course.course_messages.join_course_requests.unhandled.where(course_message_id: user_id).update_all(status: :PASSED)
end end
end end
TeacherInviteJoinCourseNotifyJob.perform_later(current_user.id, @course.id, role, teacher_ids) if teacher_ids.present? TeacherInviteJoinCourseNotifyJob.perform_later(current_user.id, @course.id, role, teacher_ids) if teacher_ids.present?

@ -42,6 +42,10 @@ class FilesController < ApplicationController
@unpublish_count = @total_count - @publish_count @unpublish_count = @total_count - @publish_count
@attachments = @attachments.by_keywords(params[:search]) @attachments = @attachments.by_keywords(params[:search])
if params[:no_link]
@attachments = @attachments.no_link
end
@attachments = @attachments.page(@page).per(@page_size) @attachments = @attachments.page(@page).per(@page_size)
end end
@ -138,7 +142,7 @@ class FilesController < ApplicationController
end end
def public_with_course_and_project def public_with_course_and_project
@attachments = Attachment.publiced.simple_columns @attachments = Attachment.publiced.no_link.simple_columns
.contains_course_and_project .contains_course_and_project
.includes(:container, author: :user_extension) .includes(:container, author: :user_extension)
.by_filename_or_user_name(params[:search]) .by_filename_or_user_name(params[:search])
@ -151,7 +155,7 @@ class FilesController < ApplicationController
def mine_with_course_and_project def mine_with_course_and_project
@current_user = current_user @current_user = current_user
@attachments = Attachment.mine(current_user) @attachments = Attachment.mine(current_user).no_link
.simple_columns .simple_columns
.contains_course_and_project .contains_course_and_project
.by_keywords(params[:search]) .by_keywords(params[:search])

@ -21,24 +21,18 @@ class MyshixunsController < ApplicationController
unless (current_user.admin? || current_user.id == @myshixun.user_id) unless (current_user.admin? || current_user.id == @myshixun.user_id)
tip_exception("403", "") tip_exception("403", "")
end end
begin
ActiveRecord::Base.transaction do
begin begin
@shixun = Shixun.select(:id, :identifier, :challenges_count).find(@myshixun.shixun_id) @shixun = Shixun.select(:id, :identifier, :challenges_count).find(@myshixun.shixun_id)
ActiveRecord::Base.transaction do
@myshixun.destroy! @myshixun.destroy!
StudentWork.where(:myshixun_id => @myshixun.id).update_all(myshixun_id: 0, work_status: 0, work_score: nil,
StudentWork.where(:myshixun_id => @myshixun.id)
.update_all(myshixun_id: 0, work_status: 0, work_score: nil,
final_score: nil, efficiency: 0, eff_score: 0, calculation_time: nil, cost_time: 0, compelete_status: 0) final_score: nil, efficiency: 0, eff_score: 0, calculation_time: nil, cost_time: 0, compelete_status: 0)
rescue Exception => e
logger.error("######reset_my_game_failed:#{e.message}")
raise("ActiveRecord::RecordInvalid")
end
end end
# 删除版本库 # 删除版本库
GitService.delete_repository(repo_path: @repo_path) unless @shixun.is_choice_type? GitService.delete_repository(repo_path: @repo_path) unless @shixun.is_choice_type?
rescue Exception => e rescue Exception => e
if e.message != "ActiveRecord::RecordInvalid"
logger.error("######delete_repository_error-:#{e.message}")
end
raise "delete_repository_error:#{e.message}" raise "delete_repository_error:#{e.message}"
end end
end end

@ -37,8 +37,14 @@ class Weapps::AttendancesController < ApplicationController
@all_member_attendances = @all_member_attendances.joins(:course_member).where(course_members: {course_group_id: params[:group_id]}) @all_member_attendances = @all_member_attendances.joins(:course_member).where(course_members: {course_group_id: params[:group_id]})
end end
@history_attendances = all_attendances.order("id asc") all_attendances = all_attendances.order("attendance_date desc, start_time desc")
@all_history_count = @history_attendances.size
data = AttendanceStatisticsService.call all_attendances, @all_member_attendances
@all_history_count = data[:all_history_count]
@history_attendances = data[:history_attendances]
@avg_normal_rate = data[:avg_normal_rate]
@avg_absence_rate = data[:avg_absence_rate]
@avg_leave_rate = data[:avg_leave_rate]
end end
def student_attendances def student_attendances
@ -94,7 +100,9 @@ class Weapps::AttendancesController < ApplicationController
@absence_count = @attendance.absence_count @absence_count = @attendance.absence_count
@all_count = @attendance.course_member_attendances.size @all_count = @attendance.course_member_attendances.size
@_is_current_attendance = @attendance.current_attendance? a_end_time = "#{@attendance.attendance_date} #{@attendance.end_time}".to_time
@_is_current_attendance = Time.current < a_end_time
if @attendance.course_attendance_groups.first&.course_group_id.to_i == 0 if @attendance.course_attendance_groups.first&.course_group_id.to_i == 0
@group_ids = @course.course_groups.pluck(:id) + [0] @group_ids = @course.course_groups.pluck(:id) + [0]

@ -25,6 +25,7 @@ class Attachment < ApplicationRecord
scope :search_by_container, -> (ids) {where(container_id: ids)} scope :search_by_container, -> (ids) {where(container_id: ids)}
scope :unified_setting, -> {where("unified_setting = ? ", 1)} scope :unified_setting, -> {where("unified_setting = ? ", 1)}
scope :published, -> {where(is_publish: 1)} scope :published, -> {where(is_publish: 1)}
scope :no_link, -> {where(link: nil)}
validates_length_of :description, maximum: 100, message: "不能超过100个字符" validates_length_of :description, maximum: 100, message: "不能超过100个字符"

@ -75,7 +75,7 @@ class Challenge < ApplicationRecord
if identifier.present? if identifier.present?
shixun.task_pass || self.status != 3 ? "/tasks/#{identifier}" : "" shixun.task_pass || self.status != 3 ? "/tasks/#{identifier}" : ""
else else
self.position == 1 ? "/api/shixuns/#{shixun.identifier}/shixun_exec" : "" self.position == 1 ? "/shixuns/#{shixun.identifier}/shixun_exec.json" : ""
end end
end end
@ -143,7 +143,7 @@ class Challenge < ApplicationRecord
# 关卡用户通关数 # 关卡用户通关数
def user_passed_count def user_passed_count
#games.map{|g| g.status == 2}.count #games.map{|g| g.status == 2}.count
self.games.where(status: 1).count self.games.where(status: 2).count
end end
# 关卡用户正在挑战的人数 # 关卡用户正在挑战的人数

@ -7,6 +7,7 @@
class Game < ApplicationRecord class Game < ApplicationRecord
default_scope { order("games.created_at desc") } default_scope { order("games.created_at desc") }
#TODO: games表要增加challenge_id与user_id的唯一索引
has_many :outputs, -> { order('query_index DESC') } has_many :outputs, -> { order('query_index DESC') }
has_many :challenge_samples, :dependent => :destroy has_many :challenge_samples, :dependent => :destroy
has_many :game_codes, :dependent => :destroy has_many :game_codes, :dependent => :destroy

@ -0,0 +1,54 @@
class AttendanceStatisticsService < ApplicationService
attr_reader :attendances, :member_attendances
def initialize(attendances, member_attendances)
@attendances = attendances
@member_attendances = member_attendances
end
def call
all_normal_rate = []
all_absence_rate = []
all_leave_rate = []
history_attendances = []
attendances.each do |attendance|
normal_count = history_member_count(member_attendances, "NORMAL", attendance.id)
absence_count = history_member_count(member_attendances, "ABSENCE", attendance.id)
leave_count = history_member_count(member_attendances, "LEAVE", attendance.id)
all_count = member_attendances.select{|member_attendance| member_attendance.course_attendance_id == attendance.id}.size
normal_rate = cal_rate(normal_count, all_count)
all_normal_rate << normal_rate
absence_rate = cal_rate(absence_count, all_count)
all_absence_rate << absence_rate
leave_rate = cal_rate(leave_count, all_count)
all_leave_rate << leave_rate
history_attendances << {name: attendance.name, attendance_date: attendance.attendance_date.strftime("%Y-%m-%d"),
start_time: attendance.start_time.strftime("%H:%M"), end_time: attendance.end_time.strftime("%H:%M"),
normal_rate: normal_rate, absence_rate: absence_rate, leave_rate: leave_rate}
end
all_history_count = history_attendances.size
history_attendances = history_attendances[0..9].reverse
avg_normal_rate = cal_rate(all_normal_rate.sum, all_history_count)
avg_absence_rate = cal_rate(all_absence_rate.sum, all_history_count)
avg_leave_rate = cal_rate(all_leave_rate.sum, all_history_count)
{all_history_count: all_history_count, history_attendances: history_attendances, avg_normal_rate: avg_normal_rate,
avg_absence_rate: avg_absence_rate, avg_leave_rate: avg_leave_rate}
end
private
def history_member_count member_attendances, status, attendance_id
member_attendances.select{|member_attendance| member_attendance.attendance_status == status && member_attendance.course_attendance_id == attendance_id}.size
end
def cal_rate base, sum
sum == 0 ? 0 : (base.to_f / sum)
end
end

@ -0,0 +1,24 @@
json.attendances @attendances do |attendance|
json.(attendance, :id, :name, :normal_count, :all_count, :mode)
json.author do
user = attendance.user
json.user_name user.real_name
json.user_login user.login
end
json.attendance_date attendance.attendance_date.strftime("%Y-%m-%d")
json.start_time attendance.start_time.strftime("%H:%M")
json.end_time attendance.end_time.strftime("%H:%M")
json.edit_auth @user_course_identity < Course::PROFESSOR || attendance.user_id == User.current.id
if @user_course_identity == Course::STUDENT
json.attendance_status student_attendance_status(attendance, User.current)
end
end
json.attendances_count @attendances_count
if @user_course_identity == Course::STUDENT
json.normal_count @normal_count
json.leave_count @leave_count
json.absence_count @absence_count
end

@ -0,0 +1,10 @@
json.history_attendances @history_attendances.each_with_index.to_a do |attendance, index|
json.(attendance, :name, :attendance_date, :start_time, :end_time, :normal_rate, :absence_rate, :leave_rate)
json.index "签到#{index + 1}"
end
json.all_history_count @all_history_count
json.avg_normal_rate @avg_normal_rate
json.avg_absence_rate @avg_absence_rate
json.avg_leave_rate @avg_leave_rate

@ -5,25 +5,12 @@ json.current_attendance @current_attendance do |attendance|
json.end_time attendance.end_time.strftime("%H:%M") json.end_time attendance.end_time.strftime("%H:%M")
end end
all_normal_rate = []
all_absence_rate = []
all_leave_rate = []
json.history_attendances @history_attendances.each_with_index.to_a do |attendance, index| json.history_attendances @history_attendances.each_with_index.to_a do |attendance, index|
normal_count = history_member_count(@all_member_attendances, "NORMAL", attendance.id) json.(attendance, :name, :attendance_date, :start_time, :end_time, :normal_rate, :absence_rate, :leave_rate)
absence_count = history_member_count(@all_member_attendances, "ABSENCE", attendance.id)
leave_count = history_member_count(@all_member_attendances, "LEAVE", attendance.id)
all_count = @all_member_attendances.select{|member_attendance| member_attendance.course_attendance_id == attendance.id}.size
json.index index + 1 json.index index + 1
json.normal_rate cal_rate(normal_count, all_count)
all_normal_rate << cal_rate(normal_count, all_count)
json.absence_rate cal_rate(absence_count, all_count)
all_absence_rate << cal_rate(absence_count, all_count)
json.leave_rate cal_rate(leave_count, all_count)
all_leave_rate << cal_rate(leave_count, all_count)
end end
json.all_history_count @all_history_count json.all_history_count @all_history_count
json.avg_normal_rate @all_history_count == 0 ? 0 : all_normal_rate.sum / @all_history_count json.avg_normal_rate @avg_normal_rate
json.avg_absence_rate @all_history_count == 0 ? 0 : all_absence_rate.sum / @all_history_count json.avg_absence_rate @avg_absence_rate
json.avg_leave_rate @all_history_count == 0 ? 0 : all_leave_rate.sum / @all_history_count json.avg_leave_rate @avg_leave_rate

@ -550,6 +550,10 @@ Rails.application.routes.draw do
end end
end end
resources :attendances, shallow: true do
get :statistics, on: :collection
end
resources :polls, only:[:index,:new,:create] do resources :polls, only:[:index,:new,:create] do
collection do collection do
post :publish # 立即发布 post :publish # 立即发布

@ -0,0 +1,28 @@
#coding=utf-8
desc "合并高校的数据,第一个参数是: 正确高校的id, 第二个参数是: 错误高校需要合并到正确高校的id"
# 命令: bundle exec rake schools:merge_school_data f_school=1 s_school=2,3
namespace :schools do
task merge_school_data: :environment do
f_school = ENV['f_school'].to_i
school = School.find_by(id: f_school)
return if school.blank?
s_school = ENV['s_school'].split(",")
merge_schools = School.where(id: s_school)
# 改变用户的学校id 和 单位
UserExtension.where(school_id: merge_schools)
.update_all(school_id: f_school, department_id: nil)
# 改变课堂的学校id
Course.where(school_id: merge_schools).update_all(school_id: f_school)
# 实训报告表迁移数据
s_report = SchoolReport.find_by(school_id: f_school)
SchoolReport.where(school_id: merge_schools).each do |sr|
s_report.update_column(:shixun_evaluate_count, (s_report.shixun_evaluate_count+sr.shixun_evaluate_count))
sr.update(shixun_evaluate_count: 0)
end
end
end

@ -2,13 +2,18 @@
namespace :video_transcode do namespace :video_transcode do
desc "视频转码成h264" desc "视频转码成h264"
task :submit => :environment do task :submit => :environment do
Video.find_each do |v| i = []
if v.uuid && !v.transcoded && !v.file_url.include?('.mp4') && !AliyunVod::Service.get_meta_code_info(v.uuid)[:codecnamne].start_with?("h264", "h265") Video.where.not(uuid: nil, file_url: nil).where(transcoded: false, status: "published").find_each do |v|
p "--- Start submit video trans code #{v.uuid}" code_info = AliyunVod::Service.get_meta_code_info(v.uuid)
AliyunVod::Service.submit_transcode_job(v.uuid, 'a0277c5c0c7458458e171b0cee6ebf5e') if v.file_url.include?('.mp4') && code_info[:codecnamne]&.include?("h264")
else
v.update(transcoded: true) 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')
end end
end end
puts "###########转码个数:#{i.size}"
puts "###########id,file_url, codecnamne:#{i}"
end end
end end

@ -55,7 +55,7 @@ export const formatDelta = (deltas) => {
*/ */
export const operate = (text, key, value) => { export const operate = (text, key, value) => {
let operatedText = null; let operatedText = null;
debugger;
switch (key) { switch (key) {
case 'bold': case 'bold':
operatedText = `<strong>${text}</strong>`; operatedText = `<strong>${text}</strong>`;

@ -34,7 +34,7 @@ class CompetitionContentsMd extends Component{
}else{ }else{
chart_rules.rule_contents.map((items,keys)=>{ chart_rules.rule_contents.map((items,keys)=>{
debugger
if(parseInt(this.props.tabkey)===items.competition_stage_id){ if(parseInt(this.props.tabkey)===items.competition_stage_id){
console.log(items) console.log(items)
this.contentMdRef.current.setValue(items.content); this.contentMdRef.current.setValue(items.content);

@ -684,12 +684,24 @@ class CoursesIndex extends Component{
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>) (props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
} }
></Route> ></Route>
{/* 子目录普通作业 */}
<Route path="/classrooms/:coursesId/common_homework/:category_id" exact
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/* 分组作业 */} {/* 分组作业 */}
<Route path="/classrooms/:coursesId/group_homeworks/:category_id" exact <Route path="/classrooms/:coursesId/group_homeworks/:category_id" exact
render={ render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>) (props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
} }
></Route> ></Route>
{/* 分组作业 */}
<Route path="/classrooms/:coursesId/group_homework/:category_id" exact
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/* 普通作业 */} {/* 普通作业 */}
<Route path="/classrooms/:coursesId/common_homeworks/" strict <Route path="/classrooms/:coursesId/common_homeworks/" strict
@ -697,6 +709,12 @@ class CoursesIndex extends Component{
(props) => (<CommonWork {...this.props} {...props} {...this.state} {...common}/>) (props) => (<CommonWork {...this.props} {...props} {...this.state} {...common}/>)
} }
></Route> ></Route>
{/* 子普通作业 */}
<Route path="/classrooms/:coursesId/common_homework/" strict
render={
(props) => (<CommonWork {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/* 分组作业 */} {/* 分组作业 */}
<Route path="/classrooms/:coursesId/group_homeworks/" strict <Route path="/classrooms/:coursesId/group_homeworks/" strict
@ -705,6 +723,14 @@ class CoursesIndex extends Component{
} }
></Route> ></Route>
{/* 分组作业 */}
<Route path="/classrooms/:coursesId/group_homework/" strict
render={
(props) => (<GroupWork {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/* 问卷答题 */} {/* 问卷答题 */}
<Route path="/classrooms/:coursesId/polls/:pollId/users/:login" <Route path="/classrooms/:coursesId/polls/:pollId/users/:login"
render={ render={

@ -230,6 +230,12 @@ class ListPageIndex extends Component{
(props) => (<CommonWork {...this.props} {...props} {...this.state} />) (props) => (<CommonWork {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
{/* 普通作业 */}
<Route path="/classrooms/:coursesId/common_homework/:category_id"
render={
(props) => (<CommonWork {...this.props} {...props} {...this.state} />)
}
></Route>
{/* 作品列表 */} {/* 作品列表 */}
<Route path="/classrooms/:coursesId/group_homeworks/:category_id" <Route path="/classrooms/:coursesId/group_homeworks/:category_id"
@ -237,6 +243,12 @@ class ListPageIndex extends Component{
(props) => (<CommonWork {...this.props} {...props} {...this.state} />) (props) => (<CommonWork {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
{/* 作品列表 */}
<Route path="/classrooms/:coursesId/group_homework/:category_id"
render={
(props) => (<CommonWork {...this.props} {...props} {...this.state} />)
}
></Route>
<Route exact path="/classrooms/:coursesId/boards/:boardId" <Route exact path="/classrooms/:coursesId/boards/:boardId"
render={ render={

@ -13,6 +13,7 @@ import VideoPanel from './video-play'
import './video.css'; import './video.css';
import '../../user/usersInfo/video/InfosVideo.css' import '../../user/usersInfo/video/InfosVideo.css'
import axios from 'axios'; import axios from 'axios';
import { logWatchHistory } from "../../../services/video-service";
const DEFAULT_VIDEO_WIDTH_IN_MD = "90%" // 400 const DEFAULT_VIDEO_WIDTH_IN_MD = "90%" // 400
const DEFAULT_VIDEO_HEIGHT_IN_MD = "55%" // 400 const DEFAULT_VIDEO_HEIGHT_IN_MD = "55%" // 400
@ -31,8 +32,8 @@ class Video extends Component {
videoVisible: false, videoVisible: false,
visible: false, visible: false,
moveVisible:false, moveVisible: false,
moveVideoId:undefined moveVideoId: undefined
} }
} }
@ -70,7 +71,6 @@ class Video extends Component {
} }
} }
// 编辑成功后回调的方法 // 编辑成功后回调的方法
editSuccess = () => { editSuccess = () => {
this.props.showNotification("视频信息修改成功!"); this.props.showNotification("视频信息修改成功!");
@ -82,7 +82,7 @@ class Video extends Component {
let videoId = { let videoId = {
videoId: item.id, videoId: item.id,
title: item.title, title: item.title,
link:item.link link: item.link
} }
this.setState({ this.setState({
videoId, videoId,
@ -118,8 +118,6 @@ class Video extends Component {
_clipboard = null; _clipboard = null;
} }
} else { } else {
// videoEl.current && videoEl.current.play()
setTimeout(() => { setTimeout(() => {
if (!_clipboard) { if (!_clipboard) {
_clipboard = new ClipboardJS('.copybtn'); _clipboard = new ClipboardJS('.copybtn');
@ -148,7 +146,7 @@ class Video extends Component {
axios.delete(url, { axios.delete(url, {
params: { params: {
video_id: item.id, video_id: item.id,
is_link:item.link ? true : undefined is_link: item.link ? true : undefined
} }
}).then(result => { }).then(result => {
if (result) { if (result) {
@ -168,30 +166,30 @@ class Video extends Component {
} }
// 移动到 // 移动到
moveVideo=(id,flag)=>{ moveVideo = (id, flag) => {
if(!flag){ if (!flag) {
this.setState({ this.setState({
moveVisible:true, moveVisible: true,
moveVideoId:id moveVideoId: id
}) })
}else{ } else {
this.props.define({ this.props.define({
title:'提示', title: '提示',
content:"您不是课堂管理员或者视频发布者,暂不能移动视频。", content: "您不是课堂管理员或者视频发布者,暂不能移动视频。",
}) })
} }
} }
setMoveVisible=(flag)=>{ setMoveVisible = (flag) => {
this.setState({ this.setState({
moveVisible:flag, moveVisible: flag,
moveVideoId:undefined moveVideoId: undefined
}) })
} }
render() { render() {
const { visible, videoVisible, videoId , moveVisible , moveVideoId } = this.state; const { visible, videoVisible, videoId, moveVisible, moveVideoId } = this.state;
const CourseId = this.props.match.params.coursesId; const CourseId = this.props.match.params.coursesId;
const VID=this.props.match.params.videoId; const VID = this.props.match.params.videoId;
const login = this.props.user && this.props.user.login; const login = this.props.user && this.props.user.login;
const _inputValue = videoId && this.getCopyText(videoId.file_url, videoId.cover_url); const _inputValue = videoId && this.getCopyText(videoId.file_url, videoId.cover_url);
@ -201,7 +199,7 @@ class Video extends Component {
const { videos, upload, uploadVideo, videoData, changePage, pageSize, page } = this.props; const { videos, upload, uploadVideo, videoData, changePage, pageSize, page } = this.props;
const operation = admin || business; const operation = admin || business;
const {course_identity} = this.props.coursedata; const { course_identity } = this.props.coursedata;
const flagMove = parseInt(course_identity) < 5; const flagMove = parseInt(course_identity) < 5;
return ( return (
@ -214,8 +212,8 @@ class Video extends Component {
{...this.props} {...this.props}
visible={moveVisible} visible={moveVisible}
mainId={videoData && videoData.course_module_id} mainId={videoData && videoData.course_module_id}
setMoveVisible={(flag)=>this.setMoveVisible(flag)} setMoveVisible={(flag) => this.setMoveVisible(flag)}
successFunc={()=>uploadVideo()} successFunc={() => uploadVideo()}
id={moveVideoId} id={moveVideoId}
></MoveBox> ></MoveBox>
<HeadlessModal <HeadlessModal
@ -224,7 +222,7 @@ class Video extends Component {
className="showVideoModal" className="showVideoModal"
width={800 - 1} width={800 - 1}
> >
{videoId && <VideoPanel src={videoId.file_url} />} {videoId && <VideoPanel src={videoId.file_url} videoId={videoId.videoId} courseId={CourseId} logWatchHistory={logWatchHistory} />}
<div className="df copyLine"> <div className="df copyLine">
<Input value={_inputValue} <Input value={_inputValue}
@ -259,7 +257,7 @@ class Video extends Component {
getCopyText={this.getCopyText} getCopyText={this.getCopyText}
operation={operation || item.user_id === user_id} operation={operation || item.user_id === user_id}
deleteVideo={(admin || item.user_id === user_id) ? this.deleteVideo : undefined} deleteVideo={(admin || item.user_id === user_id) ? this.deleteVideo : undefined}
moveVideo={videoData && videoData.has_category && flagMove ? ()=>this.moveVideo(item.id,(course_identity > 2 && item.user_id !== user_id)):undefined} moveVideo={videoData && videoData.has_category && flagMove ? () => this.moveVideo(item.id, (course_identity > 2 && item.user_id !== user_id)) : undefined}
> >
</VideoInReviewItem> </VideoInReviewItem>
) )

@ -1,37 +0,0 @@
import React, { useEffect, useRef } from 'react'
export default ({ url }) => {
const ref = useRef()
useEffect(() => {
let player = null
if (window.flvjs.isSupported) {
player = window.flvjs.createPlayer({
type: 'flv',
volume: 0.8,
cors: true,
url,
muted: false
})
if (ref.current) {
player.attachMediaElement(ref.current)
player.load()
player.play()
}
}
return () => {
if (player) {
player.unload()
player.pause()
player.destroy()
player = null
}
}
}, [url, ref.current])
return (
<video ref={ref} controls autoPlay={true} muted={false} className="flv-player"></video>
)
}

@ -1,18 +1,139 @@
import React, { Fragment } from 'react' import React, { useRef, useEffect, useCallback } from 'react'
import ReactFlvPlayer from './flv-player'
const regex = /(android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini)/i
// https://www.showdoc.cc/educoder?page_id=4029884447803706
export default ({ src, videoId, logWatchHistory, courseId = null }) => {
export default ({ src }) => {
const suf = src.split('.').pop() const suf = src.split('.').pop()
const isFlv = suf === 'flv' const isFlv = suf === 'flv'
return ( const el = useRef()
<Fragment>
{ const deviceMatch = navigator.userAgent.toLowerCase().match(regex)
isFlv ? <ReactFlvPlayer url={src} isMuted={true} /> : <video src={src} controls autoPlay={true} controlsList="nodownload"> const device = deviceMatch ? deviceMatch[0] : 'pc'
<source type={`video/${suf}`} src={src} />
您的浏览器不支持 video 标签 let totalDuration = 0
</video> let totalTimePlayed = 0
let sumTimePlayed = 0
let lastUpdatedTime = 0
let lastEffectUpdatedTime = 0
let logId = null
let initLog = false
let timeTick = 20 // 20s
let logCount = 1
const log = useCallback((callback) => {
let params = {}
if (logId) {
params['log_id'] = logId
params['watch_duration'] = totalTimePlayed //
params['total_duration'] = sumTimePlayed //
} else {
if (courseId) {
params['course_video_id'] = videoId
} else {
params['video_id'] = videoId
} }
</Fragment> params['duration'] = totalDuration
params['device'] = device
}
async function getLogId() {
let id = await logWatchHistory(params)
logId = id
if (callback) {
callback()
}
}
getLogId()
}, [videoId, courseId])
useEffect(() => {
let player = null
if (window.flvjs.isSupported && isFlv) {
player = window.flvjs.createPlayer({
type: 'flv',
volume: 0.8,
cors: true,
url: src,
muted: false
})
if (el.current) {
player.attachMediaElement(el.current)
player.load()
}
} else {
el.current.setAttribute('src', src)
}
return () => {
if (player) {
player.unload()
player.pause()
player.destroy()
player = null
}
}
}, [el, isFlv, src])
useEffect(() => {
function onPlay() {
if (!initLog) {
initLog = true
log()
}
}
async function onEnded() {
log(() => {
logId = null
logCount = 1
totalTimePlayed = 0
lastUpdatedTime = 0
sumTimePlayed = 0
initLog = false
lastEffectUpdatedTime = 0
})
}
function onTimeupdate() {
let newTime = el.current.currentTime
let timeDiff = newTime - lastUpdatedTime
let effectTimeDiff = newTime - lastEffectUpdatedTime
if (effectTimeDiff > 0) {
totalTimePlayed += effectTimeDiff
lastEffectUpdatedTime = newTime
}
sumTimePlayed += Math.abs(timeDiff)
lastUpdatedTime = newTime
if (sumTimePlayed - logCount * timeTick >= 0) {
logCount++
log()
}
}
function onCanPlay() {
totalDuration = el.current.duration
if (totalDuration <= 20) {
timeTick = totalDuration / 3
}
el.current.addEventListener('play', onPlay)
}
el.current.addEventListener('canplay', onCanPlay)
el.current.addEventListener('ended', onEnded)
el.current.addEventListener('timeupdate', onTimeupdate)
return () => {
el.current.removeEventListener('canplay', onCanPlay)
el.current.removeEventListener('play', onPlay)
el.current.removeEventListener('ended', onEnded)
el.current.removeEventListener('timeupdate', onTimeupdate)
}
}, [el, src])
return (
<video ref={el} controls autoPlay={false} controlsList="nodownload" muted={false} />
) )
} }

@ -222,6 +222,8 @@ class CommonWorkDetailIndex extends Component{
let exportUrl = `/homework_commons/${workId}/works_list.zip?${queryString.stringify(params)}` let exportUrl = `/homework_commons/${workId}/works_list.zip?${queryString.stringify(params)}`
let exportResultUrl = `/homework_commons/${workId}/works_list.xlsx?${queryString.stringify(params)}` let exportResultUrl = `/homework_commons/${workId}/works_list.xlsx?${queryString.stringify(params)}`
document.title=course_name === undefined ? "" : course_name; document.title=course_name === undefined ? "" : course_name;
console.log(category_id)
return ( return (
<div> <div>
<PublishRightnow ref={this.publishModal} showActionButton={false} {...this.props} checkBoxValues={[workId]} <PublishRightnow ref={this.publishModal} showActionButton={false} {...this.props} checkBoxValues={[workId]}
@ -426,6 +428,12 @@ class CommonWorkDetailIndex extends Component{
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/common_homework/:workId/setting"
render={
(props) => (<CommonWorkSetting {...this.props} {...props} {...this.state} {...commonHandler}/>)
}
></Route>
{/* 作品列表 */} {/* 作品列表 */}
<Route exact path="/classrooms/:coursesId/common_homeworks/:workId/list" <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/list"
render={ render={
@ -433,17 +441,35 @@ class CommonWorkDetailIndex extends Component{
} }
></Route> ></Route>
{/* 作品列表 */}
<Route exact path="/classrooms/:coursesId/common_homework/:workId/list"
render={
(props) => (<CommonWorkList ref="commonWorkList" triggerRef={this.bindRef} {...this.props} {...props} {...this.state} {...commonHandler}/>)
}
></Route>
{/* 作业问答 */} {/* 作业问答 */}
<Route exact path="/classrooms/:coursesId/common_homeworks/:workId/question" <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/question"
render={ render={
(props) => (<CommonWorkQuestion {...this.props} {...props} {...this.state} {...commonHandler}/>) (props) => (<CommonWorkQuestion {...this.props} {...props} {...this.state} {...commonHandler}/>)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/common_homework/:workId/question"
render={
(props) => (<CommonWorkQuestion {...this.props} {...props} {...this.state} {...commonHandler}/>)
}
></Route>
<Route exact path="/classrooms/:coursesId/common_homeworks/:workId/answer" <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/answer"
render={ render={
(props) => (<CommonWorkAnswer {...this.props} {...props} {...this.state} {...commonHandler}/>) (props) => (<CommonWorkAnswer {...this.props} {...props} {...this.state} {...commonHandler}/>)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/common_homework/:workId/answer"
render={
(props) => (<CommonWorkAnswer {...this.props} {...props} {...this.state} {...commonHandler}/>)
}
></Route>
<Route exact path="/classrooms/:coursesId/group_homeworks/:workId/setting" <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/setting"
@ -451,25 +477,43 @@ class CommonWorkDetailIndex extends Component{
(props) => (<CommonWorkSetting {...this.props} {...props} {...this.state} {...commonHandler}/>) (props) => (<CommonWorkSetting {...this.props} {...props} {...this.state} {...commonHandler}/>)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/group_homework/:workId/setting"
render={
(props) => (<CommonWorkSetting {...this.props} {...props} {...this.state} {...commonHandler}/>)
}
></Route>
{/* 作品列表 */} {/* 作品列表 */}
<Route exact path="/classrooms/:coursesId/group_homeworks/:workId/list" <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/list"
render={ render={
(props) => (<CommonWorkList triggerRef={this.bindRef} {...this.props} {...props} {...this.state} {...commonHandler}/>) (props) => (<CommonWorkList triggerRef={this.bindRef} {...this.props} {...props} {...this.state} {...commonHandler}/>)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/group_homework/:workId/list"
render={
(props) => (<CommonWorkList triggerRef={this.bindRef} {...this.props} {...props} {...this.state} {...commonHandler}/>)
}
></Route>
{/* 作业问答 */} {/* 作业问答 */}
<Route exact path="/classrooms/:coursesId/group_homeworks/:workId/question" <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/question"
render={ render={
(props) => (<CommonWorkQuestion {...this.props} {...props} {...this.state} {...commonHandler}/>) (props) => (<CommonWorkQuestion {...this.props} {...props} {...this.state} {...commonHandler}/>)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/group_homework/:workId/question"
render={
(props) => (<CommonWorkQuestion {...this.props} {...props} {...this.state} {...commonHandler}/>)
}
></Route>
<Route exact path="/classrooms/:coursesId/group_homeworks/:workId/answer" <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/answer"
render={ render={
(props) => (<CommonWorkAnswer {...this.props} {...props} {...this.state} {...commonHandler}/>) (props) => (<CommonWorkAnswer {...this.props} {...props} {...this.state} {...commonHandler}/>)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/group_homework/:workId/answer"
render={
(props) => (<CommonWorkAnswer {...this.props} {...props} {...this.state} {...commonHandler}/>)
}
></Route>
</Switch> </Switch>
</div> </div>
</div> </div>

@ -163,7 +163,7 @@ class CommonWorkItem extends Component{
} }
<div className="flex1" onClick={() => this.props.onItemClick(Object.assign({}, item, {id: item.homework_id})) }> <div className="flex1" onClick={() => this.props.onItemClick(Object.assign({}, item, {id: item.homework_id})) }>
<p className="clearfix mb20"> <p className="clearfix">
{canNotLink?<span className={"fl font-16 font-bd mt2 comnonwidth580 pointer color-grey-name"} {canNotLink?<span className={"fl font-16 font-bd mt2 comnonwidth580 pointer color-grey-name"}
title={ canNotLink ? "私有属性,非课堂成员不能访问" : item.name} title={ canNotLink ? "私有属性,非课堂成员不能访问" : item.name}
> >
@ -199,7 +199,13 @@ class CommonWorkItem extends Component{
</li> </li>
} */} } */}
</p> </p>
<p className="color-grey-9 clearfix"> {
item && item.upper_category_name &&
// <ConditionToolTip title={discussMessage.upper_category_name} condition={ discussMessage.upper_category_name.length > 22 }>
<div className="color-grey9 task-hide mt5" title={item.upper_category_name}>所属目录{item.upper_category_name}</div>
// </ConditionToolTip>
}
<p className="color-grey-9 clearfix mt10">
{ item.author && <span className="mr20 fl">{item.author}</span> } { item.author && <span className="mr20 fl">{item.author}</span> }
{item.commit_count===undefined?"":<span className="mr20 fl">{item.commit_count} 已交</span>} {item.commit_count===undefined?"":<span className="mr20 fl">{item.commit_count} 已交</span>}
{item.uncommit_count===undefined?"":<span className="mr20 fl">{item.uncommit_count} 未交</span>} {item.uncommit_count===undefined?"":<span className="mr20 fl">{item.uncommit_count} 未交</span>}

@ -68,6 +68,12 @@ class CoursesWorkIndex extends Component{
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/common_homework/:workId/setting"
render={
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
}
></Route>
{/* 作品列表 */} {/* 作品列表 */}
<Route exact path="/classrooms/:coursesId/common_homeworks/:workId/list" <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/list"
@ -75,17 +81,36 @@ class CoursesWorkIndex extends Component{
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
{/* 作品列表 */}
<Route exact path="/classrooms/:coursesId/common_homework/:workId/list"
render={
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
}
></Route>
{/* 作业问答 */} {/* 作业问答 */}
<Route exact path="/classrooms/:coursesId/common_homeworks/:workId/question" <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/question"
render={ render={
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/common_homework/:workId/question"
render={
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
}
></Route>
<Route exact path="/classrooms/:coursesId/common_homeworks/:workId/answer" <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/answer"
render={ render={
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/common_homework/:workId/answer"
render={
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
}
></Route>
{/* 评阅 */} {/* 评阅 */}
<Route exact path="/classrooms/:coursesId/common_homeworks/:workId/:studentWorkId/appraise" <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/:studentWorkId/appraise"
@ -93,6 +118,12 @@ class CoursesWorkIndex extends Component{
(props) => (<CommonWorkAppraise {...this.props} {...props} {...this.state} />) (props) => (<CommonWorkAppraise {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/common_homework/:workId/:studentWorkId/appraise"
render={
(props) => (<CommonWorkAppraise {...this.props} {...props} {...this.state} />)
}
></Route>
{/* 提交作品 */} {/* 提交作品 */}
<Route exact path="/classrooms/:coursesId/common_homeworks/:workId/post" <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/post"
@ -100,11 +131,22 @@ class CoursesWorkIndex extends Component{
(props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />) (props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/common_homework/:workId/post"
render={
(props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />)
}
></Route>
<Route exact path="/classrooms/:coursesId/common_homeworks/:workId/:studentWorkId/post_edit" <Route exact path="/classrooms/:coursesId/common_homeworks/:workId/:studentWorkId/post_edit"
render={ render={
(props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />) (props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/common_homework/:workId/:studentWorkId/post_edit"
render={
(props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />)
}
></Route>
{/* 新建 */} {/* 新建 */}
@ -114,12 +156,23 @@ class CoursesWorkIndex extends Component{
(props) => (<NewWork {...this.props} {...props} {...this.state} />) (props) => (<NewWork {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/common_homework/:workId/:pageType"
render={
(props) => (<NewWork {...this.props} {...props} {...this.state} />)
}
></Route>
<Route exact path="/classrooms/:coursesId/common_homeworks/:categroy_id/new" <Route exact path="/classrooms/:coursesId/common_homeworks/:categroy_id/new"
render={ render={
(props) => (<NewWork {...this.props} {...props} {...this.state} />) (props) => (<NewWork {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/common_homework/:categroy_id/new"
render={
(props) => (<NewWork {...this.props} {...props} {...this.state} />)
}
></Route>
{/* 作业列表 */} {/* 作业列表 */}
@ -128,6 +181,11 @@ class CoursesWorkIndex extends Component{
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />) (props) => (<ListPageIndex {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route path="/classrooms/:coursesId/common_homework"
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />)
}
></Route>
{/* --------------------------------------------------------------------- */} {/* --------------------------------------------------------------------- */}

@ -71,6 +71,11 @@ class CoursesWorkIndex extends Component{
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/group_homework/:workId/setting"
render={
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
}
></Route>
{/* 作品列表 */} {/* 作品列表 */}
<Route exact path="/classrooms/:coursesId/group_homeworks/:workId/list" <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/list"
@ -78,6 +83,11 @@ class CoursesWorkIndex extends Component{
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/group_homework/:workId/list"
render={
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
}
></Route>
{/* 作业问答 */} {/* 作业问答 */}
<Route exact path="/classrooms/:coursesId/group_homeworks/:workId/question" <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/question"
@ -85,31 +95,56 @@ class CoursesWorkIndex extends Component{
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/group_homework/:workId/question"
render={
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
}
></Route>
{/* 参考答案 */} {/* 参考答案 */}
<Route exact path="/classrooms/:coursesId/group_homeworks/:workId/answer" <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/answer"
render={ render={
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />) (props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/group_homework/:workId/answer"
render={
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
}
></Route>
{/* 评阅 */} {/* 评阅 */}
<Route exact path="/classrooms/:coursesId/group_homeworks/:workId/:studentWorkId/appraise" <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/:studentWorkId/appraise"
render={ render={
(props) => (<CommonWorkAppraise {...this.props} {...props} {...this.state} />) (props) => (<CommonWorkAppraise {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/group_homework/:workId/:studentWorkId/appraise"
render={
(props) => (<CommonWorkAppraise {...this.props} {...props} {...this.state} />)
}
></Route>
<Route exact path="/classrooms/:coursesId/group_homeworks/:workId/post" <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/post"
render={ render={
(props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />) (props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/group_homeworks/:workId/:studentWorkId/post_edit"
<Route exact path="/classrooms/:coursesId/group_homework/:workId/post"
render={ render={
(props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />) (props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/group_homeworks/:workId/:studentWorkId/post_edit"
render={
(props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />)
}
></Route>
<Route exact path="/classrooms/:coursesId/group_homework/:workId/:studentWorkId/post_edit"
render={
(props) => (<CommonWorkPost {...this.props} {...props} {...this.state} />)
}
></Route>
{/* 新建 */} {/* 新建 */}
{/* http://localhost:3007/classrooms/1309/group_homeworks/9299/edit/1 */} {/* http://localhost:3007/classrooms/1309/group_homeworks/9299/edit/1 */}
<Route exact path="/classrooms/:coursesId/group_homeworks/:workId/:pageType" <Route exact path="/classrooms/:coursesId/group_homeworks/:workId/:pageType"
@ -117,11 +152,21 @@ class CoursesWorkIndex extends Component{
(props) => (<NewWork {...this.props} {...props} {...this.state} />) (props) => (<NewWork {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/group_homework/:workId/:pageType"
render={
(props) => (<NewWork {...this.props} {...props} {...this.state} />)
}
></Route>
<Route exact path="/classrooms/:coursesId/group_homeworks/:categroy_id/new" <Route exact path="/classrooms/:coursesId/group_homeworks/:categroy_id/new"
render={ render={
(props) => (<NewWork {...this.props} {...props} {...this.state} />) (props) => (<NewWork {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
<Route exact path="/classrooms/:coursesId/group_homework/:categroy_id/new"
render={
(props) => (<NewWork {...this.props} {...props} {...this.state} />)
}
></Route>
{/* 作业列表 */} {/* 作业列表 */}
<Route path="/classrooms/:coursesId/group_homeworks" <Route path="/classrooms/:coursesId/group_homeworks"
@ -129,6 +174,12 @@ class CoursesWorkIndex extends Component{
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />) (props) => (<ListPageIndex {...this.props} {...props} {...this.state} />)
} }
></Route> ></Route>
{/* 作业列表 */}
<Route path="/classrooms/:coursesId/group_homework"
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />)
}
></Route>
</Switch> </Switch>

@ -34,8 +34,17 @@ class NewWork extends Component{
} }
} }
fetchCourseData = (courseId) => { fetchCourseData = (courseId) => {
let newcategory=undefined;
if(this.props.match.path==="/classrooms/:coursesId/common_homework/:workId/:pageType"||this.props.match.path==="/classrooms/:coursesId/group_homework/:workId/:pageType"){
newcategory=this.props.match.params.workId
}
const isGroup = this.props.isGroup() const isGroup = this.props.isGroup()
const url = `/courses/${courseId}/homework_commons/new.json?type=${isGroup ? 3 : 1}` let url=""
if(newcategory){
url = `/courses/${courseId}/homework_commons/new.json?type=${isGroup ? 3 : 1}&category=${newcategory}`;
}else{
url = `/courses/${courseId}/homework_commons/new.json?type=${isGroup ? 3 : 1}`
}
axios.get(url, { axios.get(url, {
}) })
.then((response) => { .then((response) => {
@ -54,7 +63,17 @@ class NewWork extends Component{
}); });
} }
fetchWork = (workId) => { fetchWork = (workId) => {
const url = `/homework_commons/${workId}/edit.json` let newcategory=undefined;
if(this.props.match.path==="/classrooms/:coursesId/common_homework/:workId/:pageType"||this.props.match.path==="/classrooms/:coursesId/group_homework/:workId/:pageType"){
newcategory=this.props.match.params.workId
}
let url=""
if(newcategory){
url = `/homework_commons/${workId}/edit.json?category=${newcategory}`;
}else{
url = `/homework_commons/${workId}/edit.json`
}
axios.get(url, { axios.get(url, {
}) })
.then((response) => { .then((response) => {
@ -96,6 +115,9 @@ class NewWork extends Component{
doNew = (params) => { doNew = (params) => {
const coursesId = this.props.match.params.coursesId const coursesId = this.props.match.params.coursesId
const newUrl = `/courses/${coursesId}/homework_commons.json` const newUrl = `/courses/${coursesId}/homework_commons.json`
if(this.props.match.path==="/classrooms/:coursesId/common_homework/:workId/:pageType"||this.props.match.path==="/classrooms/:coursesId/group_homework/:workId/:pageType"){
params.category=this.props.match.params.workId
}
axios.post(newUrl, params) axios.post(newUrl, params)
.then((response) => { .then((response) => {

@ -96,7 +96,7 @@ class PublishRightnow extends Component{
} }
homeworkstartend=(arg_group_ids,endtime)=>{ homeworkstartend=(arg_group_ids,endtime)=>{
debugger
if (this.usingCheckBeforePost && this.props.checkBeforePost) { if (this.usingCheckBeforePost && this.props.checkBeforePost) {
const goOn = this.props.checkBeforePost(); const goOn = this.props.checkBeforePost();
if (!goOn) { if (!goOn) {
@ -104,7 +104,7 @@ class PublishRightnow extends Component{
return; return;
} }
} }
debugger
const isPublish = this.props.isPublish; const isPublish = this.props.isPublish;
let group_ids = arg_group_ids let group_ids = arg_group_ids
if (this.usingCheckBeforePost) { if (this.usingCheckBeforePost) {
@ -112,7 +112,7 @@ class PublishRightnow extends Component{
return item.id return item.id
}) })
} }
debugger
if(this.state.course_groups.length>0){ if(this.state.course_groups.length>0){
if (this.state.course_groups.length && (!group_ids || group_ids&&group_ids.length == 0)) { if (this.state.course_groups.length && (!group_ids || group_ids&&group_ids.length == 0)) {
this.props.showNotification('请至少选择一个分班'); this.props.showNotification('请至少选择一个分班');

@ -130,9 +130,9 @@ class UseBank extends Component{
}) })
} }
onSave = () => { onSave = () => {
debugger
const { checkBoxValues } = this.state; const { checkBoxValues } = this.state;
const { object_type } = this.props const { object_type,category_id } = this.props
if(checkBoxValues.length==0){ if(checkBoxValues.length==0){
this.setState({ this.setState({
isChecked:"请先选择"+engNameMap[object_type] isChecked:"请先选择"+engNameMap[object_type]
@ -149,7 +149,8 @@ class UseBank extends Component{
, { , {
"object_type": object_type, "object_type": object_type,
"bank_id": checkBoxValues, "bank_id": checkBoxValues,
"course_id": courseId "course_id": courseId,
"category":category_id
} }
) )
.then((response) => { .then((response) => {

@ -31,7 +31,7 @@ export function RouteHOC(options = {}) {
// common_homework group_homework // common_homework group_homework
// 是否是分组作业 // 是否是分组作业
isGroup = () => { isGroup = () => {
return window.location.pathname.indexOf('group_homeworks') != -1 return window.location.pathname.indexOf('group_homeworks') != -1||window.location.pathname.indexOf('group_homework') != -1
} }
getModuleName = (isChinese) => { getModuleName = (isChinese) => {
const isGroup = this.isGroup() const isGroup = this.isGroup()
@ -39,9 +39,30 @@ export function RouteHOC(options = {}) {
let chName = isGroup ? '分组作业' : '普通作业' let chName = isGroup ? '分组作业' : '普通作业'
return chName; return chName;
} }
const secondName = isGroup ? 'group_homeworks' : 'common_homeworks'
if(window.location.pathname.indexOf('group_homeworks') != -1){
const secondName ='group_homeworks';
return secondName;
}
if(window.location.pathname.indexOf('group_homework') != -1){
const secondName ='group_homework';
return secondName;
}
if(window.location.pathname.indexOf('common_homeworks') != -1){
const secondName ='common_homeworks';
return secondName;
}
if(window.location.pathname.indexOf('common_homework') != -1){
const secondName ='common_homework';
return secondName; return secondName;
} }
}
getModuleType = () => { getModuleType = () => {
const isGroup = this.isGroup() const isGroup = this.isGroup()
return isGroup ? 3 : 1 return isGroup ? 3 : 1

@ -6,7 +6,7 @@ import '../css/busyWork.css'
import CommonWorkItem from './CommonWorkItem' import CommonWorkItem from './CommonWorkItem'
import PublishRightnow from './PublishRightnow' import PublishRightnow from './PublishRightnow'
import ConnectProject from './ConnectProject' import ConnectProject from './ConnectProject'
import { WordsBtn, on, off } from 'educoder' import { WordsBtn, on, off ,trigger} from 'educoder'
import Modals from '../../modals/Modals' import Modals from '../../modals/Modals'
import NoneData from "../coursesPublic/NoneData" import NoneData from "../coursesPublic/NoneData"
import Titlesearchsection from '../common/titleSearch/TitleSearchSection'; import Titlesearchsection from '../common/titleSearch/TitleSearchSection';
@ -34,7 +34,9 @@ class commonWork extends Component{
totalCount:0, totalCount:0,
checkAll:false, checkAll:false,
checkBoxValues:[], checkBoxValues:[],
isSpin:false isSpin:false,
category_id:undefined,
course_module:[]
} }
} }
//输入搜索条件 //输入搜索条件
@ -45,8 +47,8 @@ class commonWork extends Component{
} }
//搜索查询 //搜索查询
searchStudent=()=>{ searchStudent=()=>{
let {page,search,order}=this.state; let {category_id,search,order}=this.state;
this.getList(1,search,order); this.getList(1,search,order,category_id);
} }
openConnectionProject = (work) => { openConnectionProject = (work) => {
this.refs['connectProject'].openConnectionProject(work) this.refs['connectProject'].openConnectionProject(work)
@ -69,23 +71,53 @@ class commonWork extends Component{
} }
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {
if (prevProps.match.path != this.props.match.path) {
if (prevProps.coursesidtype != this.props.coursesidtype||prevProps.match.params.category_id!=this.props.match.params.category_id) {
if (this.props.match.path === "/classrooms/:coursesId/common_homeworks/:category_id" || this.props.match.path === "/classrooms/:coursesId/common_homework/:category_id"||
this.props.match.path === "/classrooms/:coursesId/group_homeworks/:category_id" || this.props.match.path === "/classrooms/:coursesId/group_homework/:category_id"
) {
if (this.props.coursesidtype === "node" && this.props.match.path === "/classrooms/:coursesId/common_homeworks/:category_id"||
this.props.coursesidtype === "node" && this.props.match.path === "/classrooms/:coursesId/group_homeworks/:category_id"
) {
this.clearSelection() this.clearSelection()
this.setState({ selectedKeys: 'all', order: '' }, () => { this.setState({selectedKeys: 'all', order: ''}, () => {
this._getList() this._getList()
}) })
} }
if (this.props.coursesidtype === "child" && this.props.match.path === "/classrooms/:coursesId/common_homework/:category_id"||
this.props.coursesidtype === "child" && this.props.match.path === "/classrooms/:coursesId/group_homework/:category_id"
) {
this.clearSelection()
this.setState({selectedKeys: 'all', order: ''}, () => {
this._getList(this.props.match.params.category_id)
})
}
}
}
} }
_getList = () => { _getList = (id) => {
this.setState({ this.setState({
isSpin:true isSpin:true,
category_id:id
}) })
let {page,search,order}=this.state; let {page,search,order}=this.state;
this.getList(page,search,order); this.getList(page,search,order,id);
} }
componentDidMount(){ componentDidMount(){
if(this.props.match.path === "/classrooms/:coursesId/common_homeworks/:category_id"||this.props.match.path === "/classrooms/:coursesId/group_homeworks/:category_id"){
this._getList() this._getList()
}
if(this.props.match.path === "/classrooms/:coursesId/common_homework/:category_id"||this.props.match.path === "/classrooms/:coursesId/group_homework/:category_id") {
this._getList(this.props.match.params.category_id)
}
on('updateNavSuccess', this.updateNavSuccess) on('updateNavSuccess', this.updateNavSuccess)
} }
@ -93,8 +125,13 @@ class commonWork extends Component{
off('updateNavSuccess', this.updateNavSuccess) off('updateNavSuccess', this.updateNavSuccess)
} }
updateNavSuccess = () => { updateNavSuccess = () => {
if(this.props.match.path === "/classrooms/:coursesId/common_homeworks/:category_id"||this.props.match.path === "/classrooms/:coursesId/group_homeworks/:category_id"){
this._getList() this._getList()
} }
if(this.props.match.path === "/classrooms/:coursesId/common_homework/:category_id"||this.props.match.path === "/classrooms/:coursesId/group_homework/:category_id") {
this._getList(this.props.match.params.category_id)
}
}
useBankSuccess = (checkBoxValues, newWorkIdArray) => { useBankSuccess = (checkBoxValues, newWorkIdArray) => {
this.setState({ this.setState({
@ -104,11 +141,12 @@ class commonWork extends Component{
this.refs['publishModalRef'].open() this.refs['publishModalRef'].open()
}) })
let {search, order}=this.state; let {search, order,category_id}=this.state;
this.getList(1, search, order); this.getList(1, search, order,category_id);
} }
getList=(page,search,order)=>{ getList=(page,search,order,category_id)=>{
this.setState({ this.setState({
isSpin:true isSpin:true
}) })
@ -121,6 +159,9 @@ class commonWork extends Component{
if(search!=""){ if(search!=""){
url+="&search="+search; url+="&search="+search;
} }
if(category_id){
url+="&category="+category_id;
}
axios.get(encodeURI(url)).then((result)=>{ axios.get(encodeURI(url)).then((result)=>{
if(result.status==200){ if(result.status==200){
this.setState({ this.setState({
@ -130,6 +171,32 @@ class commonWork extends Component{
page:page, page:page,
...result.data ...result.data
}) })
this.getdatas(result.data.main_category_id)
}
}).catch((error)=>{
this.setState({
isSpin:false
})
})
}
getdatas=(main_category_id)=>{
let newcourse_module=[]
let urls=`/course_modules/${main_category_id}.json`
axios.get(encodeURI(urls)).then((result)=>{
if(result.status==200){
newcourse_module.push({name:result.data.course_module.module_name,id:result.data.course_module.id})
if(result.data.course_module.course_second_categories.length>0){
result.data.course_module.course_second_categories.map((item,key)=>{
newcourse_module.push(item)
})
}
this.setState({
course_module:newcourse_module
})
} }
}).catch((error)=>{ }).catch((error)=>{
this.setState({ this.setState({
@ -148,8 +215,8 @@ class commonWork extends Component{
checkBoxValues:[], checkBoxValues:[],
checkAll:false checkAll:false
}) })
let {search}=this.state; let {search,category_id}=this.state;
this.getList(1,search,e.key==="all"?"":e.key); this.getList(1,search,e.key==="all"?"":e.key,category_id);
} }
onPageChange=(pageNumber)=>{ onPageChange=(pageNumber)=>{
@ -157,8 +224,8 @@ class commonWork extends Component{
page:pageNumber, page:pageNumber,
checkBoxValues:[] checkBoxValues:[]
}) })
let {search,order}=this.state; let {search,order,category_id}=this.state;
this.getList(pageNumber,search,order); this.getList(pageNumber,search,order,category_id);
} }
// 全选和反选 // 全选和反选
@ -191,7 +258,7 @@ class commonWork extends Component{
} }
onWorkDelete = () => { onWorkDelete = () => {
const { checkBoxValues } = this.state; const { checkBoxValues,category_id} = this.state;
const len = checkBoxValues.length; const len = checkBoxValues.length;
if (len == 0) { if (len == 0) {
this.props.showNotification('请先选择要删除的作业') this.props.showNotification('请先选择要删除的作业')
@ -209,13 +276,14 @@ class commonWork extends Component{
axios.post(url, { axios.post(url, {
homework_ids: checkBoxValues, homework_ids: checkBoxValues,
all_check: 0, all_check: 0,
// category:category_id
// group_ids // group_ids
}).then((response) => { }).then((response) => {
if (response.data.status == 0) { if (response.data.status == 0) {
this.props.showNotification('删除成功') this.props.showNotification('删除成功')
this.clearSelection() this.clearSelection()
let {search,order}=this.state; let {search,order}=this.state;
this.getList(1,search,order); this.getList(1,search,order,category_id);
this.props.updataleftNavfun() this.props.updataleftNavfun()
} }
@ -231,7 +299,7 @@ class commonWork extends Component{
} }
// //
onSetPublic = () => { onSetPublic = () => {
const { checkBoxValues } = this.state; const { checkBoxValues,category_id } = this.state;
const len = checkBoxValues.length; const len = checkBoxValues.length;
if (len == 0) { if (len == 0) {
this.props.showNotification('请先选择要公开的作业') this.props.showNotification('请先选择要公开的作业')
@ -252,7 +320,7 @@ class commonWork extends Component{
if (response.data.status == 0) { if (response.data.status == 0) {
this.props.showNotification('设为公开操作成功') this.props.showNotification('设为公开操作成功')
let {search,order, page}=this.state; let {search,order, page}=this.state;
this.getList(page,search,order); this.getList(page,search,order,category_id);
} }
}).catch((error) => { }).catch((error) => {
@ -262,8 +330,8 @@ class commonWork extends Component{
}) })
} }
doWhenSuccess = () => { doWhenSuccess = () => {
let {search,order, page}=this.state; let {search,order, page,category_id}=this.state;
this.getList(page,search,order); this.getList(page,search,order,category_id);
this.setState({ this.setState({
checkBoxValues:[] checkBoxValues:[]
}) })
@ -279,7 +347,7 @@ class commonWork extends Component{
this.onChangeSelect(checkBoxValues) this.onChangeSelect(checkBoxValues)
} }
addToBank = () => { addToBank = () => {
const { checkBoxValues } = this.state; const { checkBoxValues,category_id } = this.state;
const len = checkBoxValues.length; const len = checkBoxValues.length;
if (len == 0) { if (len == 0) {
this.props.showNotification('请先选择要加入题库的作业') this.props.showNotification('请先选择要加入题库的作业')
@ -294,7 +362,7 @@ class commonWork extends Component{
if (response.data.status == 0) { if (response.data.status == 0) {
this.props.showNotification('加入成功') this.props.showNotification('加入成功')
let {search,order}=this.state; let {search,order}=this.state;
this.getList(1,search,order); this.getList(1,search,order,category_id);
} }
}).catch((error) => { }).catch((error) => {
@ -302,26 +370,69 @@ class commonWork extends Component{
}) })
} }
connectSuccess = () => { connectSuccess = () => {
let {page,search,order}=this.state; let {page,search,order,category_id}=this.state;
this.getList(page,search,order); this.getList(page,search,order,category_id);
} }
cancelConnectionProject = (work) => { cancelConnectionProject = (work) => {
let workId=this.props.match.params.workId; let workId=this.props.match.params.workId;
let courseId=this.props.match.params.coursesId; let courseId=this.props.match.params.coursesId;
let {page,search,order,category_id}=this.state;
const url = `/homework_commons/${work.homework_id}/student_works/cancel_relate_project.json` const url = `/homework_commons/${work.homework_id}/student_works/cancel_relate_project.json`
axios.get(url).then((response)=> { axios.get(url).then((response)=> {
if (response.data.status == 0) { if (response.data.status == 0) {
let {page,search,order}=this.state;
this.getList(page,search,order); this.getList(page,search,order,category_id);
this.props.showNotification('取消关联成功') this.props.showNotification('取消关联成功')
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error) console.log(error)
}) })
} }
addDir = (id) => {
if(!id){
trigger('addcommon_homeworks', parseInt(this.props.match.params.category_id))
}else{
let data={id:parseInt(id),name:this.state.category_name}
trigger('editcommon_homeworks', data)
}
}
newaddDir = () => {
trigger('addcommon_homeworks', parseInt(this.state.main_category_id))
}
moveTo = (item) => {
const len = this.state.checkBoxValues.length
if (len == 0) {
this.props.showNotification('请先在列表中选择要移动的作业')
return;
}
const checkBoxValues = this.state.checkBoxValues;
const coursesId= this.props.match.params.coursesId;
const category_id=this.state.category_id;
const url = `/courses/${coursesId}/homework_commons/move_to_category.json`
axios.post(url, {
homework_ids: checkBoxValues,
new_category_id: item.id,
category_id:!category_id?undefined:category_id
})
.then((response) => {
if (response.data.status == 0) {
console.log('--- 成功')
this.props.showNotification('作业移动成功')
this.props.updataleftNavfun()
this.setState({
checkBoxValues:[]
})
this.updateNavSuccess()
}
})
.catch(function (error) {
console.log(error);
});
}
render(){ render(){
let { let {
@ -334,11 +445,13 @@ class commonWork extends Component{
totalCount, totalCount,
checkAll, checkAll,
checkBoxValues, checkBoxValues,
course_module,
task_count, task_count,
published_count, published_count,
unpublished_count, unpublished_count,
main_category_name, main_category_name,
category_name,
category_id
}=this.state; }=this.state;
const { coursedata } = this.props; const { coursedata } = this.props;
if (!coursedata) { if (!coursedata) {
@ -350,9 +463,8 @@ class commonWork extends Component{
const isGroup = this.props.isGroup() const isGroup = this.props.isGroup()
const isAdmin = this.props.isAdmin() const isAdmin = this.props.isAdmin()
const bid = this.props.match.params.category_id
// <CourseLayoutcomponent {...this.props}>
// </CourseLayoutcomponent>
return( return(
<div> <div>
@ -387,7 +499,7 @@ class commonWork extends Component{
<Titlesearchsection <Titlesearchsection
title={main_category_name} title={!category_id?main_category_name:category_name}
searchValue={ search } searchValue={ search }
// searchtype={this.props.isAdmin||this.props.isStudent ?true:false} // searchtype={this.props.isAdmin||this.props.isStudent ?true:false}
onInputSearchChange={this.inputStudent} onInputSearchChange={this.inputStudent}
@ -399,6 +511,9 @@ class commonWork extends Component{
{ isAdmin && <li className="fr"> { isAdmin && <li className="fr">
<UseBank {...this.props} {...this.state} object_type={isGroup ? "group" : "normal"} useBankSuccess={this.useBankSuccess}></UseBank> <UseBank {...this.props} {...this.state} object_type={isGroup ? "group" : "normal"} useBankSuccess={this.useBankSuccess}></UseBank>
</li> } </li> }
{ isAdmin && <li className="fr mr30">
<WordsBtn style="blue" className="fr" onClick={()=>this.addDir(category_id)}>{!category_id?"新建目录":"目录重命名"}</WordsBtn>
</li> }
</React.Fragment> </React.Fragment>
} }
secondRowBotton={ secondRowBotton={
@ -450,9 +565,33 @@ class commonWork extends Component{
</li> </li>
{ !!course_public && <li className="li_line"><a href="javascript:void(0)" onClick={this.onSetPublic} className="color-grey-9">设为公开</a></li>} { !!course_public && <li className="li_line"><a href="javascript:void(0)" onClick={this.onSetPublic} className="color-grey-9">设为公开</a></li>}
{this.props.user&&this.props.user.main_site===true?<li><a href="javascript:void(0)" className="color-grey-9" {this.props.user&&this.props.user.main_site===true?<li class="li_line"><a href="javascript:void(0)" className="color-grey-9"
onClick={this.addToBank} onClick={this.addToBank}
>加入题库</a></li>:""} >加入题库</a></li>:""}
<li className="li_line drop_down">
移动到...<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu"
style={{"right":"0px","left":"unset", maxHeight: '318px', overflowY: 'auto', minWidth: '200px'}}>
{ course_module && course_module.length > 10 && <p className="drop_down_search">
<Input placeholder="搜索" value={this.state.dirSearchValue} onChange={(e) => {this.setState({dirSearchValue: e.target.value})}}/>
</p> }
{
course_module && course_module.filter((item)=> {
return item.id != bid && (!this.state.dirSearchValue || item.name.indexOf(this.state.dirSearchValue) != -1)
}).map( (item, index) => {
return <li key={`i_${index}`} onClick={() => this.moveTo(item)} title={item.name}>{item.name}</li>
})
}
{ isAdmin &&
<p className="drop_down_btn">
<a href="javascript:void(0)" className="color-grey-6"
onClick={()=>this.newaddDir()}
>新建目录...</a>
</p>
}
{/* <p className="drop_down_btn"><a href="javascript:void(0)" className="color-grey-6">添加分班...</a></p> */}
</ul>
</li>
</div> </div>
{/* 设为公开 */} {/* 设为公开 */}
<Modals <Modals

@ -34,7 +34,7 @@ class CompetitionContentsMd extends Component{
}else{ }else{
chart_rules.rule_contents.map((items,keys)=>{ chart_rules.rule_contents.map((items,keys)=>{
debugger
if(parseInt(this.props.tabkey)===items.competition_stage_id){ if(parseInt(this.props.tabkey)===items.competition_stage_id){
console.log(items) console.log(items)
this.contentMdRef.current.setValue(items.content); this.contentMdRef.current.setValue(items.content);

@ -142,6 +142,8 @@ class Coursesleftnav extends Component{
off('editshixunmainname',this.editshixunmainname) off('editshixunmainname',this.editshixunmainname)
off('videoAdd',this.addVideo) off('videoAdd',this.addVideo)
off('editVideo',this.editVideo) off('editVideo',this.editVideo)
off('addcommon_homeworks',this.addcommon_homeworks)
off('editcommon_homeworks',this.editcommon_homeworks)
} }
addshixunchild=(e, data)=>{ addshixunchild=(e, data)=>{
this.Navmodalnames(e,1,"shixun_homework",data); this.Navmodalnames(e,1,"shixun_homework",data);
@ -149,6 +151,12 @@ class Coursesleftnav extends Component{
editshixunchild=(e, data)=>{ editshixunchild=(e, data)=>{
this.Navmodalnames(e,4,"editSecondname",data.id,data.name); this.Navmodalnames(e,4,"editSecondname",data.id,data.name);
} }
addcommon_homeworks=(e, data)=>{
this.Navmodalnames(e,1,"common_homework",data);
}
editcommon_homeworks=(e, data)=>{
this.Navmodalnames(e,4,"editSecondname",data.id,data.name);
}
editshixunmainname=(e, data)=>{ editshixunmainname=(e, data)=>{
this.Navmodalnames(e,3,"editname",data.id,data.name); this.Navmodalnames(e,3,"editname",data.id,data.name);
} }
@ -196,7 +204,8 @@ class Coursesleftnav extends Component{
on('editshixunmainname',this.editshixunmainname); on('editshixunmainname',this.editshixunmainname);
on('videoAdd',this.addVideo); on('videoAdd',this.addVideo);
on('editVideo',this.editVideo) on('editVideo',this.editVideo)
on('addcommon_homeworks',this.addcommon_homeworks)
on('editcommon_homeworks',this.editcommon_homeworks)
let courstype=this.props.match.url; let courstype=this.props.match.url;
@ -537,7 +546,7 @@ class Coursesleftnav extends Component{
} }
saveNavmodapost=(url,value,positiontype,coursesId,type)=>{ saveNavmodapost=(url,value,positiontype,coursesId,type)=>{
console.log(positiontype)
axios.post(url, axios.post(url,
{name:value}).then((result)=>{ {name:value}).then((result)=>{
if(result!=undefined){ if(result!=undefined){
@ -548,6 +557,23 @@ class Coursesleftnav extends Component{
description:result.data.message description:result.data.message
}); });
if(positiontype==="common_homeworks"||positiontype==="common_homework"||positiontype==="group_homeworks"||positiontype==="group_homework"){
if(type===true){
this.updasaveNavmoda()
trigger('updateNavSuccess')
}else{
this.updasaveNavmoda()
if(positiontype==="common_homeworks"){
this.props.history.push(`/classrooms/${coursesId}/common_homework/${result.data.category_id}`);
}
if(positiontype==="group_homeworks"){
this.props.history.push(`/classrooms/${coursesId}/group_homework/${result.data.category_id}`);
}
}
return
}
if(positiontype==="shixun_homeworks"||positiontype==="shixun_homework"){ if(positiontype==="shixun_homeworks"||positiontype==="shixun_homework"){
if(type===true){ if(type===true){
this.updasaveNavmoda() this.updasaveNavmoda()
@ -557,6 +583,7 @@ class Coursesleftnav extends Component{
this.props.history.push(`/classrooms/${coursesId}/shixun_homework/${result.data.category_id}`); this.props.history.push(`/classrooms/${coursesId}/shixun_homework/${result.data.category_id}`);
} }
return
} }
if(positiontype==="files"||positiontype==="file"){ if(positiontype==="files"||positiontype==="file"){
@ -569,22 +596,25 @@ class Coursesleftnav extends Component{
this.updasaveNavmoda() this.updasaveNavmoda()
this.props.history.push(`/classrooms/${coursesId}/file/${result.data.category_id}`); this.props.history.push(`/classrooms/${coursesId}/file/${result.data.category_id}`);
} }
return
} }
if(positiontype==="boards"){ if(positiontype==="boards"){
this.updasaveNavmoda() this.updasaveNavmoda()
trigger('updateNavSuccess') trigger('updateNavSuccess')
this.props.history.push(`/classrooms/${coursesId}/boards/${result.data.category_id}`); this.props.history.push(`/classrooms/${coursesId}/boards/${result.data.category_id}`);
return
} }
if(positiontype!="course_groups"&&positiontype!="shixun_homeworks"&&positiontype!="shixun_homework"){ if(positiontype!="course_groups"&&positiontype!="shixun_homeworks"&&positiontype!="shixun_homework"){
this.updasaveNavmoda() this.updasaveNavmoda()
return
} }
if(positiontype==="course_groups"){ if(positiontype==="course_groups"){
this.props.updataleftNavfun(); this.props.updataleftNavfun();
this.props.history.push(`/classrooms/${coursesId}/course_groups/${result.data.group_id}`); this.props.history.push(`/classrooms/${coursesId}/course_groups/${result.data.group_id}`);
return
} }
} }
@ -864,6 +894,10 @@ class Coursesleftnav extends Component{
{/*公告栏*/} {/*公告栏*/}
{/*作业*/} {/*作业*/}
{item.type==="shixun_homework"?<div onClick={e=>this.Navmodalnames(e,1,"shixun_homework",item.id)}>新建目录</div>:""} {item.type==="shixun_homework"?<div onClick={e=>this.Navmodalnames(e,1,"shixun_homework",item.id)}>新建目录</div>:""}
{/* 普通作业 */}
{item.type==="common_homework"?<div onClick={e=>this.Navmodalnames(e,1,"common_homeworks",item.id)}>新建目录</div>:""}
{/*/!* 分组作业 *!/*/}
{item.type==="group_homework"?<div onClick={e=>this.Navmodalnames(e,1,"group_homeworks",item.id)}>新建目录</div>:""}
{/*资源*/} {/*资源*/}
{item.type==="attachment"?<div onClick={e=>this.Navmodalnames(e,1,"attachment",item.id)}>新建目录</div>:""} {item.type==="attachment"?<div onClick={e=>this.Navmodalnames(e,1,"attachment",item.id)}>新建目录</div>:""}
{/* 视频 */} {/* 视频 */}
@ -894,8 +928,8 @@ class Coursesleftnav extends Component{
let {twosandiantypes,twosandiantypenum}=this.state; let {twosandiantypes,twosandiantypenum}=this.state;
return (item.type==="graduation"?"": <div className={item.type===twosandiantypes&&twosandiantypenum===index?"sandianboxs":"sandianboxs"} > return (item.type==="graduation"?"": <div className={item.type===twosandiantypes&&twosandiantypenum===index?"sandianboxs":"sandianboxs"} >
{/*作业/资源*/} {/*作业/资源*/}
{item.type==="shixun_homework"||item.type==="attachment"||item.type==="graduation"?<div onClick={e=>this.Navmodalnames(e,4,"editSecondname",iem.category_id,iem.category_name)}>重命名</div>:""} {item.type==="shixun_homework"||item.type==="attachment"||item.type==="graduation"||item.type==="common_homework"||item.type==="group_homework"?<div onClick={e=>this.Navmodalnames(e,4,"editSecondname",iem.category_id,iem.category_name)}>重命名</div>:""}
{item.type==="shixun_homework"||item.type==="attachment"?<div onClick={e=>this.deleteSecondary(e,1,iem.category_id)}>删除</div>:""} {item.type==="shixun_homework"||item.type==="attachment"||item.type==="common_homework"||item.type==="group_homework"?<div onClick={e=>this.deleteSecondary(e,1,iem.category_id)}>删除</div>:""}
{/*分班*/} {/*分班*/}
{item.type==="course_group"?<div onClick={e=>this.Navmodalnames(e,5,"editSecondname",iem.category_id,iem.category_name)}>重命名</div>:""} {item.type==="course_group"?<div onClick={e=>this.Navmodalnames(e,5,"editSecondname",iem.category_id,iem.category_name)}>重命名</div>:""}
{item.type==="course_group"?<div onClick={e=>this.deleteSecondary(e,2,iem.category_id)}>删除</div>:""} {item.type==="course_group"?<div onClick={e=>this.deleteSecondary(e,2,iem.category_id)}>删除</div>:""}

@ -156,7 +156,7 @@ class Bullsubdirectory extends Component{
handleSubmit=(e) => { handleSubmit=(e) => {
e.preventDefault(); e.preventDefault();
this.props.form.validateFields((err, values) => { this.props.form.validateFields((err, values) => {
debugger
if (!err) { if (!err) {
console.log(values.description); console.log(values.description);
if(values.eduintits === undefined|| values.eduintits === "" || values.eduintits ===null){ if(values.eduintits === undefined|| values.eduintits === "" || values.eduintits ===null){

@ -144,7 +144,7 @@ class EditableCourseSupportSetting extends Component {
} }
for (let i = 0 ; i < keys.length - 1; i++) { for (let i = 0 ; i < keys.length - 1; i++) {
if (keys[i] == keys[i + 1]) { if (keys[i] == keys[i + 1]) {
debugger;
} }
} }
this.position2Target_idMap = this._reverseMap(reverseMap); this.position2Target_idMap = this._reverseMap(reverseMap);

@ -277,7 +277,7 @@ class EcStudentList extends Component {
}; };
//删除学生 //删除学生
deletelistbthenters=()=>{ deletelistbthenters=()=>{
debugger
let {Myschoolstudents,studentall} =this.state; let {Myschoolstudents,studentall} =this.state;
let major_id=this.props.match.params.majorId; let major_id=this.props.match.params.majorId;
let year_id=this.props.match.params.yearId; let year_id=this.props.match.params.yearId;

@ -668,7 +668,7 @@ class MemoDetail extends Component {
// --------------------------------------------------------------------------------------------帖子獎勵 END // --------------------------------------------------------------------------------------------帖子獎勵 END
showCommentInput = () => { showCommentInput = () => {
debugger
if (window.__useKindEditor === true) { if (window.__useKindEditor === true) {
this.refs.editor.showEditor(); this.refs.editor.showEditor();
} else { } else {

@ -469,7 +469,7 @@ class LoginDialog extends Component {
autologin:isGoingValue autologin:isGoingValue
} }
).then((response) => { ).then((response) => {
debugger;
if(response===undefined){ if(response===undefined){
return return
} }

@ -34,6 +34,9 @@ render() {
} }
.color848282{ .color848282{
color:#848282; color:#848282;
}
.task-btn{
color: #fff !important;
} }
` `
} }
@ -50,7 +53,7 @@ render() {
</div> </div>
: :
<div className="clearfix mt30 edu-txt-center"> <div className="clearfix mt30 edu-txt-center">
<a className="task-btn mr30" onClick={this.props.modalCancel}>取消</a> <a className="task-btn mr30" onClick={this.props.modalCancel}>{this.props.cancelText || '取消'}</a>
<a className="task-btn task-btn-orange" onClick={this.props.modalSave}>{this.props.okText || '确定'}</a> <a className="task-btn task-btn-orange" onClick={this.props.modalSave}>{this.props.okText || '确定'}</a>
</div> </div>
} }

@ -95,7 +95,7 @@ class SendTopics extends Component{
}catch (e) { }catch (e) {
} }
debugger
if(this.props.mysendall===true){ if(this.props.mysendall===true){
//详情页面跳过来的 //详情页面跳过来的
try { try {
@ -119,7 +119,7 @@ debugger
} }
}else{ }else{
//外部多个列表页跳过来的 //外部多个列表页跳过来的
debugger
try { try {
var rurls=""; var rurls="";
if(this.props.category==="normal"){ if(this.props.category==="normal"){

@ -32,7 +32,10 @@ class DetailTop extends Component{
getappointmenttype:false, getappointmenttype:false,
openpathss:false, openpathss:false,
cancel_publics:false, cancel_publics:false,
cancel_has_publics:false cancel_has_publics:false,
applyissuePaths:false,
cancelText:undefined,
okText:undefined
} }
} }
componentDidMount(){ componentDidMount(){
@ -110,21 +113,27 @@ class DetailTop extends Component{
applyissuePath=()=>{ applyissuePath=()=>{
this.setState({
loadtype:true,
Modalstype: true,
Modalstopval:`课程发布后即可发送课堂使用`,
// modalsMidval:"有人公开可见,若仅本人教学使用则无需申请公开,直接发",
// Modalsbottomval:"送到课堂即可。",
applyissuePaths:true
})
}
showapplyissuePath=()=>{
let pathid=this.props.match.params.pathId; let pathid=this.props.match.params.pathId;
let url ="/paths/"+pathid+"/publish.json"; let url ="/paths/"+pathid+"/publish.json";
axios.post(url).then((result)=>{ axios.post(url).then((result)=>{
if(result.status===200){ if(result.status===200){
if(result.data.status===0){ if(result.data.status===0){
this.setState({
loadtype:true,
Modalstype: true,
Modalstopval: ` 课程需经过平台审核方可公开使用,公开的课程将对平台所`,
modalsMidval:"有人公开可见。若仅本人教学使用则无需申请公开, 直接发",
Modalsbottomval:"送到课堂即可.",
cardsModalsavetype: true,
})
this.props.showNotification(result.data.message) this.props.showNotification(result.data.message)
this.props.getlistdatas(); this.props.getlistdatas();
this.cardsModalcancel()
}else if(result.data.status===1){ }else if(result.data.status===1){
// window.location.reload(); // window.location.reload();
} }
@ -132,8 +141,6 @@ class DetailTop extends Component{
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
}) })
} }
postcancelissuePath=()=>{ postcancelissuePath=()=>{
let pathId=this.props.match.params.pathId; let pathId=this.props.match.params.pathId;
@ -180,12 +187,15 @@ class DetailTop extends Component{
modalsMidval:'', modalsMidval:'',
modalstyles:'', modalstyles:'',
cardsModalsavetype:false, cardsModalsavetype:false,
applyissuePath:false, applyissuePaths:false,
openpathss:false, openpathss:false,
cancel_publics:false, cancel_publics:false,
cancel_has_publics:false, cancel_has_publics:false,
Modalstopval:``, Modalstopval:``,
cancelText:undefined,
okText:undefined
}) })
} }
cardsModalsave=()=>{ cardsModalsave=()=>{
@ -369,13 +379,13 @@ class DetailTop extends Component{
openpaths=()=>{ openpaths=()=>{
this.setState({ this.setState({
loadtype:true,
Modalstype: true, Modalstype: true,
openpathss:true, openpathss:true,
Modalstopval: "公开申请已提交,请等待管理员的审核", Modalstopval: "公开课程需经过平台标准化审核审核周期为1-2天公开",
modalsMidval:"• 我们将在1-2个工作日内完成审核", modalsMidval:"的课程将对平台所有人可见。若仅本人教学使用则无需",
Loadtype:true, Modalsbottomval:"申请公开,直接发送到课堂即可",
modalstyles:"848282" cancelText:"取消申请",
okText:"确定申请"
}) })
} }
@ -433,7 +443,7 @@ class DetailTop extends Component{
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}=this.state; let{Modalstype,Modalstopval,cardsModalcancel,putappointmenttype,Modalsbottomval,cardsModalsavetype,loadtype,getappointmenttype,openpathss,cancel_publics,cancel_has_publics,applyissuePaths}=this.state;
const radioStyle = { const radioStyle = {
display: 'block', display: 'block',
height: '30px', height: '30px',
@ -470,8 +480,10 @@ class DetailTop extends Component{
modalsTopval={Modalstopval} modalsTopval={Modalstopval}
modalsBottomval={Modalsbottomval} modalsBottomval={Modalsbottomval}
modalCancel={cardsModalcancel} modalCancel={cardsModalcancel}
modalSave={loadtype===true&&openpathss===false?()=>this.cardsModalcancel():cardsModalsavetype===true?()=>this.postcancelissuePath():openpathss===true?()=>this.postopenpaths():cancel_publics===true?()=>this.postcancel_public():cancel_has_publics===true?()=>this.postcancel_has_public():putappointmenttype===true?()=>this.getappointment():()=>this.cardsModalsave()} modalSave={applyissuePaths===true?()=>this.showapplyissuePath():loadtype===true&&openpathss===false?()=>this.cardsModalcancel():cardsModalsavetype===true?()=>this.postcancelissuePath():openpathss===true?()=>this.postopenpaths():cancel_publics===true?()=>this.postcancel_public():cancel_has_publics===true?()=>this.postcancel_has_public():putappointmenttype===true?()=>this.getappointment():()=>this.cardsModalsave()}
loadtype={loadtype} loadtype={loadtype}
cancelText={this.state.cancelText}
okText={this.state.okText}
modalsMidval={this.state.modalsMidval} modalsMidval={this.state.modalsMidval}
modalstyles={this.state.modalstyles} modalstyles={this.state.modalstyles}
> >
@ -605,8 +617,8 @@ class DetailTop extends Component{
{ {
detailInfoList.publish_status===0&&detailInfoList.allow_add_member===true? detailInfoList.publish_status===0&&detailInfoList.allow_add_member===true?
<a className="fr font-18 color-white kaike mr20 kkbths" <a className="fr font-18 color-white kaike mr20 kkbths"
style={{'width':'65px'}} style={{'width':'95px'}}
onClick={this.applyissuePath}>发布</a>:"" onClick={this.applyissuePath}>申请发布</a>:""
} }

@ -16,7 +16,7 @@ class PackageIndexNEIBanner extends Component {
} }
onChange=(current)=>{ onChange=(current)=>{
debugger
console.log('onChange:', current); console.log('onChange:', current);
this.setState({ current }); this.setState({ current });
}; };

@ -63,7 +63,7 @@ class PaperDeletModel extends Component {
} }
NewknTypedeltyoedels=()=>{ NewknTypedeltyoedels=()=>{
debugger
if(this.state.newkntypeinput.length===0){ if(this.state.newkntypeinput.length===0){
this.setState({ this.setState({
errorestit:'请输入知识点', errorestit:'请输入知识点',

@ -475,7 +475,7 @@ class Comthetestpaperst extends Component {
//////console.log('Clicked! But prevent default.'); //////console.log('Clicked! But prevent default.');
} }
deletesobject = (item, index) => { deletesobject = (item, index) => {
debugger
var tmp = this.state.Knowpoints; var tmp = this.state.Knowpoints;
for (var i = 0; i < tmp.length; i++) { for (var i = 0; i < tmp.length; i++) {
if (i ===index) { if (i ===index) {

@ -123,7 +123,7 @@ class Paperreview_item extends Component {
} }
axios.post(url, data) axios.post(url, data)
.then((result) => { .then((result) => {
debugger
if (result.data.status == 0) { if (result.data.status == 0) {
// this.props.showNotification(`拖动成功`); // this.props.showNotification(`拖动成功`);
this.props.getdata(); this.props.getdata();

@ -106,7 +106,7 @@ class Audit_situationComponent extends Component {
} }
showModal = (id,status) => { showModal = (id,status) => {
debugger
this.setState({ this.setState({
visible: true, visible: true,
editid:id, editid:id,

@ -60,7 +60,8 @@ class TPMBanner extends Component {
openshowpublictype:false, openshowpublictype:false,
Radiovalue:1, Radiovalue:1,
TextAreaintshow:false, TextAreaintshow:false,
cancelText:undefined,
okText:undefined,
} }
} }
@ -434,6 +435,9 @@ class TPMBanner extends Component {
modalsMidval:undefined, modalsMidval:undefined,
ModalsBottomval:"", ModalsBottomval:"",
modalstyles:"", modalstyles:"",
cancelText:undefined,
okText:undefined,
Loadtype:false,
}) })
} }
ModalSave = () => { ModalSave = () => {
@ -441,7 +445,10 @@ class TPMBanner extends Component {
let url = "/shixuns/" + id + "/cancel_publish.json"; let url = "/shixuns/" + id + "/cancel_publish.json";
axios.get(url).then((response) => { axios.get(url).then((response) => {
this.props.showSnackbar(response.data.message); this.props.showSnackbar(response.data.message);
window.location.reload() // window.location.reload()
this.ModalCancel()
this.props.getcomponentdidmount()
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
@ -461,16 +468,21 @@ class TPMBanner extends Component {
ModalSaveopenpublic= () => { ModalSaveopenpublic= () => {
this.setState({ this.setState({
Modalstype: true, Modalstype: true,
Modalstopval: "公开申请已提交,请等待管理员的审核", Modalstopval:"公开实训需经过平台标准化审核审核周期为1-2天",
modalsMidval:"• 我们将在1-2个工作日内完成审核", modalsMidval:"公开的实训将对平台所有人可见。若仅本人教学使用",
ModalCancel: this.eopenpublicupdatadata, ModalsBottomval:"则无需申请公开, 直接发送到课堂即可。",
cancelText:"取消申请",
okText:"确定申请",
ModalCancel: this.ModalCancel,
ModalSave: this.eopenpublicupdatadata, ModalSave: this.eopenpublicupdatadata,
Loadtype:true, // Loadtype:true,
modalstyles:"848282" // modalstyles:"848282"
}) })
} }
eopenpublicupdatadata=()=>{ eopenpublicupdatadata=()=>{
window.location.reload() // window.location.reload()
this.ModalCancel()
this.props.getcomponentdidmount()
} }
openpublic=()=>{ openpublic=()=>{
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
@ -490,7 +502,9 @@ class TPMBanner extends Component {
let url = `/shixuns/${id}/cancel_apply_public.json`; let url = `/shixuns/${id}/cancel_apply_public.json`;
axios.get(url).then((response) => { axios.get(url).then((response) => {
if(response.data.status===0){ if(response.data.status===0){
window.location.reload() // window.location.reload()
this.ModalCancel()
this.props.getcomponentdidmount()
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
@ -522,7 +536,10 @@ class TPMBanner extends Component {
evaluation_set_position = response.data.evaluation_set_position evaluation_set_position = response.data.evaluation_set_position
} }
if(response.data.status===0){ if(response.data.status===0){
window.location.reload() // window.location.reload()
this.applyreleaseopen()
// this.ModalCancel()
this.props.getcomponentdidmount()
}else{ }else{
this.setState({ this.setState({
Issuevisible: true, Issuevisible: true,
@ -536,13 +553,23 @@ class TPMBanner extends Component {
console.log(error) console.log(error)
}); });
}; };
applyreleaseopen = () => {
this.setState({
Modalstype: true,
Loadtype:true,
Modalstopval: "实训发布后即可发送课堂使用",
ModalSave: this.ModalCancel,
})
}
hiddenIssuevisible = (val) => { hiddenIssuevisible = (val) => {
this.setState({ this.setState({
Issuevisible: false Issuevisible: false
}) })
if (val === 0 || val === 1) { if (val === 0 || val === 1) {
window.location.reload() // window.location.reload()
this.ModalCancel()
this.props.getcomponentdidmount()
} }
} }
@ -803,7 +830,9 @@ class TPMBanner extends Component {
hidestartshixunsreplacevalue, hidestartshixunsreplacevalue,
Forkvisibletype, Forkvisibletype,
AccountProfiletype, AccountProfiletype,
isIE isIE,
cancelText,
okText,
} = this.state; } = this.state;
let {shixunsDetails, shixunId, star_info, star_infos} = this.props; let {shixunsDetails, shixunId, star_info, star_infos} = this.props;
let challengeBtnTipText = ''; let challengeBtnTipText = '';
@ -900,6 +929,8 @@ class TPMBanner extends Component {
modalsMidval={this.state.modalsMidval} modalsMidval={this.state.modalsMidval}
loadtype={this.state.Loadtype} loadtype={this.state.Loadtype}
modalstyles={this.state.modalstyles} modalstyles={this.state.modalstyles}
cancelText={this.state.cancelText}
okText={this.state.okText}
/> : ""} /> : ""}
<div className="educontent clearfix"> <div className="educontent clearfix">

@ -412,6 +412,7 @@ class TPMIndex extends Component {
{...this.props} {...this.props}
{...this.state} {...this.state}
is_jupyter={this.state. is_jupyter} is_jupyter={this.state. is_jupyter}
getcomponentdidmount={()=>this.getcomponentdidmount()}
></TPMBanner> ></TPMBanner>
} }

@ -97,7 +97,7 @@ class Newshixuns extends Component {
}) })
const mdContnet = this.contentMdRef.current.getValue().trim(); const mdContnet = this.contentMdRef.current.getValue().trim();
this.props.form.validateFieldsAndScroll((err, values) => { this.props.form.validateFieldsAndScroll((err, values) => {
debugger
if (!err) { if (!err) {
console.log('Received values of form: ', values); console.log('Received values of form: ', values);

@ -33,7 +33,7 @@ class Challenges extends Component {
isSpin:false, isSpin:false,
boxoffsetHeigh:0, boxoffsetHeigh:0,
opentitletype:true, opentitletype:true,
isopentitletype:"Less", isopentitletype:"Less"
} }
} }
@ -357,6 +357,50 @@ class Challenges extends Component {
}) })
} }
// 开启挑战
beginChallenge=(url)=>{
if (this.props.checkIfLogin() === false) {
this.props.showLoginDialog()
return;
}
if (this.props.checkIfProfileCompleted() === false) {
this.setState({
AccountProfiletype: true
})
return;
}
this.setState({
startbtns:true
})
if(url.indexOf(".json")>-1){
axios.get(url).then((response) => {
if (response.data.status === -2) {
this.setState({
startbtns:false,
shixunsreplace:true,
hidestartshixunsreplacevalue:response.data.message+".json"
})
} else if (response.data.status === -1) {
this.setState({
startbtns: false
})
}else if(response.data.status===-3){
this.setState({
shixunsmessage:response.data.message,
startshixunCombattype:true,
startbtns:false
})
} else {
window.location.href = "/tasks/" + response.data.game_identifier;
}
}).catch((error) => {
});
}else{
window.location.href=url;
}
}
render() { render() {
let { ChallengesDataList, startbtns, sumidtype ,startshixunCombattype,shixunsreplace,shixunsmessage,hidestartshixunsreplacevalue,operationstrue,AccountProfiletype} = this.state; let { ChallengesDataList, startbtns, sumidtype ,startshixunCombattype,shixunsreplace,shixunsmessage,hidestartshixunsreplacevalue,operationstrue,AccountProfiletype} = this.state;
let { loadingContent } = this.props; let { loadingContent } = this.props;
@ -700,7 +744,8 @@ class Challenges extends Component {
</span> </span>
</div> </div>
<div className="challengtes_Item">
<div className="flex1">
<div className="clearfix mb5"> <div className="clearfix mb5">
{/*onClick={() => this.EditTraining(this.props.identity, item.challenge_id, "/editquestion")}*/} {/*onClick={() => this.EditTraining(this.props.identity, item.challenge_id, "/editquestion")}*/}
{this.props.identity<5? {this.props.identity<5?
@ -713,15 +758,7 @@ class Challenges extends Component {
} }
{/* onClick={() => this.EditTraining(this.props.identity, item.challenge_id, "/editcheckpoint")}*/} {/* onClick={() => this.EditTraining(this.props.identity, item.challenge_id, "/editcheckpoint")}*/}
<Modal
keyboard={false}
visible={startbtns}
closable={false}
footer={null}
className="startbtnModal"
>
<Spin size="large" />
</Modal>
</div> </div>
<div className="clearfix"> <div className="clearfix">
@ -740,9 +777,27 @@ class Challenges extends Component {
</div> </div>
</div> </div>
{
item.open_game ?
<a onClick={()=>this.beginChallenge(item.open_game)} className="challengeBtn blue">开启挑战</a>
:
<span className="challengeBtn">开启挑战</span>
}
</div>
</div>
) )
})} })}
</div> </div>
<Modal
keyboard={false}
visible={startbtns}
closable={false}
footer={null}
className="startbtnModal"
centered={true}
>
<Spin size="large" />
</Modal>
<Modal <Modal
keyboard={false} keyboard={false}
title="提示" title="提示"
@ -765,7 +820,6 @@ class Challenges extends Component {
</div> </div>
</Modal> </Modal>
<Modal <Modal
keyboard={false} keyboard={false}
title="提示" title="提示"

@ -263,3 +263,27 @@
.boreee{ .boreee{
border-bottom: 1px solid #F4F4F4; border-bottom: 1px solid #F4F4F4;
} }
.challengtes_Item{
display: flex;
justify-content: space-between;
align-items: center;
}
.flex1{
flex: 1;
width: 0;
}
.challengeBtn{
height:40px;
line-height: 38px;
padding:0px 27px;
color: #C0C4CC!important;
font-size: 16px;
border:1px solid rgba(235,235,235,1);
border-radius:4px;
margin-left: 15px;
}
.challengeBtn.blue{
background: #F2F8FE;
border:1px solid rgba(64,158,255,1);
color: #409EFF!important;
}

@ -94,7 +94,7 @@ class LoginRegisterComponent extends Component {
} }
//倒计时 //倒计时
getverificationcode = () => { getverificationcode = () => {
debugger
if(this.state.login === undefined || this.state.login.length===0){ if(this.state.login === undefined || this.state.login.length===0){
this.openNotification("请输入手机号或邮箱"); this.openNotification("请输入手机号或邮箱");
return; return;

@ -352,7 +352,7 @@ class LoginRegisterComponent extends Component {
login: this.state.login, login: this.state.login,
password: this.state.password, password: this.state.password,
}).then((response) => { }).then((response) => {
debugger
if (response === undefined) { if (response === undefined) {
return return
} }

@ -110,7 +110,7 @@ class NewGtaskForms extends Component{
} }
handleSubmit = () => { handleSubmit = () => {
console.log(this.props)
let {contentFileList,min_num,max_num,base_on_project}=this.state; let {contentFileList,min_num,max_num,base_on_project}=this.state;
let {data}=this.props; let {data}=this.props;
let task_type=data.task_type let task_type=data.task_type

@ -1,20 +1,12 @@
import React, { useState, useEffect, useContext, useRef, memo } from 'react'; import React, { useContext } from 'react';
import {Link} from 'react-router-dom';
import { getUrl2, isDev, ThemeContext } from 'educoder' import { ThemeContext } from 'educoder'
import { Modal } from 'antd' import { Modal } from 'antd'
function HeadlessModal (props) { function HeadlessModal(props) {
// const [ visible, setVisible ] = useState(false)
const theme = useContext(ThemeContext); const theme = useContext(ThemeContext);
const { category, visible, setVisible, className, width } = props; const { visible, setVisible, className, width } = props;
useEffect(() => {
}, [])
return ( return (
<Modal <Modal
visible={visible} visible={visible}
@ -48,7 +40,7 @@ function HeadlessModal (props) {
top: -13px; top: -13px;
} }
`}</style> `}</style>
<i className="iconfont icon-htmal5icon19 closeBtn" onClick={ () => setVisible(false) }></i> <i className="iconfont icon-htmal5icon19 closeBtn" onClick={() => setVisible(false)}></i>
{props.children} {props.children}
</Modal> </Modal>
) )

@ -10,6 +10,7 @@ import HeadlessModal from '../common/HeadlessModal'
import ClipboardJS from 'clipboard' import ClipboardJS from 'clipboard'
import VideoPlay from '../../../courses/Video/video-play'; import VideoPlay from '../../../courses/Video/video-play';
import { logWatchHistory } from '../../../../services/video-service';
function useModal(initValue) { function useModal(initValue) {
const [visible, setVisible] = useState(initValue) const [visible, setVisible] = useState(initValue)
@ -219,7 +220,7 @@ function InfoVideo(props) {
} }
function deleteVideo(item){ function deleteVideo(item) {
props.confirm({ props.confirm({
content: '该视频将被删除,不可恢复', content: '该视频将被删除,不可恢复',
subContent: '是否确认删除?', subContent: '是否确认删除?',
@ -267,7 +268,7 @@ function InfoVideo(props) {
className="showVideoModal" className="showVideoModal"
width={800 - 1} width={800 - 1}
> >
{videoModalObj.visible && <VideoPlay src={videoId.file_url} />} {videoModalObj.visible && <VideoPlay src={videoId.file_url} videoId={videoId.videoId} logWatchHistory={logWatchHistory} />}
<div className="df copyLine"> <div className="df copyLine">
<Input value={_inputValue} <Input value={_inputValue}
className="dark" className="dark"

@ -0,0 +1,11 @@
import axios from 'axios'
export async function logWatchHistory(params) {
try {
const response = await axios.post('/watch_video_histories.json', params)
return response.data.log_id
} catch (error) {
console.log(error)
}
return 0
}
Loading…
Cancel
Save