Merge remote-tracking branch 'origin/topic_bank' into topic_bank

# Conflicts:
#	config/routes.rb
#	public/react/src/modules/courses/poll/PollNew.js
dev_aliyun_beta
杨树明 5 years ago
commit a35633a4f7

@ -804,7 +804,6 @@ Rails.application.routes.draw do
end end
end end
resource :import_users, only: [:create] resource :import_users, only: [:create]
resource :import_course_members, only: [:create]
resources :library_applies, only: [:index] do resources :library_applies, only: [:index] do
member do member do

@ -1,5 +1,5 @@
import React, {Component} from "react"; import React, {Component} from "react";
import { WordsBtn,on, off, trigger,markdownToHTML,getImageUrl} from 'educoder'; import { WordsBtn,on, off, trigger,MarkdownToHtml,getImageUrl} from 'educoder';
import { import {
Button, Button,
Checkbox, Checkbox,
@ -73,7 +73,8 @@ class Groupjobbandetails extends Component {
datas.description===""? datas.description===""?
<NoneData></NoneData> <NoneData></NoneData>
: :
<div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas.description).replace(/▁/g, "▁▁▁")}}/> <MarkdownToHtml content={datas.description} selector="work_content" className="mb10"></MarkdownToHtml>
// <div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas.description).replace(/▁/g, "▁▁▁")}}/>
) )
} }
{/*<div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas&&datas.description).replace(/▁/g, "▁▁▁")}}/>*/} {/*<div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas&&datas.description).replace(/▁/g, "▁▁▁")}}/>*/}

@ -1,6 +1,6 @@
import React, {Component} from "react"; import React, {Component} from "react";
import {Link, NavLink} from 'react-router-dom'; import {Link, NavLink} from 'react-router-dom';
import {WordsBtn, ActionBtn} from 'educoder'; import {WordsBtn, ActionBtn,MarkdownToHtml} from 'educoder';
import axios from 'axios'; import axios from 'axios';
import { import {
notification notification

@ -1,5 +1,5 @@
import React, {Component} from "react"; import React, {Component} from "react";
import { WordsBtn,on, off, trigger,markdownToHTML,getImageUrl} from 'educoder'; import { WordsBtn,on, off, trigger,MarkdownToHtml,getImageUrl} from 'educoder';
import { import {
Button, Button,
Checkbox, Checkbox,
@ -72,7 +72,9 @@ class Completetopicdetails extends Component {
datas.description===""? datas.description===""?
<NoneData></NoneData> <NoneData></NoneData>
: :
<div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas.description).replace(/▁/g, "▁▁▁")}}/> <MarkdownToHtml content={datas.description} selector="work_content" className="mb10"></MarkdownToHtml>
// <div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas.description).replace(/▁/g, "▁▁▁")}}/>
) )
} }
{/*<div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas&&datas.description).replace(/▁/g, "▁▁▁")}}/>*/} {/*<div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas&&datas.description).replace(/▁/g, "▁▁▁")}}/>*/}

