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

dev_new_shixunsrepository
杨树林 5 years ago
commit cb2ae414e3

@ -12,7 +12,7 @@ class Admins::ExaminationAuthenticationsController < Admins::BaseController
ActiveRecord::Base.transaction do
exam = ExaminationBank.find current_apply.container_id
current_apply.update!(status: 1)
exam.update!(public: 0)
exam.update!(public: 1)
end
render_success_js
end

@ -16,7 +16,7 @@ class Admins::ItemAuthenticationsController < Admins::BaseController
ActiveRecord::Base.transaction do
item = ItemBank.find current_apply.container_id
current_apply.update!(status: 1)
item.update!(public: 0)
item.update!(public: 1)
end
render_success_js
end

@ -50,8 +50,11 @@ class ExaminationBanksController < ApplicationController
end
def destroy
@exam.destroy!
render_ok
ActiveRecord::Base.transaction do
ApplyAction.where(container_type: "ExaminationBank", container_id: @exam.id).destroy_all
@exam.destroy!
render_ok
end
end
def set_public

@ -1,6 +1,6 @@
class ExaminationIntelligentSettingsController < ApplicationController
before_action :require_login
before_action :find_exam, only: [:exchange_one_item, :exchange_items]
before_action :find_exam, only: [:exchange_one_item, :exchange_items, :save_exam]
def optinal_items
sub_discipline_id = params[:sub_discipline_id]
@ -26,6 +26,15 @@ class ExaminationIntelligentSettingsController < ApplicationController
render_error(ex.message)
end
def save_exam
new_exam = ExaminationBank.new(user: current_user)
# 保存试卷基础信息
ExaminationIntelligentSettings::SaveExaminationService.call(new_exam, save_params, @exam)
render_ok
rescue ApplicationService::Error => ex
render_error(ex.message)
end
def exchange_one_item
item = @exam.item_baskets.find_by!(id: params[:item_id])
exam_type_setting = @exam.examination_type_settings.find_by!(item_type: item.item_type)
@ -86,4 +95,8 @@ class ExaminationIntelligentSettingsController < ApplicationController
def form_params
params.permit(:discipline_id, :sub_discipline_id, :difficulty, :source, tag_discipline_id: [], question_settings: %i[item_type count])
end
def save_params
params.permit(:name, :duration)
end
end

@ -39,8 +39,11 @@ class ItemBanksController < ApplicationController
end
def destroy
@item.destroy!
render_ok
ActiveRecord::Base.transaction do
ApplyAction.where(container_type: "ItemBank", container_id: @item.id).destroy_all
@item.destroy!
render_ok
end
end
def set_public

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

@ -7,6 +7,10 @@ class ExaminationBank < ApplicationRecord
has_many :examination_items, -> {order(position: :asc)}, dependent: :destroy
def apply?
!public && ApplyAction.where(container_type: "ExaminationBank", container_id: id, status: 0).exists?
end
def question_count
examination_items.size
end

@ -18,6 +18,10 @@ class ItemBank < ApplicationRecord
item_analysis&.analysis
end
def apply?
!public && ApplyAction.where(container_type: "ItemBank", container_id: id, status: 0).exists?
end
def type_string
result = case item_type
when "SINGLE"

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

@ -1,8 +1,9 @@
json.exams @exams.each do |exam|
json.(exam, :id, :name, :difficulty, :quotes)
json.(exam, :id, :name, :difficulty, :quotes, :public)
json.question_count exam.question_count
json.total_score exam.total_score
json.update_time exam.updated_at&.strftime("%Y-%m-%d %H:%M")
json.apply exam.apply?
json.author do
json.login exam.user&.login
json.name exam.user&.full_name

@ -3,6 +3,7 @@ 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.apply item.apply?
json.author do
json.login item.user&.login
json.name item.user&.full_name

@ -102,6 +102,7 @@ Rails.application.routes.draw do
end
member do
post :save_exam
post :exchange_one_item
post :exchange_items
end

@ -0,0 +1,5 @@
class AddIntelligentToExam < ActiveRecord::Migration[5.2]
def change
add_column :examination_banks, :intelligent, :boolean, default: false
end
end

