Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into develop
commit
f66f8cdb26
@ -0,0 +1,22 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-examination-authentications-index-page').length > 0) {
|
||||
var $searchFrom = $('.examination-authentication-list-form');
|
||||
$searchFrom.find('select[name="status"]').val('pending');
|
||||
|
||||
$searchFrom.on('click', '.search-form-tab', function(){
|
||||
var $link = $(this);
|
||||
|
||||
$searchFrom.find('input[name="keyword"]').val('');
|
||||
$searchFrom.find('select[name="status"]').val('processed');
|
||||
|
||||
if($link.data('value') === 'processed'){
|
||||
$('.batch-action-container').hide();
|
||||
$searchFrom.find('.status-filter').show();
|
||||
} else {
|
||||
$('.batch-action-container').show();
|
||||
$searchFrom.find('.status-filter').hide();
|
||||
$searchFrom.find('select[name="status"]').val('pending');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,22 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-item-authentications-index-page').length > 0) {
|
||||
var $searchFrom = $('.item-authentication-list-form');
|
||||
$searchFrom.find('select[name="status"]').val('pending');
|
||||
|
||||
$searchFrom.on('click', '.search-form-tab', function(){
|
||||
var $link = $(this);
|
||||
|
||||
$searchFrom.find('input[name="keyword"]').val('');
|
||||
$searchFrom.find('select[name="status"]').val('processed');
|
||||
|
||||
if($link.data('value') === 'processed'){
|
||||
$('.batch-action-container').hide();
|
||||
$searchFrom.find('.status-filter').show();
|
||||
} else {
|
||||
$('.batch-action-container').show();
|
||||
$searchFrom.find('.status-filter').hide();
|
||||
$searchFrom.find('select[name="status"]').val('pending');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,30 @@
|
||||
class Admins::ExaminationAuthenticationsController < Admins::BaseController
|
||||
def index
|
||||
params[:status] ||= 'pending'
|
||||
params[:sort_direction] = params[:status] == 'pending' ? 'asc' : 'desc'
|
||||
|
||||
applies = Admins::ApplyItemBankQuery.call(params.merge(type: "ExaminationBank"))
|
||||
|
||||
@applies = paginate applies.preload(user: { user_extension: [:school, :department] })
|
||||
end
|
||||
|
||||
def agree
|
||||
ActiveRecord::Base.transaction do
|
||||
exam = ExaminationBank.find current_apply.container_id
|
||||
current_apply.update!(status: 1)
|
||||
exam.update!(public: 0)
|
||||
end
|
||||
render_success_js
|
||||
end
|
||||
|
||||
def refuse
|
||||
current_apply.update!(status: 2)
|
||||
render_success_js
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_apply
|
||||
@_current_apply ||= ApplyAction.find(params[:id])
|
||||
end
|
||||
end
|
@ -0,0 +1,34 @@
|
||||
class Admins::ItemAuthenticationsController < Admins::BaseController
|
||||
def index
|
||||
params[:status] ||= 'pending'
|
||||
params[:sort_direction] = params[:status] == 'pending' ? 'asc' : 'desc'
|
||||
|
||||
applies = Admins::ApplyItemBankQuery.call(params.merge(type: "ItemBank"))
|
||||
|
||||
@applies = paginate applies.preload(user: { user_extension: [:school, :department] })
|
||||
end
|
||||
|
||||
def show
|
||||
@item = ItemBank.find current_apply.container_id
|
||||
end
|
||||
|
||||
def agree
|
||||
ActiveRecord::Base.transaction do
|
||||
item = ItemBank.find current_apply.container_id
|
||||
current_apply.update!(status: 1)
|
||||
item.update!(public: 0)
|
||||
end
|
||||
render_success_js
|
||||
end
|
||||
|
||||
def refuse
|
||||
current_apply.update!(status: 2)
|
||||
render_success_js
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_apply
|
||||
@_current_apply ||= ApplyAction.find(params[:id])
|
||||
end
|
||||
end
|
@ -0,0 +1,84 @@
|
||||
class ExaminationItemsController < ApplicationController
|
||||
before_action :require_login
|
||||
before_action :validate_score, only: [:set_score, :batch_set_score]
|
||||
before_action :find_exam, only: [:create, :batch_set_score, :delete_item_type]
|
||||
before_action :find_item, except: [:create, :batch_set_score, :delete_item_type]
|
||||
before_action :edit_auth
|
||||
|
||||
def create
|
||||
ExaminationItems::SaveItemService.call(current_user, create_params, @exam)
|
||||
render_ok
|
||||
rescue ApplicationService::Error => ex
|
||||
render_error(ex.message)
|
||||
end
|
||||
|
||||
def destroy
|
||||
ActiveRecord::Base.transaction do
|
||||
@exam.examination_items.where(item_type: @item.item_type).where("position > #{@item.position}").update_all("position = position -1")
|
||||
@item.destroy!
|
||||
end
|
||||
render_ok
|
||||
end
|
||||
|
||||
def delete_item_type
|
||||
items = @exam.examination_items.where(item_type: params[:item_type])
|
||||
items.destroy_all
|
||||
render_ok
|
||||
end
|
||||
|
||||
def set_score
|
||||
@item.update_attributes!(score: params[:score])
|
||||
@questions_score = @exam.examination_items.where(item_type: @item.item_type).pluck(:score).sum
|
||||
@all_score = @exam.examination_items.pluck(:score).sum
|
||||
render_ok({questions_score: @questions_score, all_score: @all_score})
|
||||
end
|
||||
|
||||
def batch_set_score
|
||||
@exam.examination_items.where(item_type: params[:item_type]).update_all(score: params[:score])
|
||||
@questions_score = @exam.examination_items.where(item_type: params[:item_type]).pluck(:score).sum
|
||||
@all_score = @exam.examination_items.pluck(:score).sum
|
||||
render_ok({questions_score: @questions_score, all_score: @all_score})
|
||||
end
|
||||
|
||||
def adjust_position
|
||||
same_items = @exam.examination_items.where(item_type: @item.item_type)
|
||||
max_position = same_items.size
|
||||
tip_exception("position超出范围") unless params[:position].present? && params[:position].to_i <= max_position && params[:position].to_i >= 1
|
||||
ActiveRecord::Base.transaction do
|
||||
if params[:position].to_i > @item.position
|
||||
same_items.where("position > #{@item.position} and position <= #{params[:position].to_i}").update_all("position=position-1")
|
||||
@item.update_attributes!(position: params[:position])
|
||||
elsif params[:position].to_i < @item.position
|
||||
same_items.where("position < #{@item.position} and position >= #{params[:position].to_i}").update_all("position=position+1")
|
||||
@item.update_attributes!(position: params[:position])
|
||||
else
|
||||
return normal_status(-1, "排序无变化")
|
||||
end
|
||||
end
|
||||
render_ok
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_exam
|
||||
@exam = ExaminationBank.find_by!(id: params[:exam_id])
|
||||
end
|
||||
|
||||
def create_params
|
||||
params.permit(item_ids: [])
|
||||
end
|
||||
|
||||
def find_item
|
||||
@item = ExaminationItem.find_by!(id: params[:id])
|
||||
@exam = @item.examination_bank
|
||||
end
|
||||
|
||||
def validate_score
|
||||
tip_exception("分值不能为空") unless params[:score].present?
|
||||
tip_exception("分值需大于0") unless params[:score].to_f > 0
|
||||
end
|
||||
|
||||
def edit_auth
|
||||
current_user.admin_or_business? || @exam.user == current_user
|
||||
end
|
||||
end
|
@ -0,0 +1,34 @@
|
||||
class Admins::ApplyItemBankQuery < ApplicationQuery
|
||||
include CustomSortable
|
||||
|
||||
attr_reader :params
|
||||
|
||||
sort_columns :updated_at, default_by: :updated_at, default_direction: :desc
|
||||
|
||||
def initialize(params)
|
||||
@params = params
|
||||
end
|
||||
|
||||
def call
|
||||
applies = ApplyAction.where(container_type: params[:type].presence || "ItemBank")
|
||||
|
||||
status =
|
||||
case params[:status]
|
||||
when 'pending' then 0
|
||||
when 'processed' then [1, 2]
|
||||
when 'agreed' then 1
|
||||
when 'refused' then 2
|
||||
else 0
|
||||
end
|
||||
applies = applies.where(status: status) if status.present?
|
||||
|
||||
# 关键字模糊查询
|
||||
keyword = params[:keyword].to_s.strip
|
||||
if keyword.present?
|
||||
applies = applies.joins(user: { user_extension: :school })
|
||||
.where('CONCAT(lastname,firstname) LIKE :keyword OR schools.name LIKE :keyword', keyword: "%#{keyword}%")
|
||||
end
|
||||
|
||||
custom_sort(applies, params[:sort_by], params[:sort_direction])
|
||||
end
|
||||
end
|
@ -0,0 +1,50 @@
|
||||
class ExaminationItems::SaveItemService < ApplicationService
|
||||
attr_reader :user, :params, :exam
|
||||
|
||||
def initialize(user, params, exam)
|
||||
@user = user
|
||||
@params = params
|
||||
@exam = exam
|
||||
end
|
||||
|
||||
def call
|
||||
raise("请选择试题") if params[:item_ids].blank?
|
||||
|
||||
# 只能选用公共题库或是自己的题库
|
||||
items = ItemBank.where(public: 1).or(ItemBank.where(user_id: user.id))
|
||||
|
||||
# 已选到过试题篮的不重复选用
|
||||
item_ids = params[:item_ids] - exam.examination_items.pluck(:item_bank_id)
|
||||
items.where(id: item_ids).each do |item|
|
||||
ActiveRecord::Base.transaction do
|
||||
item_score = item_score item.item_type
|
||||
item_position = item_position item.item_type
|
||||
new_item = ExaminationItem.new
|
||||
new_item.new_item(item, exam, item_score, item_position)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def item_score item_type
|
||||
if exam.examination_items.where(item_type: item_type).last.present?
|
||||
score = exam.examination_items.where(item_type: item_type).last.score
|
||||
else
|
||||
score =
|
||||
case item_type
|
||||
when "SINGLE", "MULTIPLE", "JUDGMENT"
|
||||
5
|
||||
when "PROGRAM"
|
||||
10
|
||||
else
|
||||
5
|
||||
end
|
||||
end
|
||||
score
|
||||
end
|
||||
|
||||
def item_position item_type
|
||||
exam.examination_items.where(item_type: item_type).last&.position.to_i + 1
|
||||
end
|
||||
end
|
@ -0,0 +1,30 @@
|
||||
<% define_admin_breadcrumbs do %>
|
||||
<% add_admin_breadcrumb('试卷审批') %>
|
||||
<% end %>
|
||||
|
||||
<div class="box search-form-container flex-column mb-0 pb-0 examination-authentication-list-form">
|
||||
<ul class="nav nav-tabs w-100 search-form-tabs">
|
||||
<li class="nav-item">
|
||||
<%= link_to '待审批', admins_examination_authentications_path(status: :pending), remote: true, 'data-value': 'pending',
|
||||
class: "nav-link search-form-tab #{params[:status] == 'pending' ? 'active' : ''}" %>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<%= link_to '已审批', admins_examination_authentications_path(status: :processed), remote: true, 'data-value': 'processed',
|
||||
class: "nav-link search-form-tab #{params[:status] != 'pending' ? 'active' : ''}" %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<%= form_tag(admins_examination_authentications_path(unsafe_params), method: :get, class: 'form-inline search-form justify-content-end mt-3', remote: true) do %>
|
||||
<div class="form-group status-filter" style="<%= params[:status] != 'pending' ? '' : 'display: none;' %>">
|
||||
<label for="status">审核状态:</label>
|
||||
<% status_options = [['全部', 'processed'], ['已同意', 'agreed'], ['已拒绝', 'refused']] %>
|
||||
<%= select_tag(:status, options_for_select(status_options), class: 'form-control') %>
|
||||
</div>
|
||||
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '姓名/学校/单位检索') %>
|
||||
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="box admin-list-container examination-authentication-list-container">
|
||||
<%= render(partial: 'admins/examination_authentications/shared/list', locals: { applies: @applies }) %>
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
$('.examination-authentication-list-container').html("<%= j( render partial: 'admins/examination_authentications/shared/list', locals: { applies: @applies } ) %>");
|
@ -0,0 +1,35 @@
|
||||
<div class="modal fade admin-item-show-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">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="mt-2">
|
||||
<p>题型:<%= item.type_string %></p>
|
||||
<p>难度:<%= item.difficulty_string %></p>
|
||||
</div>
|
||||
|
||||
<div class="mt-2">
|
||||
<p><%= item.name %></p>
|
||||
<% item.item_choices.each do |choice| %>
|
||||
<div class="form-check ml-3">
|
||||
<% if item.item_type == "MULTIPLE" %>
|
||||
<%= check_box_tag(:choice, true, choice.is_answer, class: 'form-check-input') %>
|
||||
<label class="form-check-label" for="choice"><%= choice.choice_text %></label>
|
||||
<% elsif item.item_type == "SINGLE" || item.item_type == "JUDGMENT" %>
|
||||
<%= radio_button_tag(:choice, true, choice.is_answer, class: 'form-check-input') %>
|
||||
<label class="form-check-label" for="choice"><%= choice.choice_text %></label>
|
||||
<% else %>
|
||||
答案:<%= choice.choice_text %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,54 @@
|
||||
<% is_processed = params[:status].to_s != 'pending' %>
|
||||
<table class="table table-hover text-center professional-authentication-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="4%">序号</th>
|
||||
<th width="8%">头像</th>
|
||||
<th width="18%">创建者</th>
|
||||
<th width="14%">学校</th>
|
||||
<th width="24%">试卷</th>
|
||||
<th width="16%">提交时间</th>
|
||||
<% if !is_processed %>
|
||||
<th width="16%">操作</th>
|
||||
<% else %>
|
||||
<th width="16%">审批结果</th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if applies.present? %>
|
||||
<% applies.each_with_index do |apply, index| %>
|
||||
<% user = apply.user %>
|
||||
<% exam = ExaminationBank.find apply.container_id %>
|
||||
<tr class="examination-authentication-item examination-authentication-<%= apply.id %>">
|
||||
<td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
|
||||
<td>
|
||||
<%= link_to "/users/#{user.login}", class: 'examination-authentication-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %>
|
||||
<img src="/images/<%= url_to_avatar(user) %>" class="rounded-circle" width="40" height="40" />
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= user.real_name %></td>
|
||||
<td><%= raw [user.school_name.presence, user.department_name.presence].compact.join('<br/>') %></td>
|
||||
<td>
|
||||
<%= link_to exam.name, "/paperlibrary/see/#{exam.id}", target: "_blank" %>
|
||||
</td>
|
||||
|
||||
<td><%= apply.updated_at.strftime('%Y-%m-%d %H:%M') %></td>
|
||||
|
||||
<td class="action-container">
|
||||
<% if !is_processed %>
|
||||
<%= agree_link '同意', agree_admins_examination_authentication_path(apply, element: ".examination-authentication-#{apply.id}"), 'data-confirm': '确认同意该审批?', 'data-disable-with': "提交中..." %>
|
||||
<%= agree_link '拒绝', refuse_admins_examination_authentication_path(apply, element: ".examination-authentication-#{apply.id}"), 'data-confirm': '确认拒绝该审批?', 'data-disable-with': "拒绝中..." %>
|
||||
<% else %>
|
||||
<%= apply.status_text %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= render partial: 'admins/shared/paginate', locals: { objects: applies } %>
|
@ -0,0 +1,2 @@
|
||||
$('.admin-modal-container').html("<%= j( render partial: 'admins/item_authentications/shared/item_show_modal', locals: { item: @item } ) %>");
|
||||
$('.modal.admin-item-show-modal').modal('show');
|
@ -0,0 +1,30 @@
|
||||
<% define_admin_breadcrumbs do %>
|
||||
<% add_admin_breadcrumb('题库审批') %>
|
||||
<% end %>
|
||||
|
||||
<div class="box search-form-container flex-column mb-0 pb-0 item-authentication-list-form">
|
||||
<ul class="nav nav-tabs w-100 search-form-tabs">
|
||||
<li class="nav-item">
|
||||
<%= link_to '待审批', admins_item_authentications_path(status: :pending), remote: true, 'data-value': 'pending',
|
||||
class: "nav-link search-form-tab #{params[:status] == 'pending' ? 'active' : ''}" %>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<%= link_to '已审批', admins_item_authentications_path(status: :processed), remote: true, 'data-value': 'processed',
|
||||
class: "nav-link search-form-tab #{params[:status] != 'pending' ? 'active' : ''}" %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<%= form_tag(admins_item_authentications_path(unsafe_params), method: :get, class: 'form-inline search-form justify-content-end mt-3', remote: true) do %>
|
||||
<div class="form-group status-filter" style="<%= params[:status] != 'pending' ? '' : 'display: none;' %>">
|
||||
<label for="status">审核状态:</label>
|
||||
<% status_options = [['全部', 'processed'], ['已同意', 'agreed'], ['已拒绝', 'refused']] %>
|
||||
<%= select_tag(:status, options_for_select(status_options), class: 'form-control') %>
|
||||
</div>
|
||||
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '姓名/学校/单位检索') %>
|
||||
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="box admin-list-container item-authentication-list-container">
|
||||
<%= render(partial: 'admins/item_authentications/shared/list', locals: { applies: @applies }) %>
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
$('.item-authentication-list-container').html("<%= j( render partial: 'admins/item_authentications/shared/list', locals: { applies: @applies } ) %>");
|
@ -0,0 +1,35 @@
|
||||
<div class="modal fade admin-item-show-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">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="mt-2">
|
||||
<p>题型:<%= item.type_string %></p>
|
||||
<p>难度:<%= item.difficulty_string %></p>
|
||||
</div>
|
||||
|
||||
<div class="mt-2">
|
||||
<p><%= item.name %></p>
|
||||
<% item.item_choices.each do |choice| %>
|
||||
<div class="form-check ml-3">
|
||||
<% if item.item_type == "MULTIPLE" %>
|
||||
<%= check_box_tag(:choice, true, choice.is_answer, class: 'form-check-input') %>
|
||||
<label class="form-check-label" for="choice"><%= choice.choice_text %></label>
|
||||
<% elsif item.item_type == "SINGLE" || item.item_type == "JUDGMENT" %>
|
||||
<%= radio_button_tag(:choice, true, choice.is_answer, class: 'form-check-input') %>
|
||||
<label class="form-check-label" for="choice"><%= choice.choice_text %></label>
|
||||
<% else %>
|
||||
答案:<%= choice.choice_text %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,60 @@
|
||||
<% is_processed = params[:status].to_s != 'pending' %>
|
||||
<table class="table table-hover text-center professional-authentication-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="4%">序号</th>
|
||||
<th width="8%">头像</th>
|
||||
<th width="14%">创建者</th>
|
||||
<th width="10%">学校</th>
|
||||
<th width="24%">试题</th>
|
||||
<th width="8%">题型</th>
|
||||
<th width="16%">提交时间</th>
|
||||
<% if !is_processed %>
|
||||
<th width="16%">操作</th>
|
||||
<% else %>
|
||||
<th width="16%">审批结果</th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if applies.present? %>
|
||||
<% applies.each_with_index do |apply, index| %>
|
||||
<% user = apply.user %>
|
||||
<% item = ItemBank.find apply.container_id %>
|
||||
<tr class="item-authentication-item item-authentication-<%= apply.id %>">
|
||||
<td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
|
||||
<td>
|
||||
<%= link_to "/users/#{user.login}", class: 'item-authentication-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %>
|
||||
<img src="/images/<%= url_to_avatar(user) %>" class="rounded-circle" width="40" height="40" />
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= user.real_name %></td>
|
||||
<td><%= raw [user.school_name.presence, user.department_name.presence].compact.join('<br/>') %></td>
|
||||
<td>
|
||||
<% if item.item_type == "PROGRAM" %>
|
||||
<%= link_to item.name, "/problems/#{item.container&.identifier}/edit", target: "_blank" %>
|
||||
<% else %>
|
||||
<%= link_to item.name, admins_item_authentication_path(apply), remote: true %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= item.type_string %></td>
|
||||
|
||||
<td><%= apply.updated_at.strftime('%Y-%m-%d %H:%M') %></td>
|
||||
|
||||
<td class="action-container">
|
||||
<% if !is_processed %>
|
||||
<%= agree_link '同意', agree_admins_item_authentication_path(apply, element: ".item-authentication-#{apply.id}"), 'data-confirm': '确认同意该审批?', 'data-disable-with': "提交中..." %>
|
||||
<%= agree_link '拒绝', refuse_admins_item_authentication_path(apply, element: ".item-authentication-#{apply.id}"), 'data-confirm': '确认拒绝该审批?', 'data-disable-with': "拒绝中..." %>
|
||||
<% else %>
|
||||
<%= apply.status_text %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= render partial: 'admins/shared/paginate', locals: { objects: applies } %>
|
@ -0,0 +1,2 @@
|
||||
$('.admin-modal-container').html("<%= j( render partial: 'admins/item_authentications/shared/item_show_modal', locals: { item: @item } ) %>");
|
||||
$('.modal.admin-item-show-modal').modal('show');
|
@ -0,0 +1,5 @@
|
||||
class MigrateExaminationItemName < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
change_column :examination_items, :name, :text
|
||||
end
|
||||
end
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -0,0 +1,92 @@
|
||||
import React, {Component} from "react";
|
||||
import {Link, NavLink} from 'react-router-dom';
|
||||
import {WordsBtn, ActionBtn, getImageUrl,markdownToHTML} from 'educoder';
|
||||
import axios from 'axios';
|
||||
import {
|
||||
notification,
|
||||
Spin,
|
||||
Table,
|
||||
Pagination,
|
||||
Drawer,
|
||||
Input,
|
||||
Button,
|
||||
Breadcrumb
|
||||
} from "antd";
|
||||
import Itembankstop from "./component/Itembankstop";
|
||||
import NoneData from './component/NoneData';
|
||||
import './questioncss/questioncom.css';
|
||||
import '../tpm/newshixuns/css/Newshixuns.css';
|
||||
import Paperreview_single from "./Paperreview_single";
|
||||
|
||||
//判断题
|
||||
class Paperreview_items extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//初始化
|
||||
componentDidMount() {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
getdata = (data) => {
|
||||
|
||||
}
|
||||
|
||||
preservation = () => {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
setitem_type = (item_type) => {
|
||||
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
let {paperreviewsingleindex,paperreviewsinglename,typenames,indexs,object,typenamesn}=this.props;
|
||||
|
||||
// console.log(object);
|
||||
console.log("Paperreview_items");
|
||||
console.log(object.item_id);
|
||||
return (
|
||||
<div>
|
||||
{
|
||||
paperreviewsingleindex===indexs&&paperreviewsinglename===typenames?
|
||||
<div className="xaxisreverseorder mt25 mr2">
|
||||
<div className="scd xiaoshou" onClick={()=>this.props.showsetmodalsTypedels(object.item_id,true,1)}>删除</div>
|
||||
<div className="szdfd xiaoshou" onClick={()=>this.props.Singlemagazines(true,object.id,typenamesn)}>设置得分</div>
|
||||
</div>
|
||||
: <div className="xaxisreverseorder mt25 ">
|
||||
</div>
|
||||
}
|
||||
<Paperreview_single paperreviewsingleindex={paperreviewsingleindex}
|
||||
name={typenames}
|
||||
key={indexs}
|
||||
showparagraphs={(e,name) => this.props.showparagraphs(e,name)}
|
||||
objectsingle={object} key={indexs} indexx={indexs + 1}
|
||||
indexxy={indexs}
|
||||
hideparagraphs={() => this.props.hideparagraphs()}></Paperreview_single>
|
||||
</div>
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
export default Paperreview_items
|
||||
|
||||
|
@ -0,0 +1,50 @@
|
||||
import React, { Component } from 'react';
|
||||
import {getImageUrl} from 'educoder';
|
||||
import { Modal,Input} from 'antd';
|
||||
import axios from 'axios';
|
||||
import './../questioncss/questioncom.css'
|
||||
//立即申请试用
|
||||
class PaperDeletModel extends Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state={
|
||||
newkntypeinput:""
|
||||
}
|
||||
}
|
||||
|
||||
handleChange=(e)=>{
|
||||
this.setState({
|
||||
newkntypeinput: e.target.value
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
return(
|
||||
<Modal
|
||||
keyboard={false}
|
||||
closable={false}
|
||||
footer={null}
|
||||
destroyOnClose={true}
|
||||
title="新增知识点"
|
||||
centered={true}
|
||||
visible={this.props.NewknTypedel===undefined?false:this.props.NewknTypedel}
|
||||
width="442px"
|
||||
>
|
||||
<div className="educouddiv">
|
||||
<div className={"tabeltext-alignleft mt10"}>
|
||||
<Input onInput={this.handleChange} />
|
||||
</div>
|
||||
<div className="clearfix mt30 edu-txt-center">
|
||||
<a className="task-btn mr30 w80" onClick={()=>this.props.NewknTypedeldel(false)}>取消</a>
|
||||
<a className="task-btn task-btn-orange w80" onClick={()=>this.props.NewknTypedeltyoedel(this.state.newkntypeinput)}>确定</a>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default PaperDeletModel;
|
@ -0,0 +1,175 @@
|
||||
import React, { Component } from 'react';
|
||||
import { getImageUrl} from 'educoder';
|
||||
import {Tooltip} from 'antd';
|
||||
import '../../tpm/TPMIndex.css';
|
||||
|
||||
const $ = window.$;
|
||||
const poiindex=0;
|
||||
$(window).resize(function(){
|
||||
rightSlider();
|
||||
});
|
||||
|
||||
$(window).scroll(function(){
|
||||
if($(".gotop").length>0){
|
||||
if($(document).scrollTop()>0){
|
||||
$(".-task-sidebar .gotop").show();
|
||||
$(".gotop").click(function(){
|
||||
$("html,body").scrollTop(0);
|
||||
});
|
||||
}
|
||||
if($(document).scrollTop()==0){
|
||||
$(".-task-sidebar .gotop").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function rightSlider(){
|
||||
var poi=parseInt((parseInt($(window).width())- 1200 )/2)-81;
|
||||
// console.log(parseInt($(window).width())+" "+poi);
|
||||
if(poi>0){
|
||||
$(".-task-sidebar").css("right",poi);
|
||||
}else{
|
||||
$(".-task-sidebar").css("right","0px");
|
||||
}
|
||||
$(".-task-sidebar").show();
|
||||
}
|
||||
|
||||
|
||||
function _initSider() {
|
||||
var $descSide = $("<div class='-task-desc'></div>").appendTo("body");
|
||||
$(".-task-sidebar>div").hover(function(){
|
||||
//移入显示二维码
|
||||
if($(this).hasClass("scan")){
|
||||
$(".scan_ewm").show().css({right:"75px",opacity:0}).stop().animate({
|
||||
right:"45px",opacity:1
|
||||
})
|
||||
return;
|
||||
}
|
||||
var $tool = $(this).attr("tooltips");
|
||||
$descSide.html($tool+"<div><img src='/images/edu_user/jt.png'></div>");
|
||||
$descSide.data('_dom', this)
|
||||
$descSide.show().css({
|
||||
left:$(this).offset().left - $descSide.width()-30,
|
||||
opacity:0,
|
||||
top:$(this).offset().top
|
||||
}).stop().animate({
|
||||
left:$(this).offset().left - $descSide.width()-5,
|
||||
opacity:1
|
||||
},400);
|
||||
},function(){
|
||||
if($(this).hasClass("scan")){
|
||||
$(".scan_ewm").stop().animate({right:"75px",opacity:0},200).hide();
|
||||
}
|
||||
$descSide.stop().animate({
|
||||
left:$(this).offset().left - $descSide.width()-30,
|
||||
opacity:0
|
||||
},200).hide();
|
||||
});
|
||||
rightSlider();
|
||||
|
||||
$(window).scroll(function() {
|
||||
if ($descSide.height()) {
|
||||
var hoverIcon = $descSide.data('_dom')
|
||||
$descSide.css('top', $(hoverIcon).offset().top)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
class SiderBars extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
_initSider()
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
|
||||
// console.log("SiderBar");
|
||||
// console.log(this.props);
|
||||
|
||||
var mypath= this.props&&this.props.match&&this.props.match.path;
|
||||
let{myvisible}=this.props;
|
||||
return (
|
||||
|
||||
<div className={myvisible===true?"-task-sidebar mystask-sidebar":"-task-sidebar mystask-sidebars"} >
|
||||
|
||||
{this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?<div>
|
||||
|
||||
{
|
||||
mypath&&mypath==="/question"?
|
||||
<Tooltip placement="left" title={"试题库"}>
|
||||
<div className="feedback feedbackdivcolor xiaoshou shitikus" onClick={()=>this.props.showDrawer()} >
|
||||
<a target="_blank" className="color_white xiaoshou" >
|
||||
<i className="iconfont icon-shitilan color-white xiaoshou"></i>
|
||||
</a>
|
||||
<p className="color-white font-12 xiaoshou">试题库</p>
|
||||
</div>
|
||||
</Tooltip>
|
||||
:""
|
||||
|
||||
}
|
||||
|
||||
<Tooltip placement="right" title={"返回顶部"}>
|
||||
<div className="gotop">
|
||||
<a>
|
||||
<i className="iconfont icon-shangjiantou color-white"></i>
|
||||
</a>
|
||||
</div>
|
||||
</Tooltip>
|
||||
|
||||
|
||||
|
||||
<Tooltip placement="right" title={"意见反馈"}>
|
||||
<div className="feedback">
|
||||
<a target="_blank" className="color_white" href="/help/feedback">
|
||||
<i className="iconfont icon-yijianfankui color-white font-22"></i>
|
||||
</a>
|
||||
</div>
|
||||
</Tooltip>
|
||||
|
||||
|
||||
<div className="scan pr">
|
||||
<Tooltip placement="right" title={
|
||||
<pre>
|
||||
<p className="scan_ewm">
|
||||
<p className="pr padding10">
|
||||
<style>
|
||||
{
|
||||
`
|
||||
.WeChatstyle{
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
`
|
||||
}
|
||||
</style>
|
||||
<img src={getImageUrl("images/educoder/EWM.jpg")} width="158px" height="158px" />
|
||||
<p className={"WeChatstyle wechatcenter"}>微信扫一扫</p>
|
||||
<p className={"WeChatstyle wechatcenter"}>关注公众号</p>
|
||||
</p>
|
||||
</p>
|
||||
</pre>
|
||||
}>
|
||||
<span className="inline erweima"><i className="iconfont icon-erweima color-white font-22 fl"></i></span>
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
<Tooltip placement="right" title={"在线咨询"}>
|
||||
<div className="consult">
|
||||
<a target="_blank" className="color_white" href="//shang.qq.com/wpa/qunwpa?idkey=2f2043d88c1bd61d182b98bf1e061c6185e23055bec832c07d8148fe11c5a6cd">
|
||||
<i className="iconfont icon-qqzaixianzixun color-white font-22"></i>
|
||||
</a>
|
||||
</div>
|
||||
</Tooltip>
|
||||
|
||||
</div>:""}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default SiderBars;
|
@ -0,0 +1,818 @@
|
||||
import React, {Component} from "react";
|
||||
import {Link, NavLink} from 'react-router-dom';
|
||||
import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl} from 'educoder';
|
||||
import axios from 'axios';
|
||||
import {
|
||||
notification,
|
||||
Spin,
|
||||
Table,
|
||||
Pagination,
|
||||
Radio,
|
||||
Checkbox,
|
||||
Form,
|
||||
Input,
|
||||
Select,
|
||||
Cascader,
|
||||
Col, Row, InputNumber, DatePicker, AutoComplete, Button, Tag
|
||||
} from "antd";
|
||||
import './../questioncss/questioncom.css';
|
||||
import Newknledpots from '../component/Newknledpots'
|
||||
const InputGroup = Input.Group;
|
||||
const {Option} = Select;
|
||||
const options = [
|
||||
{
|
||||
value: '方向',
|
||||
label: '方向',
|
||||
children: [
|
||||
{
|
||||
value: '课程',
|
||||
label: '课程',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: 'jiangsu',
|
||||
label: 'Jiangsu',
|
||||
children: [
|
||||
{
|
||||
value: 'nanjing',
|
||||
label: 'Nanjing',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
class Comthetestpaperst extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.contentMdRef = React.createRef()
|
||||
this.state = {
|
||||
page: 1,
|
||||
Knowpoints: [],
|
||||
rbtx: undefined,
|
||||
rbkc: undefined,
|
||||
knowledgepoints: [],
|
||||
knowledgepoints2:[],
|
||||
options: [],
|
||||
NewknTypedel:false
|
||||
}
|
||||
}
|
||||
|
||||
//初始化
|
||||
componentDidMount() {
|
||||
try {
|
||||
this.props.getJudquestio(this);
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
this.setState({
|
||||
options: this.props.disciplmy,
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
//编辑的时候
|
||||
|
||||
if (prevProps.disciplmy !== this.props.disciplmy) {
|
||||
this.setState({
|
||||
options: this.props.disciplmy
|
||||
})
|
||||
}
|
||||
// 把知识点放进塞选中 ,如果是编辑 已经选中就不放进去
|
||||
if(prevProps.disciplinesdata!== this.props.disciplinesdata){
|
||||
try {
|
||||
if(this.props.item_banksedit.discipline &&this.props.item_banksedit.sub_discipline){
|
||||
var didata = this.props.disciplinesdata;
|
||||
var knowledgepointsdata = [];
|
||||
for (var i = 0; i < didata.length; i++) {
|
||||
//方向
|
||||
if (this.props.item_banksedit.discipline.id === didata[i].id) {
|
||||
const fxdidata = didata[i].sub_disciplines;
|
||||
for (var j = 0; j < fxdidata.length; j++) {
|
||||
//课程
|
||||
if (this.props.item_banksedit.sub_discipline.id === fxdidata[j].id) {
|
||||
const zsddata = fxdidata[j].tag_disciplines;
|
||||
for (var k = 0; k < zsddata.length; k++) {
|
||||
//知识点
|
||||
knowledgepointsdata.push(zsddata[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var _result =[];
|
||||
knowledgepointsdata.filter(item => {
|
||||
if (this.props.item_banksedit.tag_disciplines.findIndex(t => t.id === item.id) === -1) {
|
||||
_result.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.setState({
|
||||
knowledgepoints:knowledgepointsdata,
|
||||
knowledgepoints2: _result,
|
||||
})
|
||||
}else{
|
||||
}
|
||||
}catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
if (prevProps.item_banksedit !== this.props.item_banksedit) {
|
||||
// if (this.props.item_banksedit.item_type) {
|
||||
// this.handleFormtixing(this.props.item_banksedit.item_type);
|
||||
// }
|
||||
if (this.props.item_banksedit.difficulty) {
|
||||
this.handleFormLayoutChange(this.props.item_banksedit.difficulty);
|
||||
}
|
||||
if (this.props.item_banksedit.tag_disciplines) {
|
||||
this.handletag_disciplinesChange(this.props.item_banksedit.tag_disciplines);
|
||||
}
|
||||
try {
|
||||
this.handdisciplinesChange(this.props.item_banksedit.discipline,this.props.item_banksedit.sub_discipline);
|
||||
}catch (e) {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
if(this.props.item_banksedit.name){
|
||||
this.props.form.setFieldsValue({
|
||||
// course:value,
|
||||
classroom:this.props.item_banksedit.name,
|
||||
})
|
||||
}
|
||||
|
||||
}catch (e) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
|
||||
if(this.props.item_banksedit.duration){
|
||||
this.props.form.setFieldsValue({
|
||||
// course:value,
|
||||
kssc:this.props.item_banksedit.duration,
|
||||
})
|
||||
}
|
||||
}catch (e) {
|
||||
|
||||
}
|
||||
this.getdatasmys();
|
||||
}
|
||||
}
|
||||
|
||||
getdatasmys=()=>{
|
||||
if(this.props.disciplinesdata){
|
||||
try {
|
||||
if(this.props.item_banksedit.discipline &&this.props.item_banksedit.sub_discipline){
|
||||
var didata = this.props.disciplinesdata;
|
||||
var knowledgepointsdata = [];
|
||||
for (var i = 0; i < didata.length; i++) {
|
||||
//方向
|
||||
if (this.props.item_banksedit.discipline.id === didata[i].id) {
|
||||
const fxdidata = didata[i].sub_disciplines;
|
||||
for (var j = 0; j < fxdidata.length; j++) {
|
||||
//课程
|
||||
if (this.props.item_banksedit.sub_discipline.id === fxdidata[j].id) {
|
||||
const zsddata = fxdidata[j].tag_disciplines;
|
||||
for (var k = 0; k < zsddata.length; k++) {
|
||||
//知识点
|
||||
knowledgepointsdata.push(zsddata[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var _result =[];
|
||||
knowledgepointsdata.filter(item => {
|
||||
if (this.props.item_banksedit.tag_disciplines.findIndex(t => t.id === item.id) === -1) {
|
||||
_result.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.setState({
|
||||
knowledgepoints:knowledgepointsdata,
|
||||
knowledgepoints2: _result,
|
||||
})
|
||||
}else{
|
||||
}
|
||||
}catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
handdisciplinesChange =(name,title)=>{
|
||||
this.setState({
|
||||
rbkc:[name.id,title.id]
|
||||
})
|
||||
this.props.form.setFieldsValue({
|
||||
rbkc: [name.id,title.id],
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
handleSearch=(value)=>{
|
||||
|
||||
|
||||
if(value!=""){
|
||||
this.props.form.setFieldsValue({
|
||||
classroom:value,
|
||||
// course:value
|
||||
});
|
||||
// this.Searchvalue(value)
|
||||
}
|
||||
|
||||
};
|
||||
handleChange=(e)=>{
|
||||
console.log(e);
|
||||
this.props.form.setFieldsValue({
|
||||
// course:value,
|
||||
classroom:e.target.value,
|
||||
})
|
||||
if(e.target.value){
|
||||
if(e.target.value.length>60){
|
||||
this.setState({
|
||||
bordebool:true,
|
||||
})
|
||||
}else if(e.target.value.length===0){
|
||||
this.setState({
|
||||
bordebool:true,
|
||||
})
|
||||
}else{
|
||||
this.setState({
|
||||
bordebool:false,
|
||||
})
|
||||
}
|
||||
}else{
|
||||
this.setState({
|
||||
bordebool:true
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
handletag_disciplinesChange = (data) => {
|
||||
//是否选中的知识点
|
||||
try {
|
||||
var sju=data[data.length-1].name;
|
||||
this.setState({
|
||||
Knowpoints:data,
|
||||
})
|
||||
this.props.form.setFieldsValue({
|
||||
rbzsd: sju,
|
||||
});
|
||||
}catch (e) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
onChange = (e) => {
|
||||
|
||||
}
|
||||
Getdatas = () => {
|
||||
return this.handleSubmits();
|
||||
}
|
||||
handleSubmits = () => {
|
||||
var data = [];
|
||||
this.props.form.validateFields((err, values) => {
|
||||
data = [];
|
||||
|
||||
if (!err) {
|
||||
data.push({
|
||||
rbnd: parseInt(values.rbnd)
|
||||
})
|
||||
data.push({
|
||||
rbtx: null
|
||||
})
|
||||
data.push({
|
||||
rbzsd: this.state.Knowpoints
|
||||
})
|
||||
data.push({
|
||||
rbkc: values.rbkc
|
||||
})
|
||||
data.push({
|
||||
classroom:values.classroom
|
||||
})
|
||||
data.push({
|
||||
kssc:values.kssc
|
||||
})
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return data;
|
||||
|
||||
}
|
||||
handleSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
this.props.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
////console.log("获取的form 数据");
|
||||
////console.log(values);
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
handleFormLayoutChange = (value) => {
|
||||
//难度塞选
|
||||
////console.log("难度塞选");
|
||||
////console.log(value);
|
||||
this.props.form.setFieldsValue({
|
||||
rbnd: value + "",
|
||||
});
|
||||
this.setState({
|
||||
rbnd: value + "",
|
||||
})
|
||||
|
||||
}
|
||||
handleFormkechen = (value) => {
|
||||
//课程
|
||||
////console.log("课程");
|
||||
////console.log(value);
|
||||
if(this.state.Knowpoints.length>4){
|
||||
this.props.showNotification(`知识点最多选择5个`);
|
||||
return
|
||||
}
|
||||
var valuename = undefined;
|
||||
this.props.form.setFieldsValue({
|
||||
rbzsd: value,
|
||||
});
|
||||
|
||||
var arr = this.state.knowledgepoints;
|
||||
for (let data of arr) {
|
||||
if (data.id === value) {
|
||||
this.state.Knowpoints.push(data);
|
||||
valuename = data.name;
|
||||
}
|
||||
}
|
||||
|
||||
const _result =[];
|
||||
this.state.knowledgepoints.filter(item => {
|
||||
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
|
||||
console.log("guonue");
|
||||
console.log(item);
|
||||
_result.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.setState({
|
||||
rbzsd: valuename,
|
||||
Knowpoints: this.state.Knowpoints,
|
||||
knowledgepoints2: _result,
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
handleFormzhishidian = (value) => {
|
||||
console.log("handleFormzhishidian 课程");
|
||||
console.log(value);
|
||||
|
||||
//课程
|
||||
this.props.form.setFieldsValue({
|
||||
rbkc: value,
|
||||
});
|
||||
this.setState({
|
||||
rbkc:value,
|
||||
})
|
||||
// console.log("handleFormzhishidian");
|
||||
// console.log(this.props.disciplinesdata);
|
||||
|
||||
const didata = this.props.disciplinesdata;
|
||||
const knowledgepointsdata = [];
|
||||
|
||||
for (var i = 0; i < didata.length; i++) {
|
||||
//方向
|
||||
if (value[0] === didata[i].id) {
|
||||
const fxdidata = didata[i].sub_disciplines;
|
||||
for (var j = 0; j < fxdidata.length; j++) {
|
||||
//课程
|
||||
if (value[1] === fxdidata[j].id) {
|
||||
const zsddata = fxdidata[j].tag_disciplines;
|
||||
for (var k = 0; k < zsddata.length; k++) {
|
||||
//知识点
|
||||
knowledgepointsdata.push(zsddata[k]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
this.setState({
|
||||
Knowpoints: [],
|
||||
knowledgepoints: knowledgepointsdata,
|
||||
knowledgepoints2:knowledgepointsdata,
|
||||
})
|
||||
|
||||
this.props.form.setFieldsValue({
|
||||
rbzsd: undefined,
|
||||
});
|
||||
this.setState({
|
||||
rbzsd: undefined,
|
||||
})
|
||||
}
|
||||
|
||||
handleFormtixing = (value) => {
|
||||
//题型
|
||||
//console.log("题型");
|
||||
//console.log(value);
|
||||
this.setState({
|
||||
rbtx: value + "",
|
||||
})
|
||||
this.props.form.setFieldsValue({
|
||||
rbtx: value + "",
|
||||
});
|
||||
this.props.setitem_type(value);
|
||||
}
|
||||
preventDefault = (e) => {
|
||||
e.preventDefault();
|
||||
////console.log('Clicked! But prevent default.');
|
||||
}
|
||||
deletesobject = (item, index) => {
|
||||
debugger
|
||||
var tmp = this.state.Knowpoints;
|
||||
for (var i = 0; i < tmp.length; i++) {
|
||||
if (i ===index) {
|
||||
tmp.splice(i,1);
|
||||
}
|
||||
}
|
||||
|
||||
this.props.form.setFieldsValue({
|
||||
rbzsd: this.state.Knowpoints,
|
||||
});
|
||||
|
||||
const _result =[];
|
||||
this.state.knowledgepoints.filter(item => {
|
||||
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
|
||||
_result.push(item);
|
||||
}
|
||||
});
|
||||
this.setState({
|
||||
Knowpoints: this.state.Knowpoints,
|
||||
knowledgepoints2:_result,
|
||||
})
|
||||
if (this.state.Knowpoints.length === 0) {
|
||||
this.setState({
|
||||
rbzsd: undefined,
|
||||
})
|
||||
} else if (this.state.Knowpoints.length > 0) {
|
||||
try {
|
||||
const myknowda = this.state.Knowpoints;
|
||||
this.setState({
|
||||
rbzsd: myknowda[this.state.Knowpoints.length - 1].name,
|
||||
})
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
NewknTypedeldel=(bool)=>{
|
||||
this.setState({
|
||||
NewknTypedel:bool
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
NewknTypedeltyoedel=(value)=>{
|
||||
|
||||
if(value===null||value===""){
|
||||
this.props.showNotification(`请输入知识点`);
|
||||
return
|
||||
}
|
||||
|
||||
if(value.length===0){
|
||||
this.props.showNotification(`请输入知识点`);
|
||||
return
|
||||
}
|
||||
|
||||
if(this.state.rbkc===undefined || this.state.rbkc===null || this.state.rbkc===""){
|
||||
this.props.showNotification(`请选择课程方向`);
|
||||
return;
|
||||
}
|
||||
var data={
|
||||
name:value,
|
||||
sub_discipline_id:this.state.rbkc[1]
|
||||
}
|
||||
const url="/tag_disciplines.json";
|
||||
axios.post(url,data)
|
||||
.then((result) => {
|
||||
if (result.data.status === 0) {
|
||||
this.props.showNotification(`新增知识点成功!`);
|
||||
var leydata={
|
||||
id: result.data.tag_discipline_id,
|
||||
name:value,
|
||||
}
|
||||
this.state.knowledgepoints.push(leydata);
|
||||
const _result =[];
|
||||
this.state.knowledgepoints.filter(item => {
|
||||
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
|
||||
_result.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
this.setState({
|
||||
Knowpoints: this.state.Knowpoints,
|
||||
knowledgepoints: this.state.knowledgepoints,
|
||||
knowledgepoints2: _result,
|
||||
})
|
||||
}
|
||||
}).catch((error) => {
|
||||
//console.log(error);
|
||||
})
|
||||
|
||||
this.setState({
|
||||
NewknTypedel:false
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
let {page, options,NewknTypedel,knowledgepoints,knowledgepoints2,Knowpoints} = this.state;
|
||||
const {getFieldDecorator} = this.props.form;
|
||||
const optionss = this.state.searchlist && this.state.searchlist.map(d => <Option key={d.name} value={d.name}>{d.name}</Option>);
|
||||
var addonAfterthree=this.props.form&&this.props.form.getFieldValue('classroom');
|
||||
var addonAfteronelens3=0;
|
||||
if(addonAfterthree){
|
||||
addonAfteronelens3=String(addonAfterthree).length;
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
<div className=" clearfix educontent Contentquestionbankstyle w100s w1200fpx mt19">
|
||||
<style>
|
||||
{
|
||||
`
|
||||
.ant-form-item{
|
||||
margin-bottom: 0px !important;
|
||||
|
||||
|
||||
}
|
||||
.ant-form-explain{
|
||||
padding-left:0px !important;
|
||||
margin-top: 3px !important;
|
||||
}
|
||||
.ant-select-selection{
|
||||
height: 33px !important;
|
||||
}
|
||||
.ant-input-group{
|
||||
width:258px !important;
|
||||
}
|
||||
.ant-input {
|
||||
height: 33px !important;
|
||||
}
|
||||
|
||||
.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):focus-within {
|
||||
outline: 0px solid rgba(24, 144, 255, 0.06) !important;
|
||||
}
|
||||
|
||||
`
|
||||
}
|
||||
</style>
|
||||
<div className="h12"></div>
|
||||
{
|
||||
NewknTypedel?
|
||||
<Newknledpots {...this.state} {...this.props}
|
||||
NewknTypedeldel={(bool)=>this.NewknTypedeldel(bool)}
|
||||
NewknTypedeltyoedel={(value)=>this.NewknTypedeltyoedel(value)}
|
||||
></Newknledpots>
|
||||
:""
|
||||
}
|
||||
|
||||
<Form onSubmit={this.handleSubmit}>
|
||||
|
||||
<Form.Item
|
||||
label="课程"
|
||||
>
|
||||
{getFieldDecorator("rbkc",
|
||||
{
|
||||
rules: [{required: true, message: '请选择课程'}],
|
||||
}
|
||||
)(
|
||||
<div className="sortinxdirection">
|
||||
<InputGroup compact>
|
||||
<Cascader style={{width: '258px'}} value={this.state.rbkc} options={options} onChange={this.handleFormzhishidian}
|
||||
placeholder="请选择..."/>
|
||||
</InputGroup>
|
||||
|
||||
</div>
|
||||
)}
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="知识点"
|
||||
>
|
||||
{getFieldDecorator("rbzsd"
|
||||
)(
|
||||
<div className="sortinxdirection">
|
||||
<InputGroup compact>
|
||||
<Select style={{width: '258px'}} value={undefined} onChange={this.handleFormkechen}
|
||||
placeholder="请选择...">
|
||||
{knowledgepoints2 && knowledgepoints2.map((object, index) => {
|
||||
return (
|
||||
<Option key={object.id} value={object.id}>{object.name}</Option>
|
||||
)
|
||||
})}
|
||||
</Select>
|
||||
</InputGroup>
|
||||
|
||||
|
||||
|
||||
<img className=" ml22 zjzsdian xiaoshou" src={getImageUrl("/images/educoder/zjzsd.png")} onClick={()=>this.NewknTypedeldel(true)}/>
|
||||
|
||||
|
||||
<div className="sortinxdirection" style={{
|
||||
height: "33px",
|
||||
lineHeight: "28px",
|
||||
|
||||
}}>
|
||||
|
||||
{this.state.Knowpoints === undefined ? "" : this.state.Knowpoints.map((object, index) => {
|
||||
return (
|
||||
<div key={index} className="mytags" style={{
|
||||
position: "relative",
|
||||
}}>
|
||||
<p className="w100s stestcen lh32">{object.name}</p>
|
||||
|
||||
<img className=" ml7 zjzsdian xiaoshou icondowncolorssy" onClick={() => this.deletesobject(object, index)} src={getImageUrl("/images/educoder/bzucha.png")}/>
|
||||
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</Form.Item>
|
||||
|
||||
<style>
|
||||
{
|
||||
`
|
||||
.ml19{
|
||||
margin-left:19px;
|
||||
}
|
||||
`
|
||||
}
|
||||
</style>
|
||||
<div className="stud-class-set ">
|
||||
<style>{
|
||||
`
|
||||
.yslzxueshis .ant-input{
|
||||
border-right: none !important;
|
||||
height: 38px !important;
|
||||
width: 970px !important;
|
||||
}
|
||||
.yslzxueshisy span .ant-input-group-addon{
|
||||
width: 65px !important;
|
||||
background-color: #fafafa!important;
|
||||
}
|
||||
.yslzxueshisy .ant-input-group-addon{
|
||||
width: 65px !important;
|
||||
background-color: #fafafa!important;
|
||||
}
|
||||
|
||||
`
|
||||
}</style>
|
||||
<div className="sjmc">
|
||||
<Form.Item label="试卷名称:">
|
||||
{getFieldDecorator('classroom', {
|
||||
rules: [{required: true, message: "不能为空"}],
|
||||
})(
|
||||
|
||||
<AutoComplete
|
||||
onSearch={this.handleSearch}
|
||||
className={"fl construction yslzxueshis "}
|
||||
dataSource={optionss}
|
||||
>
|
||||
<Input className="yslzxueshisy " placeholder="例如:数据结构" onInput={this.handleChange} addonAfter={String(addonAfteronelens3)+"/60"} maxLength={60} />
|
||||
</AutoComplete>
|
||||
)}
|
||||
<div id='isclassroom'></div>
|
||||
</Form.Item>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<style>
|
||||
{
|
||||
`
|
||||
.kssc .ant-form-item-label{
|
||||
line-height: 38px !important;
|
||||
}
|
||||
|
||||
`
|
||||
}
|
||||
</style>
|
||||
<div className="kssc">
|
||||
|
||||
<Form.Item label="考试时长:">
|
||||
{getFieldDecorator('kssc')(<InputNumber
|
||||
min={0}
|
||||
step={0.1}
|
||||
></InputNumber>)}
|
||||
<span className="ant-form-text"> 分钟</span>
|
||||
</Form.Item>
|
||||
</div>
|
||||
|
||||
|
||||
<style>
|
||||
{
|
||||
`
|
||||
.rbndclass .ant-radio-button-wrapper{
|
||||
width:106px !important;
|
||||
height:33px !important;
|
||||
background:#EEEEEE;
|
||||
border-radius:17px !important;
|
||||
color:#333333;
|
||||
text-align: center !important;
|
||||
border:0px !important;
|
||||
margin-right: 27px !important;
|
||||
margin-top: 6px !important;
|
||||
|
||||
}
|
||||
.rbndclass .ant-radio-button-wrapper-checked {
|
||||
width: 106px !important;
|
||||
height: 33px !important;
|
||||
background: #4CACFF !important;
|
||||
border-radius: 17px !important;
|
||||
text-align: center !important;
|
||||
border:0px !important;
|
||||
color: #ffffff !important;
|
||||
margin-right: 27px !important;
|
||||
margin-top: 6px!important;
|
||||
|
||||
}
|
||||
.rbndclass .ant-radio-button-wrapper:not(:first-child)::before{
|
||||
border:0px !important;
|
||||
width:0px !important;
|
||||
}
|
||||
|
||||
.rbndclass .ant-radio-button-wrapper{
|
||||
border:0px !important;
|
||||
}
|
||||
.rbndclass .ant-radio-group{
|
||||
border:0px !important;
|
||||
}
|
||||
.rbndclass .ant-radio-group label{
|
||||
border:0px !important;
|
||||
}
|
||||
|
||||
.rbndclass .ant-radio-group span{
|
||||
border:0px !important;
|
||||
}
|
||||
|
||||
ant-radio-button-wrapper:focus-within {
|
||||
outline: 0px solid #ffffff;
|
||||
}
|
||||
|
||||
`
|
||||
}
|
||||
</style>
|
||||
<div className="rbndclass">
|
||||
<Form.Item label="难度">
|
||||
{getFieldDecorator('rbnd',
|
||||
{
|
||||
rules: [{required: true, message: '请选择难度'}],
|
||||
}
|
||||
)(
|
||||
<Radio.Group initialValue={this.state.rbnd} onChange={this.handleFormLayoutChange}>
|
||||
<Radio.Button value="1">简单</Radio.Button>
|
||||
<Radio.Button value="2">适中</Radio.Button>
|
||||
<Radio.Button value="3">困难</Radio.Button>
|
||||
</Radio.Group>,
|
||||
)}
|
||||
</Form.Item>
|
||||
</div>
|
||||
</Form>
|
||||
<div className="h20"></div>
|
||||
</div>
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
const Comthetestpapersts = Form.create({name: 'Comthetestpaperst'})(Comthetestpaperst);
|
||||
export default Comthetestpapersts;
|
@ -0,0 +1,88 @@
|
||||
import React, {Component} from "react";
|
||||
import {Link, NavLink} from 'react-router-dom';
|
||||
import {WordsBtn, ActionBtn, getImageUrl,markdownToHTML} from 'educoder';
|
||||
import axios from 'axios';
|
||||
import {
|
||||
notification,
|
||||
Spin,
|
||||
Table,
|
||||
Pagination,
|
||||
Drawer,
|
||||
Input,
|
||||
Button,
|
||||
Breadcrumb
|
||||
} from "antd";
|
||||
import '../../question/questioncss/questioncom.css';
|
||||
import '../../tpm/newshixuns/css/Newshixuns.css';
|
||||
import Paperreview_single from "../../question/Paperreview_single";
|
||||
|
||||
//判断题
|
||||
//这不是唯一的 试题库还有Paperreview_items
|
||||
class Paperlibraryseeid_itemsss extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//初始化
|
||||
componentDidMount() {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
getdata = (data) => {
|
||||
|
||||
}
|
||||
|
||||
preservation = () => {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
setitem_type = (item_type) => {
|
||||
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
let {paperreviewsingleindex,paperreviewsinglename,typenames,indexs,object,typenamesn}=this.props;
|
||||
|
||||
return (
|
||||
<div>
|
||||
{
|
||||
paperreviewsingleindex===indexs&&paperreviewsinglename===typenames?
|
||||
<div className="xaxisreverseorder mt25 mr2">
|
||||
<div className="scd xiaoshou" onClick={()=>this.props.showsetmodalsTypedels(object.id,true,1)}>删除</div>
|
||||
<div className="szdfd xiaoshou" onClick={()=>this.props.Singlemagazines(true,object.id,typenamesn)}>设置得分</div>
|
||||
</div>
|
||||
: <div className="xaxisreverseorder mt25 ">
|
||||
</div>
|
||||
}
|
||||
<Paperreview_single paperreviewsingleindex={paperreviewsingleindex}
|
||||
name={typenames}
|
||||
key={indexs}
|
||||
showparagraphs={(e,name) => this.props.showparagraphs(e,name)}
|
||||
objectsingle={object} key={indexs} indexx={indexs + 1}
|
||||
indexxy={indexs}
|
||||
hideparagraphs={() => this.props.hideparagraphs()}></Paperreview_single>
|
||||
</div>
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
export default Paperlibraryseeid_itemsss
|
||||
|
||||
|
Loading…
Reference in new issue