@ -605,7 +605,7 @@ class ExerciseNewCommon extends Component{
<i className="iconfont icon-tianjiafangda color-white font-14 mr5" style={{ marginTop: '-1px', display: 'inline-block'}}></i> <i className="iconfont icon-tianjiafangda color-white font-14 mr5" style={{ marginTop: '-1px', display: 'inline-block'}}></i>
</ActionBtn> </ActionBtn>
{exercise_id && <ActionBtn style="blue" className="fr" onClick={() => this.goToPreview()}> {exercise_id && !this.props.hidePreviewButton && <ActionBtn style="blue" className="fr" onClick={() => this.goToPreview()}>
{/* <i className="iconfont icon-tianjiafangda color-white font-14 mr5" style={{ marginTop: '-1px', display: 'inline-block'}}></i> */} {/* <i className="iconfont icon-tianjiafangda color-white font-14 mr5" style={{ marginTop: '-1px', display: 'inline-block'}}></i> */}
试卷预览 试卷预览
</ActionBtn>} </ActionBtn>}

@ -1,5 +1,5 @@
import React, {Component} from "react"; import React, {Component} from "react";
import { WordsBtn,on, off, trigger,markdownToHTML,getImageUrl} from 'educoder'; import { WordsBtn,on, off, trigger,MarkdownToHtml,getImageUrl} from 'educoder';
import { import {
Button, Button,
Checkbox, Checkbox,
@ -74,7 +74,8 @@ class Groupjobbandetails extends Component {
datas.description===""? datas.description===""?
<NoneData></NoneData> <NoneData></NoneData>
: :
<div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas.description).replace(/▁/g, "▁▁▁")}}/> <MarkdownToHtml content={datas.description} selector="work_content" className="mb10"></MarkdownToHtml>
// <div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas.description).replace(/▁/g, "▁▁▁")}}/>
) )
} }
{/*<div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas&&(datas.description===null?"无":datas.description==="null"?"无":datas.description)).replace(/▁/g, "▁▁▁")}}/>*/} {/*<div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas&&(datas.description===null?"无":datas.description==="null"?"无":datas.description)).replace(/▁/g, "▁▁▁")}}/>*/}

@ -1,5 +1,5 @@
import React, {Component} from "react"; import React, {Component} from "react";
import { WordsBtn,on, off, trigger,markdownToHTML,getImageUrl} from 'educoder'; import { WordsBtn,on, off, trigger,MarkdownToHtml,getImageUrl} from 'educoder';
import { import {
Button, Button,
Checkbox, Checkbox,
@ -71,7 +71,8 @@ class Groupjobquesanswer extends Component {
datas.reference_answer===""? datas.reference_answer===""?
<NoneData></NoneData> <NoneData></NoneData>
: :
<div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas.reference_answer).replace(/▁/g, "▁▁▁")}}/> <MarkdownToHtml content={datas.reference_answer} selector="work_content" className="mb10"></MarkdownToHtml>
// <div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas.reference_answer).replace(/▁/g, "▁▁▁")}}/>
) )
} }
{/*<div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas&&(datas.description===null?"无":datas.description==="null"?"无":datas.description)).replace(/▁/g, "▁▁▁")}}/>*/} {/*<div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas&&(datas.description===null?"无":datas.description==="null"?"无":datas.description)).replace(/▁/g, "▁▁▁")}}/>*/}

