commit
d96bdc8751
@ -0,0 +1,12 @@
|
|||||||
|
class ExaminationIntelligentSettings::SaveExamForm
|
||||||
|
include ActiveModel::Model
|
||||||
|
|
||||||
|
attr_accessor :name, :duration
|
||||||
|
|
||||||
|
validates :name, presence: true, length: { maximum: 60 }
|
||||||
|
validate :validate_duration
|
||||||
|
|
||||||
|
def validate_duration
|
||||||
|
raise '时长应为大于0的整数' if duration.present? && duration.to_i < 1
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,11 @@
|
|||||||
|
class ExaminationIntelligentSettings::SaveExamSettingForm
|
||||||
|
include ActiveModel::Model
|
||||||
|
|
||||||
|
attr_accessor :discipline_id, :sub_discipline_id, :source, :difficulty, :tag_discipline_id, :question_settings
|
||||||
|
|
||||||
|
validates :discipline_id, presence: true
|
||||||
|
validates :sub_discipline_id, presence: true
|
||||||
|
validates :source, presence: true
|
||||||
|
validates :difficulty, presence: true, inclusion: {in: 1..3}, numericality: { only_integer: true }
|
||||||
|
validates :question_settings, presence: true
|
||||||
|
end
|
@ -0,0 +1,7 @@
|
|||||||
|
class ExaminationIntelligentSetting < ApplicationRecord
|
||||||
|
belongs_to :sub_discipline
|
||||||
|
belongs_to :user
|
||||||
|
has_many :examination_type_settings, dependent: :destroy
|
||||||
|
has_many :tag_discipline_containers, as: :container, dependent: :destroy
|
||||||
|
has_many :item_baskets, dependent: :destroy
|
||||||
|
end
|
@ -0,0 +1,4 @@
|
|||||||
|
class ExaminationTypeSetting < ApplicationRecord
|
||||||
|
enum item_type: { SINGLE: 0, MULTIPLE: 1, JUDGMENT: 2, COMPLETION: 3, SUBJECTIVE: 4, PRACTICAL: 5, PROGRAM: 6 }
|
||||||
|
belongs_to :examination_intelligent_setting
|
||||||
|
end
|
@ -1,3 +1,3 @@
|
|||||||
class ItemAnalysis < ApplicationRecord
|
class ItemAnalysis < ApplicationRecord
|
||||||
belongs_to :item_bank
|
belongs_to :item_bank, touch: true
|
||||||
end
|
end
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
class ItemChoice < ApplicationRecord
|
class ItemChoice < ApplicationRecord
|
||||||
belongs_to :item_bank
|
belongs_to :item_bank, touch: true
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
class TagDisciplineContainer < ApplicationRecord
|
class TagDisciplineContainer < ApplicationRecord
|
||||||
belongs_to :tag_discipline
|
belongs_to :tag_discipline
|
||||||
|
|
||||||
belongs_to :container, polymorphic: true, optional: true
|
belongs_to :container, polymorphic: true, optional: true, touch: true
|
||||||
end
|
end
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
class OptionalItemQuery < ApplicationQuery
|
||||||
|
attr_reader :sub_discipline_id, :tag_discipline_id, :difficulty, :source
|
||||||
|
|
||||||
|
def initialize(sub_discipline_id, tag_discipline_id, difficulty, source)
|
||||||
|
@sub_discipline_id = sub_discipline_id
|
||||||
|
@tag_discipline_id = tag_discipline_id
|
||||||
|
@difficulty = difficulty
|
||||||
|
@source = source
|
||||||
|
end
|
||||||
|
|
||||||
|
def call
|
||||||
|
items = ItemBank.all
|
||||||
|
if tag_discipline_id.present? && sub_discipline_id.present?
|
||||||
|
items = items.joins(:tag_discipline_containers).where(tag_discipline_containers: {tag_discipline_id: tag_discipline_id})
|
||||||
|
hacks = Hack.joins(:tag_discipline_containers).where(tag_discipline_containers: {tag_discipline_id: tag_discipline_id})
|
||||||
|
elsif sub_discipline_id.present?
|
||||||
|
items = items.where(sub_discipline_id: sub_discipline_id)
|
||||||
|
hacks = Hack.where(sub_discipline_id: sub_discipline_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
if hacks.present?
|
||||||
|
items = ItemBank.where(container_id: hacks.pluck(:id), container_type: "Hack").or(ItemBank.where(id: items.pluck(:id)))
|
||||||
|
end
|
||||||
|
|
||||||
|
# 来源
|
||||||
|
public = source.present? ? source.to_i : 1
|
||||||
|
public = public == 2 ? [0, 1] : public
|
||||||
|
items = items.where(public: public)
|
||||||
|
|
||||||
|
# 难度
|
||||||
|
difficulty = difficulty ? difficulty.to_i : 1
|
||||||
|
items = items.where(difficulty: difficulty)
|
||||||
|
items
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,38 @@
|
|||||||
|
class ExaminationIntelligentSettings::SaveExaminationService < ApplicationService
|
||||||
|
attr_reader :exam, :params, :exam_setting
|
||||||
|
|
||||||
|
def initialize(exam, params, exam_setting)
|
||||||
|
@exam = exam
|
||||||
|
@params = params
|
||||||
|
@exam_setting = exam_setting
|
||||||
|
end
|
||||||
|
|
||||||
|
def call
|
||||||
|
ExaminationIntelligentSettings::SaveExamForm.new(params).validate!
|
||||||
|
|
||||||
|
ActiveRecord::Base.transaction do
|
||||||
|
exam.name = params[:name].to_s.strip
|
||||||
|
exam.difficulty = exam_setting.difficulty
|
||||||
|
exam.duration = params[:duration].present? ? params[:duration].to_i : nil
|
||||||
|
exam.sub_discipline_id = exam_setting.sub_discipline_id
|
||||||
|
exam.intelligent = 1
|
||||||
|
exam.save!
|
||||||
|
|
||||||
|
# 知识点的创建
|
||||||
|
exam_setting.tag_discipline_containers.each do |tag|
|
||||||
|
exam.tag_discipline_containers << TagDisciplineContainer.new(tag_discipline_id: tag.tag_discipline_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
# 试题的复制
|
||||||
|
exam_setting.item_baskets.includes(:item_bank).each do |basket|
|
||||||
|
item = basket.item_bank
|
||||||
|
if item.present?
|
||||||
|
new_item = ExaminationItem.new
|
||||||
|
new_item.new_item(item, exam, basket.score, basket.position)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
exam_setting.destroy!
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,63 @@
|
|||||||
|
class ExaminationIntelligentSettings::SaveSettingService < ApplicationService
|
||||||
|
attr_reader :exam, :params
|
||||||
|
|
||||||
|
def initialize(exam, params)
|
||||||
|
@exam = exam
|
||||||
|
@params = params
|
||||||
|
end
|
||||||
|
|
||||||
|
def call
|
||||||
|
ExaminationIntelligentSettings::SaveExamSettingForm.new(params).validate!
|
||||||
|
items = OptionalItemQuery.call(params[:sub_discipline_id], params[:tag_discipline_id], params[:difficulty], params[:source])
|
||||||
|
params[:question_settings].each do |setting|
|
||||||
|
raise "超出可选题数范围" if items.select{ |item| item.item_type == setting[:item_type] }.size.to_i < setting[:count].to_i
|
||||||
|
end
|
||||||
|
|
||||||
|
exam.difficulty = params[:difficulty]
|
||||||
|
exam.sub_discipline_id = params[:sub_discipline_id]
|
||||||
|
exam.public = params[:source].present? ? params[:source].to_i : 1
|
||||||
|
exam.save!
|
||||||
|
|
||||||
|
# 知识点的创建
|
||||||
|
params[:tag_discipline_id].each do |tag_id|
|
||||||
|
exam.tag_discipline_containers << TagDisciplineContainer.new(tag_discipline_id: tag_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
# 智能选题的设置
|
||||||
|
params[:question_settings].each do |setting|
|
||||||
|
if setting[:count].to_i > 0
|
||||||
|
exam.examination_type_settings << ExaminationTypeSetting.new(item_type: setting[:item_type], count: setting[:count].to_i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# 选题
|
||||||
|
choose_question items
|
||||||
|
|
||||||
|
exam
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def choose_question items
|
||||||
|
exam.examination_type_settings.each do |setting|
|
||||||
|
questions = items.select{ |item| item.item_type == setting.item_type }
|
||||||
|
questions.pluck(:id).sample(setting.count).each_with_index do |item_id, index|
|
||||||
|
item = ItemBank.find item_id
|
||||||
|
exam.item_baskets << ItemBasket.new(item_bank_id: item.id, position: index+1, score: item_score(item.item_type), item_type: item.item_type)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def item_score item_type
|
||||||
|
score =
|
||||||
|
case item_type
|
||||||
|
when "SINGLE", "MULTIPLE", "JUDGMENT"
|
||||||
|
5
|
||||||
|
when "PROGRAM"
|
||||||
|
10
|
||||||
|
else
|
||||||
|
5
|
||||||
|
end
|
||||||
|
score
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,4 @@
|
|||||||
|
json.single_question_count @single_question_count
|
||||||
|
json.multiple_question_count @multiple_question_count
|
||||||
|
json.judgement_question_count @judgement_question_count
|
||||||
|
json.program_question_count @program_question_count
|
@ -0,0 +1,13 @@
|
|||||||
|
class CreateExaminationIntelligentSettings < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :examination_intelligent_settings do |t|
|
||||||
|
t.references :sub_discipline
|
||||||
|
t.integer :public, default: 1
|
||||||
|
t.integer :difficulty, default: 1
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index :examination_intelligent_settings, :sub_discipline_id, name: "index_on_sub_discipline_id"
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,13 @@
|
|||||||
|
class CreateExaminationTypeSettings < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :examination_type_settings do |t|
|
||||||
|
t.references :examination_intelligent_setting, index: false
|
||||||
|
t.integer :item_type
|
||||||
|
t.integer :count
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index :examination_type_settings, :examination_intelligent_setting_id, name: "index_on_examination_intelligent_setting"
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddUserIdToIntelligentSettings < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
add_column :examination_intelligent_settings, :user_id, :integer, index: true
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddIntelligentSettingIdToItemBaskets < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
add_column :item_baskets, :examination_intelligent_setting_id, :integer, index: true
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddIntelligentToExam < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
add_column :examination_banks, :intelligent, :boolean, default: false
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,970 @@
|
|||||||
|
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,
|
||||||
|
Drawer,
|
||||||
|
Input,
|
||||||
|
Tooltip
|
||||||
|
} from "antd";
|
||||||
|
import {parabola} from './animation/parabola'
|
||||||
|
import Headplugselections from "./component/Headplugselections";
|
||||||
|
import QuestionModal from "./component/QuestionModal";
|
||||||
|
import QuestionModals from "./component/QuestionModals";
|
||||||
|
import Contentpart from "./component/Contentpart";
|
||||||
|
import {TPMIndexHOC} from "../tpm/TPMIndexHOC";
|
||||||
|
import NoneData from './component/NoneData';
|
||||||
|
import './questioncss/questioncom.css';
|
||||||
|
import Bottomsubmit from "../modals/Bottomsubmit";
|
||||||
|
|
||||||
|
//exam_id 试卷的id
|
||||||
|
class NewMyShixunModel extends Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
count: 50,
|
||||||
|
defaultActiveKey:"1",
|
||||||
|
Headertop: "",
|
||||||
|
Footerdown: "",
|
||||||
|
visible: false,
|
||||||
|
placement: 'right',
|
||||||
|
modalsType: false,
|
||||||
|
modalsTypes:false,
|
||||||
|
titilesm: "在平台审核后,所有成员均可使用试题",
|
||||||
|
titiless: "是否设置为公开?",
|
||||||
|
titilesms:"单选题",
|
||||||
|
titbool: false,
|
||||||
|
Contentdata: [],
|
||||||
|
difficulty: null,
|
||||||
|
visiblemys: false,
|
||||||
|
visiblemyss: false,
|
||||||
|
item_type: null,
|
||||||
|
keyword: null,
|
||||||
|
timuid: null,
|
||||||
|
items_count: 0,
|
||||||
|
basket_list: [],
|
||||||
|
completion_questions_count: 0,
|
||||||
|
judgement_questions_count: 0,
|
||||||
|
multiple_questions_count: 0,
|
||||||
|
practical_questions_count: 0,
|
||||||
|
program_questions_count: 0,
|
||||||
|
single_questions_count: 0,
|
||||||
|
subjective_questions_count: 0,
|
||||||
|
page:1,
|
||||||
|
per_page:10,
|
||||||
|
disciplinesdata:[],
|
||||||
|
discipline_id:null,
|
||||||
|
sub_discipline_id:null,
|
||||||
|
tag_discipline_id:null,
|
||||||
|
booljupyterurls:false,
|
||||||
|
disciplinesdatakc:0,
|
||||||
|
disciplinesdatazsd:0,
|
||||||
|
selectallquestionsonthispages:false,
|
||||||
|
oj_status:null,
|
||||||
|
isVisible: false,
|
||||||
|
selectionbools:false,
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
setdiscipline_id=(discipline_id)=>{
|
||||||
|
this.setState({
|
||||||
|
discipline_id:discipline_id,
|
||||||
|
sub_discipline_id:null,
|
||||||
|
tag_discipline_id:null,
|
||||||
|
keywords:"",
|
||||||
|
page:1,
|
||||||
|
per_page:10,
|
||||||
|
oj_status:null
|
||||||
|
})
|
||||||
|
var data = {
|
||||||
|
discipline_id:discipline_id,
|
||||||
|
sub_discipline_id:null,
|
||||||
|
tag_discipline_id:null,
|
||||||
|
public: this.state.defaultActiveKey,
|
||||||
|
difficulty: this.state.difficulty,
|
||||||
|
item_type: this.state.item_type,
|
||||||
|
keywords: null,
|
||||||
|
page: this.state.page,
|
||||||
|
per_page:10,
|
||||||
|
oj_status:null,
|
||||||
|
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
|
||||||
|
};
|
||||||
|
this.getdata(data);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
setsub_discipline_id=(discipline_id,sub_discipline_id)=>{
|
||||||
|
this.setState({
|
||||||
|
sub_discipline_id:sub_discipline_id,
|
||||||
|
tag_discipline_id:null,
|
||||||
|
keywords:"",
|
||||||
|
page:1,
|
||||||
|
per_page:10,
|
||||||
|
oj_status:null
|
||||||
|
})
|
||||||
|
var data = {
|
||||||
|
discipline_id:discipline_id,
|
||||||
|
sub_discipline_id:sub_discipline_id,
|
||||||
|
tag_discipline_id:null,
|
||||||
|
public: this.state.defaultActiveKey,
|
||||||
|
difficulty: this.state.difficulty,
|
||||||
|
item_type: this.state.item_type,
|
||||||
|
keywords:null,
|
||||||
|
page: 1,
|
||||||
|
per_page:10,
|
||||||
|
oj_status:null,
|
||||||
|
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
|
||||||
|
};
|
||||||
|
this.getdata(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
settag_discipline_id=(tag_discipline_id)=>{
|
||||||
|
this.setState({
|
||||||
|
tag_discipline_id:tag_discipline_id,
|
||||||
|
keywords:"",
|
||||||
|
page:1,
|
||||||
|
per_page:10,
|
||||||
|
oj_status:null
|
||||||
|
})
|
||||||
|
var data = {
|
||||||
|
discipline_id:this.state.discipline_id,
|
||||||
|
sub_discipline_id:this.state.sub_discipline_id,
|
||||||
|
tag_discipline_id:tag_discipline_id,
|
||||||
|
public: this.state.defaultActiveKey,
|
||||||
|
difficulty: this.state.difficulty,
|
||||||
|
item_type: this.state.item_type,
|
||||||
|
keywords: null,
|
||||||
|
page: 1,
|
||||||
|
per_page:10,
|
||||||
|
oj_status:null,
|
||||||
|
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
|
||||||
|
};
|
||||||
|
this.getdata(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
//初始化
|
||||||
|
componentDidMount() {
|
||||||
|
const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false;
|
||||||
|
const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false;
|
||||||
|
const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false;
|
||||||
|
let {defaultActiveKey} = this.props;
|
||||||
|
var defaultActiveKeys=defaultActiveKey;
|
||||||
|
if(isysladmins===true||(is_teacher===true&&professional_certification===true)){
|
||||||
|
defaultActiveKeys="0"
|
||||||
|
}else{
|
||||||
|
defaultActiveKeys="1"
|
||||||
|
}
|
||||||
|
this.callback(defaultActiveKeys);
|
||||||
|
let url = `/users/get_navigation_info.json`;
|
||||||
|
axios.get(url, {}).then((response) => {
|
||||||
|
// //////console.log("开始请求/get_navigation_info.json");
|
||||||
|
// //////console.log(response);
|
||||||
|
if (response != undefined) {
|
||||||
|
if (response.status === 200) {
|
||||||
|
this.setState({
|
||||||
|
Headertop: response.data.top,
|
||||||
|
Footerdown: response.data.down
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.getbasket_listdata();
|
||||||
|
|
||||||
|
//获取题库筛选资料
|
||||||
|
let urls = `/disciplines.json`;
|
||||||
|
axios.get(urls, {params: {
|
||||||
|
source:"question"
|
||||||
|
}}).then((response) => {
|
||||||
|
//console.log("Questiondisciplines");
|
||||||
|
//console.log(response.data);
|
||||||
|
if (response) {
|
||||||
|
this.setState({
|
||||||
|
disciplinesdata: response.data.disciplines,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidUpdate(prevProps) {
|
||||||
|
if(prevProps.current_user !== this.props.current_user) {
|
||||||
|
debugger
|
||||||
|
const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false;
|
||||||
|
const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false;
|
||||||
|
const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false;
|
||||||
|
let {defaultActiveKey} = this.props;
|
||||||
|
var defaultActiveKeys=defaultActiveKey;
|
||||||
|
if(isysladmins===true||(is_teacher===true&&professional_certification===true)){
|
||||||
|
defaultActiveKeys="0"
|
||||||
|
}else{
|
||||||
|
defaultActiveKeys="1"
|
||||||
|
}
|
||||||
|
this.callback(defaultActiveKeys);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//公共和我的
|
||||||
|
callback = (key) => {
|
||||||
|
this.setState({
|
||||||
|
defaultActiveKey: key,
|
||||||
|
selectallquestionsonthispages:false,
|
||||||
|
difficulty:null,
|
||||||
|
page:1,
|
||||||
|
oj_status:null
|
||||||
|
})
|
||||||
|
var data = {
|
||||||
|
discipline_id:this.state.discipline_id,
|
||||||
|
sub_discipline_id:this.state.sub_discipline_id,
|
||||||
|
tag_discipline_id:this.state.tag_discipline_id,
|
||||||
|
public: key,
|
||||||
|
item_type: this.state.item_type,
|
||||||
|
difficulty: null,
|
||||||
|
page: 1,
|
||||||
|
per_page:10,
|
||||||
|
oj_status:null,
|
||||||
|
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
|
||||||
|
};
|
||||||
|
this.getdata(data);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//刷新加载
|
||||||
|
getdata = (data) => {
|
||||||
|
const url = `/item_banks.json`;
|
||||||
|
this.setState({
|
||||||
|
booljupyterurls:true,
|
||||||
|
selectionbools:false,
|
||||||
|
})
|
||||||
|
axios.get((url), {params: data}).then((response) => {
|
||||||
|
setTimeout(()=>{
|
||||||
|
this.setState({
|
||||||
|
booljupyterurls:false,
|
||||||
|
})
|
||||||
|
},1000);
|
||||||
|
if (response === null || response === undefined) {
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
//////console.log("item_banks");
|
||||||
|
//////console.log(response);
|
||||||
|
this.setState({
|
||||||
|
Contentdata: response.data,
|
||||||
|
items_count: response.data.items_count,
|
||||||
|
})
|
||||||
|
this.getdataslen(response.data.items);
|
||||||
|
}).catch((error) => {
|
||||||
|
//////console.log(error)
|
||||||
|
this.setState({
|
||||||
|
booljupyterurls:false,
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//不刷新加载
|
||||||
|
getdatasy = (data) => {
|
||||||
|
const url = `/item_banks.json`;
|
||||||
|
this.setState({
|
||||||
|
selectionbools:false,
|
||||||
|
})
|
||||||
|
axios.get((url), {params: data}).then((response) => {
|
||||||
|
setTimeout(()=>{
|
||||||
|
|
||||||
|
},1000);
|
||||||
|
if (response === null || response === undefined) {
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
//////console.log("item_banks");
|
||||||
|
//////console.log(response);
|
||||||
|
this.setState({
|
||||||
|
Contentdata: response.data,
|
||||||
|
items_count: response.data.items_count,
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
this.getdataslen(response.data.items);
|
||||||
|
}).catch((error) => {
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//计算
|
||||||
|
getdataslen=(arr)=>{
|
||||||
|
var contes=0;
|
||||||
|
for(let data of arr) {
|
||||||
|
if(data.item_type==="PROGRAM"){
|
||||||
|
//编程题
|
||||||
|
if(data.choosed===true){
|
||||||
|
|
||||||
|
}else{
|
||||||
|
//未选用
|
||||||
|
if(data.program_attr.status===1){
|
||||||
|
//已发布
|
||||||
|
contes=contes+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
//不是编程题
|
||||||
|
if(data.choosed===true){
|
||||||
|
|
||||||
|
}else{
|
||||||
|
//未选用
|
||||||
|
contes=contes+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(contes>0){
|
||||||
|
this.setState({
|
||||||
|
selectionbools:false,
|
||||||
|
selectallquestionsonthispages:false,
|
||||||
|
})
|
||||||
|
}else {
|
||||||
|
this.setState({
|
||||||
|
selectionbools:true,
|
||||||
|
selectallquestionsonthispages:true,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
paginationonChange = (pageNumber) => {
|
||||||
|
this.setState({
|
||||||
|
page: pageNumber,
|
||||||
|
})
|
||||||
|
var data = {
|
||||||
|
discipline_id:this.state.discipline_id,
|
||||||
|
sub_discipline_id:this.state.sub_discipline_id,
|
||||||
|
tag_discipline_id:this.state.tag_discipline_id,
|
||||||
|
public: this.state.defaultActiveKey,
|
||||||
|
difficulty: this.state.difficulty,
|
||||||
|
item_type: this.state.item_type,
|
||||||
|
keywords: this.state.keywords,
|
||||||
|
page: pageNumber,
|
||||||
|
per_page:10,
|
||||||
|
oj_status:this.state.oj_status,
|
||||||
|
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
|
||||||
|
|
||||||
|
};
|
||||||
|
this.getdata(data);
|
||||||
|
}
|
||||||
|
showDrawer = () => {
|
||||||
|
if(this.state.visible===true){
|
||||||
|
this.setState({
|
||||||
|
visible: false,
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
this.setState({
|
||||||
|
visible: true,
|
||||||
|
});
|
||||||
|
this.getbasket_listdata();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
onClose = () => {
|
||||||
|
this.setState({
|
||||||
|
visible: false,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
onChange = e => {
|
||||||
|
this.setState({
|
||||||
|
placement: e.target.value,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
getContainer = () => {
|
||||||
|
return this.container;
|
||||||
|
};
|
||||||
|
saveContainer = container => {
|
||||||
|
this.container = container;
|
||||||
|
};
|
||||||
|
|
||||||
|
showmodels = (id) => {
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
modalsType: true,
|
||||||
|
titilesm: "在平台审核后,所有成员均可使用试题",
|
||||||
|
titiless: "是否设置为公开?",
|
||||||
|
titbool: true,
|
||||||
|
timuid: id
|
||||||
|
})
|
||||||
|
};
|
||||||
|
showmodelysl = (id) => {
|
||||||
|
this.setState({
|
||||||
|
modalsType: true,
|
||||||
|
titilesm: "确认删除后,无法撤销",
|
||||||
|
titiless: "是否确认删除?",
|
||||||
|
titbool: false,
|
||||||
|
timuid: id
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
modalCancel = () => {
|
||||||
|
this.setState({
|
||||||
|
modalsType: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
modalCancels=()=>{
|
||||||
|
this.setState({
|
||||||
|
modalsTypes: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
showQuestionModals =(item_type)=>{
|
||||||
|
this.setState({
|
||||||
|
modalsTypes: true,
|
||||||
|
titilesms:item_type,
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
setDownloads=(item_type)=>{
|
||||||
|
this.Deletebigquestiontype(item_type);
|
||||||
|
this.setState({
|
||||||
|
modalsTypes: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
setDownload = () => {
|
||||||
|
//确认
|
||||||
|
if (this.state.titbool === true) {
|
||||||
|
//公开
|
||||||
|
this.publicopentimu(this.state.timuid);
|
||||||
|
} else {
|
||||||
|
// 删除
|
||||||
|
this.deletetimu(this.state.timuid);
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
modalsType: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
setdifficulty = (difficulty) => {
|
||||||
|
this.setState({
|
||||||
|
difficulty: difficulty,
|
||||||
|
visiblemys: false,
|
||||||
|
page: 1,
|
||||||
|
per_page:10,
|
||||||
|
keywords:"",
|
||||||
|
oj_status:null
|
||||||
|
})
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
discipline_id:this.state.discipline_id,
|
||||||
|
sub_discipline_id:this.state.sub_discipline_id,
|
||||||
|
tag_discipline_id:this.state.tag_discipline_id,
|
||||||
|
public: this.state.defaultActiveKey,
|
||||||
|
difficulty: difficulty,
|
||||||
|
item_type: this.state.item_type,
|
||||||
|
keywords:null,
|
||||||
|
page:1,
|
||||||
|
per_page:10,
|
||||||
|
oj_status:null,
|
||||||
|
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getdata(data);
|
||||||
|
|
||||||
|
}
|
||||||
|
setitem_types = (item_type) => {
|
||||||
|
this.setState({
|
||||||
|
item_type: item_type,
|
||||||
|
visiblemyss: false,
|
||||||
|
page: 1,
|
||||||
|
per_page:10,
|
||||||
|
keywords:"",
|
||||||
|
oj_status:null
|
||||||
|
})
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
discipline_id:this.state.discipline_id,
|
||||||
|
sub_discipline_id:this.state.sub_discipline_id,
|
||||||
|
tag_discipline_id:this.state.tag_discipline_id,
|
||||||
|
public: this.state.defaultActiveKey,
|
||||||
|
difficulty: this.state.difficulty,
|
||||||
|
item_type: item_type,
|
||||||
|
page: 1,
|
||||||
|
per_page:10,
|
||||||
|
keywords:null,
|
||||||
|
oj_status:null,
|
||||||
|
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getdata(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
handleVisibleChange = (boll) => {
|
||||||
|
if (this.state.visiblemyss === true) {
|
||||||
|
this.setState({
|
||||||
|
visiblemys: boll,
|
||||||
|
visiblemyss: false,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.setState({
|
||||||
|
visiblemys: boll,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
handleVisibleChanges = (boll) => {
|
||||||
|
if (this.state.visiblemys === true) {
|
||||||
|
this.setState({
|
||||||
|
visiblemyss: boll,
|
||||||
|
visiblemys: false,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.setState({
|
||||||
|
visiblemyss: boll,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
setdatafunsval = (e) => {
|
||||||
|
this.setState({
|
||||||
|
keywords: e.target.value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
setdatafuns = (value) => {
|
||||||
|
this.setState({
|
||||||
|
keywords: value,
|
||||||
|
})
|
||||||
|
var data = {
|
||||||
|
discipline_id:this.state.discipline_id,
|
||||||
|
sub_discipline_id:this.state.sub_discipline_id,
|
||||||
|
tag_discipline_id:this.state.tag_discipline_id,
|
||||||
|
public: this.state.defaultActiveKey,
|
||||||
|
difficulty: this.state.difficulty,
|
||||||
|
item_type: this.state.item_type,
|
||||||
|
keywords: value,
|
||||||
|
page: this.state.page,
|
||||||
|
per_page:10,
|
||||||
|
oj_status:this.state.oj_status,
|
||||||
|
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getdata(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
deletetimu = (id) => {
|
||||||
|
|
||||||
|
const url = `/item_banks/${id}.json`;
|
||||||
|
axios.delete(url)
|
||||||
|
.then((response) => {
|
||||||
|
if (response.data.status == 0) {
|
||||||
|
// this.props.showNotification('删除试题成功')
|
||||||
|
// props.history.push(response.data.right_url)
|
||||||
|
var data = {
|
||||||
|
discipline_id:this.state.discipline_id,
|
||||||
|
sub_discipline_id:this.state.sub_discipline_id,
|
||||||
|
tag_discipline_id:this.state.tag_discipline_id,
|
||||||
|
public: this.state.defaultActiveKey,
|
||||||
|
difficulty: this.state.difficulty,
|
||||||
|
item_type: this.state.item_type,
|
||||||
|
keywords: this.state.keywords,
|
||||||
|
page: this.state.page,
|
||||||
|
per_page:10,
|
||||||
|
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
|
||||||
|
};
|
||||||
|
this.getdata(data);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
////console.log(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
publicopentimu = (id) => {
|
||||||
|
|
||||||
|
const url = `/item_banks/${id}/set_public.json`;
|
||||||
|
axios.post(url)
|
||||||
|
.then((result) => {
|
||||||
|
if (result.data.status == 0) {
|
||||||
|
// this.props.showNotification(`公开题目成功`);
|
||||||
|
var data = {
|
||||||
|
discipline_id:this.state.discipline_id,
|
||||||
|
sub_discipline_id:this.state.sub_discipline_id,
|
||||||
|
tag_discipline_id:this.state.tag_discipline_id,
|
||||||
|
public: this.state.defaultActiveKey,
|
||||||
|
difficulty: this.state.difficulty,
|
||||||
|
item_type: this.state.item_type,
|
||||||
|
keywords: this.state.keywords,
|
||||||
|
page: this.state.page,
|
||||||
|
per_page:10,
|
||||||
|
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
|
||||||
|
|
||||||
|
};
|
||||||
|
this.getdata(data);
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
////console.log(error);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
getbasket_listdata = () => {
|
||||||
|
// 获取试题篮展开的数据
|
||||||
|
// const url = "/item_baskets/basket_list.json";
|
||||||
|
// axios.get(url)
|
||||||
|
// .then((result) => {
|
||||||
|
// // ////console.log("getbasket_listdata");
|
||||||
|
// // ////console.log(result.data);
|
||||||
|
// this.setState({
|
||||||
|
// completion_questions_count: result.data.completion_questions_count,
|
||||||
|
// judgement_questions_count: result.data.judgement_questions_count,
|
||||||
|
// multiple_questions_count: result.data.multiple_questions_count,
|
||||||
|
// practical_questions_count: result.data.practical_questions_count,
|
||||||
|
// program_questions_count: result.data.program_questions_count,
|
||||||
|
// single_questions_count: result.data.single_questions_count,
|
||||||
|
// subjective_questions_count: result.data.subjective_questions_count,
|
||||||
|
// })
|
||||||
|
//
|
||||||
|
// }).catch((error) => {
|
||||||
|
// // ////console.log(error);
|
||||||
|
// this.setState({
|
||||||
|
// completion_questions_count: 0,
|
||||||
|
// judgement_questions_count: 0,
|
||||||
|
// multiple_questions_count: 0,
|
||||||
|
// practical_questions_count: 0,
|
||||||
|
// program_questions_count: 0,
|
||||||
|
// single_questions_count: 0,
|
||||||
|
// subjective_questions_count: 0,
|
||||||
|
// })
|
||||||
|
// })
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//选用
|
||||||
|
getitem_baskets=(data)=>{
|
||||||
|
//选用题型可以上传单个 或者多个题型
|
||||||
|
let url="";
|
||||||
|
if(this.props.exam_id===undefined){
|
||||||
|
url="/item_baskets.json";
|
||||||
|
}else{
|
||||||
|
url="/examination_items.json";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
axios.post(url, data)
|
||||||
|
.then((result) => {
|
||||||
|
if (result.data.status == 0) {
|
||||||
|
// this.props.showNotification(`选用成功`);
|
||||||
|
var data = {
|
||||||
|
discipline_id:this.state.discipline_id,
|
||||||
|
sub_discipline_id:this.state.sub_discipline_id,
|
||||||
|
tag_discipline_id:this.state.tag_discipline_id,
|
||||||
|
public: this.state.defaultActiveKey,
|
||||||
|
difficulty: this.state.difficulty,
|
||||||
|
item_type: this.state.item_type,
|
||||||
|
keywords: this.state.keywords,
|
||||||
|
page: this.state.page,
|
||||||
|
per_page:10,
|
||||||
|
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
|
||||||
|
};
|
||||||
|
this.getdatasy(data);
|
||||||
|
this.getbasket_listdata();
|
||||||
|
// this.setState({
|
||||||
|
// visible:true
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
////console.log(error);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 撤销
|
||||||
|
getitem_basketss=(id)=>{
|
||||||
|
let url="";
|
||||||
|
if(this.props.exam_id===undefined){
|
||||||
|
url=`/item_baskets/${id}.json`;
|
||||||
|
axios.delete(url)
|
||||||
|
.then((result) => {
|
||||||
|
if (result.data.status == 0) {
|
||||||
|
// this.props.showNotification(`撤销成功`);
|
||||||
|
var data = {
|
||||||
|
discipline_id:this.state.discipline_id,
|
||||||
|
sub_discipline_id:this.state.sub_discipline_id,
|
||||||
|
tag_discipline_id:this.state.tag_discipline_id,
|
||||||
|
public: this.state.defaultActiveKey,
|
||||||
|
difficulty: this.state.difficulty,
|
||||||
|
item_type: this.state.item_type,
|
||||||
|
keywords: this.state.keywords,
|
||||||
|
page: this.state.page,
|
||||||
|
per_page:10,
|
||||||
|
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
|
||||||
|
};
|
||||||
|
this.getdatasy(data);
|
||||||
|
this.getbasket_listdata();
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
////console.log(error);
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
url=`/examination_banks/${this.props.exam_id}/revoke_item.json`;
|
||||||
|
axios.delete(url,{ data: {
|
||||||
|
item_id:id===undefined?"":parseInt(id),
|
||||||
|
}})
|
||||||
|
.then((result) => {
|
||||||
|
if (result.data.status == 0) {
|
||||||
|
// this.props.showNotification(`撤销成功`);
|
||||||
|
var data = {
|
||||||
|
discipline_id:this.state.discipline_id,
|
||||||
|
sub_discipline_id:this.state.sub_discipline_id,
|
||||||
|
tag_discipline_id:this.state.tag_discipline_id,
|
||||||
|
public: this.state.defaultActiveKey,
|
||||||
|
difficulty: this.state.difficulty,
|
||||||
|
item_type: this.state.item_type,
|
||||||
|
keywords: this.state.keywords,
|
||||||
|
page: this.state.page,
|
||||||
|
per_page:10,
|
||||||
|
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
|
||||||
|
};
|
||||||
|
this.getdatasy(data);
|
||||||
|
this.getbasket_listdata();
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
////console.log(error);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
//全选试题库
|
||||||
|
selectallquestionsonthispage=()=>{
|
||||||
|
var item_idsdata=[];
|
||||||
|
|
||||||
|
var arr= this.state.Contentdata.items;
|
||||||
|
for(let data of arr) {
|
||||||
|
if(data.item_type==="PROGRAM"){
|
||||||
|
//编程题
|
||||||
|
if(data.choosed===true){
|
||||||
|
|
||||||
|
}else{
|
||||||
|
//未选用
|
||||||
|
if(data.program_attr.status===1){
|
||||||
|
//已发布
|
||||||
|
item_idsdata.push(data.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
//不是编程题
|
||||||
|
if(data.choosed===true){
|
||||||
|
|
||||||
|
}else{
|
||||||
|
//未选用
|
||||||
|
item_idsdata.push(data.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
const data={
|
||||||
|
item_ids:item_idsdata,
|
||||||
|
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
|
||||||
|
}
|
||||||
|
this.getitem_baskets(data);
|
||||||
|
this.setState({
|
||||||
|
selectallquestionsonthispages:true,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//全选的状态
|
||||||
|
|
||||||
|
//删除大题型
|
||||||
|
Deletebigquestiontype =(item_type)=>{
|
||||||
|
const url=`/item_baskets/delete_item_type.json`;
|
||||||
|
axios.delete((url), { data: {
|
||||||
|
item_type:item_type
|
||||||
|
}})
|
||||||
|
.then((response) => {
|
||||||
|
if (response.data.status == 0) {
|
||||||
|
// this.props.showNotification('删除成功');
|
||||||
|
var data = {
|
||||||
|
discipline_id:this.state.discipline_id,
|
||||||
|
sub_discipline_id:this.state.sub_discipline_id,
|
||||||
|
tag_discipline_id:this.state.tag_discipline_id,
|
||||||
|
public: this.state.defaultActiveKey,
|
||||||
|
difficulty: this.state.difficulty,
|
||||||
|
item_type: this.state.item_type,
|
||||||
|
keywords: this.state.keywords,
|
||||||
|
page: this.state.page,
|
||||||
|
per_page:10,
|
||||||
|
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
|
||||||
|
};
|
||||||
|
this.getdata(data);
|
||||||
|
this.getbasket_listdata();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
////console.log(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//跳转
|
||||||
|
gotopaperreview=()=>{
|
||||||
|
|
||||||
|
this.props.history.replace("/paperreview");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
setoj_status=(oj_status)=>{
|
||||||
|
//编程题发布未发布
|
||||||
|
this.setState({
|
||||||
|
selectallquestionsonthispages:false,
|
||||||
|
difficulty:null,
|
||||||
|
oj_status:oj_status
|
||||||
|
})
|
||||||
|
var data = {
|
||||||
|
discipline_id:this.state.discipline_id,
|
||||||
|
sub_discipline_id:this.state.sub_discipline_id,
|
||||||
|
tag_discipline_id:this.state.tag_discipline_id,
|
||||||
|
public: this.state.defaultActiveKey,
|
||||||
|
difficulty: this.state.difficulty,
|
||||||
|
item_type: this.state.item_type,
|
||||||
|
keywords: this.state.keywords,
|
||||||
|
page: this.state.page,
|
||||||
|
per_page:10,
|
||||||
|
oj_status:oj_status,
|
||||||
|
exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id),
|
||||||
|
};
|
||||||
|
this.getdata(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let {
|
||||||
|
page, per_page, items_count, Headertop, visible, placement, modalsType, modalsTypes,basket_list,
|
||||||
|
completion_questions_count, judgement_questions_count, multiple_questions_count, practical_questions_count,
|
||||||
|
program_questions_count, single_questions_count, subjective_questions_count,selectionbools
|
||||||
|
} = this.state;
|
||||||
|
|
||||||
|
const Datacount = completion_questions_count + judgement_questions_count
|
||||||
|
+ multiple_questions_count + practical_questions_count
|
||||||
|
+ program_questions_count
|
||||||
|
+ single_questions_count
|
||||||
|
+ subjective_questions_count;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="newMain clearfix " ref={this.saveContainer}>
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
visible===true?
|
||||||
|
<style>
|
||||||
|
{
|
||||||
|
`
|
||||||
|
.newHeaders{
|
||||||
|
position: fixed;
|
||||||
|
top: 0px;
|
||||||
|
z-index: 999 !important;
|
||||||
|
}
|
||||||
|
.ant-drawer {
|
||||||
|
z-index: 800 !important;
|
||||||
|
}
|
||||||
|
.ant-notification{
|
||||||
|
position: fixed;
|
||||||
|
z-index: 1500 !important;
|
||||||
|
}
|
||||||
|
.newFooter{
|
||||||
|
position: relative;
|
||||||
|
z-index: 9999999 ;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
:""
|
||||||
|
}
|
||||||
|
{
|
||||||
|
visible===true?
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
marginTop: "60px"
|
||||||
|
}}></div>
|
||||||
|
:""}
|
||||||
|
{
|
||||||
|
modalsTypes===true?
|
||||||
|
<QuestionModals {...this.props}{...this.state} modalsTypes={modalsTypes} modalCancels={() => this.modalCancels()}
|
||||||
|
setDownloads={(e) => this.setDownloads(e)}></QuestionModals>
|
||||||
|
:""
|
||||||
|
}
|
||||||
|
{
|
||||||
|
modalsType===true?
|
||||||
|
<QuestionModal {...this.props}{...this.state} modalsType={modalsType} modalCancel={() => this.modalCancel()}
|
||||||
|
setDownload={() => this.setDownload()}></QuestionModal>
|
||||||
|
:""
|
||||||
|
}
|
||||||
|
|
||||||
|
{/*顶部*/}
|
||||||
|
|
||||||
|
<Headplugselections
|
||||||
|
disciplinesdata={this.state.disciplinesdata}
|
||||||
|
{...this.props}
|
||||||
|
{...this.state}
|
||||||
|
setdifficulty={(e) => this.setdifficulty(e)}
|
||||||
|
setitem_types={(e) => this.setitem_types(e)}
|
||||||
|
setdiscipline_id={(e)=>this.setdiscipline_id(e)}
|
||||||
|
setsub_discipline_id={(e)=>this.setsub_discipline_id(e)}
|
||||||
|
settag_discipline_id={(e)=>this.settag_discipline_id(e)}
|
||||||
|
/>
|
||||||
|
{/*头部*/}
|
||||||
|
<Contentpart {...this.state} {...this.props}
|
||||||
|
exam_id={this.props.exam_id}
|
||||||
|
Isitapopup={"true"}
|
||||||
|
getitem_basketss={(id)=>this.getitem_basketss(id)}
|
||||||
|
selectallquestionsonthispage={()=>this.selectallquestionsonthispage()}
|
||||||
|
getitem_baskets={(e)=>this.getitem_baskets(e)}
|
||||||
|
setdatafuns={(e) => this.setdatafuns(e)}
|
||||||
|
setdatafunsval={(e) => this.setdatafunsval(e)}
|
||||||
|
handleVisibleChanges={(e) => this.handleVisibleChanges(e)}
|
||||||
|
handleVisibleChange={(e) => this.handleVisibleChange(e)}
|
||||||
|
showmodels={(e) => this.showmodels(e)}
|
||||||
|
showmodelysl={(e) => this.showmodelysl(e)}
|
||||||
|
callback={(e) => this.callback(e)}
|
||||||
|
setoj_status={(e)=>this.setoj_status(e)}></Contentpart>
|
||||||
|
|
||||||
|
{
|
||||||
|
items_count&&items_count>10?
|
||||||
|
<div className="mb30 clearfix educontent mt40 intermediatecenter">
|
||||||
|
<Pagination showQuickJumper current={page} onChange={this.paginationonChange}
|
||||||
|
pageSize={per_page}
|
||||||
|
total={items_count}></Pagination>
|
||||||
|
</div>
|
||||||
|
:<div className="h30 clearfix educontent mt40 intermediatecenter">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
<Bottomsubmit {...this.props} {...this.state} bottomvalue={"确定"}
|
||||||
|
Cohetepaperbool={true}
|
||||||
|
setCohetepaperbool={() => this.props.setnewmyshixunmodelbool(false)}
|
||||||
|
onSubmits={() => this.props.setnewmyshixunmodelbool(false)} url={'/paperlibrary'}></Bottomsubmit>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export default NewMyShixunModel;
|
@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* 抛物线动画函数
|
||||||
|
* @param ballWrapper 小球的父容器
|
||||||
|
* @param origin 动画起点DOM
|
||||||
|
* @param target 动画目标DOM
|
||||||
|
* @param time 持续时间
|
||||||
|
* @param a 抛物线参数
|
||||||
|
* @param offset 动画尺寸
|
||||||
|
* @param callback 回调
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function parabola(config) {
|
||||||
|
const {
|
||||||
|
ballWrapper,
|
||||||
|
origin,
|
||||||
|
target,
|
||||||
|
time = 1000,
|
||||||
|
a = 0.004,
|
||||||
|
callback,
|
||||||
|
finish,
|
||||||
|
offset = 0
|
||||||
|
} =
|
||||||
|
config || {};
|
||||||
|
const ballWrapperDimension = ballWrapper.getBoundingClientRect();
|
||||||
|
const originDimension = origin.getBoundingClientRect();
|
||||||
|
const targetDimension = target.getBoundingClientRect();
|
||||||
|
const x1 = originDimension.left + 0.5 * originDimension.width;
|
||||||
|
const y1 = originDimension.top + 0.5 * originDimension.height;
|
||||||
|
const x2 = targetDimension.left + 0.5 * targetDimension.width;
|
||||||
|
const y2 = targetDimension.top + 0.5 * targetDimension.height;
|
||||||
|
const diffx = x2 - x1;
|
||||||
|
const diffy = y2 - y1;
|
||||||
|
const speedx = diffx / time;
|
||||||
|
const b = (diffy - a * diffx * diffx) / diffx;
|
||||||
|
|
||||||
|
const refPoint_x = x1 - ballWrapperDimension.left - 0.5 * offset;
|
||||||
|
const refPoint_y = y1 - ballWrapperDimension.top - 0.5 * offset;
|
||||||
|
|
||||||
|
const start = Date.now();
|
||||||
|
const timer = setInterval(() => {
|
||||||
|
if (Date.now() - start > time) {
|
||||||
|
finish();
|
||||||
|
clearInterval(timer);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const x = speedx * (Date.now() - start);
|
||||||
|
const y = a * x * x + b * x;
|
||||||
|
callback && callback(refPoint_x + x, refPoint_y + y);
|
||||||
|
}, 15);
|
||||||
|
}
|
@ -1,640 +0,0 @@
|
|||||||
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,
|
|
||||||
AutoComplete,
|
|
||||||
Col, Row, InputNumber, DatePicker, Button, Tag
|
|
||||||
} from "antd";
|
|
||||||
import './../questioncss/questioncom.css';
|
|
||||||
|
|
||||||
const InputGroup = Input.Group;
|
|
||||||
const {Option} = Select;
|
|
||||||
|
|
||||||
class Comthetestpapers 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,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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) {
|
|
||||||
data.push({
|
|
||||||
rbnd: parseInt(values.rbnd)
|
|
||||||
})
|
|
||||||
data.push({
|
|
||||||
rbtx: values.rbtx
|
|
||||||
})
|
|
||||||
data.push({
|
|
||||||
rbzsd: this.state.Knowpoints
|
|
||||||
})
|
|
||||||
data.push({
|
|
||||||
rbkc: values.rbkc
|
|
||||||
})
|
|
||||||
data.push({
|
|
||||||
classroom:values.classroom
|
|
||||||
})
|
|
||||||
data.push({
|
|
||||||
kssc:values.kssc
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return data;
|
|
||||||
|
|
||||||
}
|
|
||||||
handleSubmit = (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
this.props.form.validateFields((err, values) => {
|
|
||||||
if (!err) {
|
|
||||||
////console.log("获取的form 数据");
|
|
||||||
////console.log(values);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handleFormLayoutChange = (value) => {
|
|
||||||
//难度塞选
|
|
||||||
////console.log("难度塞选");
|
|
||||||
////console.log(value);
|
|
||||||
this.props.form.setFieldsValue({
|
|
||||||
rbnd: value + "",
|
|
||||||
});
|
|
||||||
this.setState({
|
|
||||||
rbnd: value + "",
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
handleFormkechen = (value) => {
|
|
||||||
//课程
|
|
||||||
////console.log("课程");
|
|
||||||
////console.log(value);
|
|
||||||
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) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
handleSearch=(value)=>{
|
|
||||||
|
|
||||||
|
|
||||||
if(value!=""){
|
|
||||||
this.props.form.setFieldsValue({
|
|
||||||
classroom:value,
|
|
||||||
// course:value
|
|
||||||
});
|
|
||||||
// this.Searchvalue(value)
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
handleChange=(e)=>{
|
|
||||||
console.log(e);
|
|
||||||
this.props.form.setFieldsValue({
|
|
||||||
// course:value,
|
|
||||||
classroom:e.target.value,
|
|
||||||
})
|
|
||||||
if(e.target.value){
|
|
||||||
if(e.target.value.length>60){
|
|
||||||
this.setState({
|
|
||||||
bordebool:true,
|
|
||||||
})
|
|
||||||
}else if(e.target.value.length===0){
|
|
||||||
this.setState({
|
|
||||||
bordebool:true,
|
|
||||||
})
|
|
||||||
}else{
|
|
||||||
this.setState({
|
|
||||||
bordebool:false,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
this.setState({
|
|
||||||
bordebool:true
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
render() {
|
|
||||||
let {page,options} = this.state;
|
|
||||||
const {getFieldDecorator} = this.props.form;
|
|
||||||
const optionss = this.state.searchlist && this.state.searchlist.map(d => <Option key={d.name} value={d.name}>{d.name}</Option>);
|
|
||||||
var addonAfterthree=this.props.form&&this.props.form.getFieldValue('classroom');
|
|
||||||
var addonAfteronelens3=0;
|
|
||||||
if(addonAfterthree){
|
|
||||||
addonAfteronelens3=String(addonAfterthree).length;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
|
|
||||||
<div className=" clearfix educontent Contentquestionbankstyle w100s w1200fpx mt19">
|
|
||||||
<style>
|
|
||||||
{
|
|
||||||
`
|
|
||||||
.ant-form-item{
|
|
||||||
margin-bottom: 0px !important;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
.ant-form-explain{
|
|
||||||
padding-left:0px !important;
|
|
||||||
margin-top: 3px !important;
|
|
||||||
}
|
|
||||||
.ant-select-selection{
|
|
||||||
height: 33px !important;
|
|
||||||
}
|
|
||||||
.ant-input-group{
|
|
||||||
width:258px !important;
|
|
||||||
}
|
|
||||||
.ant-input {
|
|
||||||
height: 33px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):focus-within {
|
|
||||||
outline: 0px solid rgba(24, 144, 255, 0.06) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
`
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<div className="h12"></div>
|
|
||||||
<Form onSubmit={this.handleSubmit}>
|
|
||||||
<div className="kechen">
|
|
||||||
<Form.Item
|
|
||||||
label="课程:"
|
|
||||||
>
|
|
||||||
{getFieldDecorator("rbkc",
|
|
||||||
{
|
|
||||||
rules: [{required: true, message: '请选择课程'}],
|
|
||||||
}
|
|
||||||
)(
|
|
||||||
<div className="sortinxdirection">
|
|
||||||
<InputGroup compact>
|
|
||||||
<Cascader style={{width: '258px'}} value={this.state.rbkc} options={options} onChange={this.handleFormzhishidian}
|
|
||||||
placeholder="请选择..."/>
|
|
||||||
</InputGroup>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</Form.Item>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="zsdd">
|
|
||||||
<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>
|
|
||||||
</div>
|
|
||||||
<style>
|
|
||||||
{
|
|
||||||
`
|
|
||||||
.ml19{
|
|
||||||
margin-left:19px;
|
|
||||||
}
|
|
||||||
`
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<div className="stud-class-set ">
|
|
||||||
<style>{
|
|
||||||
`
|
|
||||||
.yslzxueshis .ant-input{
|
|
||||||
border-right: none !important;
|
|
||||||
height: 38px !important;
|
|
||||||
width: 970px !important;
|
|
||||||
}
|
|
||||||
.yslzxueshisy span .ant-input-group-addon{
|
|
||||||
width: 65px !important;
|
|
||||||
background-color: #fafafa!important;
|
|
||||||
}
|
|
||||||
.yslzxueshisy .ant-input-group-addon{
|
|
||||||
width: 65px !important;
|
|
||||||
background-color: #fafafa!important;
|
|
||||||
}
|
|
||||||
|
|
||||||
`
|
|
||||||
}</style>
|
|
||||||
<div className="sjmc">
|
|
||||||
<Form.Item label="试卷名称:">
|
|
||||||
{getFieldDecorator('classroom', {
|
|
||||||
rules: [{required: true, message: "不能为空"}],
|
|
||||||
})(
|
|
||||||
|
|
||||||
<AutoComplete
|
|
||||||
onSearch={this.handleSearch}
|
|
||||||
className={"fl construction yslzxueshis "}
|
|
||||||
dataSource={optionss}
|
|
||||||
>
|
|
||||||
<Input className="yslzxueshisy " placeholder="例如:数据结构" onInput={this.handleChange} addonAfter={String(addonAfteronelens3)+"/60"} maxLength={60} />
|
|
||||||
</AutoComplete>
|
|
||||||
)}
|
|
||||||
<div id='isclassroom'></div>
|
|
||||||
</Form.Item>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<style>
|
|
||||||
{
|
|
||||||
`
|
|
||||||
.kssc .ant-form-item-label{
|
|
||||||
line-height: 38px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
`
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<div className="kssc">
|
|
||||||
|
|
||||||
<Form.Item label="考试时长:">
|
|
||||||
{getFieldDecorator('kssc')(<InputNumber
|
|
||||||
min={0}
|
|
||||||
step={0.1}
|
|
||||||
></InputNumber>)}
|
|
||||||
<span className="ant-form-text"> 分钟</span>
|
|
||||||
</Form.Item>
|
|
||||||
</div>
|
|
||||||
{/*<div className="tixing">*/}
|
|
||||||
{/*<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>*/}
|
|
||||||
{/*</div>*/}
|
|
||||||
|
|
||||||
<style>
|
|
||||||
{
|
|
||||||
`
|
|
||||||
.rbndclass .ant-radio-button-wrapper{
|
|
||||||
width:106px !important;
|
|
||||||
height:33px !important;
|
|
||||||
background:#EEEEEE;
|
|
||||||
border-radius:17px !important;
|
|
||||||
color:#333333;
|
|
||||||
text-align: center !important;
|
|
||||||
border:0px !important;
|
|
||||||
margin-right: 27px !important;
|
|
||||||
margin-top: 6px !important;
|
|
||||||
|
|
||||||
}
|
|
||||||
.rbndclass .ant-radio-button-wrapper-checked {
|
|
||||||
width: 106px !important;
|
|
||||||
height: 33px !important;
|
|
||||||
background: #4CACFF !important;
|
|
||||||
border-radius: 17px !important;
|
|
||||||
text-align: center !important;
|
|
||||||
border:0px !important;
|
|
||||||
color: #ffffff !important;
|
|
||||||
margin-right: 27px !important;
|
|
||||||
margin-top: 6px!important;
|
|
||||||
|
|
||||||
}
|
|
||||||
.rbndclass .ant-radio-button-wrapper:not(:first-child)::before{
|
|
||||||
border:0px !important;
|
|
||||||
width:0px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rbndclass .ant-radio-button-wrapper{
|
|
||||||
border:0px !important;
|
|
||||||
}
|
|
||||||
.rbndclass .ant-radio-group{
|
|
||||||
border:0px !important;
|
|
||||||
}
|
|
||||||
.rbndclass .ant-radio-group label{
|
|
||||||
border:0px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rbndclass .ant-radio-group span{
|
|
||||||
border:0px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
ant-radio-button-wrapper:focus-within {
|
|
||||||
outline: 0px solid #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
`
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<div className="rbndclass">
|
|
||||||
<Form.Item label="难度:">
|
|
||||||
{getFieldDecorator('rbnd',
|
|
||||||
{
|
|
||||||
rules: [{required: true, message: '请选择难度'}],
|
|
||||||
}
|
|
||||||
)(
|
|
||||||
<Radio.Group 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>
|
|
||||||
<div className="h20"></div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
const Comthetestpaperss = Form.create({name: 'Itembankstops'})(Comthetestpapers);
|
|
||||||
export default Comthetestpaperss;
|
|
@ -0,0 +1,831 @@
|
|||||||
|
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,Icon
|
||||||
|
} from "antd";
|
||||||
|
import './../questioncss/questioncom.css';
|
||||||
|
import Newknledpots from '../component/Newknledpots';
|
||||||
|
import Ldanxuan from './lntlligentpone';
|
||||||
|
const InputGroup = Input.Group;
|
||||||
|
const {Option} = Select;
|
||||||
|
//Itembankstop Comthetestpaperst 题库的
|
||||||
|
class Intelligentcomponents extends Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.contentMdRef = React.createRef()
|
||||||
|
this.state = {
|
||||||
|
page: 1,
|
||||||
|
Knowpoints: [],
|
||||||
|
rbtx: undefined,
|
||||||
|
rbkc: undefined,
|
||||||
|
knowledgepoints: [],
|
||||||
|
knowledgepoints2:[],
|
||||||
|
options: [],
|
||||||
|
NewknTypedel:false,
|
||||||
|
boolred:false,
|
||||||
|
rbly:"1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setboolred=(bool)=>{
|
||||||
|
this.setState({
|
||||||
|
boolred:bool
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
//初始化
|
||||||
|
componentDidMount() {
|
||||||
|
try {
|
||||||
|
this.props.getJudquestio(this);
|
||||||
|
} catch (e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
options: this.props.disciplmy,
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidUpdate(prevProps) {
|
||||||
|
//编辑的时候
|
||||||
|
if (prevProps.disciplmy !== this.props.disciplmy) {
|
||||||
|
this.setState({
|
||||||
|
options: this.props.disciplmy
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
handdisciplinesChange =(name,title)=>{
|
||||||
|
this.setState({
|
||||||
|
rbkc:[name.id,title.id]
|
||||||
|
})
|
||||||
|
this.props.form.setFieldsValue({
|
||||||
|
rbkc: [name.id,title.id],
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
handleSearch=(value)=>{
|
||||||
|
|
||||||
|
|
||||||
|
if(value!=""){
|
||||||
|
this.props.form.setFieldsValue({
|
||||||
|
classroom:value,
|
||||||
|
// course:value
|
||||||
|
});
|
||||||
|
// this.Searchvalue(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
handleChange=(e)=>{
|
||||||
|
//console.log(e);
|
||||||
|
|
||||||
|
if(e.target.value){
|
||||||
|
if(e.target.value.length>60){
|
||||||
|
this.setState({
|
||||||
|
bordebool:true,
|
||||||
|
})
|
||||||
|
}else if(e.target.value.length===0){
|
||||||
|
this.setState({
|
||||||
|
bordebool:true,
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
this.setState({
|
||||||
|
bordebool:false,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
this.setState({
|
||||||
|
bordebool:true
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
handletag_disciplinesChange = (data) => {
|
||||||
|
//是否选中的知识点
|
||||||
|
try {
|
||||||
|
var sju=data[data.length-1].name;
|
||||||
|
this.setState({
|
||||||
|
Knowpoints:data,
|
||||||
|
})
|
||||||
|
this.props.form.setFieldsValue({
|
||||||
|
rbzsd: sju,
|
||||||
|
});
|
||||||
|
}catch (e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
onChange = (e) => {
|
||||||
|
|
||||||
|
}
|
||||||
|
Getdatas = () => {
|
||||||
|
return this.handleSubmits();
|
||||||
|
}
|
||||||
|
handleSubmits = () => {
|
||||||
|
var dxt=0;
|
||||||
|
var dxtx=0;
|
||||||
|
var pdt=0;
|
||||||
|
var bct=0;
|
||||||
|
try {
|
||||||
|
dxt=this.$dxt.mygetinputnumber();
|
||||||
|
}catch (e) {
|
||||||
|
dxt=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
dxtx=this.$ddxt.mygetinputnumber();
|
||||||
|
}catch (e) {
|
||||||
|
dxtx=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
pdt=this.$pdt.mygetinputnumber();
|
||||||
|
}catch (e) {
|
||||||
|
pdt=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
bct=this.$bct.mygetinputnumber();
|
||||||
|
}catch (e) {
|
||||||
|
bct=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var data = [];
|
||||||
|
this.props.form.validateFields((err, values) => {
|
||||||
|
data = [];
|
||||||
|
if (!err) {
|
||||||
|
data.push({
|
||||||
|
rbnd: parseInt(values.rbnd)
|
||||||
|
})
|
||||||
|
data.push({
|
||||||
|
rbzsd: this.state.Knowpoints
|
||||||
|
})
|
||||||
|
data.push({
|
||||||
|
rbkc: values.rbkc
|
||||||
|
})
|
||||||
|
data.push({
|
||||||
|
rbdxt: dxt
|
||||||
|
})
|
||||||
|
data.push({
|
||||||
|
rbdxtx: dxtx
|
||||||
|
})
|
||||||
|
data.push({
|
||||||
|
rbpdt: pdt
|
||||||
|
})
|
||||||
|
data.push({
|
||||||
|
rbbct: bct
|
||||||
|
})
|
||||||
|
data.push({
|
||||||
|
rbly: parseInt(values.rbly)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
handleSubmit = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
this.props.form.validateFields((err, values) => {
|
||||||
|
if (!err) {
|
||||||
|
//////console.log("获取的form 数据");
|
||||||
|
//////console.log(values);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
handleFormLayoutChanges = (e) => {
|
||||||
|
// //console.log("handleFormLayoutChanges");
|
||||||
|
// //console.log(value);
|
||||||
|
// debugger
|
||||||
|
//来源
|
||||||
|
this.props.form.setFieldsValue({
|
||||||
|
rbly: e.target.value + "",
|
||||||
|
});
|
||||||
|
this.setState({
|
||||||
|
rbly: e.target.value + "",
|
||||||
|
})
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.props.getdatassssy(e.target.value);
|
||||||
|
}catch (e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
handleFormLayoutChange = (e) => {
|
||||||
|
// //console.log("handleFormLayoutChange");
|
||||||
|
// //console.log(value);
|
||||||
|
// debugger
|
||||||
|
//难度塞选
|
||||||
|
this.props.form.setFieldsValue({
|
||||||
|
rbnd: e.target.value + "",
|
||||||
|
});
|
||||||
|
this.setState({
|
||||||
|
rbnd: e.target.value + "",
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
this.props.getdatass(parseInt(e.target.value));
|
||||||
|
}catch (e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
handleFormkechen = (value) => {
|
||||||
|
//课程
|
||||||
|
if(this.state.Knowpoints.length>4){
|
||||||
|
this.props.showNotification(`知识点最多选择5个`);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var valuename = undefined;
|
||||||
|
this.props.form.setFieldsValue({
|
||||||
|
rbzsd: value,
|
||||||
|
});
|
||||||
|
|
||||||
|
var arr = this.state.knowledgepoints;
|
||||||
|
for (let data of arr) {
|
||||||
|
if (data.id === value) {
|
||||||
|
this.state.Knowpoints.push(data);
|
||||||
|
valuename = data.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const _result =[];
|
||||||
|
this.state.knowledgepoints.filter(item => {
|
||||||
|
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
|
||||||
|
_result.push(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
rbzsd: valuename,
|
||||||
|
Knowpoints: this.state.Knowpoints,
|
||||||
|
knowledgepoints2: _result,
|
||||||
|
})
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.props.getdatassss(this.state.Knowpoints);
|
||||||
|
}catch (e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
handleFormzhishidian = (value) => {
|
||||||
|
//console.log("handleFormzhishidian 课程");
|
||||||
|
//console.log(value);
|
||||||
|
|
||||||
|
//课程
|
||||||
|
this.props.form.setFieldsValue({
|
||||||
|
rbkc: value,
|
||||||
|
});
|
||||||
|
this.setState({
|
||||||
|
rbkc:value,
|
||||||
|
})
|
||||||
|
// //console.log("handleFormzhishidian");
|
||||||
|
// //console.log(this.props.disciplinesdata);
|
||||||
|
|
||||||
|
const didata = this.props.disciplinesdata;
|
||||||
|
const knowledgepointsdata = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < didata.length; i++) {
|
||||||
|
//方向
|
||||||
|
if (value[0] === didata[i].id) {
|
||||||
|
const fxdidata = didata[i].sub_disciplines;
|
||||||
|
for (var j = 0; j < fxdidata.length; j++) {
|
||||||
|
//课程
|
||||||
|
if (value[1] === fxdidata[j].id) {
|
||||||
|
const zsddata = fxdidata[j].tag_disciplines;
|
||||||
|
for (var k = 0; k < zsddata.length; k++) {
|
||||||
|
//知识点
|
||||||
|
knowledgepointsdata.push(zsddata[k]);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
Knowpoints: [],
|
||||||
|
knowledgepoints: knowledgepointsdata,
|
||||||
|
knowledgepoints2:knowledgepointsdata,
|
||||||
|
})
|
||||||
|
|
||||||
|
this.props.form.setFieldsValue({
|
||||||
|
rbzsd: undefined,
|
||||||
|
});
|
||||||
|
this.setState({
|
||||||
|
rbzsd: undefined,
|
||||||
|
})
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.props.getdatasss(parseInt(value[1]));
|
||||||
|
}catch (e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 tmp = this.state.Knowpoints;
|
||||||
|
for (var i = 0; i < tmp.length; i++) {
|
||||||
|
if (i ===index) {
|
||||||
|
tmp.splice(i,1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.props.form.setFieldsValue({
|
||||||
|
rbzsd: this.state.Knowpoints,
|
||||||
|
});
|
||||||
|
|
||||||
|
const _result =[];
|
||||||
|
this.state.knowledgepoints.filter(item => {
|
||||||
|
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
|
||||||
|
_result.push(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.setState({
|
||||||
|
Knowpoints: this.state.Knowpoints,
|
||||||
|
knowledgepoints2:_result,
|
||||||
|
})
|
||||||
|
if (this.state.Knowpoints.length === 0) {
|
||||||
|
this.setState({
|
||||||
|
rbzsd: undefined,
|
||||||
|
})
|
||||||
|
} else if (this.state.Knowpoints.length > 0) {
|
||||||
|
try {
|
||||||
|
const myknowda = this.state.Knowpoints;
|
||||||
|
this.setState({
|
||||||
|
rbzsd: myknowda[this.state.Knowpoints.length - 1].name,
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//删除知识点
|
||||||
|
try {
|
||||||
|
this.props.getdatassss(this.state.Knowpoints);
|
||||||
|
}catch (e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
NewknTypedeldel=(bool)=>{
|
||||||
|
if(this.state.rbkc===undefined || this.state.rbkc===null || this.state.rbkc===""){
|
||||||
|
this.props.showNotification(`请选择课程方向`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
NewknTypedel:bool
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
NewknTypedeltyoedel=(value)=>{
|
||||||
|
var knowledgepointmys= this.state.knowledgepoints;
|
||||||
|
for(let myda of knowledgepointmys) {
|
||||||
|
if(myda.name===value){
|
||||||
|
this.props.showNotification(`重复的知识点`);
|
||||||
|
this.setboolred(true);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(value===null||value===""){
|
||||||
|
this.props.showNotification(`请输入知识点`);
|
||||||
|
this.setboolred(true);
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if(value.length===0){
|
||||||
|
this.props.showNotification(`请输入知识点`);
|
||||||
|
this.setboolred(true);
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var data={
|
||||||
|
name:value,
|
||||||
|
sub_discipline_id:this.state.rbkc[1]
|
||||||
|
}
|
||||||
|
const url="/tag_disciplines.json";
|
||||||
|
axios.post(url,data)
|
||||||
|
.then((result) => {
|
||||||
|
if (result.data.status === 0) {
|
||||||
|
// this.props.showNotification(`新增知识点成功!`);
|
||||||
|
var leydata={
|
||||||
|
id: result.data.tag_discipline_id,
|
||||||
|
name:value,
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.state.Knowpoints.length>=5){
|
||||||
|
this.state.knowledgepoints.push(leydata);
|
||||||
|
const _result =[];
|
||||||
|
this.state.knowledgepoints.filter(item => {
|
||||||
|
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
|
||||||
|
_result.push(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
Knowpoints: this.state.Knowpoints,
|
||||||
|
knowledgepoints: this.state.knowledgepoints,
|
||||||
|
knowledgepoints2: _result,
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
this.state.Knowpoints.push(leydata);
|
||||||
|
this.state.knowledgepoints.push(leydata);
|
||||||
|
const _result =[];
|
||||||
|
this.state.knowledgepoints.filter(item => {
|
||||||
|
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
|
||||||
|
_result.push(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.setState({
|
||||||
|
Knowpoints: this.state.Knowpoints,
|
||||||
|
knowledgepoints: this.state.knowledgepoints,
|
||||||
|
knowledgepoints2: _result,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
////console.log(error);
|
||||||
|
})
|
||||||
|
//新增知识点
|
||||||
|
try {
|
||||||
|
this.getdatassss(this.state.Knowpoints);
|
||||||
|
}catch (e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
NewknTypedel:false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let {page, options,NewknTypedel,knowledgepoints,knowledgepoints2,Knowpoints} = this.state;
|
||||||
|
const {getFieldDecorator} = this.props.form;
|
||||||
|
const optionss = this.state.searchlist && this.state.searchlist.map(d => <Option key={d.name} value={d.name}>{d.name}</Option>);
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
.kechen .ant-input-group{
|
||||||
|
width:258px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.zsdd .ant-input-group{
|
||||||
|
width:258px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sjmc .ant-input-group{
|
||||||
|
width:258px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kssc .ant-input-group{
|
||||||
|
width:258px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rbndclass .ant-input-group{
|
||||||
|
width:258px !important;
|
||||||
|
}
|
||||||
|
.ant-input {
|
||||||
|
height: 33px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):focus-within {
|
||||||
|
outline: 0px solid rgba(24, 144, 255, 0.06) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
`
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div className="h12"></div>
|
||||||
|
{
|
||||||
|
NewknTypedel?
|
||||||
|
<Newknledpots {...this.state} {...this.props}
|
||||||
|
boolred={this.state.boolred}
|
||||||
|
setboolred={(bool)=>this.setboolred(bool)}
|
||||||
|
NewknTypedeldel={(bool)=>this.NewknTypedeldel(bool)}
|
||||||
|
NewknTypedeltyoedel={(value)=>this.NewknTypedeltyoedel(value)}
|
||||||
|
></Newknledpots>
|
||||||
|
:""
|
||||||
|
}
|
||||||
|
|
||||||
|
<Form onSubmit={this.handleSubmit}>
|
||||||
|
<div className="kechen">
|
||||||
|
<div className="sortinxdirection">
|
||||||
|
<Form.Item
|
||||||
|
label="课程"
|
||||||
|
>
|
||||||
|
{getFieldDecorator("rbkc"
|
||||||
|
,
|
||||||
|
{initialValue: this.state.rbkc,
|
||||||
|
rules: [{required: true, message: '请选择课程'}],
|
||||||
|
}
|
||||||
|
)(
|
||||||
|
<Cascader style={{width: '258px'}} options={options} onChange={this.handleFormzhishidian}
|
||||||
|
placeholder="请选择..."/>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="zsdd">
|
||||||
|
<Form.Item
|
||||||
|
label="知识点"
|
||||||
|
>
|
||||||
|
{getFieldDecorator("rbzsd"
|
||||||
|
)(
|
||||||
|
<div className="sortinxdirection">
|
||||||
|
<InputGroup compact>
|
||||||
|
<Select style={{width: '258px'}} value={undefined} onChange={this.handleFormkechen}
|
||||||
|
placeholder="请选择...">
|
||||||
|
{knowledgepoints2 && knowledgepoints2.map((object, index) => {
|
||||||
|
return (
|
||||||
|
<Option key={object.id} value={object.id}>{object.name}</Option>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</Select>
|
||||||
|
</InputGroup>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<img className=" ml22 zjzsdian xiaoshou" src={getImageUrl("images/educoder/zjzsd.png")} onClick={()=>this.NewknTypedeldel(true)}/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
</div>
|
||||||
|
{
|
||||||
|
this.state.Knowpoints===undefined||this.state.Knowpoints===null?"":
|
||||||
|
this.state.Knowpoints.length>0?
|
||||||
|
<div className="sortinxdirection huanhan w100s mt15" style={{
|
||||||
|
minHeight: "33px",
|
||||||
|
lineHeight: "28px",
|
||||||
|
}}>
|
||||||
|
{this.state.Knowpoints === undefined ? "" : this.state.Knowpoints.map((object, index) => {
|
||||||
|
return (
|
||||||
|
<div key={index} className={index===0?"mytagss mb20":"mytagss"} style={{
|
||||||
|
position: "relative",
|
||||||
|
}}>
|
||||||
|
<p className="w100s stestcen lh32">{object.name}</p>
|
||||||
|
|
||||||
|
<img className=" ml7 zjzsdian xiaoshou icondowncolorssy" onClick={() => this.deletesobject(object, index)} src={getImageUrl("images/educoder/bzucha.png")}/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
:
|
||||||
|
""
|
||||||
|
}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
{
|
||||||
|
`
|
||||||
|
.rbndclasss .ant-radio-button-wrapper{
|
||||||
|
width:106px !important;
|
||||||
|
height:33px !important;
|
||||||
|
background:#EEEEEE;
|
||||||
|
border-radius:2px;
|
||||||
|
color:#333333;
|
||||||
|
text-align: center !important;
|
||||||
|
border:0px !important;
|
||||||
|
margin-right: 27px !important;
|
||||||
|
margin-top: 6px !important;
|
||||||
|
|
||||||
|
}
|
||||||
|
.rbndclasss .ant-radio-button-wrapper-checked {
|
||||||
|
width: 106px !important;
|
||||||
|
height: 33px !important;
|
||||||
|
background: #4CACFF !important;
|
||||||
|
border-radius:2px;
|
||||||
|
text-align: center !important;
|
||||||
|
border:0px !important;
|
||||||
|
color: #ffffff !important;
|
||||||
|
margin-right: 27px !important;
|
||||||
|
margin-top: 6px!important;
|
||||||
|
|
||||||
|
}
|
||||||
|
.rbndclasss .ant-radio-button-wrapper:not(:first-child)::before{
|
||||||
|
border:0px !important;
|
||||||
|
width:0px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rbndclasss .ant-radio-button-wrapper{
|
||||||
|
border:0px !important;
|
||||||
|
}
|
||||||
|
.rbndclasss .ant-radio-group{
|
||||||
|
border:0px !important;
|
||||||
|
}
|
||||||
|
.rbndclasss .ant-radio-group label{
|
||||||
|
border:0px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rbndclasss .ant-radio-group span{
|
||||||
|
border:0px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
ant-radio-button-wrapper:focus-within {
|
||||||
|
outline: 0px solid #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
`
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div className="rbndclasss">
|
||||||
|
<Form.Item label="来源">
|
||||||
|
{getFieldDecorator('rbly'
|
||||||
|
,
|
||||||
|
{initialValue: this.state.rbly,
|
||||||
|
}
|
||||||
|
)(
|
||||||
|
<Radio.Group onChange={this.handleFormLayoutChanges}>
|
||||||
|
<Radio.Button value="1">公共</Radio.Button>
|
||||||
|
<Radio.Button value="0">我的</Radio.Button>
|
||||||
|
</Radio.Group>,
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p className="conditionsetting mt40">条件设置</p>
|
||||||
|
<div className="hengxians mt13"></div>
|
||||||
|
|
||||||
|
|
||||||
|
<style>
|
||||||
|
{
|
||||||
|
`
|
||||||
|
.rbndclass .ant-radio-button-wrapper{
|
||||||
|
width:106px !important;
|
||||||
|
height:33px !important;
|
||||||
|
background:#EEEEEE;
|
||||||
|
border-radius:17px !important;
|
||||||
|
color:#333333;
|
||||||
|
text-align: center !important;
|
||||||
|
border:0px !important;
|
||||||
|
margin-right: 27px !important;
|
||||||
|
margin-top: 6px !important;
|
||||||
|
|
||||||
|
}
|
||||||
|
.rbndclass .ant-radio-button-wrapper-checked {
|
||||||
|
width: 106px !important;
|
||||||
|
height: 33px !important;
|
||||||
|
background: #4CACFF !important;
|
||||||
|
border-radius: 17px !important;
|
||||||
|
text-align: center !important;
|
||||||
|
border:0px !important;
|
||||||
|
color: #ffffff !important;
|
||||||
|
margin-right: 27px !important;
|
||||||
|
margin-top: 6px!important;
|
||||||
|
|
||||||
|
}
|
||||||
|
.rbndclass .ant-radio-button-wrapper:not(:first-child)::before{
|
||||||
|
border:0px !important;
|
||||||
|
width:0px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rbndclass .ant-radio-button-wrapper{
|
||||||
|
border:0px !important;
|
||||||
|
}
|
||||||
|
.rbndclass .ant-radio-group{
|
||||||
|
border:0px !important;
|
||||||
|
}
|
||||||
|
.rbndclass .ant-radio-group label{
|
||||||
|
border:0px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rbndclass .ant-radio-group span{
|
||||||
|
border:0px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
ant-radio-button-wrapper:focus-within {
|
||||||
|
outline: 0px solid #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
`
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div className="rbndclass">
|
||||||
|
<Form.Item label="试卷难度">
|
||||||
|
{getFieldDecorator('rbnd'
|
||||||
|
,
|
||||||
|
{initialValue: this.state.rbnd,
|
||||||
|
rules: [{required: true, message: '请选择难度'}],
|
||||||
|
}
|
||||||
|
)(
|
||||||
|
<Radio.Group 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>
|
||||||
|
{
|
||||||
|
this.props.single_question_count===0&&this.props.multiple_question_count===0&&this.props.judgement_question_count===0&&
|
||||||
|
this.props.program_question_count===0?
|
||||||
|
""
|
||||||
|
:
|
||||||
|
<div>
|
||||||
|
<p className={"conditionsettings mt40"}>题型及数量</p>
|
||||||
|
<div className={"hengxians mt13"}></div>
|
||||||
|
<Ldanxuan {...this.state} {...this.props} dxtx={"单选题:"} mycount={this.props.single_question_count} getdatas={()=>this.props.getdatas()} ref={dom => {
|
||||||
|
this.$dxt = dom;
|
||||||
|
}}></Ldanxuan>
|
||||||
|
<Ldanxuan {...this.state} {...this.props} dxtx={"多选题:"} mycount={this.props.multiple_question_count} getdatas={()=>this.props.getdatas()} ref={dom => {
|
||||||
|
this.$ddxt = dom;
|
||||||
|
}}></Ldanxuan>
|
||||||
|
<Ldanxuan {...this.state} {...this.props} dxtx={"判断题:"} mycount={this.props.judgement_question_count} getdatas={()=>this.props.getdatas()} ref={dom => {
|
||||||
|
this.$pdt = dom;
|
||||||
|
}}></Ldanxuan>
|
||||||
|
<Ldanxuan {...this.state} {...this.props} dxtx={"编程题:"} mycount={this.props.program_question_count} getdatas={()=>this.props.getdatas()} ref={dom => {
|
||||||
|
this.$bct = dom;
|
||||||
|
}}></Ldanxuan>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
<div className="h20"></div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const Intelligentcomponentss = Form.create({name: 'Intelligentcomponents'})(Intelligentcomponents);
|
||||||
|
export default Intelligentcomponentss;
|
@ -0,0 +1,169 @@
|
|||||||
|
import React, {Component} from "react";
|
||||||
|
import {Link, NavLink} from 'react-router-dom';
|
||||||
|
import {WordsBtn, ActionBtn, getImageUrl, markdownToHTML} from 'educoder';
|
||||||
|
import axios from 'axios';
|
||||||
|
import {
|
||||||
|
notification,
|
||||||
|
Spin,
|
||||||
|
Table,
|
||||||
|
Pagination,
|
||||||
|
Drawer,
|
||||||
|
Input,
|
||||||
|
Button,
|
||||||
|
Breadcrumb,
|
||||||
|
Icon,
|
||||||
|
InputNumber,
|
||||||
|
Tooltip
|
||||||
|
} from "antd";
|
||||||
|
import '../questioncss/questioncom.css';
|
||||||
|
|
||||||
|
//判断题
|
||||||
|
class lntlligentpone extends Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
count: 0,
|
||||||
|
countbool: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//初始化
|
||||||
|
componentDidMount() {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
increase = () => {
|
||||||
|
|
||||||
|
const datasbool=this.props.getdatas();
|
||||||
|
// if(datasbool===undefined || datasbool===null){
|
||||||
|
// if(this.props.mycount===0){
|
||||||
|
// this.props.showNotification(`题数为0无法增加题目`);
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
const count = this.state.count + 1;
|
||||||
|
if(count<=this.props.mycount){
|
||||||
|
this.setState({count: count, countbool: false});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
decline = () => {
|
||||||
|
const datasbool=this.props.getdatas();
|
||||||
|
// if(datasbool===undefined || datasbool===null){
|
||||||
|
// if(this.props.mycount===0){
|
||||||
|
// this.props.showNotification(`题数为0无法减少题目`);
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
let count = this.state.count - 1;
|
||||||
|
if (count < 0) {
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
this.setState({count: count, countbool: false});
|
||||||
|
};
|
||||||
|
inputsnumber = (value) => {
|
||||||
|
const datasbool=this.props.getdatas();
|
||||||
|
// if(datasbool===undefined || datasbool===null){
|
||||||
|
// if(this.props.mycount===0){
|
||||||
|
// this.setState({count: 0, countbool: false});
|
||||||
|
// this.props.showNotification(`题数为0无法输入`);
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
if(this.props.mycount===0){
|
||||||
|
this.setState({count: 0, countbool: false});
|
||||||
|
}else {
|
||||||
|
this.setState({count: value, countbool: false});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//返回数据
|
||||||
|
mygetinputnumber=()=>{
|
||||||
|
return this.state.count;
|
||||||
|
}
|
||||||
|
isNumber=(val)=>{
|
||||||
|
var regPos = /^\d+(\.\d+)?$/; //非负浮点数
|
||||||
|
var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数
|
||||||
|
if(regPos.test(val) && regNeg.test(val)){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let {questions, totalscore, total, items} = this.state;
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<p className="dxuantitie mt19">{this.props.dxtx}</p>
|
||||||
|
{
|
||||||
|
this.props.mycount===0?
|
||||||
|
<div className="sortinxdirection mt10 inpustredssdiv">
|
||||||
|
<Tooltip placement="top" title={"题数为0无法减少"}>
|
||||||
|
<Button disabled={this.props.mycount===0?true:false} onClick={this.decline}>
|
||||||
|
<Icon type="minus"/>
|
||||||
|
</Button>
|
||||||
|
</Tooltip>
|
||||||
|
<div className={this.state.countbool === true ? "inpustredss ml12 mr12" : "ml12 mr12"}>
|
||||||
|
|
||||||
|
<Tooltip placement="top" title={"题数为0无法输入"}>
|
||||||
|
<InputNumber
|
||||||
|
disabled={this.props.mycount===0?true:false}
|
||||||
|
min={0}
|
||||||
|
value={this.state.count}
|
||||||
|
onChange={this.inputsnumber}
|
||||||
|
></InputNumber>
|
||||||
|
</Tooltip>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<Tooltip placement="top" title={"题数为0无法增加"}>
|
||||||
|
<Button disabled={this.props.mycount===0?true:false} onClick={this.increase}>
|
||||||
|
<Icon type="plus"/>
|
||||||
|
</Button>
|
||||||
|
</Tooltip>
|
||||||
|
|
||||||
|
<p className={"ml23 lh32"}>共{this.props.mycount}道</p>
|
||||||
|
</div>
|
||||||
|
:
|
||||||
|
|
||||||
|
<div className="sortinxdirection mt10 inpustredssdiv">
|
||||||
|
<Button onClick={this.decline}>
|
||||||
|
<Icon type="minus"/>
|
||||||
|
</Button>
|
||||||
|
<div className={this.state.countbool === true ? "inpustredss ml12 mr12" : "ml12 mr12"}>
|
||||||
|
<InputNumber
|
||||||
|
min={0}
|
||||||
|
value={this.state.count}
|
||||||
|
onChange={this.inputsnumber}
|
||||||
|
></InputNumber>
|
||||||
|
</div>
|
||||||
|
<Button onClick={this.increase}>
|
||||||
|
<Icon type="plus"/>
|
||||||
|
</Button>
|
||||||
|
<p className={"ml23 lh32"}>共{this.props.mycount}道</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export default lntlligentpone
|
||||||
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe ExaminationIntelligentSetting, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe ExaminationTypeSetting, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
Loading…
Reference in new issue