Commit 08ce27ec by yuananting

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

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