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

issues25489
hjm 5 years ago
commit 3c29e67825

@ -7,6 +7,7 @@ $(document).on('turbolinks:load', function() {
$searchForm.find('.school-select').select2({
theme: 'bootstrap4',
placeholder: '请选择创建者单位',
allowClear: true,
minimumInputLength: 1,
ajax: {
delay: 500,

@ -0,0 +1,60 @@
$(document).on('turbolinks:load', function() {
if ($('body.cooperative-laboratory-shixuns-index-page').length > 0) {
var $searchForm = $('.laboratory-shixun-list-form .search-form');
$searchForm.find('select#tag_id').select2({
placeholder: "请选择",
allowClear: true
});
// 上传图片
$('.modal.cooperative-upload-file-modal').on('upload:success', function (e, data) {
var $imageElement = $('.shixun-image-' + data.source_id);
if($imageElement.length === 0) return;
$imageElement.attr('src', data.url);
$imageElement.show();
$imageElement.next().html('重新上传');
});
// 定义状态切换监听事件
var defineStatusChangeFunc = function (doElement, undoElement, url, callback) {
$('.laboratory-shixun-list-container').on('click', doElement, function () {
var $doAction = $(this);
var $undoAction = $doAction.siblings(undoElement);
var laboratoryShixunId = $doAction.data('id');
customConfirm({
content: '确认进行该操作吗?',
ok: function () {
$.ajax({
url: '/cooperative/laboratory_shixuns/' + laboratoryShixunId + url,
method: 'POST',
dataType: 'json',
success: function () {
show_success_flash();
$doAction.hide();
$undoAction.show();
if (callback && typeof callback === "function") {
callback(laboratoryShixunId, url);
}
}
});
}
});
});
}
// 首页展示与取消首页展示
var homepageShowCallback = function (laboratoryShixunId, url) {
var $laboratoryShixunItem = $('.laboratory-shixun-list-container').find('.laboratory-shixun-item-' + laboratoryShixunId);
if (url === '/homepage') {
$laboratoryShixunItem.find('.homepage-badge').show();
} else {
$laboratoryShixunItem.find('.homepage-badge').hide();
}
}
defineStatusChangeFunc('.homepage-show-action', '.homepage-hide-action', '/homepage', homepageShowCallback);
defineStatusChangeFunc('.homepage-hide-action', '.homepage-show-action', '/cancel_homepage', homepageShowCallback);
}
})

@ -0,0 +1,83 @@
$(document).on('turbolinks:load', function() {
if ($('body.cooperative-laboratory-subjects-index-page').length > 0) {
var $searchForm = $('.laboratory-subject-list-form .search-form');
// ************** 学校选择 *************
$searchForm.find('.school-select').select2({
theme: 'bootstrap4',
placeholder: '请选择创建者单位',
allowClear: true,
minimumInputLength: 1,
ajax: {
delay: 500,
url: '/api/schools/search.json',
dataType: 'json',
data: function (params) {
return {keyword: params.term};
},
processResults: function (data) {
return {results: data.schools}
}
},
templateResult: function (item) {
if (!item.id || item.id === '') return item.text;
return item.name;
},
templateSelection: function (item) {
if (item.id) {
}
return item.name || item.text;
}
});
// 上传图片
$('.modal.cooperative-upload-file-modal').on('upload:success', function (e, data) {
var $imageElement = $('.subject-image-' + data.source_id);
if($imageElement.length === 0) return;
$imageElement.attr('src', data.url);
$imageElement.show();
$imageElement.next().html('重新上传');
});
// 定义状态切换监听事件
var defineStatusChangeFunc = function (doElement, undoElement, url, callback) {
$('.laboratory-subject-list-container').on('click', doElement, function () {
var $doAction = $(this);
var $undoAction = $doAction.siblings(undoElement);
var laboratorySubjectId = $doAction.data('id');
customConfirm({
content: '确认进行该操作吗?',
ok: function () {
$.ajax({
url: '/cooperative/laboratory_subjects/' + laboratorySubjectId + url,
method: 'POST',
dataType: 'json',
success: function () {
show_success_flash();
$doAction.hide();
$undoAction.show();
if (callback && typeof callback === "function") {
callback(laboratorySubjectId, url);
}
}
});
}
});
});
}
// 首页展示与取消首页展示
var homepageShowCallback = function (laboratoryShixunId, url) {
var $laboratoryShixunItem = $('.laboratory-subject-list-container').find('.laboratory-subject-item-' + laboratoryShixunId);
if (url === '/homepage') {
$laboratoryShixunItem.find('.homepage-badge').show();
} else {
$laboratoryShixunItem.find('.homepage-badge').hide();
}
}
defineStatusChangeFunc('.homepage-show-action', '.homepage-hide-action', '/homepage', homepageShowCallback);
defineStatusChangeFunc('.homepage-hide-action', '.homepage-show-action', '/cancel_homepage', homepageShowCallback);
}
})

@ -0,0 +1,18 @@
$(document).on('turbolinks:load', function () {
$('.cooperative-modal-container').on('show.bs.modal', '.modal.cooperative-edit-subject-modal', function () {
var $modal = $('.modal.cooperative-edit-subject-modal');
var $form = $modal.find('form.cooperative-edit-subject-form');
$modal.on('click', '.submit-btn', function () {
$form.find('.error').html('');
var url = $form.attr('action');
$.ajax({
method: 'PATCH',
dataType: 'script',
url: url,
data: $form.serialize()
});
});
})
});

@ -42,7 +42,7 @@ $(document).on('turbolinks:load', function() {
$.ajax({
method: 'POST',
dataType: 'json',
url: '/cooperatives/files?' + formDataString,
url: '/cooperative/files?' + formDataString,
data: new FormData($form[0]),
processData: false,
contentType: false,

@ -47,6 +47,12 @@
}
}
.image-preview-container {
display: flex;
flex-direction: column;
align-items: center;
}
.action-container {
& > .action {
padding: 0 3px;

@ -47,6 +47,12 @@
}
}
.image-preview-container {
display: flex;
flex-direction: column;
align-items: center;
}
.action-container {
& > .action {
padding: 0 3px;

@ -8,6 +8,7 @@ module Base::RenderHelper
def render_forbidden
render_by_format(html: -> { current_user&.business? ? render('shared/403') : redirect_to('/403') },
js: -> { render_js_error(I18n.t('error.forbidden'), type: :notify) },
json: -> { render status: 403, json: { messages: I18n.t('error.forbidden') } } )
end

@ -1,5 +1,5 @@
class Cooperative::FilesController < Cooperative::BaseController
before_action :convert_file!, only: [:create]
before_action :convert_file!, :check_permission!, only: [:create]
def create
File.delete(file_path) if File.exist?(file_path) # 删除之前的文件
@ -29,6 +29,22 @@ class Cooperative::FilesController < Cooperative::BaseController
render_error(ex.message)
end
def check_permission!
permission =
case params[:source_type].to_s
when '' then false
when 'Shixun' then
current_laboratory.laboratory_shixuns.exists?(ownership: true, shixun_id: params[:source_id])
when 'Subject' then
current_laboratory.laboratory_subjects.exists?(ownership: true, subject_id: params[:source_id])
else true
end
return if permission
render_forbidden
end
def file_path
@_file_path ||= begin
case params[:source_type].to_s

@ -0,0 +1,39 @@
class Cooperative::LaboratoryShixunsController < Cooperative::BaseController
before_action :check_shixun_ownership!, only: [:edit, :update]
helper_method :current_laboratory_shixun
def index
laboratory_shixuns = Admins::LaboratoryShixunQuery.call(current_laboratory, params)
@laboratory_shixuns = paginate laboratory_shixuns.includes(shixun: %i[tag_repertoires user])
end
def edit
end
def update
end
def homepage
current_laboratory_shixun.update!(homepage: true)
render_ok
end
def cancel_homepage
current_laboratory_shixun.update!(homepage: false)
render_ok
end
private
def current_laboratory_shixun
@_current_laboratory_shixun ||= current_laboratory.laboratory_shixuns.find(params[:id])
end
def check_shixun_ownership!
return if current_laboratory_shixun.ownership?
render_forbidden
end
end

@ -0,0 +1,46 @@
class Cooperative::LaboratorySubjectsController < Cooperative::BaseController
before_action :check_subject_ownership!, only: [:edit, :update]
helper_method :current_laboratory_subject
def index
laboratory_subjects = Admins::LaboratorySubjectQuery.call(current_laboratory, params)
includes_tables = { subject: [:repertoire, :subject_level_system, user: {user_extension: :school}] }
@laboratory_subjects = paginate(laboratory_subjects.includes(includes_tables))
end
def edit
@laboratory_subject = current_laboratory_subject
end
def update
current_laboratory_subject.subject.update!(update_params)
end
def homepage
current_laboratory_subject.update!(homepage: true)
render_ok
end
def cancel_homepage
current_laboratory_subject.update!(homepage: false)
render_ok
end
private
def current_laboratory_subject
@_current_laboratory_subject ||= current_laboratory.laboratory_subjects.find(params[:id])
end
def check_subject_ownership!
return if current_laboratory_subject.ownership?
render_forbidden
end
def update_params
params.require(:laboratory_subject).permit(:repertoire_id, :subject_level_system_id)
end
end

@ -1141,7 +1141,7 @@ class CoursesController < ApplicationController
# 如果在该课堂已经存在学生身份,且邀请码为分班邀请码,则将其直接加入分班
existing_student.update_attributes(course_group_id: course_group.id) if course_group.present?
else
correspond_teacher_exist = current_user.teacher_of_course? course
correspond_teacher_exist = current_user.none_admin_teacher_of_course? course
new_student = CourseMember.new(user_id: current_user.id, course_id: course.id, role: 4)
new_student.is_active = 0 if correspond_teacher_exist

@ -612,13 +612,27 @@ class ExercisesController < ApplicationController
def adjust_score
exercise_user = @exercise.exercise_users.find_by!(user_id: params[:user_id])
tip_exception("已提交的作品请去评阅页进行调分") if exercise_user.commit_status == 1
tip_exception("分数不能为空") if params[:score].blank?
tip_exception("分数不能超过0-#{@exercise.question_scores}") if params[:score].to_f < 0 || params[:score].to_f.round(1) > @exercise.question_scores.round(1)
if @exercise.subjective_score > 0
tip_exception("主观题成绩不能为空") if params[:subject_score].blank?
tip_exception("主观题成绩不能小于零") if params[:subject_score].to_f < 0
tip_exception("主观题成绩不能大于总分值:#{@exercise.subjective_score}") if params[:subject_score].to_f.round(1) > @exercise.subjective_score.round(1)
end
if @exercise.objective_score > 0
tip_exception("客观题成绩不能为空") if params[:objective_score].blank?
tip_exception("客观题成绩不能小于零") if params[:objective_score].to_f < 0
tip_exception("客观题成绩不能大于总分值:#{@exercise.objective_score}") if params[:objective_score].to_f.round(1) > @exercise.objective_score.round(1)
end
ActiveRecord::Base.transaction do
start_at_time = exercise_user.start_at || Time.now
exercise_user.update_attributes!(start_at: start_at_time, end_at: Time.now, status: 1, commit_status: 1, score: params[:score].to_f.round(2), commit_method: 5)
ExerciseUserScore.create!(exercise_id: @exercise.id, exercise_user_id: exercise_user.id, score: params[:score], comment: params[:comment])
subjective_score = @exercise.subjective_score > 0 ? params[:subject_score].to_f.round(2) : 0
objective_score = @exercise.objective_score > 0 ? params[:objective_score].to_f.round(2) : 0
score = subjective_score + objective_score
exercise_user.update_attributes!(start_at: start_at_time, end_at: Time.now, status: 1, commit_status: 1, score: score,
subjective_score: subjective_score, objective_score: objective_score, commit_method: 5)
ExerciseUserScore.create!(exercise_id: @exercise.id, exercise_user_id: exercise_user.id,
subjective_score: subjective_score, objective_score: objective_score)
normal_status("操作成功")
end
end

@ -149,6 +149,7 @@ class GraduationTasksController < ApplicationController
else
respond_to do |format|
format.xlsx{
set_export_cookies
graduation_work_to_xlsx(@work_excel,@task,current_user)
task_export_name_ = "#{current_user.real_name}_#{@course.name}_#{@task.name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}"
render xlsx: "#{task_export_name_.strip}",template: "graduation_tasks/tasks_list.xlsx.axlsx",locals: {table_columns:@head_cells_column, task_users:@task_cells_column}

@ -379,8 +379,9 @@ class GraduationWorksController < ApplicationController
end
def adjust_score
tip_exception("分数不能为空") if params[:score].blank?
tip_exception("分数不能超过0-100") if params[:score].to_f < 0 || params[:score].to_f > 100
tip_exception("成绩不能为空") if params[:score].blank?
tip_exception("成绩不能小于零") if params[:score].to_f < 0
tip_exception("成绩不能大于100") if params[:score].to_f.round(1) > 100
ActiveRecord::Base.transaction do
begin
# 分数不为空的历史评阅都置为失效

@ -160,7 +160,7 @@ class HomeworkCommonsController < ApplicationController
# 作品状态 0 未提交, 1 按时提交, 2 延迟提交
if params[:work_status].present?
params_work_status = request.get? ? params[:work_status].split(",") : params[:work_status]
params_work_status = params[:work_status]
work_status = params_work_status.map{|status| status.to_i}
all_student_works = @student_works.left_joins(:myshixun)
@student_works = all_student_works.where(work_status: work_status)
@ -171,7 +171,7 @@ class HomeworkCommonsController < ApplicationController
# 分班情况
unless params[:course_group].blank?
group_ids = request.get? ? params[:course_group].split(",") : params[:course_group]
group_ids = params[:course_group]
group_user_ids = @course.students.where(course_group_id: group_ids).pluck(:user_id)
# 有分组只可能是老师身份查看列表
@student_works = @student_works.where(user_id: group_user_ids)
@ -179,9 +179,9 @@ class HomeworkCommonsController < ApplicationController
if @homework.homework_type == "group" && !params[:member_work].blank?
if params[:member_work].to_i == 1
@student_works = @student_works.where("user_id = commit_user_id")
@student_works = @student_works.where("student_works.user_id = commit_user_id")
elsif params[:member_work].to_i == 0
@student_works = @student_works.where("user_id != commit_user_id")
@student_works = @student_works.where("student_works.user_id != commit_user_id")
end
end

@ -103,17 +103,19 @@ class MessagesController < ApplicationController
return normal_status(403, "您没有权限进行该操作") if current_user != @message.author && !current_user.teacher_of_course?(@message.board.course)
begin
email_notify = @message.email_notify ? 1 : @board.course.email_notify && params[:email_notify]
board = @message.board&.course&.boards.find_by!(id: params[:select_board_id])
email_notify = @message.email_notify ? 1 : @message.board&.course.email_notify && params[:email_notify]
send_email = !@message.email_notify && email_notify
h = {is_md: true, email_notify: email_notify}
h = {is_md: true, email_notify: email_notify, board_id: board&.id}
m_params = message_params.merge(h)
@message.update_attributes(m_params)
Attachment.associate_container(params[:attachment_ids], @message.id, @message.class.name)
@message.update_content(params[:content])
notify_course_students(@message, @board.course) if send_email
notify_course_students(@message, @message.board&.course) if send_email
rescue Exception => e
uid_logger_error(e.message)
tip_exception("修改失败")
tip_exception(e.message)
raise ActiveRecord::Rollback
end
end

@ -533,10 +533,9 @@ class StudentWorksController < ApplicationController
# 作品调分
def adjust_score
tip_exception("分数不能为空") if params[:score].blank?
tip_exception("分数不能超过0-100") if @homework.homework_type != "practice" && (params[:score].to_f < 0 || params[:score].to_f.round(1) > 100.round(1))
tip_exception("已提交的作品请去评阅页进行调分") if @homework.homework_type == "practice" && @work.work_status > 0
tip_exception("分数不能超过总分值#{@homework.total_score}") if @homework.homework_type == "practice" && (params[:score].to_f < 0 || params[:score].to_f.round(1) > @homework.total_score.round(1))
tip_exception("成绩不能为空") if params[:score].blank?
tip_exception("成绩不能小于零") if params[:score].to_f < 0
tip_exception("成绩不能大于100") if params[:score].to_f.round(1) > 100
ActiveRecord::Base.transaction do
begin
# 分数不为空的历史评阅都置为失效

@ -1,4 +1,6 @@
class LaboratorySubject < ApplicationRecord
belongs_to :laboratory
belongs_to :subject
delegate :repertoire_id, :subject_level_system_id, :student_count, to: :subject
end

@ -287,6 +287,11 @@ class User < ApplicationRecord
course.course_members.exists?(user_id: id, role: [1,2,3], is_active: 1) || admin? || business?
end
# 课堂的老师(创建者、老师、助教),不考虑超管和运营人员
def none_admin_teacher_of_course?(course)
course.course_members.exists?(user_id: id, role: [1,2,3], is_active: 1)
end
# 课堂的老师(创建者、老师、助教),不用考虑当前身份
def teacher_of_course_non_active?(course)
course.course_members.exists?(user_id: id, role: [1,2,3])

@ -7,8 +7,8 @@
<th width="10%">封面</th>
<th width="8%">创建者</th>
<th width="8%">状态</th>
<th width="10%">执行时间</th>
<th width="14%">操作</th>
<th width="8%">执行时间</th>
<th width="16%">操作</th>
</tr>
</thead>
<tbody>

@ -1,10 +1,10 @@
<% sidebar_collapse = request.cookies['admin_sidebar_collapse'].to_s == 'true' %>
<nav id="sidebar" class="<%= sidebar_collapse ? 'active' : '' %>" data-current-controller="<%= admin_sidebar_controller %>">
<div class="sidebar-header">
<div class="sidebar-header-logo">
<a href="/" class="sidebar-header-logo" data-toggle="tooltip" data-title="返回主站" >
<img class="rounded-circle" src="/images/<%= url_to_avatar(current_user) %>" />
<span class="logo-label">后台管理</span>
</div>
</a>
<div id="sidebarCollapse" class="navbar-btn <%= sidebar_collapse ? 'active' : '' %>">
<i class="fa fa-chevron-left fold" data-toggle="tooltip" data-placement="right" data-boundary="window" title="收起"></i>
<i class="fa fa-bars unfold" data-toggle="tooltip" data-placement="right" data-boundary="window" title="展开"></i>

@ -0,0 +1,42 @@
<% define_breadcrumbs do %>
<% add_breadcrumb('实训项目') %>
<% end %>
<div class="box search-form-container laboratory-shixun-list-form">
<%= form_tag(cooperative_laboratory_shixuns_path, method: :get, class: 'form-inline search-form', remote: true) do %>
<div class="form-group mr-1">
<label for="status">状态:</label>
<% status_options = [['全部', ''], ['编辑中', 0], ['审核中', 1], ['已发布', 2], ['已关闭', 3]] %>
<%= select_tag(:status, options_for_select(status_options), class: 'form-control') %>
</div>
<div class="form-group mr-4">
<label for="status">技术平台:</label>
<%= select_tag(:tag_id, options_for_select(MirrorRepository.pluck(:type_name,:id).unshift(['']), params[:tag_id]), class: 'form-control') %>
</div>
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-12 col-md-2 mr-3', placeholder: '创建者/实训名称检索') %>
<div class="form-check mr-2">
<%= hidden_field_tag(:homepage, false, id:'') %>
<%= check_box_tag(:homepage, true, params[:homepage].to_s == 'true', class: 'form-check-input') %>
<label class="form-check-label" for="homepage">只看首页展示</label>
</div>
<div class="form-check mr-2">
<%= hidden_field_tag(:ownership, false, id:'') %>
<%= check_box_tag(:ownership, true, params[:ownership].to_s == 'true', class: 'form-check-input') %>
<label class="form-check-label" for="ownership">只看自建</label>
</div>
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
<%= link_to '清空', cooperative_laboratory_shixuns_path, class: 'btn btn-default','data-disable-with': '清空中...' %>
<% end %>
</div>
<div class="box laboratory-shixun-list-container">
<%= render partial: 'cooperative/laboratory_shixuns/shared/list', locals: { laboratory_shixuns: @laboratory_shixuns } %>
</div>
<%= render(partial: 'cooperative/shared/modal/upload_file_modal', locals: { title: '上传封面', accept: 'image/*' }) %>

@ -0,0 +1 @@
$('.laboratory-shixun-list-container').html("<%= j(render partial: 'cooperative/laboratory_shixuns/shared/list', locals: { laboratory_shixuns: @laboratory_shixuns }) %>");

@ -0,0 +1,27 @@
<table class="table text-center laboratory-shixun-list-table">
<thead class="thead-light">
<tr>
<th width="28%" class="text-left">实训名称</th>
<th width="12%">技术平台</th>
<th width="14%" class="text-left">技术体系</th>
<th width="10%">封面</th>
<th width="8%">创建者</th>
<th width="8%">状态</th>
<th width="8%">执行时间</th>
<th width="16%">操作</th>
</tr>
</thead>
<tbody>
<% if laboratory_shixuns.present? %>
<% laboratory_shixuns.each do |laboratory_shixun| %>
<tr class="laboratory-shixun-item-<%= laboratory_shixun.id %>">
<%= render partial: 'cooperative/laboratory_shixuns/shared/td', locals: { laboratory_shixun: laboratory_shixun } %>
</tr>
<% end %>
<% else %>
<%= render 'cooperative/shared/no_data_for_table' %>
<% end %>
</tbody>
</table>
<%= render partial: 'cooperative/shared/paginate', locals: { objects: laboratory_shixuns } %>

@ -0,0 +1,32 @@
<%- shixun = laboratory_shixun.shixun -%>
<td class="text-left">
<%= link_to "/shixuns/#{shixun.identifier}", target: '_blank' do %>
<%= shixun.name %>
<span class="badge badge-pill badge-success homepage-badge" style="<%= laboratory_shixun.homepage? ? '' : 'display:none' %>">首页</span>
<span class="badge badge-pill badge-info ownership-badge" style="<%= laboratory_shixun.ownership ? '' : 'display:none' %>">自建</span>
<% end %>
</td>
<td><%= shixun.shixun_main_name %></td>
<td class="text-left">
<% shixun.tag_repertoires.each do |tag| %>
<span class="badge badge-secondary"><%= tag.name %></span>
<% end %>
</td>
<td class="image-preview-container">
<% imageExists = Util::FileManage.exists?(shixun) %>
<%= image_tag(imageExists ? Util::FileManage.source_disk_file_url(shixun) : '', height: 40, class: "preview-image shixun-image-#{shixun.id}", data: { toggle: 'tooltip', title: '点击预览' }, style: imageExists ? '' : 'display:none') %>
<% if laboratory_shixun.ownership? %>
<%= javascript_void_link imageExists ? '重新上传' : '上传图片', class: 'action upload-shixun-image-action', data: { source_id: shixun.id, source_type: 'Shixun', toggle: 'modal', target: '.cooperative-upload-file-modal' } %>
<% end %>
</td>
<td><%= link_to shixun.user&.real_name, "/users/#{shixun.user&.login}", target:'_blank' %></td>
<td><span class="<%= shixun_status_class(shixun) %>"><%= t("shixun.status.#{shixun.status}") %></span></td>
<td><%= shixun.excute_time %></td>
<td class="action-container">
<% if laboratory_shixun.ownership? %>
<%#= link_to('修改', cooperative_laboratory_subjects_path(laboratory_shixun)) %>
<% end %>
<%= javascript_void_link('首页展示', class: 'action homepage-show-action', data: { id: laboratory_shixun.id }, style: laboratory_shixun.homepage? ? 'display:none' : '') %>
<%= javascript_void_link('取消首页展示', class: 'action homepage-hide-action', data: { id: laboratory_shixun.id }, style: laboratory_shixun.homepage? ? '' : 'display:none') %>
</td>

@ -0,0 +1,2 @@
$('.cooperative-modal-container').html("<%= j( render partial: 'cooperative/laboratory_subjects/shared/edit_subject_modal', locals: { laboratory_subject: @laboratory_subject } ) %>");
$('.modal.cooperative-edit-subject-modal').modal('show');

@ -0,0 +1,42 @@
<% define_breadcrumbs do %>
<% add_breadcrumb('实践课程') %>
<% end %>
<div class="box search-form-container laboratory-subject-list-form">
<%= form_tag(cooperative_laboratory_subjects_path, method: :get, class: 'form-inline search-form', remote: true) do %>
<div class="form-group mr-1">
<label for="status">状态:</label>
<% status_options = [['全部', ''], ['编辑中', 0], ['审核中', 1], ['已发布', 2]] %>
<%= select_tag(:status, options_for_select(status_options), class: 'form-control') %>
</div>
<div class="form-group col-12 col-md-3">
<label for="school_name">单位:</label>
<%= select_tag :school_id, options_for_select([''], params[:school_id]), class: 'form-control school-select flex-1' %>
</div>
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-12 col-md-2 mr-3', placeholder: '创建者/课程名称检索') %>
<div class="form-check mr-2">
<%= hidden_field_tag(:homepage, false, id:'') %>
<%= check_box_tag(:homepage, true, params[:homepage].to_s == 'true', class: 'form-check-input') %>
<label class="form-check-label" for="homepage">只看首页展示</label>
</div>
<div class="form-check mr-2">
<%= hidden_field_tag(:ownership, false, id:'') %>
<%= check_box_tag(:ownership, true, params[:ownership].to_s == 'true', class: 'form-check-input') %>
<label class="form-check-label" for="ownership">只看自建</label>
</div>
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
<%= link_to '清空', cooperative_laboratory_subjects_path(current_laboratory), class: 'btn btn-default','data-disable-with': '清空中...' %>
<% end %>
</div>
<div class="box laboratory-subject-list-container">
<%= render partial: 'cooperative/laboratory_subjects/shared/list', locals: { laboratory_subjects: @laboratory_subjects } %>
</div>
<%= render(partial: 'cooperative/shared/modal/upload_file_modal', locals: { title: '上传封面', accept: 'image/*' }) %>

@ -0,0 +1 @@
$('.laboratory-subject-list-container').html("<%= j(render partial: 'cooperative/laboratory_subjects/shared/list', locals: { laboratory_subjects: @laboratory_subjects }) %>");

@ -0,0 +1,31 @@
<div class="modal fade cooperative-edit-subject-modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">编辑课程信息</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<%= simple_form_for([:cooperative, laboratory_subject], html: { class: 'cooperative-edit-subject-form' }, defaults: { wrapper_html: { class: 'offset-md-1 col-md-10' } }) do |f| %>
<%= f.input :repertoire_id, label: '技术体系:' do %>
<% repertoire_options = Repertoire.order('CONVERT(name USING gbk) COLLATE gbk_chinese_ci ASC').map{|r| [r.name, r.id]} %>
<%= f.select :repertoire_id, [['请选择', '']] + repertoire_options, {}, class: 'form-control' %>
<% end %>
<%= f.input :subject_level_system_id, label: '等级体系:' do %>
<% level_options = SubjectLevelSystem.all.map{|r| [r.name, r.id]} %>
<%= f.select :subject_level_system_id, [['请选择', '']] + level_options, {}, class: 'form-control' %>
<% end %>
<div class="error text-danger"></div>
<% end %>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary submit-btn">确认</button>
</div>
</div>
</div>
</div>

@ -0,0 +1,27 @@
<table class="table text-center laboratory-subject-list-table">
<thead class="thead-light">
<tr>
<th width="28%" class="text-left">课程名称</th>
<th width="12%">技术体系</th>
<th width="10%">等级体系</th>
<th width="10%">封面</th>
<th width="8%">创建者</th>
<th width="10%">单位</th>
<th width="8%">状态</th>
<th width="14%">操作</th>
</tr>
</thead>
<tbody>
<% if laboratory_subjects.present? %>
<% laboratory_subjects.each do |laboratory_subject| %>
<tr class="laboratory-subject-item-<%= laboratory_subject.id %>">
<%= render partial: 'cooperative/laboratory_subjects/shared/td', locals: { laboratory_subject: laboratory_subject } %>
</tr>
<% end %>
<% else %>
<%= render 'cooperative/shared/no_data_for_table' %>
<% end %>
</tbody>
</table>
<%= render partial: 'cooperative/shared/paginate', locals: { objects: laboratory_subjects } %>

@ -0,0 +1,28 @@
<%- subject = laboratory_subject.subject -%>
<td class="text-left">
<%= link_to(subject.name, "/paths/#{subject.id}", target: '_blank') %>
<span class="badge badge-pill badge-success homepage-badge" style="<%= laboratory_subject.homepage? ? '' : 'display:none' %>">首页</span>
<span class="badge badge-pill badge-success ownership-badge" style="<%= laboratory_subject.ownership? ? '' : 'display:none' %>">自建</span>
</td>
<td><%= display_text subject.repertoire&.name %></td>
<td><%= display_text subject.subject_level_system&.name %></td>
<td class="image-preview-container">
<% image_exists = Util::FileManage.exists?(subject) %>
<%= image_tag(image_exists ? Util::FileManage.source_disk_file_url(subject) : '', height: 40, class: "w-100 preview-image subject-image-#{subject.id}", style: image_exists ? '' : 'display:none') %>
<% if laboratory_subject.ownership? %>
<%= javascript_void_link image_exists ? '重新上传' : '上传图片', class: 'action upload-subject-image-action', data: { source_id: subject.id, source_type: 'Subject', toggle: 'modal', target: '.cooperative-upload-file-modal' } %>
<% end %>
</td>
<td><%= link_to subject.user&.real_name, "/users/#{subject.user&.login}", target:'_blank' %></td>
<td><%= subject.user.school_name %></td>
<td><%= display_subject_status(subject) %></td>
<td class="action-container">
<% if laboratory_subject.ownership? %>
<%= link_to('修改', edit_cooperative_laboratory_subject_path(laboratory_subject), remote: true) %>
<% end %>
<%= javascript_void_link('首页展示', class: 'action homepage-show-action', data: { id: laboratory_subject.id }, style: laboratory_subject.homepage? ? 'display:none' : '') %>
<%= javascript_void_link('取消首页展示', class: 'action homepage-hide-action', data: { id: laboratory_subject.id }, style: laboratory_subject.homepage? ? '' : 'display:none') %>
</td>

@ -0,0 +1,3 @@
$('.laboratory-subject-list-container .laboratory-subject-item-<%= current_laboratory_subject.id %>').html("<%= j(render partial: 'cooperative/laboratory_subjects/shared/td', locals: { laboratory_subject: current_laboratory_subject }) %>");
$('.cooperative-modal-container .modal.cooperative-edit-subject-modal').modal('hide');
show_success_flash();

@ -17,6 +17,8 @@
<li><%= sidebar_item(edit_cooperative_laboratory_setting_path, '网站设置', icon: 'cogs', controller: 'cooperative-laboratory_settings') %></li>
<li><%= sidebar_item(cooperative_carousels_path, '轮播图设置', icon: 'image', controller: 'cooperative-carousels') %></li>
<li><%= sidebar_item(cooperative_laboratory_users_path, '管理员列表', icon: 'user', controller: 'cooperative-laboratory_users') %></li>
<li><%= sidebar_item(cooperative_laboratory_shixuns_path, '实训项目', icon: 'window-restore', controller: 'cooperative-laboratory_shixuns') %></li>
<li><%= sidebar_item(cooperative_laboratory_subjects_path, '实践课程', icon: 'th-list', controller: 'cooperative-laboratory_subjects') %></li>
<li><%= sidebar_item('/', '返回主页', icon: 'sign-out', controller: 'root') %></li>
</ul>
</nav>

@ -11,12 +11,13 @@
<form class="cooperative-upload-file-form" enctype="multipart/form-data">
<%= hidden_field_tag(:source_type, nil) %>
<%= hidden_field_tag(:source_id, nil) %>
<%= hidden_field_tag(:suffix, nil) %>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">文件</span>
</div>
<div class="custom-file">
<input type="file" name="file" class="upload-file-input" id="upload-file-input">
<input type="file" name="file" class="upload-file-input" accept="<%= accept ||= '*' %>" id="upload-file-input">
<label class="custom-file-label file-names" for="upload-file-input">选择文件</label>
</div>
</div>

@ -3,8 +3,8 @@ json.author do
end
json.id message.id
# json.content content_safe(message.contents_show(identity))
json.content message.contents_show(identity)
json.content content_safe(message.contents_show(identity))
# json.content message.contents_show(identity)
json.time time_from_now(message.created_at)
json.hidden message.hidden
# 主贴与子贴不一致

@ -1121,12 +1121,25 @@ Rails.application.routes.draw do
namespace :cooperative do
# get '/', to: 'dashboards#show'
get '/', to: 'laboratory_settings#edit'
resources :files, only: [:create]
resources :users, only: [:index]
resources :laboratory_users, only: [:index, :create, :destroy]
resource :laboratory_setting, only: [:edit, :update]
resources :carousels, only: [:index, :create, :update, :destroy] do
post :drag, on: :collection
end
resources :laboratory_shixuns, only: [:index, :edit, :update] do
member do
post :homepage
post :cancel_homepage
end
end
resources :laboratory_subjects, only: [:index, :edit, :update] do
member do
post :homepage
post :cancel_homepage
end
end
end
resources :colleges, only: [] do

@ -0,0 +1,6 @@
class AddColumnToExerciseUserScore < ActiveRecord::Migration[5.2]
def change
add_column :exercise_user_scores, :subjective_score, :float, default: 0
add_column :exercise_user_scores, :objective_score, :float, default: 0
end
end

File diff suppressed because one or more lines are too long

@ -137829,6 +137829,7 @@ $(document).on('turbolinks:load', function() {
$searchForm.find('.school-select').select2({
theme: 'bootstrap4',
placeholder: '请选择创建者单位',
allowClear: true,
minimumInputLength: 1,
ajax: {
delay: 500,

@ -25487,17 +25487,28 @@ input.form-control {
height: 300px;
}
/* line 51, app/assets/stylesheets/admins/common.scss */
/* line 50, app/assets/stylesheets/admins/common.scss */
.admin-body-container .image-preview-container {
display: -webkit-box;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
flex-direction: column;
-webkit-box-align: center;
align-items: center;
}
/* line 57, app/assets/stylesheets/admins/common.scss */
.admin-body-container .action-container > .action {
padding: 0 3px;
}
/* line 56, app/assets/stylesheets/admins/common.scss */
/* line 62, app/assets/stylesheets/admins/common.scss */
.admin-body-container .action-container .more-action-dropdown .dropdown-item {
font-size: 14px;
}
/* line 63, app/assets/stylesheets/admins/common.scss */
/* line 69, app/assets/stylesheets/admins/common.scss */
.admin-body-container .paginate-container {
margin-top: 20px;
display: -webkit-box;
@ -25511,68 +25522,68 @@ input.form-control {
align-items: center;
}
/* line 70, app/assets/stylesheets/admins/common.scss */
/* line 76, app/assets/stylesheets/admins/common.scss */
.admin-body-container .paginate-container .paginate-total {
margin-bottom: 10px;
color: darkgrey;
}
/* line 75, app/assets/stylesheets/admins/common.scss */
/* line 81, app/assets/stylesheets/admins/common.scss */
.admin-body-container .paginate-container .pagination {
margin-bottom: 0px;
}
/* line 81, app/assets/stylesheets/admins/common.scss */
/* line 87, app/assets/stylesheets/admins/common.scss */
.admin-body-container .search-form-container {
display: -webkit-box;
display: flex;
margin-bottom: 20px;
}
/* line 85, app/assets/stylesheets/admins/common.scss */
/* line 91, app/assets/stylesheets/admins/common.scss */
.admin-body-container .search-form-container .search-form {
-webkit-box-flex: 1;
flex: 1;
}
/* line 88, app/assets/stylesheets/admins/common.scss */
/* line 94, app/assets/stylesheets/admins/common.scss */
.admin-body-container .search-form-container .search-form * {
font-size: 14px;
}
/* line 90, app/assets/stylesheets/admins/common.scss */
/* line 96, app/assets/stylesheets/admins/common.scss */
.admin-body-container .search-form-container .search-form select, .admin-body-container .search-form-container .search-form input {
margin-right: 10px;
font-size: 14px;
}
/* line 97, app/assets/stylesheets/admins/common.scss */
/* line 103, app/assets/stylesheets/admins/common.scss */
.admin-body-container .global-error {
color: grey;
min-height: 300px;
}
/* line 101, app/assets/stylesheets/admins/common.scss */
/* line 107, app/assets/stylesheets/admins/common.scss */
.admin-body-container .global-error-code {
font-size: 80px;
}
/* line 105, app/assets/stylesheets/admins/common.scss */
/* line 111, app/assets/stylesheets/admins/common.scss */
.admin-body-container .global-error-text {
font-size: 24px;
}
/* line 111, app/assets/stylesheets/admins/common.scss */
/* line 117, app/assets/stylesheets/admins/common.scss */
.admin-body-container .nav-tabs .nav-link {
padding: 0.5rem 2rem;
}
/* line 116, app/assets/stylesheets/admins/common.scss */
/* line 122, app/assets/stylesheets/admins/common.scss */
.admin-body-container .CodeMirror {
border: 1px solid #ced4da;
}
/* line 120, app/assets/stylesheets/admins/common.scss */
/* line 126, app/assets/stylesheets/admins/common.scss */
.admin-body-container .batch-action-container {
margin-bottom: -15px;
padding: 10px 20px 0;

@ -25047,17 +25047,28 @@ input.form-control {
height: 300px;
}
/* line 51, app/assets/stylesheets/cooperative/common.scss */
/* line 50, app/assets/stylesheets/cooperative/common.scss */
.cooperative-body-container .image-preview-container {
display: -webkit-box;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
flex-direction: column;
-webkit-box-align: center;
align-items: center;
}
/* line 57, app/assets/stylesheets/cooperative/common.scss */
.cooperative-body-container .action-container > .action {
padding: 0 3px;
}
/* line 56, app/assets/stylesheets/cooperative/common.scss */
/* line 62, app/assets/stylesheets/cooperative/common.scss */
.cooperative-body-container .action-container .more-action-dropdown .dropdown-item {
font-size: 14px;
}
/* line 63, app/assets/stylesheets/cooperative/common.scss */
/* line 69, app/assets/stylesheets/cooperative/common.scss */
.cooperative-body-container .paginate-container {
margin-top: 20px;
display: -webkit-box;
@ -25071,68 +25082,68 @@ input.form-control {
align-items: center;
}
/* line 70, app/assets/stylesheets/cooperative/common.scss */
/* line 76, app/assets/stylesheets/cooperative/common.scss */
.cooperative-body-container .paginate-container .paginate-total {
margin-bottom: 10px;
color: darkgrey;
}
/* line 75, app/assets/stylesheets/cooperative/common.scss */
/* line 81, app/assets/stylesheets/cooperative/common.scss */
.cooperative-body-container .paginate-container .pagination {
margin-bottom: 0px;
}
/* line 81, app/assets/stylesheets/cooperative/common.scss */
/* line 87, app/assets/stylesheets/cooperative/common.scss */
.cooperative-body-container .search-form-container {
display: -webkit-box;
display: flex;
margin-bottom: 20px;
}
/* line 85, app/assets/stylesheets/cooperative/common.scss */
/* line 91, app/assets/stylesheets/cooperative/common.scss */
.cooperative-body-container .search-form-container .search-form {
-webkit-box-flex: 1;
flex: 1;
}
/* line 88, app/assets/stylesheets/cooperative/common.scss */
/* line 94, app/assets/stylesheets/cooperative/common.scss */
.cooperative-body-container .search-form-container .search-form * {
font-size: 14px;
}
/* line 90, app/assets/stylesheets/cooperative/common.scss */
/* line 96, app/assets/stylesheets/cooperative/common.scss */
.cooperative-body-container .search-form-container .search-form select, .cooperative-body-container .search-form-container .search-form input {
margin-right: 10px;
font-size: 14px;
}
/* line 97, app/assets/stylesheets/cooperative/common.scss */
/* line 103, app/assets/stylesheets/cooperative/common.scss */
.cooperative-body-container .global-error {
color: grey;
min-height: 300px;
}
/* line 101, app/assets/stylesheets/cooperative/common.scss */
/* line 107, app/assets/stylesheets/cooperative/common.scss */
.cooperative-body-container .global-error-code {
font-size: 80px;
}
/* line 105, app/assets/stylesheets/cooperative/common.scss */
/* line 111, app/assets/stylesheets/cooperative/common.scss */
.cooperative-body-container .global-error-text {
font-size: 24px;
}
/* line 111, app/assets/stylesheets/cooperative/common.scss */
/* line 117, app/assets/stylesheets/cooperative/common.scss */
.cooperative-body-container .nav-tabs .nav-link {
padding: 0.5rem 2rem;
}
/* line 116, app/assets/stylesheets/cooperative/common.scss */
/* line 122, app/assets/stylesheets/cooperative/common.scss */
.cooperative-body-container .CodeMirror {
border: 1px solid #ced4da;
}
/* line 120, app/assets/stylesheets/cooperative/common.scss */
/* line 126, app/assets/stylesheets/cooperative/common.scss */
.cooperative-body-container .batch-action-container {
margin-bottom: -15px;
padding: 10px 20px 0;

@ -136047,6 +136047,151 @@ $(document).on('turbolinks:load', function() {
})
}
});
$(document).on('turbolinks:load', function() {
if ($('body.cooperative-laboratory-shixuns-index-page').length > 0) {
var $searchForm = $('.laboratory-shixun-list-form .search-form');
$searchForm.find('select#tag_id').select2({
placeholder: "请选择",
allowClear: true
});
// 上传图片
$('.modal.cooperative-upload-file-modal').on('upload:success', function (e, data) {
var $imageElement = $('.shixun-image-' + data.source_id);
if($imageElement.length === 0) return;
$imageElement.attr('src', data.url);
$imageElement.show();
$imageElement.next().html('重新上传');
});
// 定义状态切换监听事件
var defineStatusChangeFunc = function (doElement, undoElement, url, callback) {
$('.laboratory-shixun-list-container').on('click', doElement, function () {
var $doAction = $(this);
var $undoAction = $doAction.siblings(undoElement);
var laboratoryShixunId = $doAction.data('id');
customConfirm({
content: '确认进行该操作吗?',
ok: function () {
$.ajax({
url: '/cooperative/laboratory_shixuns/' + laboratoryShixunId + url,
method: 'POST',
dataType: 'json',
success: function () {
show_success_flash();
$doAction.hide();
$undoAction.show();
if (callback && typeof callback === "function") {
callback(laboratoryShixunId, url);
}
}
});
}
});
});
}
// 首页展示与取消首页展示
var homepageShowCallback = function (laboratoryShixunId, url) {
var $laboratoryShixunItem = $('.laboratory-shixun-list-container').find('.laboratory-shixun-item-' + laboratoryShixunId);
if (url === '/homepage') {
$laboratoryShixunItem.find('.homepage-badge').show();
} else {
$laboratoryShixunItem.find('.homepage-badge').hide();
}
}
defineStatusChangeFunc('.homepage-show-action', '.homepage-hide-action', '/homepage', homepageShowCallback);
defineStatusChangeFunc('.homepage-hide-action', '.homepage-show-action', '/cancel_homepage', homepageShowCallback);
}
})
;
$(document).on('turbolinks:load', function() {
if ($('body.cooperative-laboratory-subjects-index-page').length > 0) {
var $searchForm = $('.laboratory-subject-list-form .search-form');
// ************** 学校选择 *************
$searchForm.find('.school-select').select2({
theme: 'bootstrap4',
placeholder: '请选择创建者单位',
allowClear: true,
minimumInputLength: 1,
ajax: {
delay: 500,
url: '/api/schools/search.json',
dataType: 'json',
data: function (params) {
return {keyword: params.term};
},
processResults: function (data) {
return {results: data.schools}
}
},
templateResult: function (item) {
if (!item.id || item.id === '') return item.text;
return item.name;
},
templateSelection: function (item) {
if (item.id) {
}
return item.name || item.text;
}
});
// 上传图片
$('.modal.cooperative-upload-file-modal').on('upload:success', function (e, data) {
var $imageElement = $('.subject-image-' + data.source_id);
if($imageElement.length === 0) return;
$imageElement.attr('src', data.url);
$imageElement.show();
$imageElement.next().html('重新上传');
});
// 定义状态切换监听事件
var defineStatusChangeFunc = function (doElement, undoElement, url, callback) {
$('.laboratory-subject-list-container').on('click', doElement, function () {
var $doAction = $(this);
var $undoAction = $doAction.siblings(undoElement);
var laboratorySubjectId = $doAction.data('id');
customConfirm({
content: '确认进行该操作吗?',
ok: function () {
$.ajax({
url: '/cooperative/laboratory_subjects/' + laboratorySubjectId + url,
method: 'POST',
dataType: 'json',
success: function () {
show_success_flash();
$doAction.hide();
$undoAction.show();
if (callback && typeof callback === "function") {
callback(laboratorySubjectId, url);
}
}
});
}
});
});
}
// 首页展示与取消首页展示
var homepageShowCallback = function (laboratoryShixunId, url) {
var $laboratoryShixunItem = $('.laboratory-subject-list-container').find('.laboratory-subject-item-' + laboratoryShixunId);
if (url === '/homepage') {
$laboratoryShixunItem.find('.homepage-badge').show();
} else {
$laboratoryShixunItem.find('.homepage-badge').hide();
}
}
defineStatusChangeFunc('.homepage-show-action', '.homepage-hide-action', '/homepage', homepageShowCallback);
defineStatusChangeFunc('.homepage-hide-action', '.homepage-show-action', '/cancel_homepage', homepageShowCallback);
}
})
;
$(document).on('turbolinks:load', function() {
if ($('body.cooperative-laboratory-users-index-page').length > 0) {
// ============= 添加管理员 ==============
@ -136109,6 +136254,24 @@ $(document).on('turbolinks:load', function() {
});
}
});
$(document).on('turbolinks:load', function () {
$('.cooperative-modal-container').on('show.bs.modal', '.modal.cooperative-edit-subject-modal', function () {
var $modal = $('.modal.cooperative-edit-subject-modal');
var $form = $modal.find('form.cooperative-edit-subject-form');
$modal.on('click', '.submit-btn', function () {
$form.find('.error').html('');
var url = $form.attr('action');
$.ajax({
method: 'PATCH',
dataType: 'script',
url: url,
data: $form.serialize()
});
});
})
});
$(document).on('turbolinks:load', function() {
var $modal = $('.modal.cooperative-upload-file-modal');
if ($modal.length > 0) {
@ -136153,7 +136316,7 @@ $(document).on('turbolinks:load', function() {
$.ajax({
method: 'POST',
dataType: 'json',
url: '/cooperatives/files?' + formDataString,
url: '/cooperative/files?' + formDataString,
data: new FormData($form[0]),
processData: false,
contentType: false,

@ -30,7 +30,8 @@ class BoardsNew extends Component{
boards: [],
title_num: 0,
email_notify:false,
isemail_notify:false
isemail_notify:false,
isemail_notifys:false
}
}
addSuccess = () => {
@ -99,7 +100,7 @@ class BoardsNew extends Component{
}
})
this.setState({ fileList: _fileList, board_name: data.board_name, title_num: parseInt(data.subject.length) ,isemail_notify:response.data.data.email_notify})
this.setState({ fileList: _fileList, board_name: data.board_name, title_num: parseInt(data.subject.length) ,isemail_notifys:response.data.data.email_notify})
}
}
})
@ -341,8 +342,8 @@ class BoardsNew extends Component{
{/* notRequired */}
<Form {...formItemLayout} onSubmit={this.handleSubmit}>
<div className="formBlock" style={{paddingBottom: '0px', position: 'relative'}}>
{this.state.boardsdata&&this.state.boardsdata.email_notify===true?this.props.isAdminOrTeacher()===true?<Tooltip placement="bottom" title={this.state.isemail_notify?"邮件只能发送一次":""}><span className={"setemail fr mr70 setemailposition"}>
<Checkbox onChange={this.setemailchange} checked={this.state.isemail_notify} disabled={this.state.isemail_notify}>发送邮件提醒</Checkbox>
{this.state.boardsdata&&this.state.boardsdata.email_notify===true?this.props.isAdminOrTeacher()===true?<Tooltip placement="bottom" title={this.state.isemail_notifys===true?"邮件只能发送一次":""}><span className={"setemail fr mr70 setemailposition"}>
<Checkbox onChange={this.setemailchange} checked={this.state.isemail_notifys===true?this.state.isemail_notifys:this.state.isemail_notify} disabled={this.state.isemail_notifys}>发送邮件提醒</Checkbox>
</span></Tooltip>:"":""}
{ isAdmin &&

@ -120,9 +120,9 @@ class ExerciseNewCommon extends Component{
componentDidMount = () => {
this.fetchExercise()
}
handleSubmit = (e) => {
}
// handleSubmit = (e) => {
//
// }
onSaveExercise = () => {
const { exercise_name, exercise_description } = this.state;
const exercise_id = this.props.match.params.Id
@ -472,7 +472,9 @@ class ExerciseNewCommon extends Component{
></div>
</div>}
{this.state.editMode && <Form {...formItemLayout} onSubmit={this.handleSubmit}>
{this.state.editMode && <Form {...formItemLayout}
// onSubmit={this.handleSubmit}
>
<div className="formBlock" style={{paddingBottom: '2px',borderBottom:"none"}}>
<Form.Item
label="试卷标题"

@ -292,7 +292,7 @@ class Testpapersettinghomepage extends Component{
const isStudent = this.props.isStudent();
// TODO
// console.log(Commonheadofthetestpaper.exercise_status);
//console.log(Commonheadofthetestpaper.exercise_status);
document.title=this.props.coursedata&&this.props.coursedata.name;
return(
<div className="newMain clearfix ">
@ -411,7 +411,7 @@ class Testpapersettinghomepage extends Component{
</div>
{
isAdmin === true &&Commonheadofthetestpaper && Commonheadofthetestpaper.user_permission.user_commit_counts>0?
isAdmin === true &&Commonheadofthetestpaper && Commonheadofthetestpaper.user_permission.user_commit_counts>0&&Commonheadofthetestpaper.exercise_status===2?
<a className="fr color-blue font-16 mt20 mr20" onClick={this.Ecerciseacallagain}>打回重做</a>:""
}

@ -218,7 +218,7 @@ class Bullsubdirectory extends Component{
const {getFieldDecorator} = this.props.form;
// console.log("Bullsubdirectory");
// console.log(this.props.isAdmin());
// console.log(this.props.yslbool);
// console.log(this.props);
return(
<React.Fragment >
<div >
@ -274,7 +274,7 @@ class Bullsubdirectory extends Component{
</div>
<div id="MakedownHTML"className="markdown-body fonttext yslmtopcg yslminHeigth markdownysltext" dangerouslySetInnerHTML={{__html: markdownToHTML(mydescription).replace(/▁/g, "▁▁▁")}}/>
</div>
<div className="bor-bottom-greyE mr25 ml25"></div>
{parseInt(this.props&&this.props.informs.length)===parseInt(this.props&&this.props.index+1)?"":<div className="bor-bottom-greyE mr25 ml25"></div>}
</div>
:
<div className="edu-back-white ">

@ -493,7 +493,7 @@ class Eduinforms extends Component{
<div className="edu-back-white ">
{ informs&&informs.map((item, index) => {
return (
<Bullsubdirectory {...this.state} {...this.props} key={index} yslbool={yslbool} id={item.id} myname={item.name} mydescription={item.description}
<Bullsubdirectory {...this.state} {...this.props} key={index} index={index} yslbool={yslbool} id={item.id} myname={item.name} mydescription={item.description}
getyslbooltrue={()=>this.getyslbooltrue()}
getyslboolfalse={()=>this.getyslboolfalse()}
getinputdata={()=>this.getinputdata()} ></Bullsubdirectory>

@ -1,5 +1,5 @@
import React,{ Component } from "react";
import { Pagination} from "antd";
import { Pagination , Spin } from "antd";
import NoneData from "../coursesPublic/NoneData"
import '../css/members.css'
@ -16,10 +16,14 @@ class PollDetailTabSecond extends Component{
page:1,
limit:10,
questions:undefined,
questionsInfo:undefined
questionsInfo:undefined,
isSpin:false
}
}
getInfo=(page)=>{
this.setState({
isSpin:true
})
let pollId=this.props.match.params.pollId;
let url=`/polls/${pollId}/commit_result.json?page=${page}`;
axios.get(url).then((result)=>{
@ -27,7 +31,8 @@ class PollDetailTabSecond extends Component{
this.setState({
page: page,
questions:result.data.questions,
questionsInfo:result.data.question_types
questionsInfo:result.data.question_types,
isSpin:false
})
}
}).catch((error)=>{
@ -56,11 +61,12 @@ class PollDetailTabSecond extends Component{
}
render(){
let {page, limit, questions, questionsInfo} = this.state;
let {page, limit, questions, questionsInfo , isSpin} = this.state;
return(
<Spin size="large" spinning={ isSpin }>
<div>
{
questions && questions.length>0?questions.map((item,key)=>{
questions && questions.length>0 && questions.map((item,key)=>{
return(
<div className="edu-back-white mb10">
<div className="pt20 pl30 pr30 pb10">
@ -91,7 +97,8 @@ class PollDetailTabSecond extends Component{
{
item.question.question_type==3?
<ul className="clearfix">
<span>文本答案</span>
<span style={{width:"6%"}}>编号</span>
<span style={{width:"50%",textAlign:"left"}}>文本答案</span>
</ul>
:
<ul className="clearfix">
@ -105,19 +112,22 @@ class PollDetailTabSecond extends Component{
{/* 主观题 */}
{
item.question.question_type == 3 && item.question.vote_text &&
<div className="countBody">
<ul className="clearfix">
<span className="color-grey-3 break-word" style={{width:"100%"}}>
{
item.question.vote_text.map((txt,t)=>{
return(
<li>{t+1}.{txt}</li>
)
})
}
</span>
</ul>
</div>
<React.Fragment>
{
item.question.vote_text.map((txt,t)=>{
return(
<div className="countBody">
<ul className="clearfix">
<span style={{width:"6%"}}>{t+1}</span>
<span style={{flex:"1",textAlign:"left"}} className="color-grey-3 break-word">
<li>{txt}</li>
</span>
</ul>
</div>
)
})
}
</React.Fragment>
}
{/* 单选和多选 */}
{
@ -166,7 +176,10 @@ class PollDetailTabSecond extends Component{
</div>
</div>
)
}):<NoneData></NoneData>
})
}
{
questions && questions.length == 0 && <NoneData></NoneData>
}
{
questionsInfo && questionsInfo.q_counts > limit &&
@ -177,6 +190,7 @@ class PollDetailTabSecond extends Component{
}
</div>
</Spin>
)
}
}

@ -1,5 +1,5 @@
import React,{ Component } from "react";
import { Spin } from 'antd';
import '../css/members.css'
import '../css/busyWork.css'
import './pollStyle.css'
@ -12,10 +12,14 @@ class PollDetailTabThird extends Component{
constructor(props){
super(props);
this.state={
pollDetail:undefined
pollDetail:undefined,
isSpin:false
}
}
getPollInfo=()=>{
this.setState({
isSpin:true
})
let pollId=this.props.match.params.pollId;
let url=`/polls/${pollId}.json`;
axios.get(url).then((result)=>{
@ -23,12 +27,14 @@ class PollDetailTabThird extends Component{
if (result.data.status === 401) {
//未登入
this.setState({
pollDetail: undefined
pollDetail: undefined,
isSpin:false
})
return
}
this.setState({
pollDetail:result.data
pollDetail:result.data,
isSpin:false
})
}
}).catch((error)=>{
@ -39,10 +45,12 @@ class PollDetailTabThird extends Component{
this.getPollInfo();
}
render(){
let {pollDetail}=this.state;
let {pollDetail , isSpin}=this.state;
return(
<div>
<PollDetailTabThirdInfo {...this.props} {...this.state} pollDetail = {pollDetail}></PollDetailTabThirdInfo>
<Spin size="large" spinning={isSpin}>
<PollDetailTabThirdInfo {...this.props} {...this.state} pollDetail = {pollDetail}></PollDetailTabThirdInfo>
</Spin>
</div>
)
}

@ -288,7 +288,11 @@ class Listofworksstudentone extends Component {
),
},
{
title: '实战耗时',
title:<span>实训总耗时<Tooltip placement="top" title={<pre>
计算规则:<br/>
学员离开实训学习界面停止计时<br/>
评测首次通过之后停止计时<br/>
</pre>}><img src={getImageUrl("images/educoder/problem.png")}/></Tooltip></span>,
dataIndex: 'cost_time',
key: 'cost_time',
align: 'center',
@ -383,7 +387,11 @@ class Listofworksstudentone extends Component {
)
},
{
title: '效率分',
title: <span>效率分<Tooltip placement="top" title={<pre>
计算规则:<br/>
学员离开实训学习界面停止计时<br/>
评测首次通过之后停止计时<br/>
</pre>}><img src={getImageUrl("images/educoder/problem.png")}/></Tooltip></span>,
dataIndex: 'efficiencyscore',
key: 'efficiencyscore',
align: 'center',
@ -645,7 +653,11 @@ class Listofworksstudentone extends Component {
),
},
{
title: '实战耗时',
title:<span>实训总耗时<Tooltip placement="top" title={<pre>
计算规则:<br/>
学员离开实训学习界面停止计时<br/>
评测首次通过之后停止计时<br/>
</pre>}><img src={getImageUrl("images/educoder/problem.png")}/></Tooltip></span>,
dataIndex: 'cost_time',
key: 'cost_time',
align: 'center',
@ -736,7 +748,11 @@ class Listofworksstudentone extends Component {
)
},
{
title: '效率分',
title: <span>效率分<Tooltip placement="top" title={<pre>
计算规则:<br/>
学员离开实训学习界面停止计时<br/>
评测首次通过之后停止计时<br/>
</pre>}><img src={getImageUrl("images/educoder/problem.png")}/></Tooltip></span>,
dataIndex: 'efficiencyscore',
key: 'efficiencyscore',
align: 'center',
@ -953,7 +969,11 @@ class Listofworksstudentone extends Component {
},
{
title: '实战耗时',
title:<span>实训总耗时<Tooltip placement="top" title={<pre>
计算规则:<br/>
学员离开实训学习界面停止计时<br/>
评测首次通过之后停止计时<br/>
</pre>}><img src={getImageUrl("images/educoder/problem.png")}/></Tooltip></span>,
dataIndex: 'cost_time',
key: 'cost_time',
align: 'center',
@ -1007,18 +1027,11 @@ class Listofworksstudentone extends Component {
className: 'font-14',
render: (text, record) => (
<span>
<Tooltip placement="bottom" title={<div>
<div>已通过{record.completion}{this.state.challenges_count}</div>
<div>完成任务评测之前查看了参考答案{record.view_answer_count}</div>
</div>}>
<span style={{
color: '#07111B',
"text-align": "center"
}}>{record.completion + "/" + this.state.challenges_count} </span>
</Tooltip>
</span>
</span>
)
},
{
@ -1043,7 +1056,11 @@ class Listofworksstudentone extends Component {
)
},
{
title: '效率分',
title: <span>效率分<Tooltip placement="top" title={<pre>
计算规则:<br/>
学员离开实训学习界面停止计时<br/>
评测首次通过之后停止计时<br/>
</pre>}><img src={getImageUrl("images/educoder/problem.png")}/></Tooltip></span>,
dataIndex: 'efficiencyscore',
key: 'efficiencyscore',
align: 'center',
@ -1053,22 +1070,14 @@ class Listofworksstudentone extends Component {
{
record.efficiencyscore && record.efficiencyscore === "--" ? (
this.state.allow_late && this.state.allow_late === false ?
<Tooltip placement="bottom" title={<div>
<div>作业截止时系统根据学生在课堂成员中的效率表现自动评分</div>
</div>}>
<span style={{color: "#9A9A9A"}}>
--
</span>
</Tooltip>
:
this.state.allow_late && this.state.allow_late === true ?
<Tooltip placement="bottom" title={<div>
<div>补交结束时系统根据学生在课堂成员中的效率表现自动评分</div>
</div>}>
<span style={{color: "#9A9A9A"}}>
--
</span>
</Tooltip>
:
<span style={{color: "#9A9A9A"}}>
--
@ -1304,7 +1313,11 @@ class Listofworksstudentone extends Component {
// ),
// },
{
title: '实战耗时',
title:<span>实训总耗时<Tooltip placement="top" title={<pre>
计算规则:<br/>
学员离开实训学习界面停止计时<br/>
评测首次通过之后停止计时<br/>
</pre>}><img src={getImageUrl("images/educoder/problem.png")}/></Tooltip></span>,
dataIndex: 'cost_time',
key: 'cost_time',
align: 'center',
@ -1341,18 +1354,11 @@ class Listofworksstudentone extends Component {
className: 'font-14',
render: (text, record) => (
<span>
<Tooltip placement="bottom" title={<div>
<div>已通过{record.completion}{this.state.challenges_count}</div>
<div>完成任务评测之前查看了参考答案{record.view_answer_count}</div>
</div>}>
<span style={{
color: '#07111B',
textAlign: "center"
}}>{record.completion + "/" + this.state.challenges_count} </span>
</Tooltip>
</span>
<span style={{
color: '#07111B',
textAlign: "center"
}}>{record.completion + "/" + this.state.challenges_count} </span>
</span>
)
},
{
@ -1377,7 +1383,11 @@ class Listofworksstudentone extends Component {
)
},
{
title: '效率分',
title: <span>效率分<Tooltip placement="top" title={<pre>
计算规则:<br/>
学员离开实训学习界面停止计时<br/>
评测首次通过之后停止计时<br/>
</pre>}><img src={getImageUrl("images/educoder/problem.png")}/></Tooltip></span>,
dataIndex: 'efficiencyscore',
key: 'efficiencyscore',
align: 'center',
@ -1387,22 +1397,14 @@ class Listofworksstudentone extends Component {
{
record.efficiencyscore && record.efficiencyscore === "--" ? (
this.state.allow_late && this.state.allow_late === false ?
<Tooltip placement="bottom" title={<div>
<div>作业截止时系统根据学生在课堂成员中的效率表现自动评分</div>
</div>}>
<span style={{color: "#9A9A9A"}}>
--
</span>
</Tooltip>
:
this.state.allow_late && this.state.allow_late === true ?
<Tooltip placement="bottom" title={<div>
<div>补交结束时系统根据学生在课堂成员中的效率表现自动评分</div>
</div>}>
<span style={{color: "#9A9A9A"}}>
--
</span>
</Tooltip>
:
<span style={{color: "#9A9A9A"}}>
--

@ -96,7 +96,7 @@
}
.tip-info-wrap .tip-info{
display: flex;
background: #707070;
background: rgba(40, 47, 53, 1);
border: 1px solid rgba(112,112,112,1);
border-radius: 100px;
width: 375px;

Loading…
Cancel
Save