Commit 3867d55e by yuananting

style:题库编辑样式调整

parent d0ea633b
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-02-25 14:34:29 * @Date: 2021-02-25 14:34:29
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-06-04 17:06:46 * @LastEditTime: 2021-06-09 12:00:12
* @Description: 助学工具-题库-操作题目Tab * @Description: 助学工具-题库-操作题目Tab
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -66,12 +66,17 @@ class OperateQuestionTab extends Component { ...@@ -66,12 +66,17 @@ class OperateQuestionTab extends Component {
} }
componentDidMount() { componentDidMount() {
const { chooseOptions } = this.state;
const { questionTypeKey } = this.props; const { questionTypeKey } = this.props;
const isEditCurrent = getParameterByName("id") && getParameterByName("type") === questionTypeKey; const isEditCurrent =
getParameterByName("id") &&
getParameterByName("type") === questionTypeKey;
const optionSize = isEditCurrent ? 20 : 4; const optionSize = isEditCurrent ? 20 : 4;
if (["INDEFINITE_CHOICE", "MULTI_CHOICE", "SINGLE_CHOICE"].includes(questionTypeKey)) { if (
// 选择题(单选 多选 不定项)-插入4条默认选项 ["INDEFINITE_CHOICE", "MULTI_CHOICE", "SINGLE_CHOICE"].includes(
questionTypeKey
)
) {
// 选择题(单选 多选 不定项)-插入4条默认选项
for (var i = 0; i < optionSize; i++) { for (var i = 0; i < optionSize; i++) {
this.handleAddOption(); this.handleAddOption();
this.setState({ this.setState({
...@@ -631,9 +636,9 @@ class OperateQuestionTab extends Component { ...@@ -631,9 +636,9 @@ class OperateQuestionTab extends Component {
this.state.stemContent, this.state.stemContent,
(contentItem) => contentItem.type === "RICH_TEXT" (contentItem) => contentItem.type === "RICH_TEXT"
); );
if(stemContent.textLength > 1000) { if (stemContent.textLength > 1000) {
validateError++; validateError++;
} }
let stem = stemContent.content.replace(/<[^>]+>/g, ""); let stem = stemContent.content.replace(/<[^>]+>/g, "");
stem = stem.replace(/\&nbsp\;/gi, ""); stem = stem.replace(/\&nbsp\;/gi, "");
stem = stem.replace(/\s+/g, ""); stem = stem.replace(/\s+/g, "");
...@@ -691,7 +696,7 @@ class OperateQuestionTab extends Component { ...@@ -691,7 +696,7 @@ class OperateQuestionTab extends Component {
optionUnChecked = item.isCorrectAnswer optionUnChecked = item.isCorrectAnswer
? optionUnChecked ? optionUnChecked
: optionUnChecked + 1; : optionUnChecked + 1;
if(optionContent[0].textLength > 1000) { if (optionContent[0].textLength > 1000) {
validateError++; validateError++;
} }
let optionInput = optionContent[0].content.replace(/<[^>]+>/g, ""); let optionInput = optionContent[0].content.replace(/<[^>]+>/g, "");
...@@ -1037,11 +1042,11 @@ class OperateQuestionTab extends Component { ...@@ -1037,11 +1042,11 @@ class OperateQuestionTab extends Component {
return dom ? ( return dom ? (
<div <div
className="question-item_question-content" className="question-item_question-content"
style={{ style={
display: ["PICTURE", "VIDEO"].includes(type) !["PICTURE", "VIDEO"].includes(type)
? "inline-grid" ? { display: "flex" }
: "flex", : { float: "left" }
}} }
key={index} key={index}
> >
{dom} {dom}
...@@ -1191,10 +1196,8 @@ class OperateQuestionTab extends Component { ...@@ -1191,10 +1196,8 @@ class OperateQuestionTab extends Component {
data-label="正确答案" data-label="正确答案"
> >
{_.map(chooseOptions, (optionItem, optionIndex) => { {_.map(chooseOptions, (optionItem, optionIndex) => {
const { const { questionOptionContentList, isCorrectAnswer } =
questionOptionContentList, optionItem;
isCorrectAnswer,
} = optionItem;
optionItem.optionSort = optionIndex; optionItem.optionSort = optionIndex;
const mediaBtn = ["VOICE", "AUDIO", "PICTURE"]; const mediaBtn = ["VOICE", "AUDIO", "PICTURE"];
const placeHold = const placeHold =
......
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