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

dev_hs
杨树林 6 years ago
commit e8ebdeddb2

@ -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();

@ -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

@ -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)

@ -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
# 超级管理员和课堂管理员的权限判断

@ -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: ""}

@ -1,12 +1,12 @@
<table class="table table-hover daily-school-statistic-list-table">
<thead class="thead-light">
<tr>
<th width="18%" class="edu-txt-left">单位名称</th>
<th width="14%" class="text-left">单位名称</th>
<th width="10%"><%= sort_tag('教师总数', name: 'teacher_count', path: admins_daily_school_statistics_path) %></th>
<th width="10%"><%= sort_tag('学生总数', name: 'student_count', path: admins_daily_school_statistics_path) %></th>
<th width="10%"><%= sort_tag('教师总数', name: 'teacher_count', path: admins_daily_school_statistics_path) %></th>
<th width="10%"><%= sort_tag('学生总数', name: 'student_count', path: admins_daily_school_statistics_path) %></th>
<th width="10%"><%= sort_tag('课堂总数', name: 'course_count', path: admins_daily_school_statistics_path) %></th>
<th width="10%"><%= sort_tag('正在进行课堂数', name: 'active_course_count', path: admins_daily_school_statistics_path) %></th>
<th width="14%"><%= sort_tag('正在进行课堂数', name: 'active_course_count', path: admins_daily_school_statistics_path) %></th>
<th width="10%"><%= sort_tag('实训总数', name: 'shixun_count', path: admins_daily_school_statistics_path) %></th>
<th width="12%">
<%= sort_tag('实训评测总数', name: 'shixun_evaluate_count', path: admins_daily_school_statistics_path) %>
@ -14,17 +14,16 @@
</th>
<th width="10%"><%= sort_tag('实训作业总数', name: 'homework_count', path: admins_daily_school_statistics_path) %></th>
<th width="10%"><%= sort_tag('其它作业总数', name: 'other_homework_count', path: admins_daily_school_statistics_path) %></th>
<th width="14%"><%= sort_tag('动态时间', name: 'nearly_course_time', path: admins_daily_school_statistics_path) %></th>
<th width="13%"><%= sort_tag('动态时间', name: 'nearly_course_time', path: admins_daily_school_statistics_path) %></th>
</tr>
</thead>
<tbody>
<% if statistics.present? %>
<% statistics.each do |statistic| %>
<tr>
<td class="edu-txt-left">
<%= link_to '#' do %>
<%= overflow_hidden_span statistic[:name], width: '200px' %>
<% end %>
<td class="text-left">
<%= link_to statistic[:name], "/colleges/#{statistic[:id]}/statistics",
target: '_blank', data: { toggle: 'tooltip', title: '点击查看学校统计概况' } %>
</td>
<td><%= statistic[:teacher_count].to_i %></td>
<td><%= statistic[:student_count].to_i %></td>

@ -30,7 +30,8 @@
<% statistics.each do |statistic| %>
<tr>
<td class="text-left">
<%= link_to statistic.school_name, '' %>
<%= link_to statistic.school_name, "/colleges/#{statistic.school_id}/statistics",
target: '_blank', data: { toggle: 'tooltip', title: '点击查看学校统计概况' } %>
</td>
<td><%= statistic['total'] %></td>
<td><%= statistic['other_total'] %></td>

@ -35,7 +35,8 @@
<% statistics.each do |statistic| %>
<tr>
<td class="text-left">
<%= link_to statistic.school_name, '' %>
<%= link_to statistic.school_name, "/colleges/#{statistic.school_id}/statistics",
target: '_blank', data: { toggle: 'tooltip', title: '点击查看学校统计概况' } %>
</td>
<td><%= statistic.teacher_increase_count.to_i %></td>
<td><%= statistic.student_increase_count.to_i %></td>

@ -0,0 +1,3 @@
;
$('[data-toggle="tooltip"]').tooltip();
$('[data-toggle="popover"]').popover();

@ -49,9 +49,9 @@
Apply_end: "申请发布实训:%{name}"
ApplySubject:
System:
"1_end": "你提交的实课程发布申请:%{name},审核已通过"
"2_end": "你提交的实课程发布申请:%{name},审核未通过<br/><span>原因:%{reason}</span>"
Apply_end: "申请发布实课程:%{name}"
"1_end": "你提交的实课程发布申请:%{name},审核已通过"
"2_end": "你提交的实课程发布申请:%{name},审核未通过<br/><span>原因:%{reason}</span>"
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"

