修改题库可以输入空格

video_transcode
杨树林 5 years ago
parent 9daef0475f
commit 17ef1d3a2a

@ -229,22 +229,9 @@ class ChoquesEditor extends Component{
var texts; var texts;
const _text = quill.getText(); const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/; const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if(this.isNull(_text)===true){
return
}
if (!reg.test(_text)) { if (!reg.test(_text)) {
// 处理编辑器内容为空 // 处理编辑器内容为空
try {
texts=JSON.stringify(value);
}catch (e) {
texts=""; texts="";
}
} else { } else {
if(_text.length>=500){ if(_text.length>=500){
var result = _text.substring(0,450); var result = _text.substring(0,450);
@ -298,66 +285,46 @@ class ChoquesEditor extends Component{
// debugger // debugger
const _text = quill.getText(); const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/; const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if (!reg.test(_text)) {
if(this.isNull(_text)===true){ // 处理编辑器内容为空
this.setState({ this.setState({
question_titleysl:"" question_titleysl:""
}) })
return } else {
} // 提交到后台的内容需要处理一下;
if (!reg.test(_text)) {
// 处理编辑器内容为空
try { try {
let texts = JSON.stringify(value);
this.setState({ this.setState({
question_titleysl: JSON.stringify(value) question_titleysl:texts
}) })
}catch (e) { }catch (e) {
this.setState({ this.setState({
question_titleysl:"" question_titleysl:""
}) })
} }
} else {
// 提交到后台的内容需要处理一下;
let texts="";
texts = JSON.stringify(value);
this.setState({
question_titleysl:texts
})
} }
} }
onContentChanges=(value,quill)=>{ onContentChanges=(value,quill)=>{
const _text = quill.getText(); const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/; const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if (!reg.test(_text)) {
// 处理编辑器内容为空
if(this.isNull(_text)===true){
this.setState({ this.setState({
question_titlesysl:"" question_titlesysl:""
}) })
return } else {
} // 提交到后台的内容需要处理一下;
if (!reg.test(_text)) {
// 处理编辑器内容为空
try { try {
let texts = JSON.stringify(value);
this.setState({ this.setState({
question_titlesysl: JSON.stringify(value) question_titlesysl:texts
}) })
}catch (e) { }catch (e) {
this.setState({ this.setState({
question_titlesysl:"" question_titlesysl:""
}) })
} }
} else {
// 提交到后台的内容需要处理一下;
let texts="";
texts = JSON.stringify(value);
this.setState({
question_titlesysl:texts
})
} }
} }

@ -303,72 +303,50 @@ class JudquestionEditor extends Component{
// console.log(quill); // console.log(quill);
const _text = quill.getText(); const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/; const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
// console.log(_text);
// console.log(_text.length);
if(this.isNull(_text)===true){
this.setState({
question_titleysl:""
})
return
}
if (!reg.test(_text)) { if (!reg.test(_text)) {
// 处理编辑器内容为空 // 处理编辑器内容为空
try {
this.setState({
question_titleysl:JSON.stringify(value)
})
}catch (e) {
this.setState({ this.setState({
question_titleysl:"" question_titleysl:""
}) })
}
// console.log("空"); // console.log("空");
} else { } else {
// console.log("有");
// 提交到后台的内容需要处理一下; // 提交到后台的内容需要处理一下;
let texts=""; try {
texts = JSON.stringify(value); let texts = JSON.stringify(value);
this.setState({ this.setState({
question_titleysl:texts question_titleysl:texts
}) })
}catch (e) {
this.setState({
question_titleysl:""
})
}
} }
} }
onContentChanges=(value,quill)=>{ onContentChanges=(value,quill)=>{
const _text = quill.getText(); const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/; const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if(this.isNull(_text)===true){
this.setState({
question_titlesysl:""
})
return
}
if (!reg.test(_text)) { if (!reg.test(_text)) {
// 处理编辑器内容为空 // 处理编辑器内容为空
try {
this.setState({
question_titlesysl:JSON.stringify(value)
})
}catch (e) {
this.setState({ this.setState({
question_titlesysl:"" question_titlesysl:""
}) })
}
} else { } else {
// 提交到后台的内容需要处理一下; // 提交到后台的内容需要处理一下;
let texts=""; try {
texts = JSON.stringify(value); let texts = JSON.stringify(value);
this.setState({ this.setState({
question_titlesysl:texts question_titlesysl:texts
}) })
}catch (e) {
this.setState({
question_titlesysl:""
})
}
} }
} }
render() { render() {

@ -140,7 +140,13 @@ class SingleEditor extends Component{
// this.refs['titleEditor'].showError() // this.refs['titleEditor'].showError()
this.props.showNotification('请您输入题干'); this.props.showNotification('请您输入题干');
return editordata; return editordata;
}else{
console.log("question_titleysl");
console.log(question_titleysl);
} }
for(let i = 0; i < question_choices.length; i++) { for(let i = 0; i < question_choices.length; i++) {
if (!question_choices[i]) { if (!question_choices[i]) {
// this.refs[`optionEditor${i}`].showError() // this.refs[`optionEditor${i}`].showError()
@ -244,6 +250,7 @@ class SingleEditor extends Component{
this.setState({ standard_answers }) this.setState({ standard_answers })
} }
onOptionContentChange = (value,quill,index) => { onOptionContentChange = (value,quill,index) => {
debugger
if (index >= this.state.question_choices.length) { if (index >= this.state.question_choices.length) {
// TODO 新建然后删除CD选项再输入题干会调用到这里且index是3 // TODO 新建然后删除CD选项再输入题干会调用到这里且index是3
return; return;
@ -251,18 +258,9 @@ class SingleEditor extends Component{
var texts; var texts;
const _text = quill.getText(); const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/; const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if(this.isNull(_text)===true){
return
}
if (!reg.test(_text)) { if (!reg.test(_text)) {
// 处理编辑器内容为空 // 处理编辑器内容为空
try {
texts= JSON.stringify(value)
}catch (e) {
texts=""; texts="";
}
} else { } else {
if(_text.length>=500){ if(_text.length>=500){
var result = _text.substring(0,450); var result = _text.substring(0,450);
@ -315,61 +313,47 @@ class SingleEditor extends Component{
const reg = /^[\s\S]*.*[^\s][\s\S]*$/; const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if (!reg.test(_text)) {
if(this.isNull(_text)===true){ // 处理编辑器内容为空
this.setState({ this.setState({
question_titleysl:"" question_titleysl:""
}) })
return } else {
}
if (!reg.test(_text)) {
// 处理编辑器内容为空
try { try {
let texts = JSON.stringify(value);
this.setState({ this.setState({
question_titleysl: JSON.stringify(value) question_titleysl:texts===undefined|| null?"":texts
}) })
}catch (e) { }catch (e) {
this.setState({ this.setState({
question_titleysl:"" question_titleysl:""
}) })
} }
} else {
let texts = JSON.stringify(value);
this.setState({
question_titleysl:texts
})
} }
} }
onContentChanges=(value,quill)=>{ onContentChanges=(value,quill)=>{
const _text = quill.getText(); const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/; const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if(this.isNull(_text)===true){
if (!reg.test(_text)) {
// 处理编辑器内容为空
this.setState({ this.setState({
question_titlesysl:"" question_titlesysl:""
}) })
return } else {
}
if (!reg.test(_text)) {
// 处理编辑器内容为空
try { try {
let texts = JSON.stringify(value);
this.setState({ this.setState({
question_titlesysl:JSON.stringify(value) question_titlesysl:texts===undefined|| null?"":texts
}) })
}catch (e) { }catch (e) {
this.setState({ this.setState({
question_titlesysl:"" question_titlesysl:""
}) })
} }
} else {
let texts = JSON.stringify(value);
this.setState({
question_titlesysl:texts
})
} }
} }
handleShowImage = (url) => { handleShowImage = (url) => {

@ -1075,21 +1075,21 @@ submittojoinclass=(value)=>{
` `
} }
</style> </style>
{/*{*/} {
{/* Periofters===true?*/} Periofters===true?
{/* <li className={`pr questionbanks`} >*/} <li className={`pr questionbanks`} >
{/* <Popover className="queyppors" id={"yslpopovers"} placement="bottom" content={contents} trigger="click" >*/} <Popover className="queyppors" id={"yslpopovers"} placement="bottom" content={contents} trigger="click" >
{/* <div className=" sortinxdirection mr10">*/} <div className=" sortinxdirection mr10">
{/* <div style={{*/} <div style={{
{/* color:"#fff"*/} color:"#fff"
{/* }}>*/} }}>
{/* 题库*/} 题库
{/* </div>*/} </div>
{/* </div>*/} </div>
{/* </Popover>*/} </Popover>
{/* </li>*/} </li>
{/* :""*/} :""
{/*}*/} }
<li <li

Loading…
Cancel
Save