@ -4,7 +4,7 @@
* @Github:
* @Date: 2020-01-06 16:20:03
* @LastEditors : tangjiang
* @LastEditTime : 2020-01-06 17:13:19
* @LastEditTime : 2020-01-09 09:45:29
-->
## QuillForEditor 使用 [https://quilljs.com/]
@ -21,7 +21,7 @@
| autoFocus | 自动获得焦点 |
| options | 配置参数, 指定工具栏内容 |
| value | 文本编辑器内容 |
| imgAttrs | 指定上传图片的尺寸 |
| imgAttrs | 指定上传图片的尺寸 { width: 'xxpx}, height: 'xxpx'|
| style | 指定quill容器样式 |
| wrapStyle | 指定包裹quill容器的样式|
| onContentChange | 当编辑器内容变化时调用此回调函数(注: 此时返回的内容为对象,提交到后台时需要格式成 JSON 字符串: JSON.stringify(xx)) |

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-12-18 08:49:30
* @LastEditors : tangjiang
* @LastEditTime : 2020-01-06 16:45:50
* @LastEditTime : 2020-01-09 11:01:51
*/
import './index.scss';
import 'quill/dist/quill.core.css'; // 核心样式
@ -18,11 +18,12 @@ import deepEqual from './deepEqual.js'
import { fetchUploadImage } from '../../services/ojService.js';
import { getImageUrl } from 'educoder'
import ImageBlot from './ImageBlot';
import { Modal } from 'antd';
// import Toolbar from 'quill/modules/toolbar';
import FillBlot from './FillBlot';
const Size = Quill.import('attributors/style/size');
const Font = Quill.import('formats/font');
const { confirm } = Modal;
// const Color = Quill.import('attributes/style/color');
Size.whitelist = ['12px', '14px', '16px', '18px', '20px', false];
Font.whitelist = ['SimSun', 'SimHei','Microsoft-YaHei','KaiTi','FangSong','Arial','Times-New-Roman','sans-serif'];
@ -36,6 +37,7 @@ Quill.register(Font, true);
Quill.register(FillBlot);
// Quill.register(Color);
function QuillForEditor ({
placeholder,
readOnly,
@ -79,10 +81,44 @@ function QuillForEditor ({
const renderOptions = options || defaultConfig;
const bindings = {
tab: {
key: 9,
handler: function () {
console.log('调用了tab=====>>>>');
}
},
enter: {
key: 'Enter',
handler: function () {
console.log('enter====>>>>>>');
}
},
backspace: {
key: 'Backspace',
handler: function (range, context) {
console.log('调用了删除按钮', range, context);
// 1. 获取删除的文件
// 2. 判断删除的文件中包含空格的个数
// 3. 循环调用删除方法
const r = window.confirm('确定要删除吗?')
console.log('+++++', quill);
if (r) {
// 调用传入的删除事件
return true
} else {
return false;
}
}
}
};
// quill 配置信息
const quillOption = {
modules: {
toolbar: renderOptions
toolbar: renderOptions,
keyboard: {
bindings: bindings
}
// toolbar: {
// container: renderOptions
// }
@ -98,8 +134,14 @@ function QuillForEditor ({
const quillNode = document.createElement('div');
editorRef.current.appendChild(quillNode);
const _quill = new Quill(editorRef.current, quillOption);
setQuill(_quill);
// _quill.keyboard.addBinding({
// key: 'tab'
// }, function (range, context) {
// console.log('点击了键盘的删除按钮: ', range, context);
// });
setQuill(_quill);
// 处理图片上传功能
_quill.getModule('toolbar').addHandler('image', (e) => {
const input = document.createElement('input');
@ -142,6 +184,12 @@ function QuillForEditor ({
// 点击填空图标时,插入一个下划线
// 1. 获取编辑器内容
});
// TODO
/**
* 1.获取键盘删除事件
* 2.点击时获取删除的叶子节点 getLeaf(range.index)
*/
}, []);
// 设置值
@ -232,6 +280,7 @@ function QuillForEditor ({
}, [quill, handleOnChange]);
useEffect(() => {
if (!quill) return;
if (autoFocus) {
quill.focus();
}

@ -530,20 +530,22 @@ class Coursesleftnav extends Component{
{name:value}).then((result)=>{
if(result!=undefined){
if(result.data.status===0){
// window.location.reload()
// this.updasaveNavmoda()
//
notification.open({
message:"提示",
description:result.data.message
});
trigger('updateNavSuccess')
if(positiontype==="files"){
this.updasaveNavmoda()
trigger('updateNavSuccess')
window.location.href=`/courses/${coursesId}/file/${result.data.category_id}`;
}
if(positiontype==="boards"){
this.updasaveNavmoda()
trigger('updateNavSuccess')
window.location.href=`/courses/${coursesId}/boards/${result.data.category_id}`;
}

@ -188,7 +188,7 @@ class ExerciseListItem extends Component{
{ IsAdmin &&<div className="homepagePostSetting" style={{"right":"-17px","top":"51px","display":"block","width":"200px"}}>
{ IsAdmin &&<div className="homepagePostSetting" style={{"right":"-17px","top":"46px","display":"block","width":"200px"}}>
<a className="btn colorblue font-16 ml20" onClick={()=>this.toDetailPage(`/courses/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情</a>
<Link className="btn colorblue font-16 ml20" to={`/courses/${coursesId}/exercises/${item.id}/edit`}>编辑</Link>
<Link className="btn colorblue ml20 font-16" to={`/courses/${coursesId}/exercises/${item.id}/student_exercise_list?tab=3`}>设置</Link>
@ -215,18 +215,18 @@ class ExerciseListItem extends Component{
{
IsStudent &&
<div className="homepagePostSetting" style={{"right":"0px","top":"62px","position":"absolute","display":"block"}}>
<div className="homepagePostSetting" style={{"right":"0px","top":"46px","position":"absolute","display":"block"}}>
<li className={"fl"}> <a className="btn colorblue font-16" onClick={()=>this.toDetailPage(`/courses/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情</a></li>
{item.current_status ===0&&item.exercise_status>1? <li className={"fl ml20"}> <Link className="btn colorblue font-16" to={`/courses/${coursesId}/exercises/${item.id}/users/${this.props.current_user.login}`}>继续答题</Link></li>:
item.current_status ===1&&item.exercise_status>1? <li className={"fl ml20"}> <a className="btn colorblue font-16" target="_blank" href={`/courses/${coursesId}/exercises/${item.id}/users/${this.props.current_user.login}`}>查看答题</a></li>:
item.current_status ===2&&item.exercise_status>1? <li className={"fl ml20"}s> <a className="btn colorblue ml20 font-16" onClick={()=>this.setgameexercise(`/courses/${coursesId}/exercises/${item.id}/users/${this.props.current_user.login}`)}>开始答题</a></li>:""}
item.current_status ===2&&item.exercise_status>1? <li className={"fl ml20"}s> <a className="btn colorblue font-16" onClick={()=>this.setgameexercise(`/courses/${coursesId}/exercises/${item.id}/users/${this.props.current_user.login}`)}>开始答题</a></li>:""}
</div>
}
{
this.props.isNotMember()? item.lock_status === 0 ?
""
: <div className="homepagePostSetting" style={{"right":"0px","top":"62px","position":"absolute","display":"block"}}>
: <div className="homepagePostSetting" style={{"right":"0px","top":"42px","position":"absolute","display":"block"}}>
<li> <a className="btn colorblue font-16" onClick={()=>this.toDetailPage(`/courses/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>查看详情</a></li>
</div>:""
}

@ -131,8 +131,11 @@ class Exercisesetting extends Component{
// }
// 已有设置数据的查询
getSettingInfo=()=>{
this.props.Commonheadofthetestpapers()
getSettingInfo=(type)=>{
if(type!=1){
this.props.Commonheadofthetestpapers()
}
let Id=this.props.match.params.Id;
let url=`/exercises/${Id}/exercise_setting.json`;
axios.get(url).then((result)=>{
@ -241,10 +244,10 @@ class Exercisesetting extends Component{
let{unified_setting}=this.state
if(unified_setting==true){
console.log("统一设置");
this.UnifiedSetting();
this.UnifiedSetting( );
}else{
console.log("非统一设置");
this.NotUnifiedSetting();
this.NotUnifiedSetting( );
}
}
})
@ -347,7 +350,7 @@ class Exercisesetting extends Component{
console.log(result)
if(result.status==200){
this.props.showNotification(`${result.data.message}`);
this.getSettingInfo();
this.getSettingInfo(1);
this.cancelEdit();
}
})
@ -367,7 +370,7 @@ class Exercisesetting extends Component{
if(result.status==200){
this.props.showNotification(`${result.data.message}`);
this.cancelEdit();
this.getSettingInfo();
this.getSettingInfo(1);
}
});
@ -559,7 +562,7 @@ class Exercisesetting extends Component{
}
//取消编辑
cancelEdit=()=>{
this.getSettingInfo();
this.getSettingInfo(1);
this.setState({
flagPageEdit:false
})

@ -51,6 +51,7 @@ class GraduationTaskssettinglist extends Component{
visibles:false,
DownloadType:false,
DownloadMessageval:undefined,
commentstate:null
}
}
@ -88,13 +89,13 @@ class GraduationTaskssettinglist extends Component{
course_groupslist:[],
checkAllValue:false
})
let {teacher_comment, task_status, course_group, cross_comment, order, b_order, search} = this.state;
this.seacthdata(teacher_comment, task_status, course_group, cross_comment, order, b_order, search,this.state.page);
let {commentstate, task_status, course_group, cross_comment, order, b_order, search} = this.state;
this.seacthdata(commentstate, task_status, course_group, cross_comment, order, b_order, search,this.state.page);
this.props.getsonar(teacher_comment, task_status, course_group, cross_comment, search)
this.props.getsonar(commentstate, task_status, course_group, cross_comment, search)
}
seacthdata=(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,pages)=>{
seacthdata=(commentstate,task_status,course_group,cross_comment,order,b_order,search,pages)=>{
let{page,limit}=this.state;
// console.log(teacher_comment,task_status,course_group,cross_comment,order,b_order,search)
@ -104,7 +105,7 @@ class GraduationTaskssettinglist extends Component{
//get 数组
axios.get(url,{
params: {
teacher_comment:teacher_comment===null?undefined:teacher_comment,
teacher_comment:commentstate===null||commentstate===undefined?undefined:commentstate,
task_status:task_status===null?undefined:task_status,
course_group:course_group===null?undefined:course_group,
cross_comment:cross_comment===null?undefined:cross_comment,
@ -229,7 +230,8 @@ class GraduationTaskssettinglist extends Component{
}
funteachercomment=(list,key)=> {
// console.log(e.target.value)
let asum=undefined
let {teacher_comment, task_status, course_group, cross_comment, order, b_order, search} = this.state;
if(this.state.teacher_comment!=null&&list.length>0){
if(this.state.teacher_comment.length>0){
@ -247,19 +249,29 @@ class GraduationTaskssettinglist extends Component{
if(listype===false){
this.setState({
teacher_comment:null,
loadingstate:true
loadingstate:true,
commentstate:null
})
}else{
if(list.length>0){
list.map((item,key)=>{
if(key===0){
asum=item;
}
})
}else{
asum=undefined
}
this.setState({
teacher_comment:list,
loadingstate:true
loadingstate:true,
commentstate:asum,
})
}
let newvalue=list.length===0?undefined:parseInt(list[0])
this.seacthdata(newvalue, task_status, course_group, cross_comment, order, b_order, search,this.state.page);
this.props.getsonar(newvalue, task_status, course_group, cross_comment, search)
this.seacthdata(asum, task_status, course_group, cross_comment, order, b_order, search,this.state.page);
this.props.getsonar(asum, task_status, course_group, cross_comment, search)
// if(list.length===key){
// this.seacthdata(undefined, task_status, course_group, cross_comment, order, b_order, search,this.state.page);
// this.props.getsonar(undefined, task_status, course_group, cross_comment, search)
@ -275,14 +287,14 @@ class GraduationTaskssettinglist extends Component{
funcross_comment=(e)=>{
let {teacher_comment, task_status, course_group, order, b_order, search} = this.state;
let {teacher_comment, task_status, course_group, order, b_order, search,commentstate} = this.state;
this.setState({
cross_comment:e.target.value===undefined||e.target.value===false?null:e.target.value,
loadingstate:true
})
this.seacthdata(teacher_comment, task_status, course_group, e.target.value===undefined||e.target.value===false?"":e.target.value, order, b_order, search,this.state.page);
this.props.getsonar(teacher_comment, task_status, course_group, e.target.value===undefined||e.target.value===false?"":e.target.value, search)
this.seacthdata(commentstate, task_status, course_group, e.target.value===undefined||e.target.value===false?"":e.target.value, order, b_order, search,this.state.page);
this.props.getsonar(commentstate, task_status, course_group, e.target.value===undefined||e.target.value===false?"":e.target.value, search)
}
inputSearchValue=(e)=>{
@ -302,24 +314,24 @@ class GraduationTaskssettinglist extends Component{
searchValue=()=>{
let {teacher_comment, task_status, course_group, cross_comment, order, b_order,search} = this.state;
let {teacher_comment, task_status, course_group, cross_comment, order, b_order,search,commentstate} = this.state;
this.setState({
loadingstate:true
})
this.seacthdata(teacher_comment, task_status, course_group, cross_comment, order, b_order, search,this.state.page);
this.props.getsonar(teacher_comment, task_status, course_group, cross_comment, search)
this.seacthdata(commentstate, task_status, course_group, cross_comment, order, b_order, search,this.state.page);
this.props.getsonar(commentstate, task_status, course_group, cross_comment, search)
}
funorder = (value, newb_order) => {
let {teacher_comment, task_status, course_group, cross_comment, b_order, search,order} = this.state;
let {teacher_comment, task_status, course_group, cross_comment, b_order, search,commentstate} = this.state;
this.setState({
order: value,
b_order: newb_order,
loadingstate: true
})
this.seacthdata(teacher_comment, task_status, course_group, cross_comment, value, newb_order, search,this.state.page);
this.props.getsonar(teacher_comment, task_status, course_group, cross_comment, search)
this.seacthdata(commentstate, task_status, course_group, cross_comment, value, newb_order, search,this.state.page);
this.props.getsonar(commentstate, task_status, course_group, cross_comment, search)
}
@ -327,7 +339,7 @@ class GraduationTaskssettinglist extends Component{
funtaskstatus=(checkedValues,key)=>{
// console.log(checkedValues)
let {teacher_comment, course_group, cross_comment, order, b_order, search} = this.state;
let {teacher_comment, course_group, cross_comment, order, b_order, search,commentstate} = this.state;
@ -339,8 +351,8 @@ class GraduationTaskssettinglist extends Component{
task_status:undefined,
loadingstate:true
})
this.seacthdata(teacher_comment, null, course_group, cross_comment, order, b_order, search,this.state.page);
this.props.getsonar(teacher_comment, null, course_group, cross_comment, search)
this.seacthdata(commentstate, null, course_group, cross_comment, order, b_order, search,this.state.page);
this.props.getsonar(commentstate, null, course_group, cross_comment, search)
}
// else if(checkedValues.length ===key){
// // 全部抖选中 自然就是查找全部 就是空
@ -356,8 +368,8 @@ class GraduationTaskssettinglist extends Component{
task_status:checkedValues===key?null:checkedValues,
loadingstate:true
})
this.seacthdata(teacher_comment, checkedValues===key?undefined:checkedValues, course_group, cross_comment, order, b_order, search,this.state.page);
this.props.getsonar(teacher_comment, checkedValues===key?undefined:checkedValues, course_group, cross_comment, search)
this.seacthdata(commentstate, checkedValues===key?undefined:checkedValues, course_group, cross_comment, order, b_order, search,this.state.page);
this.props.getsonar(commentstate, checkedValues===key?undefined:checkedValues, course_group, cross_comment, search)
}
@ -366,7 +378,7 @@ class GraduationTaskssettinglist extends Component{
// console.log(checkedValues);
// console.log(key);
let {teacher_comment, task_status, cross_comment, order,b_order, search} = this.state;
let {teacher_comment, task_status, cross_comment, order,b_order, search,commentstate} = this.state;
if(JSON.stringify(checkedValues) === "[]"){
// console.log(checkedValues);
@ -375,8 +387,8 @@ class GraduationTaskssettinglist extends Component{
course_group:undefined,
loadingstate:true
})
this.seacthdata(teacher_comment, task_status, null, cross_comment, order, b_order, search,this.state.page);
this.props.getsonar(teacher_comment,task_status, null, cross_comment, search)
this.seacthdata(commentstate, task_status, null, cross_comment, order, b_order, search,this.state.page);
this.props.getsonar(commentstate,task_status, null, cross_comment, search)
}
// else if(checkedValues.length ===key){
// // 全部抖选中 自然就是查找全部 就是空
@ -393,8 +405,8 @@ class GraduationTaskssettinglist extends Component{
course_group:checkedValues===key?null:checkedValues,
loadingstate:true
})
this.seacthdata(teacher_comment, task_status, checkedValues===key?undefined:checkedValues, cross_comment, order, b_order, search,this.state.page);
this.props.getsonar(teacher_comment,task_status, checkedValues===key?undefined:checkedValues, cross_comment, search)
this.seacthdata(commentstate, task_status, checkedValues===key?undefined:checkedValues, cross_comment, order, b_order, search,this.state.page);
this.props.getsonar(commentstate,task_status, checkedValues===key?undefined:checkedValues, cross_comment, search)
}
@ -575,7 +587,7 @@ class GraduationTaskssettinglist extends Component{
saveModulationModal=(value,num)=>{
let{teacher_comment,task_status,course_group,cross_comment,order,b_order,search}=this.state;
let{teacher_comment,task_status,course_group,cross_comment,order,b_order,search,commentstate}=this.state;
let {operationId}=this.state;
// console.log(value,num)
@ -586,8 +598,8 @@ class GraduationTaskssettinglist extends Component{
}).then((result)=>{
// console.log(result)
if(result.data.status===0){
this.seacthdata(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,this.state.page);
this.props.getsonar(teacher_comment,task_status, course_group, cross_comment, search)
this.seacthdata(commentstate,task_status,course_group,cross_comment,order,b_order,search,this.state.page);
this.props.getsonar(commentstate,task_status, course_group, cross_comment, search)
this.props.showNotification(result.data.message);
this.cancelmodel();
this.setState({
@ -703,18 +715,18 @@ class GraduationTaskssettinglist extends Component{
this.setState({
page: pageNumber,
})
let{teacher_comment,task_status,course_group,cross_comment,order,b_order,search}=this.state;
this.seacthdata(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,pageNumber);
this.props.getsonar(teacher_comment,task_status, course_group, cross_comment, search)
let{teacher_comment,task_status,course_group,cross_comment,order,b_order,search,commentstate}=this.state;
this.seacthdata(commentstate,task_status,course_group,cross_comment,order,b_order,search,pageNumber);
this.props.getsonar(commentstate,task_status, course_group, cross_comment, search)
}
/// 确认是否下载
confirmysl(url){
let {teacher_comment, task_status, course_group, cross_comment, order, b_order, search,page} =this.state;
let {teacher_comment, task_status, course_group, cross_comment, order, b_order, search,commentstate} =this.state;
let params ={
teacher_comment:teacher_comment,
teacher_comment:commentstate,
task_status:task_status,
course_group:course_group,
cross_comment:cross_comment,
@ -764,8 +776,8 @@ class GraduationTaskssettinglist extends Component{
}
render(){
let {coursename,coursesearch,taskname,taskid,taskslistdata,data,page,limit,teacher_comment,task_status,cross_comment,search,loadingstate,
order, course_group,Modalstype,Modalstopval,ModalCancel,ModalSave,modalname,Modulationtype,operationId,Allocationtype,visibles,
let { taskslistdata,data,page,limit,teacher_comment,task_status,cross_comment,search,loadingstate,
course_group,Modalstype,Modalstopval,ModalCancel,ModalSave,modalname,Modulationtype,Allocationtype,visibles,
visible,
Topval,
Topvalright,

@ -555,11 +555,7 @@ class Trainingjobsetting extends Component {
})
if(result.validate==false){
this.scrollToAnchor("publishtimeid");
this.props.showNotification(`分班发布设置不能为空`);
return false;
}
let rulesdata = this.state.rulesdata;

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-20 10:35:40
* @LastEditors : tangjiang
* @LastEditTime : 2020-01-07 15:29:18
* @LastEditTime : 2020-01-09 11:04:44
*/
import './index.scss';
// import 'katex/dist/katex.css';
@ -291,6 +291,7 @@ class EditTab extends React.Component {
// {font: []},
'image', 'formula', // 数学公式、图片、视频
'clean', // 清除格式
// 'fill',
];
const renderCourseQuestion = (arrs) => {
@ -452,6 +453,7 @@ class EditTab extends React.Component {
colon={ false }
>
<QuillForEditor
autoFocus={true}
style={{ height: '200px' }}
placeholder="请输入描述信息"
onContentChange={handleContentChange}

@ -149,10 +149,10 @@ class ChoquesEditor extends Component{
this.props.showNotification('多选题最小正确选项为2个');
return editordata;
}
if(!question_titlesysl) {
this.props.showNotification('请您输入题目解析');
return editordata;
}
// if(!question_titlesysl) {
// this.props.showNotification('请您输入题目解析');
// return editordata;
// }
/**
{
"question_title":"同学朋友间常用的沟通工具是什么?",
@ -365,6 +365,7 @@ class ChoquesEditor extends Component{
</p>
<QuillForEditor
autoFocus={true}
imgAttrs={{width: '146px', height: '136px'}}
style={{ height: '155px'}}
placeholder="请您输入题干"
@ -377,7 +378,7 @@ class ChoquesEditor extends Component{
<div className="mb10 sortinxdirection">
{/* {!question_id ? '新建' : '编辑'} */}
<span className="xingcolor font-16 fl mr4">*</span>
<span className="xingtigans fl"><span className="xingtigan">答案选项</span></span>
<span className="xingtigans fl"><span className="xingtigan">答案选项</span></span>
</div>
{question_choices.map( (item, index) => {
@ -398,6 +399,7 @@ class ChoquesEditor extends Component{
{
item===undefined||item===null||item===""?
<QuillForEditor
autoFocus={false}
imgAttrs={{width: '146px', height: '136px'}}
style={{ height: '166px'}}
placeholder="请您输入题干"
@ -407,6 +409,7 @@ class ChoquesEditor extends Component{
/>
:
<QuillForEditor
autoFocus={false}
imgAttrs={{width: '146px', height: '136px'}}
style={{ height: '166px'}}
placeholder="请您输入题干"
@ -440,11 +443,12 @@ class ChoquesEditor extends Component{
<p className="mb10 mt10 clearfix">
{/* {!question_id ? '新建' : '编辑'} */}
<span className="xingcolor font-16 fl mr4">*</span>
<span className="xingcolor font-16 fl mr4"></span>
<span className="xingtigan fl">题目解析</span>
</p>
<div className="mt10"></div>
<QuillForEditor
autoFocus={false}
imgAttrs={{width: '146px', height: '136px'}}
style={{height: '166px' }}
placeholder="请您输入题目解析"

@ -43,7 +43,7 @@ const options = [
],
},
];
//Comthetestpaperst试卷的
class Itembankstop extends Component {
constructor(props) {
super(props);
@ -55,10 +55,19 @@ class Itembankstop extends Component {
knowledgepoints: [],
knowledgepoints2:[],
options: [],
NewknTypedel:false
NewknTypedel:false,
boolred:false,
}
}
setboolred=(bool)=>{
this.setState({
boolred:bool
})
}
//初始化
componentDidMount() {
@ -532,14 +541,31 @@ class Itembankstop extends Component {
}
NewknTypedeltyoedel=(value)=>{
var knowledgepointmys= this.state.knowledgepoints;
var konwbool=null;
for(let myda of knowledgepointmys) {
if(myda.name===value){
konwbool="yes"
break;
}
}
if(konwbool!=null){
this.props.showNotification(`重复的知识点`);
this.setboolred(true);
return
}
if(value===null||value===""){
this.props.showNotification(`请输入知识点`);
this.setboolred(true);
return
}
if(value.length===0){
this.props.showNotification(`请输入知识点`);
this.setboolred(true);
return
}
@ -556,19 +582,37 @@ class Itembankstop extends Component {
id: result.data.tag_discipline_id,
name:value,
}
this.state.knowledgepoints.push(leydata);
const _result =[];
this.state.knowledgepoints.filter(item => {
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
_result.push(item);
}
});
this.setState({
Knowpoints: this.state.Knowpoints,
knowledgepoints: this.state.knowledgepoints,
knowledgepoints2: _result,
})
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);
@ -625,6 +669,8 @@ class Itembankstop extends Component {
{
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>
@ -668,32 +714,34 @@ class Itembankstop extends Component {
<img className=" ml22 zjzsdian xiaoshou" src={getImageUrl("images/educoder/zjzsd.png")} onClick={()=>this.NewknTypedeldel(true)}/>
<div className="sortinxdirection huanhan" style={{
minHeight: "33px",
lineHeight: "28px",
}}>
</div>
)}
</Form.Item>
{this.state.Knowpoints === undefined ? "" : this.state.Knowpoints.map((object, index) => {
return (
<div key={index} className={index===0?"mytags mb20":"mytags"} style={{
position: "relative",
}}>
<p className="w100s stestcen lh32">{object.name}</p>
<div className="sortinxdirection huanhan w100s mt15" style={{
minHeight: "33px",
lineHeight: "28px",
<img className=" ml7 zjzsdian xiaoshou icondowncolorssy" onClick={() => this.deletesobject(object, index)} src={getImageUrl("images/educoder/bzucha.png")}/>
}}>
</div>
)
})}
{this.state.Knowpoints === undefined ? "" : this.state.Knowpoints.map((object, index) => {
return (
<div key={index} className={index===0?"mytags mb20":"mytags"} style={{
position: "relative",
}}>
<p className="w100s stestcen lh32">{object.name}</p>
<img className=" ml7 zjzsdian xiaoshou icondowncolorssy" onClick={() => this.deletesobject(object, index)} src={getImageUrl("images/educoder/bzucha.png")}/>
</div>
)
})}
</div>
</div>
)}
</Form.Item>
</div>
<Form.Item
label="题型"

@ -119,11 +119,11 @@ class JudquestionEditor extends Component{
if(!question_titlesysl) {
this.props.showNotification('请您输入题目解析');
return editordata;
}
//
// if(!question_titlesysl) {
// this.props.showNotification('请您输入题目解析');
// return editordata;
// }
/**
{
"question_title":"同学朋友间常用的沟通工具是什么?",
@ -161,28 +161,29 @@ class JudquestionEditor extends Component{
question_title: this.props.item_banksedit.name!==undefined?JSON.parse(this.props.item_banksedit.name):"",
question_titles: this.props.item_banksedit.analysis!==undefined?JSON.parse(this.props.item_banksedit.analysis):"",
mychoicess:this.props.item_banksedit.choices,
question_titleysl:this.props.item_banksedit.name|| '',
question_titlesysl:this.props.item_banksedit.analysis||'',
})
// if(this.props.item_banksedit){
// if(this.props.item_banksedit.choices){
// for(var ik=0;ik<this.props.item_banksedit.choices.length;ik++ ){
// if( this.props.item_banksedit.choices[ik].choice_text==="正确"){
// if( this.props.item_banksedit.choices[ik].is_answer===true){
// this.setState({
// zqda:"0"
// })
// }
//
// }else{
// if( this.props.item_banksedit.choices[ik].is_answer===true){
// this.setState({
// zqda:"1"
// })
// }
// }
// }
// }
// }
if(this.props.item_banksedit){
if(this.props.item_banksedit.choices){
for(var ik=0;ik<this.props.item_banksedit.choices.length;ik++ ){
if( this.props.item_banksedit.choices[ik].choice_text==="正确"){
if( this.props.item_banksedit.choices[ik].is_answer===true){
this.setState({
zqda:"0"
})
}
}else{
if( this.props.item_banksedit.choices[ik].is_answer===true){
this.setState({
zqda:"1"
})
}
}
}
}
}
}catch (e) {
}
@ -199,28 +200,30 @@ class JudquestionEditor extends Component{
question_title: this.props.item_banksedit.name!==undefined?JSON.parse(this.props.item_banksedit.name):"",
question_titles: this.props.item_banksedit.analysis!==undefined?JSON.parse(this.props.item_banksedit.analysis):"",
mychoicess:this.props.item_banksedit.choices,
question_titleysl:this.props.item_banksedit.name|| '',
question_titlesysl:this.props.item_banksedit.analysis||'',
})
// if(this.props.item_banksedit){
// if(this.props.item_banksedit.choices){
// for(var ik=0;ik<this.props.item_banksedit.choices.length;ik++ ){
// if( this.props.item_banksedit.choices[ik].choice_text==="正确"){
// if( this.props.item_banksedit.choices[ik].is_answer===true){
// this.setState({
// zqda:"0"
// })
// }
//
// }else{
// if( this.props.item_banksedit.choices[ik].is_answer===true){
// this.setState({
// zqda:"1"
// })
// }
// }
// }
// }
// }
if(this.props.item_banksedit){
if(this.props.item_banksedit.choices){
for(var ik=0;ik<this.props.item_banksedit.choices.length;ik++ ){
if( this.props.item_banksedit.choices[ik].choice_text==="正确"){
if( this.props.item_banksedit.choices[ik].is_answer===true){
this.setState({
zqda:"0"
})
}
}else{
if( this.props.item_banksedit.choices[ik].is_answer===true){
this.setState({
zqda:"1"
})
}
}
}
}
}
}
}
@ -377,6 +380,7 @@ class JudquestionEditor extends Component{
</p>
<QuillForEditor
autoFocus={true}
imgAttrs={{width: '146px', height: '136px'}}
style={{ height: '155px'}}
placeholder="请您输入题干"
@ -389,7 +393,7 @@ class JudquestionEditor extends Component{
<div className="mb10 sortinxdirection">
{/* {!question_id ? '新建' : '编辑'} */}
<span className="xingcolor font-16 fl mr4">*</span>
<span className="xingtigans fl"><span className="xingtigan">答案选项</span></span>
<span className="xingtigans fl"><span className="xingtigan">答案选项</span></span>
</div>
<style>
@ -421,11 +425,12 @@ class JudquestionEditor extends Component{
<div className="mt10">
<p className="mb10 clearfix">
{/* {!question_id ? '新建' : '编辑'} */}
<span className="xingcolor font-16 fl mr4">*</span>
<span className="xingcolor font-16 fl mr4"></span>
<span className="xingtigan fl">题目解析</span>
</p>
<QuillForEditor
autoFocus={false}
imgAttrs={{width: '146px', height: '136px'}}
style={{height: '166px' }}
placeholder="请您输入题目解析"

@ -69,15 +69,14 @@ class Listjihe extends Component {
// 编程答案
var rightkey = null
var MULTIPLEkey = null;
if (items) {
if (items.item_type) {
if (items.item_type === "PROGRAM") {
} else {
if (items.item_type === "JUDGMENT") {
//多选题
if (items.choices) {
if (items.choices.length > 0) {
var arr = items.choices;
@ -90,19 +89,38 @@ class Listjihe extends Component {
}
}
} else {
if (items.choices) {
if (items.choices.length > 0) {
var arr = items.choices;
for (var i = 0; i < arr.length; i++) {
if (arr[i].is_answer === true) {
rightkey = i;
break;
// 单选题和判断题
if(items.item_type === "MULTIPLE"){
if (items.choices) {
if (items.choices.length > 0) {
var arr = items.choices;
for (var i = 0; i < arr.length; i++) {
if (arr[i].is_answer === true) {
if(MULTIPLEkey===null){
MULTIPLEkey = tagArrays[i];
}else{
MULTIPLEkey =MULTIPLEkey+ tagArrays[i];
}
}
}
}
}
}
}else{
if (items.choices) {
if (items.choices.length > 0) {
var arr = items.choices;
for (var i = 0; i < arr.length; i++) {
if (arr[i].is_answer === true) {
rightkey = i;
break;
}
}
}
}
}
}
}
}
@ -182,7 +200,7 @@ class Listjihe extends Component {
items === undefined || items === null ? "" : items.choices.map((object, index) => {
return (
<p className={index === 1 ? "sortinxdirection ml10" : "sortinxdirection "}>
<Radio disabled={false}>
<Radio disabled={false} disabled={true} >
{object.choice_text}
</Radio>
</p>
@ -331,15 +349,20 @@ class Listjihe extends Component {
items.program_attr.status === 0 ?
""
:
items.apply===false?
<p className="viewparsings xiaoshou mr25" onClick={() => this.props.showmodels(items.id)}>
<i className="iconfont icon-gongkai font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>公开</span>
</p>
:
:
""
:items.apply===false?
<p className="viewparsings xiaoshou mr25" onClick={() => this.props.showmodels(items.id)}>
<i className="iconfont icon-gongkai font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>公开</span>
</p>
:
""
:
""
}
@ -367,11 +390,18 @@ class Listjihe extends Component {
<div className=" sortinxdirection mt15 yldxtit">
{
items.item_type === "SINGLE" || items.item_type === "MULTIPLE" ?
items.item_type === "SINGLE" ?
<p className=" testfondex yldxtit"
style={{wordBreak: "break-word"}}
dangerouslySetInnerHTML={{__html: markdownToHTML("答案:" + tagArrays[rightkey]).replace(/▁/g, "▁▁▁")}}
>
</p>
: items.item_type === "MULTIPLE"?
<p className=" testfondex yldxtit"
style={{wordBreak: "break-word"}}
dangerouslySetInnerHTML={{__html: markdownToHTML("答案:" + MULTIPLEkey).replace(/▁/g, "▁▁▁")}}
>
</p>
:
<p className=" testfondex yldxtit"

@ -23,6 +23,7 @@ class PaperDeletModel extends Component {
this.setState({
newkntypeinput: e.target.value
})
this.props.setboolred(false);
//
// debugger
// console.log(e);
@ -36,6 +37,13 @@ class PaperDeletModel extends Component {
// }
// }
}
mysinputOnBlur=(e)=>{
console.log("失去焦点了");
}
inputOnFocus=(e)=>{
console.log("获取焦点");
}
render() {
@ -51,8 +59,8 @@ class PaperDeletModel extends Component {
width="442px"
>
<div className="educouddiv">
<div className={"tabeltext-alignleft mt10"}>
<Input onInput={this.handleChange} maxLength={16} />
<div className={this.props.boolred===true?"tabeltext-alignleft mt10 inpustred":"tabeltext-alignleft mt10"}>
<Input onInput={this.handleChange} maxLength={16} onBlur={this.mysinputOnBlur } onFocus={this.inputOnFocus }/>
</div>
<div className="clearfix mt30 edu-txt-center">
<a className="task-btn mr30 w80" onClick={()=>this.props.NewknTypedeldel(false)}>取消</a>

@ -157,10 +157,10 @@ class SingleEditor extends Component{
if(!question_titlesysl) {
this.props.showNotification('请您输入题目解析');
return editordata;
}
// if(!question_titlesysl) {
// this.props.showNotification('请您输入题目解析');
// return editordata;
// }
/**
{
"question_title":"同学朋友间常用的沟通工具是什么?",
@ -389,19 +389,19 @@ class SingleEditor extends Component{
</p>
<QuillForEditor
autoFocus={true}
imgAttrs={{width: '146px', height: '136px'}}
style={{ height: '155px'}}
placeholder="请您输入题干"
options={['code-block', 'image', 'formula']}
value={question_title}
onContentChange={this.onContentChange}
/>
<div className="mb10 mt10 sortinxdirection">
{/* {!question_id ? '新建' : '编辑'} */}
<span className="xingcolor font-16 fl mr4">*</span>
<span className="xingtigans fl"><span className="xingtigan">答案选项</span></span>
<span className="xingtigans fl"><span className="xingtigan">答案选项</span></span>
</div>
{question_choices.map( (item, index) => {
@ -421,6 +421,7 @@ class SingleEditor extends Component{
{
item===undefined||item===null||item===""?
<QuillForEditor
autoFocus={false}
imgAttrs={{width: '146px', height: '136px'}}
style={{ height: '166px'}}
placeholder="请您输入题干"
@ -430,6 +431,7 @@ class SingleEditor extends Component{
/>
:
<QuillForEditor
autoFocus={false}
imgAttrs={{width: '146px', height: '136px'}}
style={{ height: '166px'}}
placeholder="请您输入题干"
@ -465,11 +467,12 @@ class SingleEditor extends Component{
<div className="mt10">
<p className="mb10 clearfix">
{/* {!question_id ? '新建' : '编辑'} */}
<span className="xingcolor font-16 fl mr4">*</span>
<span className="xingcolor font-16 fl mr4"></span>
<span className="xingtigan fl">题目解析</span>
</p>
<div className="mt10"></div>
<QuillForEditor
autoFocus={false}
imgAttrs={{width: '146px', height: '136px'}}
style={{height: '166px' }}
placeholder="请您输入题目解析"

@ -1,656 +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;
}
.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>
<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;

@ -41,7 +41,7 @@ const options = [
],
},
];
//Itembankstop 题库的
class Comthetestpaperst extends Component {
constructor(props) {
super(props);
@ -54,10 +54,16 @@ class Comthetestpaperst extends Component {
knowledgepoints: [],
knowledgepoints2:[],
options: [],
NewknTypedel:false
NewknTypedel:false,
boolred:false,
}
}
setboolred=(bool)=>{
this.setState({
boolred:bool
})
}
//初始化
componentDidMount() {
try {
@ -495,19 +501,32 @@ class Comthetestpaperst extends Component {
}
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
}
if(this.state.rbkc===undefined || this.state.rbkc===null || this.state.rbkc===""){
this.props.showNotification(`请选择课程方向`);
this.setboolred(true);
return;
}
var data={
@ -523,19 +542,36 @@ class Comthetestpaperst extends Component {
id: result.data.tag_discipline_id,
name:value,
}
this.state.knowledgepoints.push(leydata);
const _result =[];
this.state.knowledgepoints.filter(item => {
if (this.state.Knowpoints.findIndex(t => t.id === item.id) === -1) {
_result.push(item);
}
});
this.setState({
Knowpoints: this.state.Knowpoints,
knowledgepoints: this.state.knowledgepoints,
knowledgepoints2: _result,
})
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);
@ -609,6 +645,8 @@ class Comthetestpaperst extends Component {
{
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>
@ -656,32 +694,33 @@ class Comthetestpaperst extends Component {
<img className=" ml22 zjzsdian xiaoshou" src={getImageUrl("/images/educoder/zjzsd.png")} onClick={()=>this.NewknTypedeldel(true)}/>
<div className="sortinxdirection" style={{
height: "33px",
lineHeight: "28px",
}}>
</div>
)}
</Form.Item>
</div>
<div className="sortinxdirection huanhan w100s mt15" style={{
height: "33px",
lineHeight: "28px",
{this.state.Knowpoints === undefined ? "" : this.state.Knowpoints.map((object, index) => {
return (
<div key={index} className="mytags" style={{
position: "relative",
}}>
<p className="w100s stestcen lh32">{object.name}</p>
}}>
<img className=" ml7 zjzsdian xiaoshou icondowncolorssy" onClick={() => this.deletesobject(object, index)} src={getImageUrl("/images/educoder/bzucha.png")}/>
{this.state.Knowpoints === undefined ? "" : this.state.Knowpoints.map((object, index) => {
return (
<div key={index} className="mytags" style={{
position: "relative",
}}>
<p className="w100s stestcen lh32">{object.name}</p>
</div>
)
})}
<img className=" ml7 zjzsdian xiaoshou icondowncolorssy" onClick={() => this.deletesobject(object, index)} src={getImageUrl("/images/educoder/bzucha.png")}/>
</div>
)
})}
</div>
</div>
)}
</Form.Item>
</div>
<style>
{

@ -528,7 +528,7 @@
height:32px;
border-radius:2px;
border:1px solid #DDDDDD;
margin-left: 20px;
margin-right: 20px;
}
.lh32{
line-height: 32px;
@ -961,3 +961,12 @@
.mb20{
margin-bottom: 20px;
}
.inpustred .ant-input{
border: 1px solid #f30707;
border-radius: 5px;
}
.mt15{
margin-top: 15px;
}

@ -548,7 +548,7 @@
height:32px;
border-radius:2px;
border:1px solid #DDDDDD;
margin-left: 20px;
margin-right: 20px;
}
.lh32{
line-height: 32px;

Loading…
Cancel
Save