Binary file not shown.

@ -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 <?", start_time, end_time)
discusses.each do |discuss|
puts discuss.id
# 找到所有的子回复
replies = Discuss.where(parent_id: discuss.id)
# 如果有子回复,除了创建父回复外,还需要同步子回复
new_message = Message.create!(board_id: board_id.to_i, author_id: discuss.user_id, parent_id: message_id, root_id: message_id)
MessageDetail.create!(message_id: new_message.id, content: discuss.try(:content))
if replies.present?
replies.each do |reply|
reply_message = Message.create!(board_id: board_id.to_i, author_id: reply.user_id, parent_id: new_message.id, root_id: message_id)
MessageDetail.create!(message_id: reply_message.id, content: reply.try(:content))
end
end
end
end
end
end

@ -121,7 +121,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;}
@ -3443,4 +3443,8 @@ a.singlepublishtwo{
.ant-tooltip{
max-width: 100% !important;
}
.square-main p{
margin-bottom: 0 !important;
}

@ -242,7 +242,7 @@ class DetailCardsEditAndAdd extends Component{
//保存
clickShixunsaves=()=>{
debugger
let{stage_names,stage_descriptions,shixuns_listeditlist}=this.state;
let newstage_descriptions=stage_descriptions;

@ -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{
</style>
{this.props.courses===undefined?"":detailInfoList.is_creator===true?this.state.courseslist.map((item,key)=>{
return(
<Tooltip placement="bottom" title={"编辑课堂"} key={key}>
{this.props.courses===undefined?"":this.state.courseslist.map((item,key)=>{
if(item.course_identity<4){
return(
<Tooltip placement="bottom" title={"编辑课堂"} key={key}>
<a href={`/courses/${item.course_id}/newgolds/settings`} target={"_blank"}>
<i className="iconfont icon-bianji1 newbianji1"></i>
<i className="iconfont icon-bianji1 newbianji1"></i>
</a>
</Tooltip>
)}):""
</Tooltip>
)}})
}
@ -529,22 +531,20 @@ class DetailTop extends Component{
<div className="mr51 shixun_detail pointer fl user-colorgrey-9b pathdefault">已结束</div>:"":""}
{item.course_status.status===0?
detailInfoList.is_creator===true||detailInfoList.allow_add_member===true?<a className="fr user_default_btn task-btn-orange font-18 mt28 pathbtens" href={item.first_category_url} target="_blank">
item.course_identity<5?<a className="fr user_default_btn task-btn-orange font-18 mt28 pathbtens" href={item.first_category_url} target="_blank">
进入课堂
</a>:item.course_identity<6?<div className="fr user_default_btn background191 font-18 mt28 pathbtens pathdefault"></div>
:<a className="fr user_default_btn task-btn-orange font-18 mt28 pathbtens" onClick={()=>this.JoinnowCourse(item.course_id)}>立即报名</a>:""}
{item.course_status.status===1?
detailInfoList.is_creator===true||detailInfoList.allow_add_member===true?<a className="fr user_default_btn task-btn-orange font-18 mt28 pathbtens" href={item.first_category_url} target="_blank">
item.course_identity<5?<a className="fr user_default_btn task-btn-orange font-18 mt28 pathbtens" href={item.first_category_url} target="_blank">
进入课堂
</a>:item.course_identity<6?<a className="fr user_default_btn task-btn-orange font-18 mt28 pathbtens" href={item.first_category_url} target="_blank">
立即学习
</a>:<a className="fr user_default_btn task-btn-orange font-18 mt28 pathbtens" onClick={()=>this.JoinnowCourse(item.course_id)}></a>:""}
{item.course_status.status===2?
detailInfoList.is_creator===true||detailInfoList.allow_add_member===true?<a className="fr user_default_btn task-btn-orange font-18 mt28 pathbtens" href={item.first_category_url} target="_blank">
进入课堂
</a>:item.course_identity<6?<a className="fr user_default_btn task-btn-orange font-18 mt28 pathbtens" href={item.first_category_url} target="_blank">
item.course_identity<6?<a className="fr user_default_btn task-btn-orange font-18 mt28 pathbtens" href={item.first_category_url} target="_blank">
进入课堂
</a>:<div className="fr user_default_btn background191 font-18 mt28 pathbtens pathdefault"></div>:""}

@ -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({

@ -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{

@ -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;
}
Loading…
Cancel
Save