diff --git a/app/assets/javascripts/admin.js b/app/assets/javascripts/admin.js index 1e1f384ff..27844be53 100644 --- a/app/assets/javascripts/admin.js +++ b/app/assets/javascripts/admin.js @@ -19,6 +19,8 @@ $.fn.select2.defaults.set('theme', 'bootstrap4'); $.fn.select2.defaults.set('language', 'zh-CN'); +Turbolinks.setProgressBarDelay(200); + $(document).on('turbolinks:load', function(){ $('[data-toggle="tooltip"]').tooltip(); $('[data-toggle="popover"]').popover(); diff --git a/app/controllers/admins/base_controller.rb b/app/controllers/admins/base_controller.rb index 43f18b39c..6f89e7afa 100644 --- a/app/controllers/admins/base_controller.rb +++ b/app/controllers/admins/base_controller.rb @@ -7,6 +7,8 @@ class Admins::BaseController < ApplicationController before_action :require_login, :require_admin! + after_action :rebind_event_if_ajax_render_partial + private def require_login @@ -21,4 +23,16 @@ class Admins::BaseController < ApplicationController render_forbidden end + + # 触发after ajax render partial hooks,执行一些因为局部刷新后失效的绑定事件 + def rebind_event_if_ajax_render_partial + return if request.format.symbol != :js + return if response.content_type != 'text/javascript' + + path = Rails.root.join('app/views/admins/shared/after_render_js_hook.js.erb') + return unless File.exists?(path) + + append_js = ERB.new(File.open(path).read).result + response.body += append_js + end end \ No newline at end of file diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index bea9e6173..57eed15fd 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -40,7 +40,7 @@ class ApplicationController < ActionController::Base if @user_course_identity > Course::STUDENT && @course.is_public == 0 tip_exception(401, "..") unless User.current.logged? check_account - tip_exception(409, "您没有权限进入") + tip_exception(@course.excellent ? 410 : 409, "您没有权限进入") end uid_logger("###############user_course_identity:#{@user_course_identity}") end @@ -568,7 +568,7 @@ class ApplicationController < ActionController::Base end def strf_date(date) - date.blank? ? '' : date.strftime("%Y-%m-%d") + date.blank? ? '' : date.to_date.strftime("%Y-%m-%d") end def logger_error(error) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index d6694baa6..6194b7b41 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -26,7 +26,7 @@ class CoursesController < ApplicationController :base_info, :get_historical_courses, :create_group_by_importing_file, :attahcment_category_list,:export_member_scores_excel, :duplicate_course, :switch_to_teacher, :switch_to_assistant, :switch_to_student, :exit_course, - :informs, :update_informs, :online_learning, :update_task_position, :tasks_list] + :informs, :update_informs, :online_learning, :update_task_position, :tasks_list, :join_excellent_course] before_action :user_course_identity, except: [:join_excellent_course, :index, :create, :new, :apply_to_join_course, :search_course_list, :get_historical_course_students, :mine, :search_slim] before_action :teacher_allowed, only: [:update, :destroy, :settings, :search_teacher_candidate, @@ -158,6 +158,8 @@ class CoursesController < ApplicationController @course.subject.subject_members.where.not(user_id: current_user.id).each do |s_member| CourseMember.create!(course_id: @course.id, user_id: s_member.user_id, role: 2) end + + Inform.create(container: @course, description: @subject.learning_notes) end course_module_types = params[:course_module_types] @@ -179,7 +181,7 @@ class CoursesController < ApplicationController extra_params = Hash.new extra_params[:school_id] = @school.id - if @course.is_end && (course_params[:end_date].blank? || course_params[:end_date].to_date > Date.today) + if @course.is_end && (course_params[:end_date].blank? || course_params[:end_date].to_date >= Date.today) extra_params[:is_end] = 0 elsif !@course.is_end && !course_params[:end_date].blank? && course_params[:end_date].to_date < Date.today extra_params[:is_end] = 1 @@ -1193,8 +1195,8 @@ class CoursesController < ApplicationController @subject = @course.present? ? @course.subject : Subject.find_by!(id: params[:subject_id]) tip_exception("开始时间不能为空") if params[:start_date].blank? tip_exception("结束时间不能为空") if params[:end_date].blank? - tip_exception("结束时间必须晚于开始时间") if params[:end_date] <= params[:start_date] - tip_exception("开始时间和结束时间不能与往期开课时间重叠") if @course.nil? && @subject.max_course_end_date && params[:start_date] <= strf_date(@subject.max_course_end_date) + tip_exception("结束时间必须晚于开始时间") if strf_date(params[:end_date]) <= strf_date(params[:start_date]) + tip_exception("开始时间和结束时间不能与往期开课时间重叠") if @course.nil? && @subject.max_course_end_date && strf_date(params[:start_date]) <= strf_date(@subject.max_course_end_date) validate_start_end_date if @course.present? tip_exception("开放课堂必须包含公告栏和在线学习模块") unless params[:course_module_types].include?("announcement") && params[:course_module_types].include?("online_learning") end @@ -1206,8 +1208,8 @@ class CoursesController < ApplicationController def validate_start_end_date prev_course = @subject.courses.where("id < #{@course.id}").last next_course = @subject.courses.where("id > #{@course.id}").first - tip_exception("开始时间不能与往期开课时间重叠") if prev_course && params[:start_date] <= strf_date(prev_course.end_date) - tip_exception("结束时间不能与后期开课时间重叠") if next_course && params[:end_date] >= strf_date(next_course.start_date) + tip_exception("开始时间不能与往期开课时间重叠") if prev_course && strf_date(params[:start_date]) <= strf_date(prev_course.end_date) + tip_exception("结束时间不能与后期开课时间重叠") if next_course && strf_date(params[:end_date]) >= strf_date(next_course.start_date) end # 超级管理员和课堂管理员的权限判断 diff --git a/app/helpers/subjects_helper.rb b/app/helpers/subjects_helper.rb index 8aff41d25..75ae9f041 100644 --- a/app/helpers/subjects_helper.rb +++ b/app/helpers/subjects_helper.rb @@ -24,8 +24,8 @@ module SubjectsHelper elsif course.start_date && course.start_date > Date.today {status: 0, time: ""} elsif course.start_date && course.start_date <= Date.today && course.end_date >= Date.today - sum_week = ((course.end_date - course.start_date).to_i / 7.0).ceil - curr_week = ((Date.today - course.start_date).to_i / 7.0).ceil + sum_week = (((course.end_date - course.start_date).to_i + 1) / 7.0).ceil + curr_week = (((Date.today - course.start_date).to_i + 1) / 7.0).ceil {status: 1, time: "进行至第#{curr_week}周,共#{sum_week}周"} else {status: -1, time: ""} diff --git a/app/views/admins/daily_school_statistics/shared/_list.html.erb b/app/views/admins/daily_school_statistics/shared/_list.html.erb index b71be485e..af23e09f6 100644 --- a/app/views/admins/daily_school_statistics/shared/_list.html.erb +++ b/app/views/admins/daily_school_statistics/shared/_list.html.erb @@ -1,12 +1,12 @@ - + - - + + - + - + <% if statistics.present? %> <% statistics.each do |statistic| %> - diff --git a/app/views/admins/school_statistics/shared/_contrast_list.html.erb b/app/views/admins/school_statistics/shared/_contrast_list.html.erb index 049711ca2..928340c80 100644 --- a/app/views/admins/school_statistics/shared/_contrast_list.html.erb +++ b/app/views/admins/school_statistics/shared/_contrast_list.html.erb @@ -30,7 +30,8 @@ <% statistics.each do |statistic| %> diff --git a/app/views/admins/school_statistics/shared/_list.html.erb b/app/views/admins/school_statistics/shared/_list.html.erb index 72b92c13d..aa043f097 100644 --- a/app/views/admins/school_statistics/shared/_list.html.erb +++ b/app/views/admins/school_statistics/shared/_list.html.erb @@ -35,7 +35,8 @@ <% statistics.each do |statistic| %> diff --git a/app/views/admins/shared/after_render_js_hook.js.erb b/app/views/admins/shared/after_render_js_hook.js.erb new file mode 100644 index 000000000..9ceb13f5c --- /dev/null +++ b/app/views/admins/shared/after_render_js_hook.js.erb @@ -0,0 +1,3 @@ +; +$('[data-toggle="tooltip"]').tooltip(); +$('[data-toggle="popover"]').popover(); \ No newline at end of file diff --git a/config/locales/tidings/zh-CN.yml b/config/locales/tidings/zh-CN.yml index 347b0139a..e6e8e676d 100644 --- a/config/locales/tidings/zh-CN.yml +++ b/config/locales/tidings/zh-CN.yml @@ -49,9 +49,9 @@ Apply_end: "申请发布实训:%{name}" ApplySubject: System: - "1_end": "你提交的实训课程发布申请:%{name},审核已通过" - "2_end": "你提交的实训课程发布申请:%{name},审核未通过
原因:%{reason}" - Apply_end: "申请发布实训课程:%{name}" + "1_end": "你提交的实践课程发布申请:%{name},审核已通过" + "2_end": "你提交的实践课程发布申请:%{name},审核未通过
原因:%{reason}" + Apply_end: "申请发布实践课程:%{name}" TrialAuthorization: System: "1_end": "你提交的试用授权申请,审核已通过" @@ -61,7 +61,7 @@ Course: Delete_end: "你删除了课堂:%s" Shixun_end: "你创建了实训:%s" - Subject_end: "你创建了实训课程:%s" + Subject_end: "你创建了实践课程:%s" ArchiveCourse_end: "你的课堂已经归档:%s" JournalsForMessage: Mentioned_end: "@了你:%s" diff --git a/dump.rdb b/dump.rdb index f7b65ded0..6d0966fe0 100644 Binary files a/dump.rdb and b/dump.rdb differ diff --git a/lib/tasks/public_message.rake b/lib/tasks/public_message.rake index ca54fbd7b..ace16dbdf 100644 --- a/lib/tasks/public_message.rake +++ b/lib/tasks/public_message.rake @@ -32,6 +32,41 @@ namespace :sync do MessageDetail.create!(message_id: new_message.id, content: discuss.try(:content)) end end + end + + task :sigle_message => :environment do + shixun_id = ENV['args'].split(",")[0] # 对应课程的id + board_id = ENV['args'].split(",")[1] + message_id = ENV['args'].split(",")[2] + status = ENV['args'].split(",")[3] # 表示相应的期数 + + if status.to_i == 1 + start_time = '2018-12-16' + end_time = '2019-04-01' + elsif status.to_i == 2 + start_time = '2019-04-07' + end_time = '2019-07-28' + else + # 这种情况是取所有的 + start_time = '2015-01-01' + end_time = '2022-07-28' + end + + discusses = Discuss.where(dis_id: shixun_id).where("parent_id is null and created_at >? and created_at { - debugger + let{stage_names,stage_descriptions,shixuns_listeditlist}=this.state; let newstage_descriptions=stage_descriptions; diff --git a/public/react/src/modules/paths/PathDetail/DetailTop.js b/public/react/src/modules/paths/PathDetail/DetailTop.js index c0b969543..0256cfb33 100644 --- a/public/react/src/modules/paths/PathDetail/DetailTop.js +++ b/public/react/src/modules/paths/PathDetail/DetailTop.js @@ -200,7 +200,8 @@ class DetailTop extends Component{ }) this.setState({ MenuItemskey:keys, - courseslist:courseslist + courseslist:courseslist, + onVisibleChangestype:!this.state.onVisibleChangestype }) } @@ -409,14 +410,15 @@ class DetailTop extends Component{ - {this.props.courses===undefined?"":detailInfoList.is_creator===true?this.state.courseslist.map((item,key)=>{ - return( - + {this.props.courses===undefined?"":this.state.courseslist.map((item,key)=>{ + if(item.course_identity<4){ + return( + - + - - )}):"" + + )}}) } @@ -529,22 +531,20 @@ class DetailTop extends Component{
已结束
:"":""} {item.course_status.status===0? - detailInfoList.is_creator===true||detailInfoList.allow_add_member===true? + item.course_identity<5? 进入课堂 :item.course_identity<6?
报名成功
:this.JoinnowCourse(item.course_id)}>立即报名:""} {item.course_status.status===1? - detailInfoList.is_creator===true||detailInfoList.allow_add_member===true? + item.course_identity<5? 进入课堂 :item.course_identity<6? 立即学习 :this.JoinnowCourse(item.course_id)}>立即加入:""} {item.course_status.status===2? - detailInfoList.is_creator===true||detailInfoList.allow_add_member===true? - 进入课堂 - :item.course_identity<6? + item.course_identity<6? 进入课堂 :
已结束
:""} diff --git a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js index edac5ca01..5d63d5cf8 100644 --- a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js +++ b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js @@ -203,32 +203,9 @@ class PathDetailIndex extends Component{ } updatadetailInfoList=()=>{ - let pathid=this.props.match.params.pathId; - let url="/paths/"+pathid+".json"; - axios.get(url).then((result)=>{ - // TODO 403 让后台返回status 403 比较好 - if (result.data.status == 407 || result.data.status == 401) { - debugger - return; - } - if (result.data.status === 403 ) { - debugger - // window.location.href = "/403"; - return; - } - - if(result.data.allow_visit===true){ - this.setState({ - detailInfoList:result.data, - items: getItems(result.data.members.length), - user_id:undefined, - }) - } - - }).catch((error)=>{ - console.log(error); - }) + this.getdatasindex(); } + clickNewsubscript=(val)=>{ if(val===0){ this.setState({ diff --git a/public/react/src/modules/tpm/component/TPMright.css b/public/react/src/modules/tpm/component/TPMright.css index b0f8315e6..41b87c0d0 100644 --- a/public/react/src/modules/tpm/component/TPMright.css +++ b/public/react/src/modules/tpm/component/TPMright.css @@ -45,12 +45,12 @@ } .newedboxheight{ max-height:204px; - overflow-y: auto; + overflow-y: hidden; } .newminheight{ /*max-height: 670px;*/ max-height: 300px; - overflow: auto; + overflow-y: auto; } .delSubentry{ diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index bc6af002c..4f6dadcf9 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -123,7 +123,7 @@ em.vertical-line{display: inline-block;width: 2px;background: #999;height: 10px} background: #000000; border: 1px solid #fff; border-radius: 3px; - font-size: 14px; + font-size: 12px; opacity: 0.56; background-size: 100% 100%;padding: 0px 8px;color: #fff;float: left;} .tag-orange{position: absolute;right: 0px;top:12px;} @@ -3739,4 +3739,8 @@ a.singlepublishtwo{ .ant-tooltip{ max-width: 100% !important; +} + +.square-main p{ + margin-bottom: 0em; } \ No newline at end of file
单位名称单位名称<%= sort_tag('教师总人数', name: 'teacher_count', path: admins_daily_school_statistics_path) %><%= sort_tag('学生总人数', name: 'student_count', path: admins_daily_school_statistics_path) %><%= sort_tag('教师总数', name: 'teacher_count', path: admins_daily_school_statistics_path) %><%= sort_tag('学生总数', name: 'student_count', path: admins_daily_school_statistics_path) %> <%= sort_tag('课堂总数', name: 'course_count', path: admins_daily_school_statistics_path) %><%= sort_tag('正在进行课堂数', name: 'active_course_count', path: admins_daily_school_statistics_path) %><%= sort_tag('正在进行课堂数', name: 'active_course_count', path: admins_daily_school_statistics_path) %> <%= sort_tag('实训总数', name: 'shixun_count', path: admins_daily_school_statistics_path) %> <%= sort_tag('实训评测总数', name: 'shixun_evaluate_count', path: admins_daily_school_statistics_path) %> @@ -14,17 +14,16 @@ <%= sort_tag('实训作业总数', name: 'homework_count', path: admins_daily_school_statistics_path) %> <%= sort_tag('其它作业总数', name: 'other_homework_count', path: admins_daily_school_statistics_path) %><%= sort_tag('动态时间', name: 'nearly_course_time', path: admins_daily_school_statistics_path) %><%= sort_tag('动态时间', name: 'nearly_course_time', path: admins_daily_school_statistics_path) %>
- <%= link_to '#' do %> - <%= overflow_hidden_span statistic[:name], width: '200px' %> - <% end %> + + <%= link_to statistic[:name], "/colleges/#{statistic[:id]}/statistics", + target: '_blank', data: { toggle: 'tooltip', title: '点击查看学校统计概况' } %> <%= statistic[:teacher_count].to_i %> <%= statistic[:student_count].to_i %>
- <%= link_to statistic.school_name, '' %> + <%= link_to statistic.school_name, "/colleges/#{statistic.school_id}/statistics", + target: '_blank', data: { toggle: 'tooltip', title: '点击查看学校统计概况' } %> <%= statistic['total'] %> <%= statistic['other_total'] %>
- <%= link_to statistic.school_name, '' %> + <%= link_to statistic.school_name, "/colleges/#{statistic.school_id}/statistics", + target: '_blank', data: { toggle: 'tooltip', title: '点击查看学校统计概况' } %> <%= statistic.teacher_increase_count.to_i %> <%= statistic.student_increase_count.to_i %>