Merge branches 'dev_aliyun' and 'dev_item_bank' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_item_bank
commit
80ea35df88
@ -0,0 +1,65 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-disciplines-index-page').length > 0) {
|
||||
|
||||
// ============== 新建 ===============
|
||||
var $modal = $('.modal.admin-create-discipline-modal');
|
||||
var $form = $modal.find('form.admin-create-discipline-form');
|
||||
var $nameInput = $form.find('input[name="name"]');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
name: {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// modal ready fire
|
||||
$modal.on('show.bs.modal', function () {
|
||||
$nameInput.val('');
|
||||
});
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
|
||||
if ($form.valid()) {
|
||||
var url = $form.data('url');
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: url,
|
||||
data: $form.serialize(),
|
||||
success: function(){
|
||||
$.notify({ message: '创建成功' });
|
||||
$modal.modal('hide');
|
||||
|
||||
setTimeout(function(){
|
||||
window.location.reload();
|
||||
}, 500);
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$form.find('.error').html(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(".discipline-list-container").on("change", '.discipline-source-form', function () {
|
||||
var s_id = $(this).attr("data-id");
|
||||
var s_value = $(this).val();
|
||||
var s_name = $(this).attr("name");
|
||||
var json = {};
|
||||
json[s_name] = s_value;
|
||||
$.ajax({
|
||||
url: "/admins/disciplines/" + s_id,
|
||||
type: "PUT",
|
||||
dataType:'script',
|
||||
data: json
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,31 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-edit-discipline-modal', function(){
|
||||
var $modal = $('.modal.admin-edit-discipline-modal');
|
||||
var $form = $modal.find('form.admin-edit-discipline-form');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
'discipline[name]': {
|
||||
required: true,
|
||||
maxlength: 20
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
var url = $form.attr('action');
|
||||
|
||||
if ($form.valid()) {
|
||||
$.ajax({
|
||||
method: 'PATCH',
|
||||
dataType: 'script',
|
||||
url: url,
|
||||
data: $form.serialize()
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
@ -0,0 +1,31 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-edit-sub-discipline-modal', function(){
|
||||
var $modal = $('.modal.admin-edit-sub-discipline-modal');
|
||||
var $form = $modal.find('form.admin-edit-sub-discipline-form');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
'sub_discipline[name]': {
|
||||
required: true,
|
||||
maxlength: 20
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
var url = $form.attr('action');
|
||||
|
||||
if ($form.valid()) {
|
||||
$.ajax({
|
||||
method: 'PATCH',
|
||||
dataType: 'script',
|
||||
url: url,
|
||||
data: $form.serialize()
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
@ -0,0 +1,31 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-edit-tag-discipline-modal', function(){
|
||||
var $modal = $('.modal.admin-edit-tag-discipline-modal');
|
||||
var $form = $modal.find('form.admin-edit-tag-discipline-form');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
'tag_discipline[name]': {
|
||||
required: true,
|
||||
maxlength: 20
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
var url = $form.attr('action');
|
||||
|
||||
if ($form.valid()) {
|
||||
$.ajax({
|
||||
method: 'PATCH',
|
||||
dataType: 'script',
|
||||
url: url,
|
||||
data: $form.serialize()
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
@ -0,0 +1,65 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-sub-disciplines-index-page').length > 0) {
|
||||
|
||||
// ============== 新建 ===============
|
||||
var $modal = $('.modal.admin-create-sub-discipline-modal');
|
||||
var $form = $modal.find('form.admin-create-sub-discipline-form');
|
||||
var $nameInput = $form.find('input[name="name"]');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
name: {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// modal ready fire
|
||||
$modal.on('show.bs.modal', function () {
|
||||
$nameInput.val('');
|
||||
});
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
|
||||
if ($form.valid()) {
|
||||
var url = $form.data('url');
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: url,
|
||||
data: $form.serialize(),
|
||||
success: function(){
|
||||
$.notify({ message: '创建成功' });
|
||||
$modal.modal('hide');
|
||||
|
||||
setTimeout(function(){
|
||||
window.location.reload();
|
||||
}, 500);
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$form.find('.error').html(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(".sub-discipline-list-container").on("change", '.sub-discipline-source-form', function () {
|
||||
var s_id = $(this).attr("data-id");
|
||||
var s_value = $(this).val();
|
||||
var s_name = $(this).attr("name");
|
||||
var json = {};
|
||||
json[s_name] = s_value;
|
||||
$.ajax({
|
||||
url: "/admins/sub_disciplines/" + s_id,
|
||||
type: "PUT",
|
||||
dataType:'script',
|
||||
data: json
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,65 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-tag-disciplines-index-page').length > 0) {
|
||||
|
||||
// ============== 新建 ===============
|
||||
var $modal = $('.modal.admin-create-tag-discipline-modal');
|
||||
var $form = $modal.find('form.admin-create-tag-discipline-form');
|
||||
var $nameInput = $form.find('input[name="name"]');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
name: {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// modal ready fire
|
||||
$modal.on('show.bs.modal', function () {
|
||||
$nameInput.val('');
|
||||
});
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
|
||||
if ($form.valid()) {
|
||||
var url = $form.data('url');
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: url,
|
||||
data: $form.serialize(),
|
||||
success: function(){
|
||||
$.notify({ message: '创建成功' });
|
||||
$modal.modal('hide');
|
||||
|
||||
setTimeout(function(){
|
||||
window.location.reload();
|
||||
}, 500);
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$form.find('.error').html(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(".tag-discipline-list-container").on("change", '.tag-discipline-source-form', function () {
|
||||
var s_id = $(this).attr("data-id");
|
||||
var s_value = $(this).val();
|
||||
var s_name = $(this).attr("name");
|
||||
var json = {};
|
||||
json[s_name] = s_value;
|
||||
$.ajax({
|
||||
url: "/admins/tag_disciplines/" + s_id,
|
||||
type: "PUT",
|
||||
dataType:'script',
|
||||
data: json
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,49 @@
|
||||
class Admins::DisciplinesController < Admins::BaseController
|
||||
|
||||
def index
|
||||
@disciplines = Discipline.all
|
||||
end
|
||||
|
||||
def create
|
||||
name = params[:name].to_s.strip
|
||||
return render_error('名称重复') if Discipline.where(name: name).exists?
|
||||
Discipline.create!(name: name)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def edit
|
||||
@discipline = current_discipline
|
||||
end
|
||||
|
||||
def update
|
||||
if params[:discipline] && params[:discipline][:name].present?
|
||||
name = params[:discipline][:name].to_s.strip
|
||||
current_discipline.update_attributes!(name: name)
|
||||
else
|
||||
ActiveRecord::Base.transaction do
|
||||
current_discipline.update_attributes!(setting_params)
|
||||
current_discipline.sub_disciplines.each do |sub|
|
||||
sub.tag_disciplines.each do |tag|
|
||||
tag.update_attributes!(setting_params)
|
||||
end
|
||||
sub.update_attributes!(setting_params)
|
||||
end
|
||||
end
|
||||
end
|
||||
@disciplines = Discipline.all
|
||||
end
|
||||
|
||||
def destroy
|
||||
@discipline_id = params[:id]
|
||||
current_discipline.destroy!
|
||||
end
|
||||
|
||||
private
|
||||
def current_discipline
|
||||
@_current_discipline = Discipline.find params[:id]
|
||||
end
|
||||
|
||||
def setting_params
|
||||
params.permit(:shixun, :subject, :question)
|
||||
end
|
||||
end
|
@ -0,0 +1,52 @@
|
||||
class Admins::SubDisciplinesController < Admins::BaseController
|
||||
|
||||
def index
|
||||
@discipline = current_discipline
|
||||
@sub_disciplines = current_discipline.sub_disciplines
|
||||
end
|
||||
|
||||
def create
|
||||
name = params[:name].to_s.strip
|
||||
return render_error('名称重复') if current_discipline.sub_disciplines.where(name: name).exists?
|
||||
SubDiscipline.create!(name: name, discipline_id: current_discipline.id)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def edit
|
||||
@sub_discipline = current_sub_discipline
|
||||
end
|
||||
|
||||
def update
|
||||
if params[:sub_discipline] && params[:sub_discipline][:name].present?
|
||||
name = params[:sub_discipline][:name].to_s.strip
|
||||
current_sub_discipline.update_attributes!(name: name)
|
||||
else
|
||||
ActiveRecord::Base.transaction do
|
||||
current_sub_discipline.update_attributes!(setting_params)
|
||||
current_sub_discipline.tag_disciplines.each do |tag|
|
||||
tag.update_attributes!(setting_params)
|
||||
end
|
||||
end
|
||||
end
|
||||
@sub_disciplines = current_sub_discipline.discipline&.sub_disciplines
|
||||
end
|
||||
|
||||
def destroy
|
||||
@sub_discipline_id = params[:id]
|
||||
current_sub_discipline.destroy!
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_sub_discipline
|
||||
@_current_sub_discipline = SubDiscipline.find params[:id]
|
||||
end
|
||||
|
||||
def current_discipline
|
||||
@_current_discipline = Discipline.find params[:discipline_id]
|
||||
end
|
||||
|
||||
def setting_params
|
||||
params.permit(:shixun, :subject, :question)
|
||||
end
|
||||
end
|
@ -0,0 +1,47 @@
|
||||
class Admins::TagDisciplinesController < Admins::BaseController
|
||||
|
||||
def index
|
||||
@sub_discipline = current_sub_discipline
|
||||
@tag_disciplines = current_sub_discipline.tag_disciplines
|
||||
end
|
||||
|
||||
def create
|
||||
name = params[:name].to_s.strip
|
||||
return render_error('名称重复') if current_sub_discipline.tag_disciplines.where(name: name).exists?
|
||||
TagDiscipline.create!(name: name, sub_discipline_id: current_sub_discipline.id)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def edit
|
||||
@tag_discipline = current_tag_discipline
|
||||
end
|
||||
|
||||
def update
|
||||
if params[:tag_discipline] && params[:tag_discipline][:name].present?
|
||||
name = params[:tag_discipline][:name].to_s.strip
|
||||
current_tag_discipline.update_attributes!(name: name)
|
||||
else
|
||||
current_tag_discipline.update_attributes!(setting_params)
|
||||
end
|
||||
@tag_disciplines = current_tag_discipline.sub_discipline&.tag_disciplines
|
||||
end
|
||||
|
||||
def destroy
|
||||
@tag_discipline_id = params[:id]
|
||||
current_tag_discipline.destroy!
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_sub_discipline
|
||||
@_current_sub_discipline = SubDiscipline.find params[:sub_discipline_id]
|
||||
end
|
||||
|
||||
def current_tag_discipline
|
||||
@_current_tag_discipline = TagDiscipline.find params[:id]
|
||||
end
|
||||
|
||||
def setting_params
|
||||
params.permit(:shixun, :subject, :question)
|
||||
end
|
||||
end
|
@ -0,0 +1,6 @@
|
||||
class DisciplinesController < ApplicationController
|
||||
|
||||
def index
|
||||
|
||||
end
|
||||
end
|
@ -1,14 +1,58 @@
|
||||
class LibrariesController < ApplicationController
|
||||
class ItemBanksController < ApplicationController
|
||||
include PaginateHelper
|
||||
before_action :require_login
|
||||
before_action :find_item, except: [:index, :create]
|
||||
before_action :edit_auth, only: [:update, :destroy, :set_public]
|
||||
|
||||
def index
|
||||
default_sort('updated_at', 'desc')
|
||||
|
||||
@items = ItemBankQuery.call(params)
|
||||
@items = paginate courses.includes(:school, :students, :attachments, :homework_commons, teacher: :user_extension)
|
||||
items = ItemBankQuery.call(params)
|
||||
@items_count = items.size
|
||||
@items = paginate items.includes(:item_analysis, :user)
|
||||
@item_basket_ids = current_user.item_baskets.pluck(:item_bank_id)
|
||||
end
|
||||
|
||||
def create
|
||||
item = ItemBank.new(user: current_user)
|
||||
ItemBanks::SaveItemService.call(item, form_params)
|
||||
render_ok
|
||||
rescue ApplicationService::Error => ex
|
||||
render_error(ex.message)
|
||||
end
|
||||
|
||||
def edit
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
ItemBanks::SaveItemService.call(@item, form_params)
|
||||
render_ok
|
||||
rescue ApplicationService::Error => ex
|
||||
render_error(ex.message)
|
||||
end
|
||||
|
||||
def destroy
|
||||
@item.destroy!
|
||||
render_ok
|
||||
end
|
||||
|
||||
def set_public
|
||||
tip_exception(-1, "该试题已公开") if @item.public?
|
||||
@item.update_attributes!(public: 1)
|
||||
render_ok
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_item
|
||||
@item = ItemBank.find_by!(id: params[:id])
|
||||
end
|
||||
|
||||
def edit_auth
|
||||
current_user.admin_or_business? || @item.user == current_user
|
||||
end
|
||||
|
||||
def form_params
|
||||
params.permit(:discipline_id, :sub_discipline_id, :item_type, :difficulty, :name, :analysis, tag_discipline_id: [], choices: %i[choice_text is_answer])
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,49 @@
|
||||
class ItemBasketsController < ApplicationController
|
||||
before_action :require_login
|
||||
|
||||
def index
|
||||
@item_baskets = current_user.item_baskets
|
||||
@single_questions = @item_baskets.where(item_type: "SINGLE")
|
||||
@multiple_questions = @item_baskets.where(item_type: "MULTIPLE")
|
||||
@judgement_questions = @item_baskets.where(item_type: "JUDGMENT")
|
||||
@program_questions = @item_baskets.where(item_type: "PROGRAM")
|
||||
end
|
||||
|
||||
def basket_list
|
||||
@single_questions_count = current_user.item_baskets.where(item_type: "SINGLE").count
|
||||
@multiple_questions_count = current_user.item_baskets.where(item_type: "MULTIPLE").count
|
||||
@judgement_questions_count = current_user.item_baskets.where(item_type: "JUDGMENT").count
|
||||
@completion_questions_count = current_user.item_baskets.where(item_type: "COMPLETION").count
|
||||
@subjective_questions_count = current_user.item_baskets.where(item_type: "SUBJECTIVE").count
|
||||
@practical_questions_count = current_user.item_baskets.where(item_type: "PRACTICAL").count
|
||||
@program_questions_count = current_user.item_baskets.where(item_type: "PROGRAM").count
|
||||
end
|
||||
|
||||
def create
|
||||
ItemBaskets::SaveItemBasketService.call(current_user, create_params)
|
||||
render_ok
|
||||
rescue ApplicationService::Error => ex
|
||||
render_error(ex.message)
|
||||
end
|
||||
|
||||
def destroy
|
||||
item = current_user.item_baskets.find_by!(item_bank_id: params[:id])
|
||||
ActiveRecord::Base.transaction do
|
||||
current_user.item_baskets.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
|
||||
baskets = ItemBasket.where(item_type: params[:item_type])
|
||||
baskets.destroy_all
|
||||
render_ok
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def create_params
|
||||
params.permit(item_ids: [])
|
||||
end
|
||||
end
|
@ -0,0 +1,33 @@
|
||||
class ItemBanks::SaveItemForm
|
||||
include ActiveModel::Model
|
||||
|
||||
attr_accessor :discipline_id, :sub_discipline_id, :item_type, :difficulty, :name, :analysis, :tag_discipline_id, :choices
|
||||
|
||||
validates :discipline_id, presence: true
|
||||
validates :sub_discipline_id, presence: true
|
||||
validates :item_type, presence: true, inclusion: {in: %W(SINGLE MULTIPLE JUDGMENT COMPLETION SUBJECTIVE PRACTICAL PROGRAM)}
|
||||
validates :difficulty, presence: true, inclusion: {in: 1..3}, numericality: { only_integer: true }
|
||||
validates :name, presence: true, length: { maximum: 1000 }
|
||||
validates :analysis, length: { maximum: 1000 }
|
||||
|
||||
def validate!
|
||||
super
|
||||
return unless errors.blank?
|
||||
choices.each { |item| SubForm.new(item).validate! } if %W(SINGLE MULTIPLE JUDGMENT).include?(item_type)
|
||||
return unless errors.blank?
|
||||
if [0, 2].include?(item_type) && choices.pluck(:is_answer).select{|item| item == 1}.length > 1
|
||||
raise("正确答案只能有一个")
|
||||
elsif item_type == 1 && choices.pluck(:is_answer).select{|item| item == 1}.length <= 1
|
||||
raise("多选题至少有两个正确答案")
|
||||
end
|
||||
end
|
||||
|
||||
class SubForm
|
||||
include ActiveModel::Model
|
||||
|
||||
attr_accessor :choice_text, :is_answer
|
||||
|
||||
validates :choice_text, presence: true, length: { maximum: 100 }
|
||||
validates :is_answer, presence: true, inclusion: {in: 0..1}, numericality: { only_integer: true }
|
||||
end
|
||||
end
|
@ -0,0 +1,7 @@
|
||||
class Discipline < ApplicationRecord
|
||||
has_many :sub_disciplines, dependent: :destroy
|
||||
|
||||
has_many :shixun_sub_disciplines, -> { where("shixun = 1") }, class_name: "SubDiscipline"
|
||||
has_many :subject_sub_disciplines, -> { where("subject = 1") }, class_name: "SubDiscipline"
|
||||
has_many :question_sub_disciplines, -> { where("question = 1") }, class_name: "SubDiscipline"
|
||||
end
|
@ -1,11 +1,18 @@
|
||||
class ItemBank < ApplicationRecord
|
||||
# difficulty: 1 简单 2 适中 3 困难
|
||||
# item_type: 0 单选 1 多选 2 判断 3 填空 4 简答 5 实训 6 编程
|
||||
enum item_type: { SINGLE: 0, MULTIPLE: 1, JUDGMENT: 2, COMPLETION: 3, SUBJECTIVE: 4, PRACTICAL: 5, PROGRAM: 6 }
|
||||
# item_type: 0 单选 1 多选 2 判断 3 填空 4 简答 5 实训 6 编程
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :sub_discipline
|
||||
|
||||
has_one :item_analysis, dependent: :destroy
|
||||
has_many :item_choices, dependent: :destroy
|
||||
has_many :item_baskets, dependent: :destroy
|
||||
has_many :tag_discipline_containers, as: :container, dependent: :destroy
|
||||
has_many :tag_disciplines, through: :tag_discipline_containers
|
||||
|
||||
def analysis
|
||||
item_analysis&.analysis
|
||||
end
|
||||
end
|
||||
|
@ -1,4 +1,14 @@
|
||||
class ItemBasket < ApplicationRecord
|
||||
enum item_type: { SINGLE: 0, MULTIPLE: 1, JUDGMENT: 2, COMPLETION: 3, SUBJECTIVE: 4, PRACTICAL: 5, PROGRAM: 6 }
|
||||
|
||||
belongs_to :item_bank
|
||||
belongs_to :user
|
||||
|
||||
def all_score
|
||||
User.current.item_baskets.map(&:score).sum
|
||||
end
|
||||
|
||||
def question_count
|
||||
User.current.item_baskets.size
|
||||
end
|
||||
end
|
||||
|
@ -0,0 +1,8 @@
|
||||
class SubDiscipline < ApplicationRecord
|
||||
belongs_to :discipline
|
||||
has_many :tag_disciplines, dependent: :destroy
|
||||
|
||||
has_many :shixun_tag_disciplines, -> { where("shixun = 1") }, class_name: "TagDiscipline"
|
||||
has_many :subject_tag_disciplines, -> { where("subject = 1") }, class_name: "TagDiscipline"
|
||||
has_many :question_tag_disciplines, -> { where("question = 1") }, class_name: "TagDiscipline"
|
||||
end
|
@ -0,0 +1,7 @@
|
||||
class TagDiscipline < ApplicationRecord
|
||||
belongs_to :sub_discipline
|
||||
|
||||
def discipline
|
||||
sub_discipline&.discipline
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
class TagDisciplineContainer < ApplicationRecord
|
||||
belongs_to :tag_discipline
|
||||
|
||||
belongs_to :container, polymorphic: true, optional: true
|
||||
end
|
@ -0,0 +1,33 @@
|
||||
class ItemBankQuery < ApplicationQuery
|
||||
include CustomSortable
|
||||
attr_reader :params
|
||||
|
||||
sort_columns :updated_at, default_by: :updated_at, default_direction: :desc, default_table: 'item_banks'
|
||||
|
||||
def initialize(params)
|
||||
@params = params
|
||||
end
|
||||
|
||||
def call
|
||||
if params[:public].to_i == 1
|
||||
items = ItemBank.where(public: 1)
|
||||
elsif params[:public].to_i == 0
|
||||
items = ItemBank.where(user_id: User.current.id)
|
||||
end
|
||||
|
||||
if params[:tag_discipline_id].present?
|
||||
items = items.joins(:tag_discipline_containers).where(tag_discipline_containers: {tag_discipline_id: params[:tag_discipline_id]})
|
||||
elsif params[:sub_discipline_id].present?
|
||||
items = items.where(sub_discipline_id: params[:sub_discipline_id])
|
||||
elsif params[:discipline_id].present?
|
||||
items = items.joins(:sub_discipline).where(sub_disciplines: {discipline_id: params[:discipline_id]})
|
||||
end
|
||||
|
||||
items = items.where(item_type: params[:item_type].to_i) if params[:item_type].present?
|
||||
items = items.where(difficulty: params[:difficulty].to_i) if params[:difficulty].present?
|
||||
|
||||
items = items.where("name like ?", "%#{params[:keyword].strip}%") if params[:keyword].present?
|
||||
|
||||
custom_sort(items, params[:sort_by], params[:sort_direction])
|
||||
end
|
||||
end
|
@ -0,0 +1,58 @@
|
||||
class ItemBanks::SaveItemService < ApplicationService
|
||||
attr_reader :item, :params
|
||||
|
||||
def initialize(item, params)
|
||||
@item = item
|
||||
@params = params
|
||||
end
|
||||
|
||||
def call
|
||||
new_record = item.new_record?
|
||||
raise("不能更改题型") if !new_record && item.item_type != params[:item_type]
|
||||
ItemBanks::SaveItemForm.new(params).validate!
|
||||
|
||||
ActiveRecord::Base.transaction do
|
||||
item.item_type = params[:item_type] if new_record
|
||||
item.difficulty = params[:difficulty]
|
||||
item.sub_discipline_id = params[:sub_discipline_id]
|
||||
item.name = params[:name].strip
|
||||
item.save!
|
||||
|
||||
analysis = item.item_analysis || ItemAnalysis.new(item_bank_id: item.id)
|
||||
analysis.analysis = params[:analysis].blank? ? nil : params[:analysis].strip
|
||||
analysis.save
|
||||
|
||||
# 知识点的创建
|
||||
new_tag_discipline_ids = params[:tag_discipline_id]
|
||||
old_tag_discipline_ids = item.tag_discipline_containers.pluck(:tag_discipline_id)
|
||||
delete_tag_discipline_ids = old_tag_discipline_ids - new_tag_discipline_ids
|
||||
create_tag_discipline_ids = new_tag_discipline_ids - old_tag_discipline_ids
|
||||
item.tag_discipline_containers.where(tag_discipline_id: delete_tag_discipline_ids).destroy_all
|
||||
create_tag_discipline_ids.each do |tag_id|
|
||||
item.tag_discipline_containers << TagDisciplineContainer.new(tag_discipline_id: tag_id)
|
||||
end
|
||||
|
||||
# 选项的创建
|
||||
if %W(SINGLE MULTIPLE JUDGMENT).include?(item.item_type)
|
||||
old_choices = item.item_choices
|
||||
new_choices = params[:choices]
|
||||
|
||||
new_choices.each_with_index do |choice, index|
|
||||
choice_item = old_choices[index] || ItemChoice.new(item_bank_id: item.id)
|
||||
choice_item.choice_text = choice[:choice_text]
|
||||
choice_item.is_answer = choice[:is_answer]
|
||||
choice_item.save!
|
||||
end
|
||||
|
||||
if old_choices.length > new_choices.length
|
||||
old_choices[new_choices.length..(old_choices.length-1)].each do |old_choice|
|
||||
old_choice.destroy
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
item
|
||||
end
|
||||
end
|
@ -0,0 +1,47 @@
|
||||
class ItemBaskets::SaveItemBasketService < ApplicationService
|
||||
attr_reader :user, :params
|
||||
|
||||
def initialize(user, params)
|
||||
@user = user
|
||||
@params = params
|
||||
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] - user.item_baskets.pluck(:item_bank_id)
|
||||
items.where(id: item_ids).each do |item|
|
||||
new_item = ItemBasket.new(user_id: user.id, item_bank_id: item.id, item_type: item.item_type)
|
||||
new_item.score = item_score item.item_type
|
||||
new_item.position = item_position item.item_type
|
||||
new_item.save!
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def item_score item_type
|
||||
if user.item_baskets.where(item_type: item_type).last.present?
|
||||
score = user.item_baskets.where(item_type: item_type).last.score
|
||||
else
|
||||
score =
|
||||
case item_type
|
||||
when 0, 1, 2
|
||||
5
|
||||
when 6
|
||||
10
|
||||
else
|
||||
5
|
||||
end
|
||||
end
|
||||
score
|
||||
end
|
||||
|
||||
def item_position item_type
|
||||
user.item_baskets.where(item_type: item_type).last&.position.to_i + 1
|
||||
end
|
||||
end
|
@ -0,0 +1,2 @@
|
||||
$.notify({ message: '删除成功' });
|
||||
$(".discipline-item-<%= @discipline_id %>").remove();
|
@ -0,0 +1,2 @@
|
||||
$('.admin-modal-container').html("<%= j( render partial: 'admins/disciplines/shared/edit_discipline_modal', locals: { discipline: @discipline } ) %>");
|
||||
$('.modal.admin-edit-discipline-modal').modal('show');
|
@ -0,0 +1,13 @@
|
||||
<% define_admin_breadcrumbs do %>
|
||||
<% add_admin_breadcrumb('课程方向', admins_disciplines_path) %>
|
||||
<% end %>
|
||||
|
||||
<div class="box search-form-container discipline-list-form">
|
||||
<%= javascript_void_link '新增', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-create-discipline-modal' } %>
|
||||
</div>
|
||||
|
||||
<div class="box admin-list-container discipline-list-container">
|
||||
<%= render(partial: 'admins/disciplines/shared/list') %>
|
||||
</div>
|
||||
|
||||
<%= render 'admins/disciplines/shared/create_discipline_modal' %>
|
@ -0,0 +1,28 @@
|
||||
<div class="modal fade admin-create-discipline-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">
|
||||
<form class="admin-create-discipline-form" data-url="<%= admins_disciplines_path %>">
|
||||
<div class="form-group d-flex">
|
||||
<label for="new_mirror_id" class="col-form-label">名称:</label>
|
||||
<div class="w-75 d-flex flex-column">
|
||||
<%= text_field_tag(:name, nil, class: 'form-control', placeholder: '请输入名称') %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="error text-danger"></div>
|
||||
</form>
|
||||
</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,23 @@
|
||||
<div class="modal fade admin-edit-discipline-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">
|
||||
<%= simple_form_for([:admins, discipline], html: { class: 'admin-edit-discipline-form' }, defaults: { wrapper_html: { class: 'offset-md-1 col-md-10' } }) do |f| %>
|
||||
<%= f.input :name, as: :string, label: '名称' %>
|
||||
|
||||
<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,33 @@
|
||||
<table class="table table-hover text-center discipline-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="6%">序号</th>
|
||||
<th width="54%" class="text-left">课程方向</th>
|
||||
<th width="8%">实践课程</th>
|
||||
<th width="8%">实训</th>
|
||||
<th width="8%">题库</th>
|
||||
<th width="16%">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @disciplines.present? %>
|
||||
<% @disciplines.each_with_index do |discipline, index| %>
|
||||
<tr class="discipline-item discipline-item-<%= discipline.id %>">
|
||||
<td><%= index + 1 %></td>
|
||||
<td class="text-left">
|
||||
<span><%= link_to discipline.name, admins_sub_disciplines_path(discipline_id: discipline), :title => discipline.name %></span>
|
||||
</td>
|
||||
<td><%= check_box_tag :subject,!discipline.subject,discipline.subject,remote:true,data:{id:discipline.id},class:"discipline-source-form" %></td>
|
||||
<td><%= check_box_tag :shixun,!discipline.shixun,discipline.shixun,remote:true,data:{id:discipline.id},class:"discipline-source-form" %></td>
|
||||
<td><%= check_box_tag :question,!discipline.question,discipline.question,remote:true,data:{id:discipline.id},class:"discipline-source-form" %></td>
|
||||
<td>
|
||||
<%= link_to '编辑', edit_admins_discipline_path(discipline), remote: true, class: 'action' %>
|
||||
<%= delete_link '删除', admins_discipline_path(discipline, element: ".discipline-item-#{discipline.id}"), class: 'delete-discipline-action' %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
@ -0,0 +1,2 @@
|
||||
$('.modal.admin-edit-discipline-modal').modal("hide");
|
||||
$(".discipline-list-container").html("<%= j(render :partial => 'admins/disciplines/shared/list') %>");
|
@ -0,0 +1,2 @@
|
||||
$.notify({ message: '删除成功' });
|
||||
$(".sub-discipline-item-<%= @sub_discipline_id %>").remove();
|
@ -0,0 +1,2 @@
|
||||
$('.admin-modal-container').html("<%= j( render partial: 'admins/sub_disciplines/shared/edit_sub_discipline_modal', locals: { sub_discipline: @sub_discipline } ) %>");
|
||||
$('.modal.admin-edit-sub-discipline-modal').modal('show');
|
@ -0,0 +1,14 @@
|
||||
<% define_admin_breadcrumbs do %>
|
||||
<% add_admin_breadcrumb('课程方向', admins_disciplines_path) %>
|
||||
<% add_admin_breadcrumb(@discipline.name) %>
|
||||
<% end %>
|
||||
|
||||
<div class="box search-form-container sub-discipline-list-form">
|
||||
<%= javascript_void_link '新增', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-create-sub-discipline-modal' } %>
|
||||
</div>
|
||||
|
||||
<div class="box admin-list-container sub-discipline-list-container">
|
||||
<%= render(partial: 'admins/sub_disciplines/shared/list') %>
|
||||
</div>
|
||||
|
||||
<%= render 'admins/sub_disciplines/shared/create_sub_discipline_modal' %>
|
@ -0,0 +1,28 @@
|
||||
<div class="modal fade admin-create-sub-discipline-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">
|
||||
<form class="admin-create-sub-discipline-form" data-url="<%= admins_sub_disciplines_path(discipline_id: @discipline) %>">
|
||||
<div class="form-group d-flex">
|
||||
<label for="new_mirror_id" class="col-form-label">名称:</label>
|
||||
<div class="w-75 d-flex flex-column">
|
||||
<%= text_field_tag(:name, nil, class: 'form-control', placeholder: '请输入名称') %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="error text-danger"></div>
|
||||
</form>
|
||||
</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,23 @@
|
||||
<div class="modal fade admin-edit-sub-discipline-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">
|
||||
<%= simple_form_for([:admins, sub_discipline], html: { class: 'admin-edit-sub-discipline-form' }, defaults: { wrapper_html: { class: 'offset-md-1 col-md-10' } }) do |f| %>
|
||||
<%= f.input :name, as: :string, label: '名称' %>
|
||||
|
||||
<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,33 @@
|
||||
<table class="table table-hover text-center sub-discipline-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="6%">序号</th>
|
||||
<th width="54%" class="text-left">课程</th>
|
||||
<th width="8%">实践课程</th>
|
||||
<th width="8%">实训</th>
|
||||
<th width="8%">题库</th>
|
||||
<th width="16%">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @sub_disciplines.present? %>
|
||||
<% @sub_disciplines.each_with_index do |sub, index| %>
|
||||
<tr class="sub-discipline-item sub-discipline-item-<%= sub.id %>">
|
||||
<td><%= index + 1 %></td>
|
||||
<td class="text-left">
|
||||
<span><%= link_to sub.name, admins_tag_disciplines_path(sub_discipline_id: sub), :title => sub.name %></span>
|
||||
</td>
|
||||
<td><%= check_box_tag :subject,!sub.subject,sub.subject,disabled:!sub.discipline&.subject,remote:true,data:{id:sub.id},class:"sub-discipline-source-form" %></td>
|
||||
<td><%= check_box_tag :shixun,!sub.shixun,sub.shixun,disabled:!sub.discipline&.shixun,remote:true,data:{id:sub.id},class:"sub-discipline-source-form" %></td>
|
||||
<td><%= check_box_tag :question,!sub.question,sub.question,disabled:!sub.discipline&.question,remote:true,data:{id:sub.id},class:"sub-discipline-source-form" %></td>
|
||||
<td>
|
||||
<%= link_to '编辑', edit_admins_sub_discipline_path(sub), remote: true, class: 'action' %>
|
||||
<%= delete_link '删除', admins_sub_discipline_path(sub, element: ".sub-discipline-item-#{sub.id}"), class: 'delete-sub-discipline-action' %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
@ -0,0 +1,2 @@
|
||||
$('.modal.admin-edit-sub-discipline-modal').modal("hide");
|
||||
$(".sub-discipline-list-container").html("<%= j(render :partial => 'admins/sub_disciplines/shared/list') %>");
|
@ -0,0 +1,2 @@
|
||||
$.notify({ message: '删除成功' });
|
||||
$(".tag-discipline-item-<%= @tag_discipline_id %>").remove();
|
@ -0,0 +1,2 @@
|
||||
$('.admin-modal-container').html("<%= j( render partial: 'admins/tag_disciplines/shared/edit_tag_discipline_modal', locals: { tag_discipline: @tag_discipline } ) %>");
|
||||
$('.modal.admin-edit-tag-discipline-modal').modal('show');
|
@ -0,0 +1,15 @@
|
||||
<% define_admin_breadcrumbs do %>
|
||||
<% add_admin_breadcrumb('课程方向', admins_disciplines_path) %>
|
||||
<% add_admin_breadcrumb(@sub_discipline&.discipline&.name, admins_sub_disciplines_path(discipline_id: @sub_discipline&.discipline_id)) %>
|
||||
<% add_admin_breadcrumb(@sub_discipline.name) %>
|
||||
<% end %>
|
||||
|
||||
<div class="box search-form-container tag-discipline-list-form">
|
||||
<%= javascript_void_link '新增', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-create-tag-discipline-modal' } %>
|
||||
</div>
|
||||
|
||||
<div class="box admin-list-container tag-discipline-list-container">
|
||||
<%= render(partial: 'admins/tag_disciplines/shared/list') %>
|
||||
</div>
|
||||
|
||||
<%= render 'admins/tag_disciplines/shared/create_tag_discipline_modal' %>
|
@ -0,0 +1,28 @@
|
||||
<div class="modal fade admin-create-tag-discipline-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">
|
||||
<form class="admin-create-tag-discipline-form" data-url="<%= admins_tag_disciplines_path(sub_discipline_id: @sub_discipline) %>">
|
||||
<div class="form-group d-flex">
|
||||
<label for="new_mirror_id" class="col-form-label">名称:</label>
|
||||
<div class="w-75 d-flex flex-column">
|
||||
<%= text_field_tag(:name, nil, class: 'form-control', placeholder: '请输入名称') %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="error text-danger"></div>
|
||||
</form>
|
||||
</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,23 @@
|
||||
<div class="modal fade admin-edit-tag-discipline-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">
|
||||
<%= simple_form_for([:admins, tag_discipline], html: { class: 'admin-edit-tag-discipline-form' }, defaults: { wrapper_html: { class: 'offset-md-1 col-md-10' } }) do |f| %>
|
||||
<%= f.input :name, as: :string, label: '名称' %>
|
||||
|
||||
<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,40 @@
|
||||
<table class="table table-hover text-center tag-discipline-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="6%">序号</th>
|
||||
<th width="54%" class="text-left">知识点</th>
|
||||
<th width="8%">实践课程</th>
|
||||
<th width="8%">实训</th>
|
||||
<th width="8%">题库</th>
|
||||
<th width="16%">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @tag_disciplines.present? %>
|
||||
<% @tag_disciplines.each_with_index do |tag, index| %>
|
||||
<tr class="tag-discipline-item tag-discipline-item-<%= tag.id %>">
|
||||
<td><%= index + 1 %></td>
|
||||
<td class="text-left"><%= tag.name %></td>
|
||||
<td>
|
||||
<% disabled = !(tag.sub_discipline&.subject && tag.discipline&.subject) %>
|
||||
<%= check_box_tag :subject,!tag.subject,tag.subject,disabled:disabled,remote:true,data:{id:tag.id},class:"tag-discipline-source-form" %>
|
||||
</td>
|
||||
<td>
|
||||
<% disabled = !(tag.sub_discipline&.shixun && tag.discipline&.shixun) %>
|
||||
<%= check_box_tag :shixun,!tag.shixun,tag.shixun,disabled:disabled,remote:true,data:{id:tag.id},class:"tag-discipline-source-form" %>
|
||||
</td>
|
||||
<td>
|
||||
<% disabled = !(tag.sub_discipline&.question && tag.discipline&.question) %>
|
||||
<%= check_box_tag :question,!tag.question,tag.question,disabled:disabled,remote:true,data:{id:tag.id},class:"tag-discipline-source-form" %>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to '编辑', edit_admins_tag_discipline_path(tag), remote: true, class: 'action' %>
|
||||
<%= delete_link '删除', admins_tag_discipline_path(tag, element: ".tag-discipline-item-#{tag.id}"), class: 'delete-tag-discipline-action' %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
@ -0,0 +1,2 @@
|
||||
$('.modal.admin-edit-tag-discipline-modal').modal("hide");
|
||||
$(".tag-discipline-list-container").html("<%= j(render :partial => 'admins/tag_disciplines/shared/list') %>");
|
@ -0,0 +1,35 @@
|
||||
case params[:source]
|
||||
when 'subject'
|
||||
disciplines = Discipline.where(subject: 1).includes(subject_sub_disciplines: :subject_tag_disciplines)
|
||||
json.disciplines disciplines do |dis|
|
||||
json.(dis, :id, :name)
|
||||
json.sub_disciplines dis.subject_sub_disciplines do |sub|
|
||||
json.(sub, :id, :name)
|
||||
json.tag_disciplines sub.subject_tag_disciplines do |tag|
|
||||
json.(tag, :id, :name)
|
||||
end
|
||||
end
|
||||
end
|
||||
when 'shixun'
|
||||
disciplines = Discipline.where(shixun: 1).includes(shixun_sub_disciplines: :shixun_tag_disciplines)
|
||||
json.disciplines disciplines do |dis|
|
||||
json.(dis, :id, :name)
|
||||
json.sub_disciplines dis.shixun_sub_disciplines do |sub|
|
||||
json.(sub, :id, :name)
|
||||
json.tag_disciplines sub.shixun_tag_disciplines do |tag|
|
||||
json.(tag, :id, :name)
|
||||
end
|
||||
end
|
||||
end
|
||||
when 'question'
|
||||
disciplines = Discipline.where(question: 1).includes(question_sub_disciplines: :question_tag_disciplines)
|
||||
json.disciplines disciplines do |dis|
|
||||
json.(dis, :id, :name)
|
||||
json.sub_disciplines dis.question_sub_disciplines do |sub|
|
||||
json.(sub, :id, :name)
|
||||
json.tag_disciplines sub.question_tag_disciplines do |tag|
|
||||
json.(tag, :id, :name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,6 @@
|
||||
json.(item, :id, :name, :item_type, :difficulty, :public, :quotes)
|
||||
json.analysis item.analysis
|
||||
json.choices item.item_choices do |choice|
|
||||
json.choice_text choice.choice_text
|
||||
json.is_answer choice.is_answer
|
||||
end
|
@ -0,0 +1,15 @@
|
||||
json.discipline do
|
||||
json.(@item.sub_discipline&.discipline, :id, :name)
|
||||
end
|
||||
json.sub_discipline do
|
||||
json.(@item.sub_discipline, :id, :name)
|
||||
end
|
||||
json.tag_disciplines @item.tag_disciplines do |tag|
|
||||
json.(tag, :id, :name)
|
||||
end
|
||||
json.(@item, :id, :name, :item_type, :difficulty)
|
||||
json.analysis @item.analysis
|
||||
json.choices @item.item_choices do |choice|
|
||||
json.choice_text choice.choice_text
|
||||
json.is_answer choice.is_answer
|
||||
end
|
@ -0,0 +1,10 @@
|
||||
json.items @items.each do |item|
|
||||
json.partial! "item_banks/item", locals: {item: item}
|
||||
json.update_time item.updated_at&.strftime("%Y-%m-%d %H:%M")
|
||||
json.choosed @item_basket_ids.include?(item.id)
|
||||
json.author do
|
||||
json.login item.user&.login
|
||||
json.name item.user&.full_name
|
||||
end
|
||||
end
|
||||
json.items_count @items_count
|
@ -0,0 +1,7 @@
|
||||
json.single_questions_count @single_questions_count
|
||||
json.multiple_questions_count @multiple_questions_count
|
||||
json.judgement_questions_count @judgement_questions_count
|
||||
json.completion_questions_count @completion_questions_count
|
||||
json.subjective_questions_count @subjective_questions_count
|
||||
json.practical_questions_count @practical_questions_count
|
||||
json.program_questions_count @program_questions_count
|
@ -0,0 +1,38 @@
|
||||
json.single_questions do
|
||||
json.questions @single_questions.each do |question|
|
||||
json.(question, :id, :position, :score, :item_type)
|
||||
json.partial! "item_banks/item", locals: {item: question.item_bank}
|
||||
end
|
||||
json.questions_score @single_questions.map(&:score).sum
|
||||
json.questions_count @single_questions.size
|
||||
end
|
||||
|
||||
json.multiple_questions do
|
||||
json.questions @multiple_questions.each do |question|
|
||||
json.(question, :id, :position, :score, :item_type)
|
||||
json.partial! "item_banks/item", locals: {item: question.item_bank}
|
||||
end
|
||||
json.questions_score @multiple_questions.map(&:score).sum
|
||||
json.questions_count @multiple_questions.size
|
||||
end
|
||||
|
||||
json.judgement_questions do
|
||||
json.questions @judgement_questions.each do |question|
|
||||
json.(question, :id, :position, :score, :item_type)
|
||||
json.partial! "item_banks/item", locals: {item: question.item_bank}
|
||||
end
|
||||
json.questions_score @judgement_questions.map(&:score).sum
|
||||
json.questions_count @judgement_questions.size
|
||||
end
|
||||
|
||||
json.program_questions do
|
||||
json.questions @program_questions.each do |question|
|
||||
json.(question, :id, :position, :score, :item_type)
|
||||
json.partial! "item_banks/item", locals: {item: question.item_bank}
|
||||
end
|
||||
json.questions_score @program_questions.map(&:score).sum
|
||||
json.questions_count @program_questions.size
|
||||
end
|
||||
|
||||
json.all_score @item_baskets.map(&:score).sum
|
||||
json.all_questions_count @item_baskets.size
|
@ -0,0 +1,7 @@
|
||||
class MigrateItemBankColumn < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
remove_column :item_banks, :curriculum_id
|
||||
remove_column :item_banks, :curriculum_direction_id
|
||||
add_column :item_banks, :sub_repertoire_id, :integer, index: true
|
||||
end
|
||||
end
|
@ -0,0 +1,7 @@
|
||||
class ChangeItemBankPublicDefault < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
change_column_default :item_banks, :public, 0
|
||||
change_column_default :item_banks, :quotes, 0
|
||||
change_column_default :item_banks, :difficulty, 1
|
||||
end
|
||||
end
|
@ -0,0 +1,7 @@
|
||||
class AddPositionScoreToBasket < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :item_baskets, :position, :integer, default: 0
|
||||
add_column :item_baskets, :score, :float, default: 0
|
||||
add_column :item_baskets, :item_type, :integer, default: 0
|
||||
end
|
||||
end
|
@ -0,0 +1,12 @@
|
||||
class CreateDisciplines < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :disciplines do |t|
|
||||
t.string :name
|
||||
t.boolean :subject
|
||||
t.boolean :shixun
|
||||
t.boolean :question
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,13 @@
|
||||
class CreateSubDisciplines < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :sub_disciplines do |t|
|
||||
t.references :discipline, index: true
|
||||
t.string :name
|
||||
t.boolean :subject
|
||||
t.boolean :shixun
|
||||
t.boolean :question
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,13 @@
|
||||
class CreateTagDisciplines < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :tag_disciplines do |t|
|
||||
t.references :sub_discipline, index: true
|
||||
t.string :name
|
||||
t.boolean :subject
|
||||
t.boolean :shixun
|
||||
t.boolean :question
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,6 @@
|
||||
class MigrateItemBankTagColumn < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
remove_column :item_banks, :sub_repertoire_id
|
||||
add_column :item_banks, :sub_discipline_id, :integer, index: true
|
||||
end
|
||||
end
|
@ -0,0 +1,13 @@
|
||||
class CreateTagDisciplineContainers < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :tag_discipline_containers do |t|
|
||||
t.references :tag_discipline, index: true
|
||||
t.integer :container_id
|
||||
t.string :container_type
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :tag_discipline_containers, [:container_type, :container_id], name: "index_on_container"
|
||||
end
|
||||
end
|
@ -0,0 +1,15 @@
|
||||
class MigrateDisciplinesDefault < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
change_column_default :disciplines, :subject, from: nil, to: 1
|
||||
change_column_default :disciplines, :shixun, from: nil, to: 1
|
||||
change_column_default :disciplines, :question, from: nil, to: 1
|
||||
|
||||
change_column_default :sub_disciplines, :subject, from: nil, to: 1
|
||||
change_column_default :sub_disciplines, :shixun, from: nil, to: 1
|
||||
change_column_default :sub_disciplines, :question, from: nil, to: 1
|
||||
|
||||
change_column_default :tag_disciplines, :subject, from: nil, to: 1
|
||||
change_column_default :tag_disciplines, :shixun, from: nil, to: 1
|
||||
change_column_default :tag_disciplines, :question, from: nil, to: 1
|
||||
end
|
||||
end
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -0,0 +1,51 @@
|
||||
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 SingleEditor from './../component/SingleEditor';
|
||||
class Choicequestion extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
page:1,
|
||||
Knowpoints:[]
|
||||
}
|
||||
}
|
||||
//初始化
|
||||
componentDidMount(){
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
let {page}=this.state;
|
||||
const { getFieldDecorator } = this.props.form;
|
||||
|
||||
return (
|
||||
<div className=" clearfix educontent Contentquestionbankstyle w100s w1200fpx mt19" >
|
||||
<SingleEditor>
|
||||
|
||||
</SingleEditor>
|
||||
</div>
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
const Choicequestions = Form.create({ name: 'Choicequestions' })(Choicequestion);
|
||||
export default Choicequestions;
|
@ -0,0 +1,237 @@
|
||||
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,
|
||||
Tabs,
|
||||
Input,
|
||||
Popover
|
||||
} from "antd";
|
||||
import './../questioncss/questioncom.css';
|
||||
import NoneDatas from '../component/NoneDatas';
|
||||
import LoadingSpin from '../../../common/LoadingSpin';
|
||||
import Contentquestionbank from "./Contentquestionbank";
|
||||
import Listjihe from "./Listjihe";
|
||||
const { TabPane } = Tabs;
|
||||
const Search = Input.Search;
|
||||
class Contentpart extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
page:1,
|
||||
|
||||
}
|
||||
}
|
||||
//初始化
|
||||
componentDidMount(){
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
render() {
|
||||
let {page}=this.state;
|
||||
let {defaultActiveKey}=this.props;
|
||||
const content = (
|
||||
<div className="questiontypes" style={{
|
||||
width:'93px',
|
||||
height:'161px',
|
||||
}}>
|
||||
<p className="questiontype " onClick={()=>this.props.setitem_types("SINGLE")}>单选题</p>
|
||||
<p className="questiontypeheng" ></p>
|
||||
<p className="questiontype " onClick={()=>this.props.setitem_types("MULTIPLE")}>多选题</p>
|
||||
<p className="questiontypeheng"></p>
|
||||
<p className="questiontype " onClick={()=>this.props.setitem_types("JUDGMENT")}>判断题</p>
|
||||
<p className="questiontypeheng"></p>
|
||||
<p className="questiontype " onClick={()=>this.props.setitem_types("PROGRAM")}>编程题</p>
|
||||
<p className="questiontypeheng"></p>
|
||||
|
||||
</div>
|
||||
);
|
||||
const contents = (
|
||||
<div className="questiontypes" style={{
|
||||
width:'93px',
|
||||
height:'120px',
|
||||
}}>
|
||||
<p className="questiontype " onClick={()=>this.props.setdifficulty(1)}>简单</p>
|
||||
<p className="questiontypeheng"></p>
|
||||
<p className="questiontype " onClick={()=>this.props.setdifficulty(2)}>适中</p>
|
||||
<p className="questiontypeheng"></p>
|
||||
<p className="questiontype " onClick={()=>this.props.setdifficulty(3)}>困难</p>
|
||||
<p className="questiontypeheng"></p>
|
||||
</div>
|
||||
);
|
||||
|
||||
const buttonWidth = 70;
|
||||
//console.log("Contentpart");
|
||||
//console.log(this.props);
|
||||
return (
|
||||
<div className=" clearfix mt40">
|
||||
<div className="educontent mt10 pb20 w1200s">
|
||||
<div className="w1200ms contentparttit" style={{
|
||||
position: "relative",
|
||||
}}>
|
||||
<style>
|
||||
{
|
||||
`
|
||||
.contentparttit .ant-tabs-nav .ant-tabs-tab{
|
||||
margin: 10px 10px 10px 0 !important;
|
||||
}
|
||||
.contentparttit .ant-tabs-nav .ant-tabs-ink-bar{
|
||||
width: 31px !important;
|
||||
left: 14px;
|
||||
}
|
||||
`
|
||||
}
|
||||
</style>
|
||||
<Tabs defaultActiveKey={defaultActiveKey} onChange={(e)=>this.props.callback(e)}>
|
||||
<TabPane tab="公共" key="1">
|
||||
</TabPane>
|
||||
<TabPane tab="我的" key="0">
|
||||
</TabPane>
|
||||
</Tabs>
|
||||
|
||||
<div className=" mt19" style={{
|
||||
position:"absolute",
|
||||
top: "0px",
|
||||
right:" 0px",
|
||||
paddingRight: "20px",
|
||||
}}>
|
||||
<style>
|
||||
{
|
||||
`
|
||||
.xaxisreverseorder .ant-input-group-addon{
|
||||
width: 60px !important;
|
||||
|
||||
}
|
||||
|
||||
.xaxisreverseorder .ant-input-lg {
|
||||
height: 41px;}
|
||||
|
||||
.xaxisreverseorder .ant-popover{
|
||||
top: 348px !important;
|
||||
}
|
||||
|
||||
|
||||
.ant-popover-inner-content {
|
||||
padding:0px !important;
|
||||
}
|
||||
|
||||
`
|
||||
}
|
||||
</style>
|
||||
<div className="xaxisreverseorder">
|
||||
{
|
||||
defaultActiveKey===0||defaultActiveKey==="0"?
|
||||
<a href={'/question/newitem'}>
|
||||
<div className="newbutoon">
|
||||
<p className="newbutoontes" >新增</p>
|
||||
</div>
|
||||
</a>
|
||||
:""
|
||||
}
|
||||
<Popover placement="bottom" content={contents} trigger="click" visible={this.props.visiblemys} onVisibleChange={()=>this.props.handleVisibleChange(true)}>
|
||||
<div className=" sortinxdirection mr10">
|
||||
|
||||
<div className="subjecttit">
|
||||
难度
|
||||
</div>
|
||||
<i className="iconfont icon-sanjiaoxing-down font-12 lg ml7 icondowncolor"></i>
|
||||
</div>
|
||||
</Popover>
|
||||
|
||||
|
||||
|
||||
<Popover placement="bottom" content={content} trigger="click" visible={this.props.visiblemyss} onVisibleChange={()=>this.props.handleVisibleChanges(true)}>
|
||||
<div className="sortinxdirection mr40">
|
||||
<div className="subjecttit">
|
||||
题型
|
||||
</div>
|
||||
<i className="iconfont icon-sanjiaoxing-down font-12 lg ml7 icondowncolor"></i>
|
||||
</div>
|
||||
</Popover>
|
||||
<Search
|
||||
style={{ width: "347px",marginRight:"60px",}}
|
||||
placeholder="请输入题目名称、内容"
|
||||
enterButton
|
||||
size="large"
|
||||
onInput={(e)=>this.props.setdatafunsval(e)}
|
||||
onSearch={ (value)=>this.props.setdatafuns(value)} />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{/*内容*/}
|
||||
{
|
||||
this.props.Contentdata.items === undefined ||this.props.Contentdata.items === null||this.props.Contentdata.items.length===0 ?
|
||||
<div className=" w100s mb10"></div>
|
||||
:
|
||||
<div className=" w100s mb10">
|
||||
{
|
||||
defaultActiveKey===1||defaultActiveKey==="1"?
|
||||
<Contentquestionbank {...this.props} {...this.state} selectallquestionsonthispage={()=>this.props.selectallquestionsonthispage()}></Contentquestionbank>
|
||||
:""
|
||||
}
|
||||
{
|
||||
defaultActiveKey===0||defaultActiveKey==="0"?
|
||||
<Contentquestionbank {...this.props} {...this.state} selectallquestionsonthispage={()=>this.props.selectallquestionsonthispage()}></Contentquestionbank>
|
||||
:""
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
<div className="minheight">
|
||||
{/*列表集合*/}
|
||||
<div className=" w100s">
|
||||
{
|
||||
this.props.booljupyterurls===true?
|
||||
<LoadingSpin></LoadingSpin>
|
||||
:
|
||||
this.props.Contentdata.items === undefined ||this.props.Contentdata.items === null||this.props.Contentdata.items.length===0?
|
||||
<NoneDatas></NoneDatas>
|
||||
|
||||
|
||||
: this.props.Contentdata.items.map((object, index) => {
|
||||
return (
|
||||
<Listjihe {...this.state} {...this.props} items={object}
|
||||
getitem_basketss={(id)=>this.props.getitem_basketss(id)}
|
||||
getitem_baskets={(e)=>this.props.getitem_baskets(e)}
|
||||
showmodels={(e)=>this.props.showmodels(e)}
|
||||
showmodelysl={(e)=>this.props.showmodelysl(e)}>
|
||||
|
||||
</Listjihe>
|
||||
)
|
||||
})}
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
export default Contentpart
|
@ -0,0 +1,70 @@
|
||||
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
|
||||
} from "antd";
|
||||
import './../questioncss/questioncom.css';
|
||||
class Contentquestionbank extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
page:1,
|
||||
}
|
||||
}
|
||||
//初始化
|
||||
componentDidMount(){
|
||||
////console.log("componentDidMount");
|
||||
////console.log(this.state);
|
||||
////console.log(this.props);
|
||||
// let homeworkid = this.props.match.params.homeworkid;
|
||||
// let url = "/homework_commons/" + homeworkid + "/end_groups.json";
|
||||
// axios.get(url).then((response) => {
|
||||
// if (response.status === 200) {
|
||||
// this.setState({})
|
||||
// }
|
||||
// }).catch((error) => {
|
||||
// ////console.log(error)
|
||||
// });
|
||||
|
||||
}
|
||||
onChange=(e)=> {
|
||||
////console.log(`checked = ${e.target.checked}`);
|
||||
}
|
||||
|
||||
render() {
|
||||
let {page}=this.state;
|
||||
|
||||
return (
|
||||
|
||||
<div className=" clearfix mt5 Contentquestionbankstyle">
|
||||
<div className="educontent mt10 w100s">
|
||||
<div className="sortinxdirection w100s" >
|
||||
<div className="sortinxdirection w50s">
|
||||
<Checkbox onChange={()=>this.props.selectallquestionsonthispage()}></Checkbox>
|
||||
<p className="setequesbank ml20">选用本页全部试题</p>
|
||||
</div>
|
||||
<div className="xaxisreverseorder testpaper w50s">
|
||||
共{this.props.items_count?this.props.items_count:0}个试题
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
export default Contentquestionbank ;
|
@ -0,0 +1,604 @@
|
||||
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';
|
||||
|
||||
const InputGroup = Input.Group;
|
||||
const {Option} = Select;
|
||||
const options = [
|
||||
{
|
||||
value: '方向',
|
||||
label: '方向',
|
||||
children: [
|
||||
{
|
||||
value: '课程',
|
||||
label: '课程',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: 'jiangsu',
|
||||
label: 'Jiangsu',
|
||||
children: [
|
||||
{
|
||||
value: 'nanjing',
|
||||
label: 'Nanjing',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
class Itembankstop extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.contentMdRef = React.createRef()
|
||||
this.state = {
|
||||
page: 1,
|
||||
Knowpoints: [],
|
||||
rbtx: undefined,
|
||||
rbkc: undefined,
|
||||
knowledgepoints: [],
|
||||
options: [],
|
||||
}
|
||||
}
|
||||
|
||||
//初始化
|
||||
componentDidMount() {
|
||||
try {
|
||||
this.props.getcontentMdRef(this);
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
this.setState({
|
||||
options: this.props.disciplmy
|
||||
})
|
||||
// knowledgepoints:this.props.knowledgepoints,
|
||||
|
||||
////console.log("componentDidMount");
|
||||
////console.log(this.state);
|
||||
////console.log(this.props);
|
||||
// let homeworkid = this.props.match.params.homeworkid;
|
||||
// let url = "/homework_commons/" + homeworkid + "/end_groups.json";
|
||||
// axios.get(url).then((response) => {
|
||||
// if (response.status === 200) {
|
||||
// this.setState({})
|
||||
// }
|
||||
// }).catch((error) => {
|
||||
// ////console.log(error)
|
||||
// });()
|
||||
// 题型
|
||||
|
||||
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
if (this.props.item_banksedit.discipline &&this.props.item_banksedit.sub_discipline) {
|
||||
this.handdisciplinesChange(this.props.item_banksedit.discipline,this.props.item_banksedit.sub_discipline);
|
||||
}
|
||||
}
|
||||
if (prevProps.disciplmy !== this.props.disciplmy) {
|
||||
this.setState({
|
||||
options: this.props.disciplmy
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
handdisciplinesChange =(name,title)=>{
|
||||
this.setState({
|
||||
rbkc:[name.id,title.id]
|
||||
})
|
||||
this.props.form.setFieldsValue({
|
||||
rbkc: [name.id,title.id],
|
||||
});
|
||||
|
||||
if(this.props.item_banksedit.tag_disciplines.length===0){
|
||||
const didata = this.props.disciplinesdata;
|
||||
const knowledgepointsdata = [];
|
||||
|
||||
for (var i = 0; i < didata.length; i++) {
|
||||
//方向
|
||||
if (name.id === didata[i].id) {
|
||||
const fxdidata = didata[i].sub_disciplines;
|
||||
for (var j = 0; j < fxdidata.length; j++) {
|
||||
//课程
|
||||
if (title.id === 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,
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
handletag_disciplinesChange = (data) => {
|
||||
try {
|
||||
var sju=data[data.length-1].name;
|
||||
this.setState({
|
||||
rbzsd:sju,
|
||||
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) {
|
||||
// ////console.log("获取的form 数据");
|
||||
// ////console.log(values);
|
||||
data.push({
|
||||
rbnd: parseInt(values.rbnd)
|
||||
})
|
||||
data.push({
|
||||
rbtx: values.rbtx
|
||||
})
|
||||
data.push({
|
||||
rbzsd: this.state.Knowpoints
|
||||
})
|
||||
data.push({
|
||||
rbkc: values.rbkc
|
||||
})
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
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);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
var tmp = JSON.parse(JSON.stringify(this.state.knowledgepoints));
|
||||
for (var i = 0; i < tmp.length; i++) {
|
||||
if (tmp[i].id === value) {
|
||||
this.state.knowledgepoints.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
this.setState({
|
||||
rbzsd: valuename,
|
||||
Knowpoints: this.state.Knowpoints,
|
||||
knowledgepoints: this.state.knowledgepoints,
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
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,
|
||||
})
|
||||
|
||||
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) => {
|
||||
var arr = this.state.Knowpoints;
|
||||
for (let data of arr) {
|
||||
if (data.id === item.id) {
|
||||
this.state.knowledgepoints.push(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var tmp = JSON.parse(JSON.stringify(this.state.Knowpoints));
|
||||
for (var i = 0; i < tmp.length; i++) {
|
||||
if (i >= index) {
|
||||
var pos = this.state.Knowpoints.indexOf(tmp[i]);
|
||||
this.state.Knowpoints.splice(pos, 1);
|
||||
}
|
||||
}
|
||||
|
||||
this.props.form.setFieldsValue({
|
||||
rbzsd: this.state.Knowpoints,
|
||||
});
|
||||
|
||||
|
||||
this.setState({
|
||||
Knowpoints: this.state.Knowpoints,
|
||||
})
|
||||
|
||||
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) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
let {page, options} = this.state;
|
||||
const {getFieldDecorator} = this.props.form;
|
||||
//console.log("renderrenderrender");
|
||||
//console.log(this.props.item_banksedit);
|
||||
//console.log("renderrenderrendersssss");
|
||||
//console.log(this.state.rbtx);
|
||||
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>
|
||||
|
||||
<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 className="sortinxdirection" style={{*/}
|
||||
{/* height: "33px",*/}
|
||||
{/* lineHeight: "28px",*/}
|
||||
|
||||
{/*}}>*/}
|
||||
|
||||
{/* {this.state.Knowpoints === undefined ? "" : this.state.Knowpoints.map((object, index) => {*/}
|
||||
{/* return (*/}
|
||||
{/* <div className="mytags" style={{*/}
|
||||
{/* position: "relative",*/}
|
||||
{/* }}>*/}
|
||||
{/* <p className="w100s stestcen lh32">{object}</p>*/}
|
||||
{/* <i className="iconfont icon-roundclose font-25 lg ml7 icondowncolorss" onClick={()=>this.deletesobject(object,index)}></i>*/}
|
||||
{/* </div>*/}
|
||||
{/* )*/}
|
||||
{/* })}*/}
|
||||
|
||||
{/*</div>*/}
|
||||
</div>
|
||||
)}
|
||||
</Form.Item>
|
||||
<Form onSubmit={this.handleSubmit}>
|
||||
<Form.Item
|
||||
label="知识点"
|
||||
>
|
||||
{getFieldDecorator("rbzsd"
|
||||
)(
|
||||
<div className="sortinxdirection">
|
||||
<InputGroup compact>
|
||||
<Select style={{width: '258px'}} value={this.state.rbzsd} onChange={this.handleFormkechen}
|
||||
placeholder="请选择...">
|
||||
{this.state.knowledgepoints && this.state.knowledgepoints.map((object, index) => {
|
||||
return (
|
||||
<Option value={object.id}>{object.name}</Option>
|
||||
)
|
||||
})}
|
||||
</Select>
|
||||
</InputGroup>
|
||||
<div className="sortinxdirection" style={{
|
||||
height: "33px",
|
||||
lineHeight: "28px",
|
||||
|
||||
}}>
|
||||
|
||||
{this.state.Knowpoints === undefined ? "" : this.state.Knowpoints.map((object, index) => {
|
||||
return (
|
||||
<div className="mytags" style={{
|
||||
position: "relative",
|
||||
}}>
|
||||
<p className="w100s stestcen lh32">{object.name}</p>
|
||||
<i className="iconfont icon-roundclose font-25 lg ml7 icondowncolorss"
|
||||
onClick={() => this.deletesobject(object, index)}></i>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
label="题型"
|
||||
>
|
||||
{getFieldDecorator("rbtx",
|
||||
{
|
||||
rules: [{required: true, message: '请选择题型'}],
|
||||
}
|
||||
)(
|
||||
<InputGroup compact>
|
||||
<Select style={{width: '258px'}} value={this.state.rbtx} onChange={this.handleFormtixing}
|
||||
placeholder="请选择...">
|
||||
<Option value="SINGLE">单选题</Option>
|
||||
<Option value="MULTIPLE">多选题</Option>
|
||||
<Option value="JUDGMENT">判断题</Option>
|
||||
<Option value="PROGRAM">编程题</Option>
|
||||
</Select>
|
||||
</InputGroup>
|
||||
)}
|
||||
</Form.Item>
|
||||
|
||||
|
||||
<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 value={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.Item>*/}
|
||||
{/* <Button type="primary" htmlType="submit" className="login-form-button">*/}
|
||||
{/* 提交*/}
|
||||
{/* </Button>*/}
|
||||
{/*</Form.Item>*/}
|
||||
|
||||
</Form>
|
||||
<div className="h20"></div>
|
||||
</div>
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
const Itembankstops = Form.create({name: 'Itembankstops'})(Itembankstop);
|
||||
export default Itembankstops;
|
@ -0,0 +1,37 @@
|
||||
import React, { Component } from 'react';
|
||||
import { getImageUrl , getUrl } from 'educoder';
|
||||
|
||||
class NoneData extends Component{
|
||||
constructor(props) {
|
||||
super(props)
|
||||
}
|
||||
render(){
|
||||
const { style } = this.props;
|
||||
return(
|
||||
<div className="edu-tab-con-box clearfix edu-txt-center intermediatecenter" style={ style || { width:"100%",height:"100%"}}>
|
||||
<style>
|
||||
{`
|
||||
.edu-tab-con-box{
|
||||
padding:100px 0px;
|
||||
}
|
||||
.ant-modal-body .edu-tab-con-box{
|
||||
padding:0px!important;
|
||||
}
|
||||
img.edu-nodata-img{
|
||||
margin: 40px auto 20px;
|
||||
}
|
||||
.zenwuxgsj{
|
||||
font-size:17px;
|
||||
font-family:MicrosoftYaHei;
|
||||
color:rgba(136,136,136,1);
|
||||
}
|
||||
`}
|
||||
</style>
|
||||
<img className="edu-nodata-img mb20" src={getUrl("/images/educoder/nodata.png")}/>
|
||||
<p className="edu-nodata-p mb10 zenwuxgsj">暂无相关数据</p>
|
||||
<p className="edu-nodata-p mb20 mt4 zenwuxgsj">请选择试题进行组卷</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default NoneData;
|
@ -0,0 +1,36 @@
|
||||
import React, { Component } from 'react';
|
||||
import { getImageUrl , getUrl } from 'educoder';
|
||||
|
||||
class NoneDatas extends Component{
|
||||
constructor(props) {
|
||||
super(props)
|
||||
}
|
||||
render(){
|
||||
const { style } = this.props;
|
||||
return(
|
||||
<div className="edu-tab-con-box clearfix edu-txt-center intermediatecenter" style={ style || { width:"100%",height:"100%"}}>
|
||||
<style>
|
||||
{`
|
||||
.edu-tab-con-box{
|
||||
padding:100px 0px;
|
||||
}
|
||||
.ant-modal-body .edu-tab-con-box{
|
||||
padding:0px!important;
|
||||
}
|
||||
img.edu-nodata-img{
|
||||
margin: 40px auto 20px;
|
||||
}
|
||||
.zenwuxgsj{
|
||||
font-size:17px;
|
||||
font-family:MicrosoftYaHei;
|
||||
color:rgba(136,136,136,1);
|
||||
}
|
||||
`}
|
||||
</style>
|
||||
<img className="edu-nodata-img mb20" src={getUrl("/images/educoder/nodata.png")}/>
|
||||
<p className="edu-nodata-p mb10 zenwuxgsj">暂无相关数据</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default NoneDatas;
|
@ -0,0 +1,43 @@
|
||||
import React, { Component } from 'react';
|
||||
import {getImageUrl} from 'educoder';
|
||||
import { Modal} from 'antd';
|
||||
import axios from 'axios';
|
||||
import './../questioncss/questioncom.css'
|
||||
//立即申请试用
|
||||
class QuestionModal extends Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state={
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
|
||||
return(
|
||||
<Modal
|
||||
keyboard={false}
|
||||
closable={false}
|
||||
footer={null}
|
||||
destroyOnClose={true}
|
||||
title="提示"
|
||||
centered={true}
|
||||
visible={this.props.modalsType===undefined?false:this.props.modalsType}
|
||||
width="442px"
|
||||
>
|
||||
<div className="educouddiv">
|
||||
<div className={"tabeltext-alignleft mt10"}><p className="titiles">{this.props.titilesm}</p></div>
|
||||
<div className={"tabeltext-alignleft mt10"}><p className="titiles">{this.props.titiless}</p></div>
|
||||
<div className="clearfix mt30 edu-txt-center">
|
||||
<a className="task-btn mr30 w80" onClick={()=>this.props.modalCancel()}>取消</a>
|
||||
<a className="task-btn task-btn-orange w80" onClick={()=>this.props.setDownload()}>确定</a>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default QuestionModal;
|
@ -0,0 +1,66 @@
|
||||
import React, { Component } from 'react';
|
||||
import {getImageUrl} from 'educoder';
|
||||
import { Modal} from 'antd';
|
||||
import axios from 'axios';
|
||||
import './../questioncss/questioncom.css'
|
||||
//立即申请试用
|
||||
class QuestionModals extends Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state={
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
|
||||
return(
|
||||
<Modal
|
||||
keyboard={false}
|
||||
closable={false}
|
||||
footer={null}
|
||||
destroyOnClose={true}
|
||||
title="提示"
|
||||
centered={true}
|
||||
visible={this.props.modalsTypes===undefined?false:this.props.modalsTypes}
|
||||
width="442px"
|
||||
>
|
||||
<div className="educouddiv">
|
||||
<div className={"tabeltext-alignleft mt10"}><p className="titiles">是否删除试题栏中{
|
||||
|
||||
this.props.titilesms&&this.props.titilesms==="SINGLE"?
|
||||
"单选题"
|
||||
:
|
||||
this.props.titilesms&&this.props.titilesms==="MULTIPLE"?
|
||||
"多选题"
|
||||
:
|
||||
this.props.titilesms&&this.props.titilesms==="JUDGMENT"?
|
||||
"判断题"
|
||||
:
|
||||
this.props.titilesms&&this.props.titilesms==="COMPLETION"?
|
||||
"填空题"
|
||||
:
|
||||
this.props.titilesms&&this.props.titilesms==="SUBJECTIVE"?
|
||||
"简答题"
|
||||
:
|
||||
this.props.titilesms&&this.props.titilesms==="PROGRAM"?
|
||||
"编程题"
|
||||
:
|
||||
this.props.titilesms&&this.props.titilesms==="PRACTICAL"?
|
||||
"实训题"
|
||||
:""
|
||||
|
||||
}</p></div>
|
||||
<div className="clearfix mt30 edu-txt-center">
|
||||
<a className="task-btn mr30 w80" onClick={()=>this.props.modalCancels()}>取消</a>
|
||||
<a className="task-btn task-btn-orange w80" onClick={()=>this.props.setDownloads(this.props.titilesms)}>确定</a>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default QuestionModals;
|
@ -0,0 +1,611 @@
|
||||
.w1200{
|
||||
width:1062px;
|
||||
height:177px;
|
||||
background:rgba(255,255,255,1);
|
||||
box-shadow:0px 6px 8px 0px rgba(0,0,0,0.03);
|
||||
border-radius:2px;
|
||||
}
|
||||
|
||||
.w1200dbl{
|
||||
width:1062px;
|
||||
min-height:60px;
|
||||
background:rgba(255,255,255,1);
|
||||
box-shadow:0px 6px 8px 0px rgba(0,0,0,0.03);
|
||||
border-radius:2px;
|
||||
}
|
||||
.w1200fpx{
|
||||
width:1200px;
|
||||
background:rgba(255,255,255,1);
|
||||
box-shadow:0px 6px 8px 0px rgba(0,0,0,0.03);
|
||||
border-radius:2px;
|
||||
}
|
||||
.w1200mss{
|
||||
width:1200px;
|
||||
}
|
||||
.w1200ms{
|
||||
width:1062px;
|
||||
}
|
||||
.w1200s{
|
||||
width:1062px;
|
||||
background:rgba(255,255,255,1);
|
||||
box-shadow:0px 6px 8px 0px rgba(0,0,0,0.03);
|
||||
border-radius:2px;
|
||||
}
|
||||
.h177{
|
||||
height: 177px;
|
||||
}
|
||||
/* 中间居中 */
|
||||
.intermediatecenter{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
/* 简单居中 */
|
||||
.intermediatecenterysls{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.spacearound{
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
|
||||
}
|
||||
.spacebetween{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
/* 头顶部居中 */
|
||||
.topcenter{
|
||||
display: -webkit-flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* x轴正方向排序 */
|
||||
/* 一 二 三 四 五 六 七 八 */
|
||||
.sortinxdirection{
|
||||
display: flex;
|
||||
flex-direction:row;
|
||||
}
|
||||
/* x轴反方向排序 */
|
||||
/* 八 七 六 五 四 三 二 一 */
|
||||
.xaxisreverseorder{
|
||||
display: flex;
|
||||
flex-direction:row-reverse;
|
||||
}
|
||||
/* 垂直布局 正方向*/
|
||||
/* 一
|
||||
二
|
||||
三
|
||||
四
|
||||
五
|
||||
六
|
||||
七
|
||||
八 */
|
||||
.verticallayout{
|
||||
display: flex;
|
||||
flex-direction:column;
|
||||
}
|
||||
/* 垂直布局 反方向*/
|
||||
.reversedirection{
|
||||
display: flex;
|
||||
flex-direction:column-reverse;
|
||||
}
|
||||
.w100{
|
||||
width: 100px;
|
||||
}
|
||||
.mt21{
|
||||
margin-top: 21px;
|
||||
}
|
||||
.mt23{
|
||||
margin-top: 23px;
|
||||
}
|
||||
.mt19{
|
||||
margin-top: 19px;
|
||||
}
|
||||
.mt15{
|
||||
margin-top: 10px;
|
||||
}
|
||||
.h40{
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.tophom{
|
||||
padding-top: 33px;
|
||||
padding-bottom: 40px;
|
||||
padding-left: 26px;
|
||||
padding-right: 26px;
|
||||
}
|
||||
.tophoms{
|
||||
padding-top: 15px;
|
||||
padding-left: 26px;
|
||||
padding-right: 26px;
|
||||
}
|
||||
.borderwd{
|
||||
border: 1px solid #000000;
|
||||
}
|
||||
.borderwds{
|
||||
width: 1020px !important;
|
||||
background: #FFFFFF;
|
||||
border: 1px solid #DDDDDD;
|
||||
margin-left: 20px;
|
||||
min-height:150px;
|
||||
}
|
||||
.borderwds283{
|
||||
width: 1020px !important;
|
||||
min-height:283px;
|
||||
background:#F9F9F9;
|
||||
border:1px solid #DDDDDD;
|
||||
margin-left: 20px;
|
||||
}
|
||||
.w64{
|
||||
width: 64px;
|
||||
}
|
||||
.w70{
|
||||
width: 70px !important;
|
||||
}
|
||||
|
||||
.tophomsembold{
|
||||
height:21px;
|
||||
font-size:16px;
|
||||
color:#333333;
|
||||
line-height:21px;
|
||||
}
|
||||
|
||||
.tophomsembolds{
|
||||
width:42px;
|
||||
height:19px;
|
||||
font-size:14px;
|
||||
font-family:MicrosoftYaHeiSemibold;
|
||||
color:rgba(51,51,51,1);
|
||||
line-height:31px;
|
||||
}
|
||||
/*Contentpart*/
|
||||
.contentparttit{
|
||||
padding-top: 10px;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.subjecttit{
|
||||
width:28px;
|
||||
height:19px;
|
||||
font-size:14px;
|
||||
color:rgba(51,51,51,1);
|
||||
line-height: 42px;
|
||||
cursor:pointer;
|
||||
|
||||
}
|
||||
.ml55{
|
||||
margin-right: 55px;
|
||||
|
||||
}
|
||||
|
||||
.lg{
|
||||
line-height: 42px;
|
||||
}
|
||||
.ml7{
|
||||
margin-left: 7px;
|
||||
}
|
||||
|
||||
.icondowncolor{
|
||||
color:#9E9E9E;
|
||||
|
||||
}
|
||||
.icondowncolorss{
|
||||
color: #9E9E9E;
|
||||
position: absolute;
|
||||
top: -20px;
|
||||
right: -16px;
|
||||
}
|
||||
|
||||
.questiontype{
|
||||
width: 100%;
|
||||
font-size: 12px;
|
||||
color: #333333;
|
||||
line-height: 17px;
|
||||
text-align: center;
|
||||
padding: 11px;
|
||||
cursor:pointer;
|
||||
|
||||
}
|
||||
.questiontypes{
|
||||
width:37px;
|
||||
height:17px;
|
||||
font-size:12px;
|
||||
color:rgba(51,51,51,1);
|
||||
line-height:17px;
|
||||
cursor:pointer;
|
||||
|
||||
}
|
||||
.questiontypeheng{
|
||||
width:100%;
|
||||
height:1px;
|
||||
background: #EEEEEE;
|
||||
}
|
||||
.questiontype:hover{
|
||||
color: #4CACFF;
|
||||
}
|
||||
.questiontype:active{
|
||||
color: #4CACFF;
|
||||
}
|
||||
|
||||
.w100s{
|
||||
width:100%;
|
||||
}
|
||||
.stestcen{
|
||||
text-align: center;
|
||||
}
|
||||
.w70s{
|
||||
width:70%;
|
||||
}
|
||||
.w30s{
|
||||
width:70%;
|
||||
}
|
||||
.w50s{
|
||||
width: 50%;
|
||||
}
|
||||
.testpaper{
|
||||
font-size:12px;
|
||||
color:#888888;
|
||||
line-height:28px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.setequesbank{
|
||||
font-size:14px;
|
||||
color:#333333;
|
||||
line-height:28px;
|
||||
}
|
||||
|
||||
.Contentquestionbankstyle{
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.pd20{
|
||||
padding-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
}
|
||||
|
||||
/*listjihe*/
|
||||
.listjihetixing{
|
||||
color: #888888;
|
||||
font-size: 12px;
|
||||
line-height: 17px;
|
||||
}
|
||||
|
||||
.listjihetixings{
|
||||
color: #333333;
|
||||
font-size: 12px;
|
||||
line-height: 17px;
|
||||
}
|
||||
.listjihetixingstit{
|
||||
color: #333333;
|
||||
font-size: 14px;
|
||||
line-height: 17px;
|
||||
|
||||
}
|
||||
.listjihetixingstits{
|
||||
color: #333333;
|
||||
font-size: 14px;
|
||||
line-height:19px;
|
||||
margin-top: 19px;
|
||||
}
|
||||
|
||||
.updatetimes{
|
||||
color: #BBBBBB;
|
||||
font-size: 12px;
|
||||
}
|
||||
.mt22{
|
||||
margin-top: 22px;
|
||||
}
|
||||
.viewparsings{
|
||||
color:#4CACFF;
|
||||
font-size:12px;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.selection{
|
||||
width:88px;
|
||||
height:30px;
|
||||
background:#33BD8C;
|
||||
border-radius:4px;
|
||||
text-align: center;
|
||||
line-height: 30px;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
.selectionss{
|
||||
width:88px;
|
||||
height:30px;
|
||||
background:#eeeeee;
|
||||
border-radius:4px;
|
||||
text-align: center;
|
||||
line-height: 30px;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
.lh30{
|
||||
line-height: 30px;
|
||||
|
||||
|
||||
}
|
||||
|
||||
.analysis{
|
||||
height:19px;
|
||||
font-size:14px;
|
||||
color:#333333;
|
||||
line-height:19px;
|
||||
}
|
||||
|
||||
.testfondex{
|
||||
color: #808080;
|
||||
font-size: 14px;
|
||||
}
|
||||
.pb20{
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
.icontianjiadaohangcolor{
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.icontianjiadaohangcolors{
|
||||
color: #4CACFF;
|
||||
}
|
||||
.xiaoshou{
|
||||
cursor:pointer
|
||||
}
|
||||
.mt40{
|
||||
margin-top: 40px;
|
||||
}
|
||||
.mt42{
|
||||
margin-top: 42px;
|
||||
}
|
||||
.drawerbutton{
|
||||
width:88px;
|
||||
height:30px;
|
||||
background:#4CACFF;
|
||||
border-radius:4px;
|
||||
font-size:14px;
|
||||
color:#ffffff;
|
||||
line-height:30px;
|
||||
text-align: center;
|
||||
}
|
||||
.icondrawercolor{
|
||||
color: #979797;
|
||||
}
|
||||
|
||||
.mt25{
|
||||
margin-top: 25px;
|
||||
}
|
||||
.mb26{
|
||||
margin-bottom: 26px;
|
||||
}
|
||||
.drawernonedatadiv{
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.font-17{
|
||||
font-size: 17px;
|
||||
}
|
||||
.ml30{
|
||||
margin-right: 30px;
|
||||
}
|
||||
.mr25{
|
||||
margin-right: 25px;
|
||||
}
|
||||
.newbutoon{
|
||||
width:88px;
|
||||
height:42px;
|
||||
background:#33BD8C;
|
||||
line-height: 42px;
|
||||
border-radius:4px;
|
||||
|
||||
}
|
||||
|
||||
.newbutoontes{
|
||||
width:100%;
|
||||
height:42px;
|
||||
font-size:14px;
|
||||
color:#ffffff;
|
||||
line-height:42px;
|
||||
text-align: center;
|
||||
}
|
||||
.educouddiv {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.tabeltext-alignleftysl{
|
||||
font-size:14px;
|
||||
color:#000000;
|
||||
line-height:19px;
|
||||
|
||||
}
|
||||
.tabeltext-alignleftysltwo{
|
||||
font-size:14px;
|
||||
color:#848282;
|
||||
line-height:19px;
|
||||
|
||||
}
|
||||
|
||||
.publictask-btn{
|
||||
width:80px;
|
||||
height:34px;
|
||||
background:#CCCCCC;
|
||||
border-radius:4px;
|
||||
color: #ffffff;
|
||||
|
||||
}
|
||||
.publictask-btns{
|
||||
width:80px;
|
||||
height:34px;
|
||||
background:#4CACFF;
|
||||
border-radius:4px;
|
||||
color: #ffffff;
|
||||
}
|
||||
.w80{
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
.titiles{
|
||||
color: #333333;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.h12{
|
||||
height: 12px;
|
||||
min-height: 12px;
|
||||
}
|
||||
|
||||
.mt19{
|
||||
margin-top: 19px;
|
||||
}
|
||||
.mytags{
|
||||
width:106px;
|
||||
height:32px;
|
||||
border-radius:2px;
|
||||
border:1px solid #DDDDDD;
|
||||
margin-left: 20px;
|
||||
}
|
||||
.lh32{
|
||||
line-height: 32px;
|
||||
}
|
||||
|
||||
.h20{
|
||||
height: 20px;
|
||||
min-height: 20px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.xingcolor{
|
||||
color: rgba(224, 64, 64, 1);
|
||||
}
|
||||
.xingtigan{
|
||||
font-size:14px;
|
||||
color:rgba(51, 51, 51, 1);
|
||||
}
|
||||
.mr4{
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.xingtigans{
|
||||
width:100%;
|
||||
font-size:14px;
|
||||
color:rgba(136,136,136,1);
|
||||
}
|
||||
|
||||
.bottomdivs{
|
||||
width:100%;
|
||||
height:55px;
|
||||
background:rgba(255,255,255,1);
|
||||
box-shadow:0px -2px 7px 0px rgba(1,6,22,0.04);
|
||||
}
|
||||
.mt50{
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.divquxiao{
|
||||
width:88px;
|
||||
height:32px;
|
||||
background:rgba(255,255,255,1);
|
||||
border-radius:4px;
|
||||
border:1px solid rgba(204,204,204,1);
|
||||
}
|
||||
.divquxiaotest{
|
||||
width:100%;
|
||||
height:32px;
|
||||
font-size:12px;
|
||||
color:rgba(136,136,136,1);
|
||||
line-height:32px;
|
||||
text-align: center;
|
||||
}
|
||||
.divbaocuntests{
|
||||
width:100%;
|
||||
height:32px;
|
||||
font-size:12px;
|
||||
color:#ffffff;
|
||||
line-height:32px;
|
||||
text-align: center;
|
||||
}
|
||||
.divbaocun{
|
||||
width:88px;
|
||||
height:32px;
|
||||
background:rgba(76,172,255,1);
|
||||
border-radius:4px;
|
||||
}
|
||||
.sortzhenque{
|
||||
width:49px;
|
||||
height:33px;
|
||||
border-radius:2px;
|
||||
border:1px solid rgba(221,221,221,1);
|
||||
}
|
||||
|
||||
.sortzhenquetest{
|
||||
width:100%;
|
||||
height:33px;
|
||||
font-size:14px;
|
||||
color:rgba(51,51,51,1);
|
||||
line-height:33px;
|
||||
|
||||
}
|
||||
|
||||
.sortquxiao{
|
||||
|
||||
width:49px;
|
||||
height:33px;
|
||||
border-radius:2px;
|
||||
border:1px solid rgba(221,221,221,1);
|
||||
}
|
||||
.sortquxiaotest{
|
||||
width:100%;
|
||||
height:33px;
|
||||
font-size:14px;
|
||||
color:rgba(51,51,51,1);
|
||||
line-height:33px;
|
||||
}
|
||||
|
||||
.ml45{
|
||||
margin-left: 45px;
|
||||
}
|
||||
|
||||
.programcss{
|
||||
height: 251px;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
.titlesttingcss{
|
||||
min-width: 100px;
|
||||
height:32px;
|
||||
line-height: 32px;
|
||||
background:rgba(76,172,255,1);
|
||||
border-radius:16px;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
}
|
||||
.titlesttingcssmy{
|
||||
min-width: 100px;
|
||||
height:32px;
|
||||
line-height: 32px;
|
||||
font-size:14px;
|
||||
color:rgba(51,51,51,1);
|
||||
text-align: center;
|
||||
}
|
||||
.minleng40{
|
||||
min-height: 40px;
|
||||
}
|
||||
|
||||
.w60{
|
||||
width: 60px !important;
|
||||
}
|
||||
|
||||
.h30{
|
||||
min-height: 30px !important;
|
||||
}
|
||||
|
||||
.minheight{
|
||||
min-height: 500px !important;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue