Commit 9b24141d by wufan

Merge branch 'feature/yuananting/20210327/test-paper' into 'master'

Feature/yuananting/20210327/test paper

See merge request !19
parents 36c04299 7b526754
......@@ -54,7 +54,7 @@ function AddExam(props: any) {
}, [paperInfo.paperId])
useEffect(() => {
setPassScore(parseInt((paperInfo.totalScore || 0) * (passRate || 0) as any / 100 + ''))
setPassScore(Math.round((paperInfo.totalScore || 0) * (passRate || 0) as any / 100))
setExamTotal(paperInfo.singleChoiceCnt + paperInfo.multiChoiceCnt + paperInfo.judgeCnt + paperInfo.gapFillingCnt + paperInfo.indefiniteChoiceCnt || 0)
}, [paperInfo.paperId, passRate])
......@@ -243,7 +243,7 @@ function AddExam(props: any) {
help={check && !examName && '请选择课程'}
required>
<Input placeholder='请输入试卷名称(40字以内)' maxLength={40} value={examName} onChange={(e) => {
<Input placeholder='请输入考试名称(40字以内)' maxLength={40} value={examName} onChange={(e) => {
setExamName(e.target.value)
}} style={{ width: 320 }} />
</Form.Item>
......
......@@ -16,6 +16,7 @@ function SelectPaperModal(props: any) {
}, [item])
return <Modal
maskClosable={false}
width={900}
title="选择试卷"
visible={true}
......
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-03-29 10:52:26
* @LastEditors: yuananting
* @LastEditTime: 2021-04-07 15:23:06
* @LastEditTime: 2021-05-08 16:11:27
* @Description: 助学工具-试卷-新建选择题目弹窗
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -35,6 +35,7 @@ class SelectQuestionModal extends Component {
return (
<Modal
className="select-question-modal"
maskClosable={false}
destroyOnClose={true}
title="选择题目"
visible={true}
......
/*
* @Author: yuananting
* @Date: 2021-02-25 13:46:35
* @LastEditors: zhangleyuan
* @LastEditTime: 2021-05-10 10:16:53
* @LastEditors: yuananting
* @LastEditTime: 2021-05-10 20:33:16
* @Description: 助学工具-题库-新建/编辑题目
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -164,6 +164,8 @@ class OperateQuestion extends Component {
window.RCHistory.push({
pathname: `/question-manage-index?categoryId=${getParameterByName("categoryId")}`,
});
Bus.trigger("queryCategoryTree", "remain");
Bus.trigger("queryQuestionPageList", getParameterByName("categoryId"));
},
});
};
......@@ -334,7 +336,7 @@ class OperateQuestion extends Component {
key="SINGLE_CHOICE"
>
<OperateQuestionTab
questionTypeKey={activeKey}
questionTypeKey={"SINGLE_CHOICE"}
onRef={(ref) => {
this.singleChoiceRef = ref;
}}
......@@ -363,7 +365,7 @@ class OperateQuestion extends Component {
key="MULTI_CHOICE"
>
<OperateQuestionTab
questionTypeKey={activeKey}
questionTypeKey={"MULTI_CHOICE"}
onRef={(ref) => {
this.multiChoiceRef = ref;
}}
......@@ -391,7 +393,7 @@ class OperateQuestion extends Component {
key="JUDGE"
>
<OperateQuestionTab
questionTypeKey={activeKey}
questionTypeKey={"JUDGE"}
onRef={(ref) => {
this.judgeRef = ref;
}}
......@@ -419,7 +421,7 @@ class OperateQuestion extends Component {
key="GAP_FILLING"
>
<OperateQuestionTab
questionTypeKey={activeKey}
questionTypeKey={"GAP_FILLING"}
onRef={(ref) => {
this.gapRef = ref;
}}
......@@ -457,7 +459,7 @@ class OperateQuestion extends Component {
key="INDEFINITE_CHOICE"
>
<OperateQuestionTab
questionTypeKey={activeKey}
questionTypeKey={"INDEFINITE_CHOICE"}
onRef={(ref) => {
this.indefiniteRef = ref;
}}
......
......@@ -634,6 +634,9 @@ class OperateQuestionTab extends Component {
this.state.stemContent,
(contentItem) => contentItem.type === "RICH_TEXT"
);
if(stemContent.textLength > 1000) {
validateError++;
}
let stem = stemContent.content.replace(/<[^>]+>/g, "");
stem = stem.replace(/\&nbsp\;/gi, "");
stem = stem.replace(/\s+/g, "");
......@@ -691,7 +694,9 @@ class OperateQuestionTab extends Component {
optionUnChecked = item.isCorrectAnswer
? optionUnChecked
: optionUnChecked + 1;
if(optionContent[0].textLength > 1000) {
validateError++;
}
let optionInput = optionContent[0].content.replace(/<[^>]+>/g, "");
optionInput = optionInput.replace(/\&nbsp\;/gi, "");
optionInput = optionInput.replace(/\s+/g, "");
......
......@@ -126,18 +126,24 @@ class QuestionEditor extends Component {
// 自定义处理粘贴的文本内容
editorRoot.config.pasteTextHandle = function (content) {
if (content == "" && !content) return "";
var str = content;
str = str.replace(/<xml>[\s\S]*?<\/xml>/gi, "");
str = str.replace(/<style>[\s\S]*?<\/style>/gi, "");
str = str.replace(/<\/?[^>]*>/g, "");
str = str.replace(/[ | ]*\n/g, "\n");
str = str.replace(/\&nbsp\;/gi, " ");
str = str.replace(/[\r\n]/g, "");
if (str.length > 1000) {
str = str.substring(0, 1000);
var str1 = content; // 所有特殊字符
str1 = str1.replace(/<xml>[\s\S]*?<\/xml>/gi, "");
str1 = str1.replace(/<style>[\s\S]*?<\/style>/gi, "");
str1 = str1.replace(/<\/?[^>]*>/g, "");
str1 = str1.replace(/[ | ]*\n/g, "\n");
str1 = str1.replace(/\&nbsp\;/gi, " ");
str1 = str1.replace(/[\r\n]/g, "");
var str2 = content; // 保留空格和换行的其他字符
str2 = str2.replace(/<xml>[\s\S]*?<\/xml>/gi, "");
str2 = str2.replace(/<style>[\s\S]*?<\/style>/gi, "");
str2 = str2.replace(/<(?!br).*?>/g, "");
if (editorRoot.txt.text().length + str1.length > 1000) {
content = str2.substring(0, 1000);
message.error("内容过长,不能超过1000字");
} else {
content = str2;
}
return str;
return content;
};
let prevList = [];
......
......@@ -41,7 +41,7 @@
.editor-box_content {
width: calc(100% - 80px);
p {
display: inline-block;
display: inline;
}
}
.editor-limit {
......@@ -60,7 +60,7 @@
max-height: 110px;
overflow: auto;
p {
display: inline-block;
display: inline;
overflow-y: scroll;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment