|
|
|
@ -21,7 +21,6 @@ const tagArray = [
|
|
|
|
|
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
|
|
|
|
|
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
//题库的试卷 单选题 组件
|
|
|
|
|
class SingleEditor extends Component{
|
|
|
|
|
constructor(props){
|
|
|
|
@ -253,17 +252,14 @@ class SingleEditor extends Component{
|
|
|
|
|
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
|
|
|
|
|
if (!reg.test(_text)) {
|
|
|
|
|
// 处理编辑器内容为空
|
|
|
|
|
texts="";
|
|
|
|
|
} else {
|
|
|
|
|
if(_text.length>=301){
|
|
|
|
|
var result = _text.substring(0,300);
|
|
|
|
|
texts={"ops":[{"insert":result}]};
|
|
|
|
|
texts=JSON.stringify(texts);
|
|
|
|
|
}else {
|
|
|
|
|
// 提交到后台的内容需要处理一下;
|
|
|
|
|
value = JSON.stringify(value)
|
|
|
|
|
texts=value;
|
|
|
|
|
try {
|
|
|
|
|
texts= JSON.stringify(value)
|
|
|
|
|
}catch (e) {
|
|
|
|
|
texts="";
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
value = JSON.stringify(value);
|
|
|
|
|
texts=value;
|
|
|
|
|
}
|
|
|
|
|
let question_choices = this.state.question_choices.slice(0);
|
|
|
|
|
question_choices[index] = texts;
|
|
|
|
@ -291,30 +287,21 @@ class SingleEditor extends Component{
|
|
|
|
|
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
|
|
|
|
|
if (!reg.test(_text)) {
|
|
|
|
|
// 处理编辑器内容为空
|
|
|
|
|
this.setState({
|
|
|
|
|
question_titleysl:""
|
|
|
|
|
})
|
|
|
|
|
try {
|
|
|
|
|
this.setState({
|
|
|
|
|
question_titleysl: JSON.stringify(value)
|
|
|
|
|
})
|
|
|
|
|
}catch (e) {
|
|
|
|
|
this.setState({
|
|
|
|
|
question_titleysl:""
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// 提交到后台的内容需要处理一下;
|
|
|
|
|
|
|
|
|
|
var texts="";
|
|
|
|
|
if(_text.length>=1001){
|
|
|
|
|
var result = _text.substring(0,1000);
|
|
|
|
|
texts={"ops":[{"insert":result}]};
|
|
|
|
|
texts=JSON.stringify(texts);
|
|
|
|
|
}else {
|
|
|
|
|
value = JSON.stringify(value)
|
|
|
|
|
texts=value;
|
|
|
|
|
}
|
|
|
|
|
let texts = JSON.stringify(value);
|
|
|
|
|
this.setState({
|
|
|
|
|
question_titleysl:texts
|
|
|
|
|
})
|
|
|
|
|
try {
|
|
|
|
|
//console.log("onContentChange");
|
|
|
|
|
//console.log(quill.getText().length);
|
|
|
|
|
}catch (e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
onContentChanges=(value,quill)=>{
|
|
|
|
@ -322,19 +309,18 @@ class SingleEditor extends Component{
|
|
|
|
|
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
|
|
|
|
|
if (!reg.test(_text)) {
|
|
|
|
|
// 处理编辑器内容为空
|
|
|
|
|
this.setState({
|
|
|
|
|
question_titlesysl:""
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
var texts="";
|
|
|
|
|
if(_text.length>=1001){
|
|
|
|
|
var result = _text.substring(0,1000);
|
|
|
|
|
texts={"ops":[{"insert":result}]};
|
|
|
|
|
texts=JSON.stringify(texts);
|
|
|
|
|
}else {
|
|
|
|
|
value = JSON.stringify(value)
|
|
|
|
|
texts=value;
|
|
|
|
|
try {
|
|
|
|
|
this.setState({
|
|
|
|
|
question_titlesysl:JSON.stringify(value)
|
|
|
|
|
})
|
|
|
|
|
}catch (e) {
|
|
|
|
|
this.setState({
|
|
|
|
|
question_titlesysl:""
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
let texts = JSON.stringify(value);
|
|
|
|
|
this.setState({
|
|
|
|
|
question_titlesysl:texts
|
|
|
|
|
})
|
|
|
|
@ -368,6 +354,10 @@ class SingleEditor extends Component{
|
|
|
|
|
// //////console.log("xuanzheshijuan");
|
|
|
|
|
// //////console.log(answerTagArray);
|
|
|
|
|
// //////console.log(!exerciseIsPublish);
|
|
|
|
|
const options=['code-block', 'image', 'formula',{size: ['14px', '16px', '18px', '20px']},
|
|
|
|
|
{ 'color': ['#333333','#e60000','#ff9900','#ffff00','#ffffff']},
|
|
|
|
|
{ 'font': ['Microsoft-YaHei','SimSun', 'SimHei','KaiTi','FangSong','Arial','Times-New-Roman','sans-serif']}
|
|
|
|
|
]
|
|
|
|
|
return(
|
|
|
|
|
<div className="padding20-30 signleEditor danxuano" id={qNumber}>
|
|
|
|
|
|
|
|
|
@ -389,6 +379,12 @@ class SingleEditor extends Component{
|
|
|
|
|
#e_tips_mdEditor_question_undefined4{
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
.signleEditor .quill_editor_for_react_area .ql-toolbar .ql-formats .ql-size {
|
|
|
|
|
line-height: 20px;
|
|
|
|
|
}
|
|
|
|
|
.signleEditor .quill_editor_for_react_area .ql-toolbar .ql-formats .ql-font {
|
|
|
|
|
line-height: 20px;
|
|
|
|
|
}
|
|
|
|
|
`}</style>
|
|
|
|
|
<p className="mb10 clearfix">
|
|
|
|
|
{/* {!question_id ? '新建' : '编辑'} */}
|
|
|
|
@ -401,7 +397,7 @@ class SingleEditor extends Component{
|
|
|
|
|
imgAttrs={{width: '146px', height: '136px'}}
|
|
|
|
|
style={{ height: '155px'}}
|
|
|
|
|
placeholder="请您输入题干"
|
|
|
|
|
options={['code-block', 'image', 'formula']}
|
|
|
|
|
options={options}
|
|
|
|
|
value={question_title}
|
|
|
|
|
onContentChange={this.onContentChange}
|
|
|
|
|
/>
|
|
|
|
@ -433,7 +429,7 @@ class SingleEditor extends Component{
|
|
|
|
|
imgAttrs={{width: '146px', height: '136px'}}
|
|
|
|
|
style={{ height: '166px'}}
|
|
|
|
|
placeholder="请您输入题干"
|
|
|
|
|
options={['code-block', 'image', 'formula']}
|
|
|
|
|
options={options}
|
|
|
|
|
value={item}
|
|
|
|
|
onContentChange={(value,quill) => this.onOptionContentChange(value,quill,index)}
|
|
|
|
|
/>
|
|
|
|
@ -443,7 +439,7 @@ class SingleEditor extends Component{
|
|
|
|
|
imgAttrs={{width: '146px', height: '136px'}}
|
|
|
|
|
style={{ height: '166px'}}
|
|
|
|
|
placeholder="请您输入题干"
|
|
|
|
|
options={['code-block', 'image', 'formula']}
|
|
|
|
|
options={options}
|
|
|
|
|
value={JSON.parse(item)}
|
|
|
|
|
onContentChange={(value,quill) => this.onOptionContentChange(value,quill,index)}
|
|
|
|
|
/>
|
|
|
|
@ -484,7 +480,7 @@ class SingleEditor extends Component{
|
|
|
|
|
imgAttrs={{width: '146px', height: '136px'}}
|
|
|
|
|
style={{height: '166px' }}
|
|
|
|
|
placeholder="请您输入题目解析"
|
|
|
|
|
options={['code-block', 'image', 'formula']}
|
|
|
|
|
options={options}
|
|
|
|
|
value={question_titles}
|
|
|
|
|
onContentChange={this.onContentChanges}
|
|
|
|
|
/>
|
|
|
|
|