Commit 08ce27ec by yuananting

fix:题库编辑超出4个选项信息缺失

parent 1b8f3f61
/*
* @Author: yuananting
* @Date: 2021-02-25 14:34:29
* @LastEditors: wufan
* @LastEditTime: 2021-05-14 18:17:08
* @LastEditors: yuananting
* @LastEditTime: 2021-06-04 17:06:46
* @Description: 助学工具-题库-操作题目Tab
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -67,22 +67,19 @@ class OperateQuestionTab extends Component {
componentDidMount() {
const { chooseOptions } = this.state;
if (
["INDEFINITE_CHOICE", "MULTI_CHOICE", "SINGLE_CHOICE"].includes(
this.props.questionTypeKey
)
) {
if (chooseOptions.length === 0) {
const { questionTypeKey } = this.props;
const isEditCurrent = getParameterByName("id") && getParameterByName("type") === questionTypeKey;
const optionSize = isEditCurrent ? 20 : 4;
if (["INDEFINITE_CHOICE", "MULTI_CHOICE", "SINGLE_CHOICE"].includes(questionTypeKey)) {
// 选择题(单选 多选 不定项)-插入4条默认选项
for (var i = 0; i < 4; i++) {
this.handleAddOption();
this.setState({
[`optionsValidate_${i}`]: "success",
[`optionsText_${i}`]: "",
});
}
for (var i = 0; i < optionSize; i++) {
this.handleAddOption();
this.setState({
[`optionsValidate_${i}`]: "success",
[`optionsText_${i}`]: "",
});
}
} else if (this.props.questionTypeKey === "JUDGE") {
} else if (questionTypeKey === "JUDGE") {
this.initJudgeOption("正确");
this.initJudgeOption("错误");
}
......
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