@ -995,6 +995,37 @@ class PollNew extends Component {
} }
if(object.question.max_choices){
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
if(object.question.min_choices){
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
var questiontwo = {}; var questiontwo = {};
var other = []; var other = [];
var option = []; var option = [];
@ -1196,6 +1227,40 @@ class PollNew extends Component {
} }
} }
} }
if(object.question.max_choices){
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
if(object.question.min_choices){
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
// if (object.question.max_choices < object.question.min_choices) { // if (object.question.max_choices < object.question.min_choices) {
// this.props.showNotification('可选的最大限制不能小于最小限制!'); // this.props.showNotification('可选的最大限制不能小于最小限制!');
// //
@ -1482,11 +1547,44 @@ class PollNew extends Component {
if(object.question.max_choices>0){ if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) { if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`); this.props.showNotification(`可选的最大限制不能小于最小限制`);
return;
}
}
}
if(object.question.max_choices){
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return; return;
} }
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
} }
}
if(object.question.min_choices){
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
} }
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
// if (object.question.max_choices < object.question.min_choices) { // if (object.question.max_choices < object.question.min_choices) {
// this.props.showNotification(`可选的最大限制不能小于最小限制`); // this.props.showNotification(`可选的最大限制不能小于最小限制`);
// //
@ -1665,11 +1763,38 @@ class PollNew extends Component {
} }
} }
} }
// if (object.question.max_choices < object.question.min_choices) {
// this.props.showNotification(`可选的最大限制不能小于最小限制`); if(object.question.max_choices){
// if(object.question.max_choices>0){
// return; if(object.question.min_choices){
// } if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
if(object.question.min_choices){
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
var questiontwo = {}; var questiontwo = {};
var other = []; var other = [];
var option = []; var option = [];
@ -2240,34 +2365,34 @@ class PollNew extends Component {
var minbool = false; var minbool = false;
var maxbool = false; var maxbool = false;
let arr = this.state.adddom; let arr = this.state.adddom;
if (parseInt(value) === 0 || parseInt(value) === "0" || parseInt(value) === null || parseInt(value) === undefined || parseInt(value) < 1) { // if (parseInt(value) === 0 || parseInt(value) === "0" || parseInt(value) === null || parseInt(value) === undefined || parseInt(value) < 1) {
minbool = true; // minbool = true;
} // }
if (max === 0 || max === "0" || max === null || max === undefined) { // if (max === 0 || max === "0" || max === null || max === undefined) {
maxbool = true; // maxbool = true;
} // }
//
if (minbool === true && maxbool === true) { // if (minbool === true && maxbool === true) {
for (var i = 0; i < arr.length; i++) { // for (var i = 0; i < arr.length; i++) {
if (index === i) { // if (index === i) {
arr[i].question.min_choices = parseInt(value); // arr[i].question.min_choices = parseInt(value);
} // }
} // }
this.setState({ // this.setState({
adddom: arr // adddom: arr
}) // })
} else { // } else {
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
if (index === i) { if (index === i) {
arr[i].question.min_choices = parseInt(value); arr[i].question.min_choices = parseInt(value);
arr[i].question.max_choices = length; // arr[i].question.max_choices = length;
break; break;
} }
} }
this.setState({ this.setState({
adddom: arr adddom: arr
}) })
} // }
} }
@ -2284,21 +2409,21 @@ class PollNew extends Component {
let arr = this.state.adddom; let arr = this.state.adddom;
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
if (index === i) { if (index === i) {
if(parseInt(value)===0&&parseInt(minchoices)===0){ // if(parseInt(value)===0&&parseInt(minchoices)===0){
arr[i].question.min_choices= parseInt(0); // arr[i].question.min_choices= parseInt(0);
arr[i].question.max_choices = parseInt(0); // arr[i].question.max_choices = parseInt(0);
}else if(parseInt(minchoices)===0){ // }else if(parseInt(minchoices)===0){
arr[i].question.min_choices= parseInt(2); // arr[i].question.min_choices= parseInt(2);
arr[i].question.max_choices = parseInt(value); // arr[i].question.max_choices = parseInt(value);
} // }
else if(parseInt(value)===0&&parseInt(minchoices)>0){ // else if(parseInt(value)===0&&parseInt(minchoices)>0){
arr[i].question.min_choices= parseInt(minchoices); // arr[i].question.min_choices= parseInt(minchoices);
arr[i].question.max_choices = parseInt(value); // arr[i].question.max_choices = parseInt(value);
} // }
else { // else {
arr[i].question.min_choices= minchoices===null?2:minchoices===undefined?2:minchoices===0?2:parseInt(minchoices); // arr[i].question.min_choices= minchoices===null?2:minchoices===undefined?2:minchoices===0?2:parseInt(minchoices);
arr[i].question.max_choices = parseInt(value); arr[i].question.max_choices = parseInt(value);
} // }
} }
} }
// console.log(2119); // console.log(2119);
@ -2777,7 +2902,7 @@ class PollNew extends Component {
{ {
item.question.question_type === 2? item.question.question_type === 2?
<span style={{color: "#4B4B4B"}} <span style={{color: "#4B4B4B"}}
className="font-16 mt10 ml10">{(item.question.min_choices === undefined && item.question.max_choices === undefined ? "不限制" : item.question.min_choices === null && item.question.max_choices === null ? "不限制" : item.question.min_choices === 0 && item.question.max_choices === 0 ? "": item.question.min_choices === "null" && item.question.max_choices === "null" ? "不限制" : "可选" +(item.question.min_choices===undefined||item.question.min_choices===null||item.question.min_choices===""||item.question.min_choices==="null"?2:item.question.min_choices) + "-" + (item.question.max_choices===undefined||item.question.max_choices===null||item.question.max_choices===""||item.question.max_choices==="null"?item.question.answers.length:item.question.max_choices) + "项")}</span> className="font-16 mt10 ml10">{(item.question.min_choices === undefined && item.question.max_choices === undefined ? "不限制" : item.question.min_choices === null && item.question.max_choices === null ? "不限制" : item.question.min_choices === 0 && item.question.max_choices === 0 ? "": item.question.min_choices === "null" && item.question.max_choices === "null" ? "不限制" : item.question.min_choices === item.question.max_choices && item.question.max_choices === item.question.min_choices ? "可选"+(item.question.max_choices)+"项" : "可选" +(item.question.min_choices===undefined||item.question.min_choices===null||item.question.min_choices===""||item.question.min_choices==="null"?2:item.question.min_choices) + "-" + (item.question.max_choices===undefined||item.question.max_choices===null||item.question.max_choices===""||item.question.max_choices==="null"?item.question.answers.length:item.question.max_choices) + "项")}</span>
: "" : ""
} }

@ -1015,6 +1015,37 @@ class PollNewQuestbank extends Component {
return; return;
} }
if(object.question.max_choices){
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
if(object.question.min_choices){
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
var questiontwo = {}; var questiontwo = {};
var other = []; var other = [];
var option = []; var option = [];
@ -1214,6 +1245,38 @@ class PollNewQuestbank extends Component {
return; return;
} }
if(object.question.max_choices){
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
if(object.question.min_choices){
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
var questiontwo = {}; var questiontwo = {};
var other = []; var other = [];
var option = []; var option = [];
@ -1503,6 +1566,39 @@ class PollNewQuestbank extends Component {
return; return;
} }
if(object.question.max_choices){
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
if(object.question.min_choices){
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
var questiontwo = {}; var questiontwo = {};
var other = []; var other = [];
var option = []; var option = [];
@ -1673,6 +1769,39 @@ class PollNewQuestbank extends Component {
return; return;
} }
if(object.question.max_choices){
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
if(object.question.min_choices){
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
var questiontwo = {}; var questiontwo = {};
var other = []; var other = [];
var option = []; var option = [];
@ -1836,8 +1965,8 @@ class PollNewQuestbank extends Component {
question_title: object.question.question_title, question_title: object.question.question_title,
question_type: number, question_type: number,
is_necessary: object.question.is_necessary, is_necessary: object.question.is_necessary,
max_choices: max_choicess===undefined?length:max_choicess===null?length:max_choicess===0?length:max_choicess, max_choices: max_choicess===undefined||max_choicess===null||max_choicess===0||max_choicess==="0"?null:max_choicess,
min_choices: min_choicess===undefined?2:min_choicess===null?2:min_choicess===0?2:min_choicess, min_choices: min_choicess===undefined||min_choicess===null||min_choicess===0||min_choicess==="0"?null:min_choicess,
question_answers: option, question_answers: option,
question_other_answer: null, question_other_answer: null,
insert_id: insert_id insert_id: insert_id
@ -1908,8 +2037,8 @@ class PollNewQuestbank extends Component {
question_title: object.question.question_title, question_title: object.question.question_title,
question_type: number, question_type: number,
is_necessary: object.question.is_necessary, is_necessary: object.question.is_necessary,
max_choices: max_choicess===undefined?length:max_choicess===null?length:max_choicess===0?length:max_choicess, max_choices: max_choicess===undefined||max_choicess===null||max_choicess===0||max_choicess==="0"?null:max_choicess,
min_choices: min_choicess===undefined?2:min_choicess===null?2:min_choicess===0?2:min_choicess, min_choices: min_choicess===undefined||min_choicess===null||min_choicess===0||min_choicess==="0"?null:min_choicess,
question_answers: option, question_answers: option,
question_other_answer: null, question_other_answer: null,
}; };
@ -2240,60 +2369,75 @@ class PollNewQuestbank extends Component {
} }
//最小值 //最小值
HandleGradationGroupChangee = (value, index, max, length) => { HandleGradationGroupChangee = (value, index, max, length) => {
// console.log("最小值");
// console.log(value);
// console.log(index);
// console.log(max);
// console.log(length);
// debugger
var minbool = false; var minbool = false;
var maxbool = false; var maxbool = false;
let arr = this.state.adddom; let arr = this.state.adddom;
if (parseInt(value) === 0 || parseInt(value) === "0" || parseInt(value) === null || parseInt(value) === undefined || parseInt(value) < 1) { // if (parseInt(value) === 0 || parseInt(value) === "0" || parseInt(value) === null || parseInt(value) === undefined || parseInt(value) < 1) {
minbool = true; // minbool = true;
} // }
if (max === 0 || max === "0" || max === null || max === undefined) { // if (max === 0 || max === "0" || max === null || max === undefined) {
maxbool = true; // maxbool = true;
} // }
//
if (minbool === true && maxbool === true) { // if (minbool === true && maxbool === true) {
for (var i = 0; i < arr.length; i++) { // for (var i = 0; i < arr.length; i++) {
if (index === i) { // if (index === i) {
arr[i].question.min_choices = parseInt(value); // arr[i].question.min_choices = parseInt(value);
} // }
} // }
this.setState({ // this.setState({
adddom: arr // adddom: arr
}) // })
} else { // } else {
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
if (index === i) { if (index === i) {
arr[i].question.min_choices = parseInt(value); arr[i].question.min_choices = parseInt(value);
arr[i].question.max_choices = length; // arr[i].question.max_choices = length;
break; break;
} }
} }
this.setState({ this.setState({
adddom: arr adddom: arr
}) })
} // }
} }
//最大值 //最大值
HandleGradationGroupChangeee = (value, index,minchoices,length) => { HandleGradationGroupChangeee = (value, index,minchoices,length) => {
// console.log("2112");
// console.log(value);
// console.log(minchoices);
// console.log("最大值");
// console.log(value);
// console.log(index);
// console.log(minchoices);
// console.log(length);
let arr = this.state.adddom; let arr = this.state.adddom;
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
if (index === i) { if (index === i) {
if(parseInt(value)===0&&parseInt(minchoices)===0){ // if(parseInt(value)===0&&parseInt(minchoices)===0){
arr[i].question.min_choices= parseInt(0); // arr[i].question.min_choices= parseInt(0);
arr[i].question.max_choices = parseInt(0); // arr[i].question.max_choices = parseInt(0);
}else if(parseInt(minchoices)===0){ // }else if(parseInt(minchoices)===0){
arr[i].question.min_choices= parseInt(2); // arr[i].question.min_choices= parseInt(2);
arr[i].question.max_choices = parseInt(value); // arr[i].question.max_choices = parseInt(value);
} // }
else if(parseInt(value)===0&&parseInt(minchoices)>0){ // else if(parseInt(value)===0&&parseInt(minchoices)>0){
arr[i].question.min_choices= parseInt(minchoices); // arr[i].question.min_choices= parseInt(minchoices);
arr[i].question.max_choices = parseInt(value); // arr[i].question.max_choices = parseInt(value);
} // }
else { // else {
arr[i].question.min_choices= minchoices===null?2:minchoices===undefined?2:minchoices===0?2:parseInt(minchoices); // arr[i].question.min_choices= minchoices===null?2:minchoices===undefined?2:minchoices===0?2:parseInt(minchoices);
arr[i].question.max_choices = parseInt(value); arr[i].question.max_choices = parseInt(value);
} // }
} }
} }
// console.log(2119); // console.log(2119);
@ -2301,6 +2445,7 @@ class PollNewQuestbank extends Component {
this.setState({ this.setState({
adddom: arr adddom: arr
}) })
// console.log(this.state.adddom);
} }
//提交题目//没有就创建新的题库新建问newz题和保存题目不一样不能同时保存 这里只是新建 和编辑 标题和须知 //提交题目//没有就创建新的题库新建问newz题和保存题目不一样不能同时保存 这里只是新建 和编辑 标题和须知
@ -2831,7 +2976,7 @@ class PollNewQuestbank extends Component {
<span <span
className=" ml10">{item.question.is_necessary === 1 ? "(必答)" : item.question.question_type === 2 ? "(选答)" : "(选答)"}</span> className=" ml10">{item.question.is_necessary === 1 ? "(必答)" : item.question.question_type === 2 ? "(选答)" : "(选答)"}</span>
<span style={{color: "#4B4B4B"}} <span style={{color: "#4B4B4B"}}
className="font-16 mt10 ml10">{(item.question.min_choices === undefined && item.question.max_choices === undefined ? "" : item.question.min_choices === null && item.question.max_choices === null ? "" : item.question.min_choices === 0 && item.question.max_choices === 0 ? "" : "可选" + item.question.min_choices + "-" + item.question.max_choices + "项")}</span> className="font-16 mt10 ml10">{(item.question.min_choices === undefined && item.question.max_choices === undefined ? "不限制" : item.question.min_choices === null && item.question.max_choices === null ? "不限制" : item.question.min_choices === 0 && item.question.max_choices === 0 ? "": item.question.min_choices === "null" && item.question.max_choices === "null" ? "不限制" : item.question.min_choices === item.question.max_choices && item.question.max_choices === item.question.min_choices ? "可选"+(item.question.max_choices)+"项" : "可选" +(item.question.min_choices===undefined||item.question.min_choices===null||item.question.min_choices===""||item.question.min_choices==="null"?2:item.question.min_choices) + "-" + (item.question.max_choices===undefined||item.question.max_choices===null||item.question.max_choices===""||item.question.max_choices==="null"?item.question.answers.length:item.question.max_choices) + "项")}</span>
{ {
polls_status === undefined || polls_status === 1 ? polls_status === undefined || polls_status === 1 ?
<span className="fr"> <span className="fr">
@ -3088,7 +3233,7 @@ class PollNewQuestbank extends Component {
<span <span
className="color-grey-6 mr20 font-16 lineh-40 fl">可选</span> className="color-grey-6 mr20 font-16 lineh-40 fl">可选</span>
<div className="mr40 flex1 "> <div className="mr40 flex1 ">
{/*可选最小*/} {/*可选最小1*/}
<style> <style>
{ {
` `
@ -3106,8 +3251,7 @@ class PollNewQuestbank extends Component {
</style> </style>
<Select className="fl w100" <Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangee(value, indexo, itemo.question.max_choices, itemo.question.answers.length)} onChange={(value) => this.HandleGradationGroupChangee(value, indexo, itemo.question.max_choices, itemo.question.answers.length)}
value={itemo.question.min_choices === 0 || itemo.question.min_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.min_choices} value={itemo.question.min_choices === null || itemo.question.min_choices === undefined ||itemo.question.min_choices === "null"|| itemo.question.min_choices === 0 || itemo.question.min_choices === "0"?"0": itemo.question.min_choices}
> >
<Option value={String("0")}>--</Option> <Option value={String("0")}>--</Option>
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => { {itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
@ -3119,10 +3263,10 @@ class PollNewQuestbank extends Component {
</Select> </Select>
<span <span
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span> className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
{/*可选最大*/} {/*可选最大1*/}
<Select className="fl w100" <Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo, itemo.question.min_choices,itemo.question.answers.length)} onChange={(value) => this.HandleGradationGroupChangeee(value, indexo, itemo.question.min_choices,itemo.question.answers.length)}
value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices} value={itemo.question.max_choices === null || itemo.question.max_choices === undefined ||itemo.question.max_choices === "null"|| itemo.question.max_choices === 0 || itemo.question.max_choices === "0"?"0": itemo.question.max_choices}
> >
<Option value={String("0")}>--</Option> <Option value={String("0")}>--</Option>
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => { {itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
@ -3398,7 +3542,7 @@ class PollNewQuestbank extends Component {
<span <span
className="color-grey-6 mr20 font-16 lineh-40 fl">可选</span> className="color-grey-6 mr20 font-16 lineh-40 fl">可选</span>
<div className="mr40 flex1 "> <div className="mr40 flex1 ">
{/*可选最小*/} {/*可选最小2*/}
<style> <style>
{ {
` `
@ -3416,8 +3560,7 @@ class PollNewQuestbank extends Component {
</style> </style>
<Select className="fl w100" <Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangee(value, indexo, itemo.question.max_choices, itemo.question.answers.length)} onChange={(value) => this.HandleGradationGroupChangee(value, indexo, itemo.question.max_choices, itemo.question.answers.length)}
value={itemo.question.min_choices === 0 || itemo.question.min_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.min_choices} value={itemo.question.min_choices === null || itemo.question.min_choices === undefined ||itemo.question.min_choices === "null"|| itemo.question.min_choices === 0 || itemo.question.min_choices === "0"?"0": itemo.question.min_choices}
> >
<Option value={String("0")}>--</Option> <Option value={String("0")}>--</Option>
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => { {itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
@ -3429,10 +3572,10 @@ class PollNewQuestbank extends Component {
</Select> </Select>
<span <span
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span> className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
{/*可选最大*/} {/*可选最大2*/}
<Select className="fl w100" <Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo, itemo.question.min_choices,itemo.question.answers.length)} onChange={(value) => this.HandleGradationGroupChangeee(value, indexo, itemo.question.min_choices,itemo.question.answers.length)}
value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices} value={itemo.question.max_choices === null || itemo.question.max_choices === undefined ||itemo.question.max_choices === "null"|| itemo.question.max_choices === 0 || itemo.question.max_choices === "0"?"0": itemo.question.max_choices}
> >
<Option value={String("0")}>--</Option> <Option value={String("0")}>--</Option>
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => { {itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
@ -3718,7 +3861,7 @@ class PollNewQuestbank extends Component {
<span <span
className="color-grey-6 mr20 font-16 lineh-40 fl">可选</span> className="color-grey-6 mr20 font-16 lineh-40 fl">可选</span>
<div className="mr40 flex1 "> <div className="mr40 flex1 ">
{/*可选最小*/} {/*可选最小3*/}
<style> <style>
{ {
` `
@ -3736,8 +3879,7 @@ class PollNewQuestbank extends Component {
</style> </style>
<Select className="fl w100" <Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangee(value, indexo, itemo.question.max_choices, itemo.question.answers.length)} onChange={(value) => this.HandleGradationGroupChangee(value, indexo, itemo.question.max_choices, itemo.question.answers.length)}
value={itemo.question.min_choices === 0 || itemo.question.min_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.min_choices} value={itemo.question.min_choices === null || itemo.question.min_choices === undefined ||itemo.question.min_choices === "null"|| itemo.question.min_choices === 0 || itemo.question.min_choices === "0"?"0": itemo.question.min_choices}
> >
<Option value={String("0")}>--</Option> <Option value={String("0")}>--</Option>
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => { {itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
@ -3749,10 +3891,10 @@ class PollNewQuestbank extends Component {
</Select> </Select>
<span <span
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span> className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
{/*可选最大*/} {/*可选最大3*/}
<Select className="fl w100" <Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo, itemo.question.min_choices,itemo.question.answers.length)} onChange={(value) => this.HandleGradationGroupChangeee(value, indexo, itemo.question.min_choices,itemo.question.answers.length)}
value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices} value={itemo.question.max_choices === null || itemo.question.max_choices === undefined ||itemo.question.max_choices === "null"|| itemo.question.max_choices === 0 || itemo.question.max_choices === "0"?"0": itemo.question.max_choices}
> >
<Option value={String("0")}>--</Option> <Option value={String("0")}>--</Option>
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => { {itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {

@ -1,5 +1,5 @@
import React, {Component} from "react"; import React, {Component} from "react";
import { WordsBtn,on, off, trigger,markdownToHTML,getImageUrl} from 'educoder'; import { WordsBtn,on, off, trigger,MarkdownToHtml,getImageUrl} from 'educoder';
import { import {
Button, Button,
Checkbox, Checkbox,
@ -30,7 +30,7 @@ class Generaljobanswer extends Component {
console.log("componentDidMount"); console.log("componentDidMount");
// let query = this.props.location.pathname; // let query = this.props.location.pathname;
// const type = query.split('/'); // const type = query.split('/');
// this.setState({ // this.setState({n
// shixuntypes:type[3] // shixuntypes:type[3]
// }) // })
// this.props.triggerRef(this); // this.props.triggerRef(this);
@ -70,7 +70,9 @@ class Generaljobanswer extends Component {
datas.reference_answer===""? datas.reference_answer===""?
<NoneData></NoneData> <NoneData></NoneData>
: :
<div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas.reference_answer).replace(/▁/g, "▁▁▁")}}/> <MarkdownToHtml content={datas.reference_answer} selector="work_content" className="mb10"></MarkdownToHtml>
// <div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas.reference_answer).replace(/▁/g, "▁▁▁")}}/>
) )
} }
{/*<div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas&&(datas.reference_answer===null?"无":datas.reference_answer==="null"?"无":datas.reference_answer)).replace(/▁/g, "▁▁▁")}}/>*/} {/*<div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas&&(datas.reference_answer===null?"无":datas.reference_answer==="null"?"无":datas.reference_answer)).replace(/▁/g, "▁▁▁")}}/>*/}

@ -1,5 +1,5 @@
import React, {Component} from "react"; import React, {Component} from "react";
import { WordsBtn,on, off, trigger,markdownToHTML,getImageUrl} from 'educoder'; import { WordsBtn,on, off, trigger,markdownToHTML, MarkdownToHtml ,getImageUrl} from 'educoder';
import { import {
Button, Button,
Checkbox, Checkbox,
@ -67,7 +67,8 @@ class Generaljobdetails extends Component {
<NoneData></NoneData> <NoneData></NoneData>
:datas&&datas.description===""? :datas&&datas.description===""?
<NoneData></NoneData>: <NoneData></NoneData>:
<div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas.description).replace(/▁/g, "▁▁▁")}}/> <MarkdownToHtml content={datas.description} selector="work_content" className="mb10"></MarkdownToHtml>
// <div id="MakedownHTML "className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas.description).replace(/▁/g, "▁▁▁")}}/>
) )
} }
<div className="mt16px"> <div className="mt16px">

@ -26,4 +26,5 @@
} }
.mt16px{ .mt16px{
margin-top: 16px; margin-top: 16px;
padding-bottom: 30px;
} }

@ -53,6 +53,7 @@ class ExerciseBanksEdit extends Component {
{...this.props} {...this.props}
{...this.state} {...this.state}
{...common} {...common}
hidePreviewButton={true}
wrappedComponentRef={(ref) => this.exerciseNewCommonRef = ref} wrappedComponentRef={(ref) => this.exerciseNewCommonRef = ref}
isEdit={true} isEdit={true}
shixunsUrl={`/exercise_banks/choose_shixun.json`} shixunsUrl={`/exercise_banks/choose_shixun.json`}

Loading…
Cancel
Save