ecloud_sso
jingquan huang 5 years ago
commit 8e4c06694a

@ -70,9 +70,25 @@ class HomeworkCommonsController < ApplicationController
else
case order
when '1'
sql_str = %Q(homework_detail_manuals.comment_status = #{order} and homework_commons.end_time > '#{Time.now}')
if @user_course_identity == Course::STUDENT
unified_homework_ids = @homework_commons.published_no_end.unified_setting.pluck(:id)
group_homework_ids = @course.homework_group_settings.where("course_group_id = #{@member.course_group_id&.to_i}").published_no_end.pluck(:homework_common_id)
homework_ids = unified_homework_ids + group_homework_ids
homework_ids = homework_ids.blank? ? "(-1)" : "(" + homework_ids.join(",") + ")"
sql_str = %Q(homework_commons.id in #{homework_ids})
else
sql_str = %Q(homework_detail_manuals.comment_status = #{order} and homework_commons.end_time > '#{Time.now}')
end
when '2'
sql_str = %Q(allow_late = 1 and homework_commons.end_time < '#{Time.now}' and (late_time is null or late_time > '#{Time.now}'))
if @user_course_identity == Course::STUDENT
unified_homework_ids = @homework_commons.homework_ended.unified_setting.pluck(:id)
group_homework_ids = @course.homework_group_settings.where("course_group_id = #{@member.course_group_id&.to_i}").has_end.pluck(:homework_common_id)
homework_ids = unified_homework_ids + group_homework_ids
homework_ids = homework_ids.blank? ? "(-1)" : "(" + homework_ids.join(",") + ")"
sql_str = %Q(homework_commons.id in #{homework_ids} and allow_late = 1 and (late_time is null or late_time > '#{Time.now}'))
else
sql_str = %Q(allow_late = 1 and homework_commons.end_time < '#{Time.now}' and (late_time is null or late_time > '#{Time.now}'))
end
when '3'
sql_str = %Q(homework_detail_manuals.comment_status = #{order} and homework_detail_manuals.evaluation_end > '#{Time.now}')
when '4'

@ -14,6 +14,7 @@ class Users::UpdateAccountForm
validates :technical_title, presence: true, unless: -> { identity.to_s == 'student' }
validates :student_id, presence: true, if: -> { identity.to_s == 'student' }
validates :school_id, presence: true
validates :department_id, presence: true
validate :check_school_exist
def check_school_exist

@ -117,9 +117,16 @@ module HomeworkCommonsHelper
time = "提交剩余时间:" + how_much_time(max_end_time)
time_status = 1
else
status << "已截止"
time = course.end_date.present? ? ("评阅剩余时间:" + how_much_time(course.end_date.end_of_day)) : ""
time_status = 5
if max_end_time.present? && max_end_time < Time.now && homework_common.allow_late &&
(homework_common.late_time.nil? || homework_common.late_time > Time.now)
status << "补交中"
time = "补交剩余时间:" + how_much_time(homework_common.late_time)
time_status = 2
else
status << "已截止"
time = course.end_date.present? ? ("评阅剩余时间:" + how_much_time(course.end_date.end_of_day)) : ""
time_status = 5
end
end
end
end

@ -257,10 +257,10 @@ class Course < ApplicationRecord
# 老师负责的分班id
def charge_group_ids user
member = user.is_a?(CourseMember) ? user : course_member(user.id)
member = user.is_a?(CourseMember) ? user : course_member(user&.id)
group_ids = if member.present?
member.teacher_course_groups.size > 0 ? member.teacher_course_groups.pluck(:course_group_id) : course_groups.pluck(:id)
elsif user.admin_or_business?
elsif user&.admin_or_business?
course_groups.pluck(:id)
else
[]
@ -387,7 +387,7 @@ class Course < ApplicationRecord
end
def max_activity_time
course_acts.pluck(:updated_at).max
course_activities.pluck(:updated_at).max
end
# 课堂作业数

@ -47,6 +47,7 @@ class HomeworkCommon < ApplicationRecord
scope :homework_published, -> {where("homework_commons.publish_time IS NOT NULL AND homework_commons.publish_time <= ? ",Time.now)}
scope :published_no_end, -> {where("homework_commons.publish_time IS NOT NULL AND homework_commons.publish_time < ?
and homework_commons.end_time > ?", Time.now, Time.now)}
scope :homework_ended, -> {where("homework_commons.end_time IS NOT NULL AND homework_commons.end_time <= ? ",Time.now)}
scope :search_homework_type, lambda {|num| where(homework_type:num)}
scope :unified_setting, -> {where("unified_setting = ? ", 1)}

@ -7,5 +7,6 @@ class HomeworkGroupSetting < ApplicationRecord
scope :published_no_end, -> {where("homework_group_settings.publish_time IS NOT NULL AND homework_group_settings.publish_time < ?
and homework_group_settings.end_time > ?", Time.now, Time.now)}
scope :none_end, -> {where("homework_group_settings.end_time IS NULL or homework_group_settings.end_time > ?", Time.now)}
scope :has_end, -> {where("homework_group_settings.end_time IS NOT NULL AND homework_group_settings.end_time <= ?", Time.now)}
end

@ -44,7 +44,7 @@ class Admins::SchoolDailyStatisticService < ApplicationService
courses = Course.where(is_delete: 0, school_id: ids).group('school_id')
course_map = courses.count
nearly_course_time_map = courses.joins(:course_acts).maximum('course_activities.updated_at')
nearly_course_time_map = courses.joins(:course_activities).maximum('course_activities.updated_at')
active_course_map = courses.where(is_end: false).count
shixun_map = Shixun.joins(user: :user_extension).where(user_extensions: { identity: :teacher, school_id: ids })

@ -3,7 +3,7 @@ class Videos::DispatchCallbackService < ApplicationService
def initialize(params)
@video = Video.find_by(uuid: params[:VideoId])
@params = params``
@params = params
end
def call

@ -25,8 +25,8 @@ json.homeworks @homework_commons.each do |homework|
json.upper_category_name homework.course_second_category&.name unless params[:category]
charge_ids = @course.charge_group_ids(@member)
json.publish_immediately @user_course_identity < Course::STUDENT && homework.publish_immediately(charge_ids)
json.end_immediately @user_course_identity < Course::STUDENT && homework.end_immediately(charge_ids)
json.publish_immediately @user.logged? && @user_course_identity < Course::STUDENT && homework.publish_immediately(charge_ids)
json.end_immediately @user.logged? && @user_course_identity < Course::STUDENT && homework.end_immediately(charge_ids)
unless curr_status[:status].include?("未发布")
work_count = calculate_work_count homework, @member

@ -0,0 +1,254 @@
# 执行示例 RAILS_ENV=production bundle exec rake migrate_course_resource:import_attachments args=3835,2526
#
desc "同步课堂学生数据"
namespace :migrate_course_resource do
if ENV['args']
source_id = ENV['args'].split(",")[0] # 源课堂id
target_id = ENV['args'].split(",")[1] # 目标课堂id
end
task import_attachments: :environment do
source_course = Course.find_by(id: source_id)
target_course = Course.find_by(id: target_id)
return if source_course.blank? || target_course.blank?
source_course.attachments.each do |atta|
if atta.course_second_category.present?
target_category = CourseSecondCategory.find_by(name: atta.course_second_category.name, course_id: target_course.id, category_type: "attachment")
unless target_category.present?
course_module = target_course.course_modules.find_by(module_type: "attachment")
target_category = CourseSecondCategory.create(name: atta.course_second_category.name, course_id: target_course.id,
category_type: "attachment", course_module_id: course_module&.id,
position: course_module&.course_second_categories&.count.to_i + 1)
end
end
target_course.attachments << target_course.attachments.build(atta.attributes.except("id").merge(
quotes: 0,
downloads: 0,
author_id: target_course.tea_id,
created_on: Time.now,
course_second_category_id: target_category&.id.to_i
))
end
end
task import_videos: :environment do
source_course = Course.find_by(id: source_id)
target_course = Course.find_by(id: target_id)
return if source_course.blank? || target_course.blank?
source_course.course_videos.each do |video|
target_course.course_videos << CourseVideo.new(video_id: video.video_id)
end
end
task import_homeworks: :environment do
source_course = Course.find_by(id: source_id)
target_course = Course.find_by(id: target_id)
return if source_course.blank? || target_course.blank?
source_course.homework_commons.each do |homework|
ActiveRecord::Base.transaction do
if homework.course_second_category.present?
target_category = CourseSecondCategory.find_by(name: homework.course_second_category.name, course_id: target_course.id, category_type: "shixun_homework")
unless target_category.present?
course_module = target_course.course_modules.find_by(module_type: "shixun_homework")
target_category = CourseSecondCategory.create(name: homework.course_second_category.name, course_id: target_course.id,
category_type: "shixun_homework", course_module_id: course_module&.id,
position: course_module&.course_second_categories&.count.to_i + 1)
end
end
# 复制作业的基本信息
new_homework = HomeworkCommon.new(name: homework.name, user_id: target_course.tea_id, description: homework.description,
homework_type: homework.homework_type, course_id: target_course.id,
reference_answer: homework.reference_answer, course_second_category_id: target_category&.id.to_i)
# 作业的基本设置复制
new_homework.homework_detail_manual = HomeworkDetailManual.new
new_homework_detail_manual = new_homework.homework_detail_manual
new_homework_detail_manual.te_proportion = 0.7
new_homework_detail_manual.ta_proportion = 0.3
if new_homework.homework_type == "group"
# 分组作业表的复制
old_homework_group = homework.homework_detail_group
new_homework.homework_detail_group = HomeworkDetailGroup.new
new_homework.homework_detail_group.min_num = old_homework_group&.min_num
new_homework.homework_detail_group.max_num = old_homework_group&.max_num
new_homework.homework_detail_group.base_on_project = old_homework_group&.base_on_project
end
if new_homework.homework_type == "practice"
# 分组作业表的复制
new_homework.homework_commons_shixun = HomeworkCommonsShixun.new
new_homework.homework_commons_shixun.shixun_id = homework.homework_commons_shixun&.shixun_id
homework.position = HomeworkCommon.where(course_id:target_course.id, homework_type: "practice").pluck(:position).max.to_i + 1
homework.homework_challenge_settings.each do |setting|
new_homework.homework_challenge_settings << HomeworkChallengeSetting.new(challenge_id: setting.challenge_id,
shixun_id: setting.shixun_id, score: setting.score)
end
end
# 附件
if new_homework.save
homework.attachments.try(:each) do |attachment|
att = attachment.copy
att.container_id = nil
att.container_type = nil
att.author_id = homework.user_id
att.attachtype = attachment.attachtype || 1
# att.attachtype = 1
att.copy_from = attachment.id
att.save!
new_homework.attachments << att
end
new_homework_detail_manual.save if new_homework_detail_manual
new_homework.homework_detail_group.save if new_homework.homework_detail_group
new_homework.homework_commons_shixun.save if new_homework.homework_commons_shixun
CreateStudentWorkJob.perform_later(new_homework.id)
end
end
end
end
task import_exercises: :environment do
source_course = Course.find_by(id: source_id)
target_course = Course.find_by(id: target_id)
return if source_course.blank? || target_course.blank?
source_course.exercises.each do |exercise|
ActiveRecord::Base.transaction do
new_exercise = Exercise.new(:exercise_name => exercise.exercise_name, :exercise_description => exercise.exercise_description,
:user_id => target_course.tea_id, :course_id => target_course.id)
# 复制试卷基本信息
exercise.exercise_questions.each do |q|
option = {
:question_title => q.question_title,
:question_type => q.question_type || 1,
:question_number => q.question_number,
:question_score => q.question_score,
:shixun_name => q.shixun_name,
:shixun_id => q.shixun_id,
:is_ordered => q.is_ordered
}
exercise_question = new_exercise.exercise_questions.new option
# question_type5实训题其他是非实训题
if q.question_type != 5
# 复制选择题题目选项
q.exercise_choices.try(:each_with_index) do |choice, index|
exercise_question.exercise_choices.new({choice_position: index+1, choice_text: choice.choice_text})
end
# 复制标准答案(填空题和问答题) 多空填空题的话应该是原标准答案的exercise_choice_id即为题空的位置。
q.exercise_standard_answers.try(:each) do |answer|
exercise_question.exercise_standard_answers.new({exercise_choice_id: answer.exercise_choice_id, answer_text: answer.answer_text})
end
else
# 复制实训题
q.exercise_shixun_challenges.try(:each_with_index) do |sc, index|
exercise_question.exercise_shixun_challenges.new({position: index+1, challenge_id: sc.challenge_id,
shixun_id: sc.shixun_id, question_score: sc.question_score})
end
end
end
new_exercise.save!
end
end
end
task import_polls: :environment do
source_course = Course.find_by(id: source_id)
target_course = Course.find_by(id: target_id)
return if source_course.blank? || target_course.blank?
source_course.polls.each do |poll|
new_poll = Poll.new(:polls_name => poll.polls_name, :polls_description => poll.polls_description, :user_id => target_course.tea_id,
:polls_type => 'Course', :course_id => target_course.id)
poll.poll_questions.try(:each) do |q|
option = {
:question_title => q.question_title,
:question_type => q.question_type || 1,
:is_necessary => q.is_necessary,
:question_number => q.question_number,
:max_choices => q.max_choices,
:min_choices => q.min_choices
}
poll_question = new_poll.poll_questions.new option
q.poll_answers.try(:each_with_index) do |choice, index|
poll_question.poll_answers.new({answer_position: index+1, answer_text: choice.answer_text})
end
end
new_poll.save!
end
end
task import_members: :environment do
source_course = Course.find_by(id: source_id)
target_course = Course.find_by(id: target_id)
return if source_course.blank? || target_course.blank?
# 先把target——course中的老师创建分班权限
target_course.teachers.each do |member|
if member.teacher_course_groups.blank?
target_course.course_groups.each do |group|
TeacherCourseGroup.create!(course_group_id: group.id, course_id: target_course.id, course_member_id: member&.id, user_id: member&.user_id)
end
end
end
source_course.course_members.where(role: %i[PROFESSOR ASSISTANT_PROFESSOR]).each do |teacher|
new_member = target_course.teachers.find_by(user_id: teacher.user_id)
unless new_member.present?
new_member = CourseMember.create!(course_id: target_course.id, user_id: teacher.user_id, role: teacher.role)
end
end
source_course.course_groups.each do |group|
unless target_course.course_groups.where(name: group.name).exists?
new_group = CourseGroup.create!(course_id: target_course.id, name: group.name, position: target_course.course_groups.pluck(:position).max.to_i + 1)
else
new_group = target_course.course_groups.find_by(name: group.name)
end
new_user_ids = []
group.course_members.where(role: 4).each do |member|
new_member = target_course.students.find_by(user_id: member.user_id)
if new_member.present?
new_member.update_attributes(course_group_id: new_group.id)
else
CourseMember.create!(course_id: target_course.id, course_group_id: new_group.id, user_id: member.user_id, role: member.role)
new_user_ids << member.user_id
end
end
CourseAddStudentCreateWorksJob.perform_later(target_course.id, new_user_ids) unless new_user_ids.blank?
group.teacher_course_groups.each do |teacher_group|
member = CourseMember.find_by(course_id: target_course.id, user_id: teacher_group.user_id, role: %i[CREATOR PROFESSOR ASSISTANT_PROFESSOR])
if member.present? && !member.teacher_course_groups.where(course_group_id: new_group.id).exists?
TeacherCourseGroup.create!(course_group_id: new_group.id, course_id: target_course.id, course_member_id: member&.id, user_id: member&.user_id)
end
end
end
user_ids = []
source_course.students.where(course_group_id: 0).each do |member|
new_member = target_course.students.find_by(user_id: member.user_id)
if new_member.present?
new_member.update_attributes(course_group_id: 0)
else
CourseMember.create!(course_id: target_course.id, course_group_id: 0, user_id: member.user_id, role: member.role)
user_ids << member.user_id
end
end
CourseAddStudentCreateWorksJob.perform_later(target_course.id, user_ids) unless user_ids.blank?
end
end

@ -1,32 +0,0 @@
# 执行示例 RAILS_ENV=production bundle exec rake migrate_course_student:student args=3835,2526,21950,1000
# args 第一个课程 course_id第二个参数是学校school_id第三个参数是部门id第四个参数是迁移数量
#
desc "同步学校的学生"
namespace :migrate_course_student do
if ENV['args']
course_id = ENV['args'].split(",")[0] # 对应课堂的id
school_id = ENV['args'].split(",")[1] # 对应学校id
department_id = ENV['args'].split(",")[2] # 对应部门id
limit = ENV['args'].split(",")[3] # 限制导入的数量
end
task :student => :environment do
course = Course.find course_id
users = User.joins(:user_extension).where(user_extensions: {school_id: school_id, department_id: department_id, identity: 1}).limit(limit)
user_ids = []
users.each do |user|
if user.student_id.present? && !course.students.exists?(user_id: user.id)
begin
CourseMember.create!(course_id: course_id, user_id: user.id, role: 4)
user_ids << user.id
rescue Exception => e
Rails.logger(e.message)
end
end
end
CourseAddStudentCreateWorksJob.perform_later(course_id, user_ids)
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 149 KiB

@ -175,6 +175,9 @@ class ListPageIndex extends Component{
isexcellent:excellent
})
}
updatabanners=()=>{
this.refs.CoursesBanner.updatabanner()
}
render() {
let {yslGuideone} =this.state;
// console.log("98");
@ -187,7 +190,7 @@ class ListPageIndex extends Component{
<div>
<div className="newMain clearfix">
{/*头部banner*/}
<CoursesBanner {...this.props} ispostexcellenttype={(excellent)=>this.ispostexcellenttype(excellent)}></CoursesBanner>
<CoursesBanner ref={"CoursesBanner"} {...this.props} ispostexcellenttype={(excellent)=>this.ispostexcellenttype(excellent)}></CoursesBanner>
{/*下面是指引哦*/}
{/*{yslGuideone!==undefined?*/}
{/*(*/}
@ -249,7 +252,7 @@ class ListPageIndex extends Component{
></Route>
<Route path="/courses/:coursesId/teachers"
render={
(props) => (<TeacherList {...this.props} {...props} {...this.state} />)
(props) => (<TeacherList updatabanners={()=>this.updatabanners()} {...this.props} {...props} {...this.state} />)
}
></Route>
{/* 学生列表*/}
@ -300,7 +303,7 @@ class ListPageIndex extends Component{
(props) => (<Statistics {...this.props} {...props} {...this.state} />)
}
></Route>
{/*公告栏列表*/}
@ -324,7 +327,7 @@ class ListPageIndex extends Component{
}
></Route>
<Route path="/courses/:coursesId/files/:main_id"
render={
(props) => (<Resourcelist {...this.props} {...props} {...this.state} />)
@ -335,7 +338,7 @@ class ListPageIndex extends Component{
(props) => (<Resourcelist {...this.props} {...props} {...this.state} />)
}
></Route>
<Route path="/courses/:coursesId/graduation_topics/:Id"
render={
(props) => (<GraduationTopics {...this.props} {...props} {...this.state} />)

@ -42,7 +42,7 @@ class ModalWrapper extends Component{
{
`
body {
overflow: hidden !important;
width: calc(100%) !important;
}
`
}

@ -954,7 +954,7 @@ class Coursesleftnav extends Component{
{
`
body {
overflow: hidden !important;
width: calc(100%) !important;
}
`
}

@ -130,7 +130,9 @@ class CoursesHome extends Component{
<div className="newMain clearfix">
<style>
{
`
` ::-webkit-scrollbar {
width: 0px !important;
}
.courses-head{
width: 100%;
height: 300px;

@ -153,7 +153,7 @@ class HomeworkModal extends Component{
{
`
body {
overflow: hidden !important;
width: calc(100%) !important;
}
`
}
@ -170,7 +170,7 @@ class HomeworkModal extends Component{
destroyOnClose={true}
>
<div className="task-popup-content">
{ this.props.usingCheckBeforePost ?
<React.Fragment>
@ -183,7 +183,7 @@ class HomeworkModal extends Component{
<p className="task-popup-text-center font-16 mt10">
此设置将对所有分班生效
</p>
</React.Fragment> :
</React.Fragment> :
<React.Fragment>
<p className="task-popup-text-center font-16">
{this.props.Topval}
@ -222,8 +222,8 @@ class HomeworkModal extends Component{
</span>
</p>}
{/* usingCheckBeforePost 为true的时候 全选所有分班 */}
{this.props.modaltype===undefined||this.props.modaltype===2||this.props.modaltype===4
|| !course_groups || course_groups.length == 0
{this.props.modaltype===undefined||this.props.modaltype===2||this.props.modaltype===4
|| !course_groups || course_groups.length == 0
|| this.props.usingCheckBeforePost ?"":<ul className="upload_select_box fl clearfix mt20 mb30"
style={{"overflow-y":"auto",padding:"10px 0px"}}
id="search_not_members_list"

@ -43,6 +43,16 @@ class ModalsRename extends Component{
centered={true}
className={"Navmodal"}
>
{this.props.Navmodalnametype===undefined?false:this.props.Navmodalnametype===true?<style>
{
`
body{
width: calc(100%) !important;
}
`
}
</style>:""}
<div className={"fl mt5"}>{this.props.Navname}名称</div>
<Input placeholder={"请输入名称最大限制60个字符"}
className={"inputNav greyInput fl"}

@ -443,7 +443,7 @@ class NewShixunModel extends Component{
<div>
<style>
{
`body{ overflow: hidden !important; }
`body{ width: calc(100%) !important; }
.ant-drawer-content{ overflow:auto !important; background: #f5f5f5; }
.yslbottomsj{position: absolute;bottom: -8px;}
.ant-drawer-close{

@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'
import { trigger } from 'educoder'
import { Input, Checkbox } from "antd";
/**
/**
arg_course_groups 选中的id数组
joinCourseGroup 选中时触发 joinCourseGroup(checkedValues, item, index) 传入item数据对象index 数据对象index
checkAllValue 是否全选
@ -33,13 +33,13 @@ function CourseGroupChooser({ course_groups, isAdminOrCreator = true, item, inde
that.setState({groupSearchValue: e.target.value})
that.onCheckAllChange(e, item, index) - onCheckAllChange(e, item, index)
that.joinCourseGroup(checkedValues, item, index) - joinCourseGroup(checkedValues, item, index)
that.joinCourseGroup(checkedValues, item, index) - joinCourseGroup(checkedValues, item, index)
that.state.checkAllArray[index] - checkAllValue
*/
console.log('arg_course_groups', arg_course_groups)
const urlStyle = {"left":"unset", minWidth: '262px'};
if (alwaysShow == true) {
@ -54,17 +54,18 @@ function CourseGroupChooser({ course_groups, isAdminOrCreator = true, item, inde
</p>):
''
}
<Checkbox.Group onChange={(checkedValues) => joinCourseGroup(checkedValues, item, index)}
<Checkbox.Group onChange={(checkedValues) => joinCourseGroup(checkedValues, item, index)}
value={arg_course_groups.length && arg_course_groups[0].id ? arg_course_groups.map(item => item.id): arg_course_groups}
disabled={!isAdminOrCreator} className="mainGroup"
>
{course_groups && course_groups.length > 1 && <li key={'_all' + index} >
{/* 防止被外面group包裹 */}
<Checkbox.Group onChange={(e) => onCheckAllChange(e, item, index)} value={[checkAllValue]}>
<Checkbox
<Checkbox
value={true}
style={{ marginRight: '6px' }} onClick={() => {}}
disabled={!isAdminOrCreator}
style={{ marginRight: '6px' }} onClick={() => {}}
>全选</Checkbox>
</Checkbox.Group>
</li>}
@ -84,7 +85,7 @@ function CourseGroupChooser({ course_groups, isAdminOrCreator = true, item, inde
)
})
}
</Checkbox.Group>
<p className="drop_down_btn">
<a href="javascript:void(0)" className="color-grey-6"

@ -38,8 +38,8 @@ function buildColumns(that) {
const isAdminOrCreator = that.props.isAdminOrCreator();
const isAdminOrTeacher = that.props.isAdminOrTeacher()
const { course_groups, filterKey } = that.state
const showSorter = filterKey == '1'
const courseId = that.props.match.params.coursesId
const showSorter = filterKey == '1'
const courseId = that.props.match.params.coursesId
const columns = [{
title: '序号',
@ -48,7 +48,7 @@ function buildColumns(that) {
width: 78,
render: (content, item, index) => {
return index + 1
// return item.isApply == true ? '' : <a href="javascript:;">{(that.state.page - 1) * 20 + index + 1
// return item.isApply == true ? '' : <a href="javascript:;">{(that.state.page - 1) * 20 + index + 1
// - (that.state.application_list ? that.state.application_list.length : 0)} </a>
}
}
@ -70,7 +70,7 @@ function buildColumns(that) {
sortDirections: sortDirections,
sortOrder: sortedInfo.columnKey === 'name' && sortedInfo.order,
render: (name, record) => {
return <a href={`/users/${record.login}`} target="_blank" className="overflowHidden1" style={{ maxWidth: '110px'}}
return <a href={`/users/${record.login}`} target="_blank" className="overflowHidden1" style={{ maxWidth: '110px'}}
title={`${name.length > 4 ? name : ''}`}>{name}</a>
}
}, {
@ -84,7 +84,7 @@ function buildColumns(that) {
sortDirections: sortDirections,
sortOrder: sortedInfo.columnKey === 'role' && sortedInfo.order,
}]
}]
that.state.course_groups && that.state.course_groups.length && showSorter && columns.push({
title: <Tooltip title="仅能批阅指定分班的作品">管理权限</Tooltip>,
width: 260,
@ -152,13 +152,13 @@ function buildColumns(that) {
<span>
<WordsBtn onClick={() => that.onRefuse(record)} style={'grey'}>拒绝</WordsBtn>
<Divider type="vertical" />
<a onClick={() => that.onAgree(record)} style={{color: '#4CACFF'}}>同意</a>
<a onClick={() => that.onAgree(record)} style={{color: '#4CACFF'}}>同意</a>
</span> )
} else {
return (
<React.Fragment>
<WordsBtn style2={{ marginRight: '12px' }} onClick={() => that.onDelete(record)} style={'grey'}>删除</WordsBtn>
<WordsBtn style2={{ marginRight: '12px' }} onClick={() => that.onDelete(record)} style={'grey'}>删除</WordsBtn>
<ChangeRolePop
courseId={courseId}
record={record}
@ -169,7 +169,7 @@ function buildColumns(that) {
fetchUser={that.props.fetchUser}
></ChangeRolePop>
{/* <Popconfirm
{/* <Popconfirm
placement="bottom"
icon={null}
title={
@ -192,11 +192,11 @@ function buildColumns(that) {
// { record.role == ROLE_TEACHER ? <a style={{color: '#4CACFF'}} onClick={() => that.changeToAssistant(record)}>变更为助教</a> : '' }
// { record.role == ROLE_TEACHER_ASSISTANT ? <a style={{color: '#4CACFF'}} onClick={() => that.changeToTeacher(record)}>变更为教师</a> : '' }
// { record.role == ROLE_ADMIN && isAdminOrCreator ? <a style={{color: '#4CACFF', marginLeft: '44px'}} onClick={() => that.showChangeAdminModal(record)}>更换管理员</a> : '' }
// </span>
// </span>
)
}
},
})
}
@ -209,7 +209,7 @@ function buildColumns(that) {
render: (content, item, index) => {
return content ? <Checkbox value={content}></Checkbox> : ''
}
})
})
}
return columns
}
@ -265,10 +265,10 @@ class studentsList extends Component{
})
return;
}
const courseId = this.props.match.params.coursesId
const courseId = this.props.match.params.coursesId
let url = `/courses/${courseId}/teacher_application_review.json`
this.props.confirm({
content: `是否确认${ approval == 1 ? '同意' : '拒绝'}TA的加入`,
onOk: () => {
@ -285,11 +285,11 @@ class studentsList extends Component{
})
.catch(function (error) {
console.log(error);
});
});
}
})
}
onRefuse = (record) => {
this.onAgree(record, 2)
@ -343,10 +343,10 @@ class studentsList extends Component{
// console.log('addTeacherSuccessListener', data)
}
getCourseGroups = () => {
const courseId = this.props.match.params.coursesId
const courseId = this.props.match.params.coursesId
let url = `/courses/${courseId}/all_course_groups.json`
axios.get(url, {
params: { all: true }
})
@ -369,11 +369,11 @@ class studentsList extends Component{
}
joinCourseGroup = (ids, item, index) => {
// console.log('join ', ids, item)
const courseId = this.props.match.params.coursesId
const courseId = this.props.match.params.coursesId
let url = `/courses/${courseId}/set_course_group.json`
axios.post(url, {
course_group_ids: ids,
user_id: item.user_id,
@ -382,6 +382,7 @@ class studentsList extends Component{
.then((response) => {
if (response.data.status == 0) {
this.props.showNotification('修改成功')
this.props.updatabanners()
const newArray = ids.map((item) => {return {id: item, name: this.state.course_groups_map[item]}});
this.setState(
(prevState) => ({
@ -397,18 +398,18 @@ class studentsList extends Component{
}
onChangeRoleSuccess = () => {
this.fetchAll(undefined,this.state.filterKey)
}
}
fetchAll = async (argPage,filterKey) => {
let { searchValue }=this.state
this.setState({
isSpin:true
})
let id = this.props.match.params.coursesId
let id = this.props.match.params.coursesId
if (argPage) {
this.setState({ page: argPage })
}
const sortedInfo = this.state.sortedInfo;
let page = argPage || this.state.page
@ -436,7 +437,7 @@ class studentsList extends Component{
const result = await axios.get(encodeURI(url))
// axios.get((url)).then((result)=>{
if (result.data.teacher_list) {
this.setState({
this.setState({
teachers: result.data.teacher_list,
total_count: result.data.teacher_list_size,
application_list: result.data.application_list || [],
@ -445,7 +446,7 @@ class studentsList extends Component{
isSpin:false
})
} else if (result.data.application_list) {
this.setState({
this.setState({
total_count: result.data.teacher_list_size,
application_list: result.data.application_list || [],
is_admin: result.data.is_admin,
@ -461,7 +462,7 @@ class studentsList extends Component{
// })
}
getGroupList(){
let id = this.props.match.params.coursesId
let id = this.props.match.params.coursesId
let url='/courses/'+id+'/graduation_group_list.json';
axios.get((url)).then((result)=>{
if(result.status==200){
@ -543,16 +544,16 @@ class studentsList extends Component{
this.setState({ order: order }, () => {
this.fetchAll()
})
}
}
changeRole = (member, role) => {
const courseId = this.props.match.params.coursesId
const courseId = this.props.match.params.coursesId
let {filterKey}=this.state;
let url= `/courses/${courseId}/change_course_teacher.json`;
axios.post(url, {
course_member_id: member.course_member_id
// "user_list": [
// { "user_id": member.user_id }
// { "user_id": member.user_id }
// ],
// "graduation_group_id": member.graduation_group_id,
// "course_group_id": "820",
@ -588,7 +589,7 @@ class studentsList extends Component{
const courseId = this.props.match.params.coursesId
const url = `/courses/${courseId}/delete_course_teacher.json`
axios.post(url, {
axios.post(url, {
course_member_id: member.course_member_id
})
.then((response) => {
@ -601,15 +602,15 @@ class studentsList extends Component{
})
.catch(function (error) {
console.log(error);
});
});
}
})
}
addTeacher = () => {
this.refs.addTeacherModal.setVisible(true)
this.refs.addTeacherModal.setVisible(true)
}
addStudent = () => {
this.refs.addStudentModal.setVisible(true)
this.refs.addStudentModal.setVisible(true)
}
hasGraduationModule = () => {
@ -619,7 +620,7 @@ class studentsList extends Component{
})
return result && result.length > 0
}
onTableChange = (pagination, filters, sorter) => {
let {filterKey}=this.state;
console.log('Various parameters', pagination, filters, sorter);
@ -679,11 +680,11 @@ class studentsList extends Component{
return(
<React.Fragment>
{/* <AddTeacherModal ref="addTeacherModal"
{/* <AddTeacherModal ref="addTeacherModal"
{...this.props}
moduleName="教师"
></AddTeacherModal>
<AddStudentModal ref="addStudentModal"
<AddStudentModal ref="addStudentModal"
{...this.props}
moduleName="学生"
></AddStudentModal> */}
@ -694,7 +695,7 @@ class studentsList extends Component{
{...this.props} onOk={this.showChangeAdminModal}
changeAdminSuccess={this.changeAdminSuccess}
></AddAdminModal>
<Titlesearchsection
title={<React.Fragment>
<span>教师列表</span>
@ -708,9 +709,9 @@ class studentsList extends Component{
<React.Fragment>
{/* { isAdmin && <WordsBtn style="blue" className="mr30" onClick={()=>this.addTeacher()}></WordsBtn> }
{ isAdmin && <WordsBtn style="blue" className="mr30" onClick={()=>this.addStudent()}>添加学生</WordsBtn> } */}
{ isAdminOrCreator && <WordsBtn style="blue" className="fr" onClick={()=>this.showChangeAdminModal()}>更换管理员</WordsBtn>}
</React.Fragment>
}
secondRowLeft={
@ -777,7 +778,7 @@ class studentsList extends Component{
{ hasGraduationModule && isAdminOrTeacher && <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", minWidth: '222px'}}>
{
groupList && groupList.graduation_groups_count>10?
(<p className="drop_down_search">
@ -814,10 +815,10 @@ class studentsList extends Component{
</div>}
<Spin size="large" spinning={this.state.isSpin}>
<div className="clearfix stu_table teacher_table">
{combineArray.length ?
<Checkbox.Group style={{ width: '100%' }} onChange={this.onCheckBoxChange} value={checkBoxValues}>
{combineArray.length ?
<Checkbox.Group style={{ width: '100%' }} onChange={this.onCheckBoxChange} value={checkBoxValues}>
{/* pagination={{ current: page, total: total_count, pageSize:20, onChange: this.onPageChange }} */}
<Table columns={columns} dataSource={combineArray}
<Table columns={columns} dataSource={combineArray}
onChange={this.onTableChange}
pagination={total_count > 20 && filterKey == '1' ? { //分页
total: page == 1 && this.state.application_list.length ? total_count + total_count / Math.floor(this.state.application_list.length + 20) : total_count , //数据总数量

@ -870,7 +870,7 @@ class ShixunHomework extends Component{
Modalstype:false,
})
let category_id=this.props.match.params.category_id;
const cid = this.props.match.params.coursesId;
let url="/courses/"+cid+"/homework_commons/set_public.json";
axios.post(url, {
@ -1126,7 +1126,7 @@ class ShixunHomework extends Component{
{
`
body {
overflow: hidden !important;
width: calc(100%) !important;
}
`
}

@ -27,7 +27,7 @@ render() {
{
`
body{
overflow: hidden !important;
width: calc(100%) !important;
}
.ant-modal-body {
padding: 20px 40px;

@ -80,7 +80,7 @@ positon:0
return ""
}
// 初始化 initialValue + defaultSelected defaultSelected={``}
// {this.renderChoiceItems(item, index)}
// {this.renderChoiceItems(item, index)}
// String.valueOf(index)
var choiceQuestionComponent = choose.map( (item, index) => {
var choose_test = choose_test_cases.test_sets[index];
@ -90,7 +90,7 @@ positon:0
// <p style={{paddingLeft:'27px'}}>{item.subject}</p>
/*
<ReactMarkdown
<ReactMarkdown
source={item.subject} style={{paddingLeft:'27px'}}
renderers={{code: CodeBlock}}
/>
@ -102,31 +102,31 @@ positon:0
const i = optionValueArray.indexOf(item);
initialValueArray[i] = item
})
return (
<div id={`choice${index}`} key={index} className="mb15">
{/* <div style={groupStyle}>
{( item.category === 1 ? "单选题" : "多选题" )}
</div> */}
<div className="clearfix">
<span className="fl" style={{"color":"#8B9399"}}>{index+1}.</span>
<div id={`choose_subject_${index+1}`} className="fl choiceMD">
<textarea style={{display:'none'}}>{item.subject}</textarea>
<span className="fl" style={{"color":"#8B9399"}}>{index+1}.</span><textarea style={{display:'none'}}>{item.subject}</textarea>
</div>
</div>
<div>
{getFieldDecorator("" + (index), {
initialValue: item.category === 1 ? actual_output : (actual_output && actual_output.split(''))
})(
item.category === 1 ?
item.category === 1 ?
<RadioGroup name={`${index}`} defaultSelected={actual_output} className="radiogroup">
{this.renderChoiceItems(item, index)}
</RadioGroup>
: this.renderMultiChoiceItems(item, index, initialValueArray)
)
}
}
</div>
</div>
)
@ -151,7 +151,7 @@ positon:0
/*
<div style={ { display: 'inline-block'} }
dangerouslySetInnerHTML={{__html: optionItem.option_name}}>
</div>
</div>
<textarea value={optionItem.option_name}></textarea>
*/
ar.push(
@ -161,9 +161,9 @@ positon:0
classes={{root: this.props.classes.radio,
checked: this.props.classes.checked}}
checked={isSelected}
value={`${optionValueArray[optionIndex]}`}
style={styles.radioButton}
/>
} label={<div className="break-word" style={{lineHeight:"24px"}}>
@ -172,20 +172,20 @@ positon:0
</div>
<div style={ { display: 'inline-block',"color":"#8B9399"} }
dangerouslySetInnerHTML={{__html: showText}}>
</div>
</div>
</div>} ></FormControlLabel>
)
})
//
//
// <span style={ isSelected ? { fontSize: 16} : {}}> {optionItem.option_name}</span>
return ar
}
renderMultiChoiceItems(item, index, initialValueArray) {
return <CheckBoxGroup
return <CheckBoxGroup
{...this.props}
options={item.challenge_question} initialValueArray={initialValueArray}
itemLabelFunction={(option, index)=> {
@ -198,10 +198,10 @@ positon:0
</div>
<div style={ { display: 'inline-block',"color":"#8B9399"} }
dangerouslySetInnerHTML={{__html: showText}}>
</div>
</div>
</div>
)
}}
itemValueFunction={(option, index)=> {return optionValueArray[index]}}></CheckBoxGroup>
}
@ -235,14 +235,14 @@ positon:0
return (
<React.Fragment>
{ loading === true ?
{ loading === true ?
''
:
:
<div id="choiceRepositoryView" style={{"color":"#8B9399!important"}}>
{this.renderChooseQuestions()}
</div>
}
</React.Fragment>
);
}

@ -92,7 +92,7 @@ class ShixunPathSearch extends Component{
getList=(order,select,search,page )=>{
let url='/paths.json';
// '?order='+order+'&page='+page;
// if(select!=""){
@ -166,6 +166,9 @@ class ShixunPathSearch extends Component{
<style>
{
`
::-webkit-scrollbar {
width: 0px !important;
}
.pathImg{
width: 100%;
height: 300px;
@ -205,7 +208,7 @@ class ShixunPathSearch extends Component{
{/*<div className="fr mr5 search-new">*/}
{/*/!* <Search*/}
{/*placeholder="请输入路径名称进行搜索"*/}
{/*id="subject_search_input"*/}
{/*id="subject_search_input"*/}
{/*value={search}*/}
{/*onInput={this.inputSearchValue}*/}
{/*onSearch={this.searchValue}*/}

Loading…
Cancel
Save