Commit dd8a438d by yuananting

fix:填空测试

parent b45fc574
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-02-25 13:46:35 * @Date: 2021-02-25 13:46:35
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-03-25 16:56:40 * @LastEditTime: 2021-03-25 18:25:34
* @Description: 助学工具-题库-题目管理-新增题目 * @Description: 助学工具-题库-题目管理-新增题目
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -95,7 +95,6 @@ class AddNewQuestion extends Component { ...@@ -95,7 +95,6 @@ class AddNewQuestion extends Component {
return item; return item;
}) })
.join(""); .join("");
console.log("1.接口返回:", result)
this.setState({ gapFillingContent: result }); this.setState({ gapFillingContent: result });
break; break;
case "INDEFINITE_CHOICE": case "INDEFINITE_CHOICE":
...@@ -284,7 +283,6 @@ class AddNewQuestion extends Component { ...@@ -284,7 +283,6 @@ class AddNewQuestion extends Component {
gapFillingContent, gapFillingContent,
indefiniteChoiceContent, indefiniteChoiceContent,
} = this.state; } = this.state;
console.log("2.主页面渲染:", gapFillingContent)
const categoryId = getParameterByName("categoryId"); const categoryId = getParameterByName("categoryId");
return ( return (
<div className="page add-new-question"> <div className="page add-new-question">
......
...@@ -2,12 +2,21 @@ ...@@ -2,12 +2,21 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-02-25 14:34:29 * @Date: 2021-02-25 14:34:29
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-03-25 17:54:40 * @LastEditTime: 2021-03-25 18:30:21
* @Description: 助学工具-题库-题目管理-新建题目Tab * @Description: 助学工具-题库-题目管理-新建题目Tab
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import React, { Component } from "react"; import React, { Component } from "react";
import { Form, Radio, message, Checkbox, Tag, Modal, Input, Popover } from "antd"; import {
Form,
Radio,
message,
Checkbox,
Tag,
Modal,
Input,
Popover,
} from "antd";
import "./NewQuestionTab.less"; import "./NewQuestionTab.less";
import QuestionEditor from "./QuestionEditor"; import QuestionEditor from "./QuestionEditor";
import { PlusOutlined, CloseOutlined } from "@ant-design/icons"; import { PlusOutlined, CloseOutlined } from "@ant-design/icons";
...@@ -33,7 +42,6 @@ class NewQuestionTab extends Component { ...@@ -33,7 +42,6 @@ class NewQuestionTab extends Component {
questionAnswerDescList, questionAnswerDescList,
showBox, showBox,
} = questionInfo; } = questionInfo;
console.log("3. 子组件接收:", gapFillingAnswerList)
this.state = { this.state = {
stemContent: JSON.parse(JSON.stringify(questionStemList)), // 题干内容 stemContent: JSON.parse(JSON.stringify(questionStemList)), // 题干内容
gapFillingAnswer: JSON.parse(JSON.stringify(gapFillingAnswerList)), // 填空题-选项列表 gapFillingAnswer: JSON.parse(JSON.stringify(gapFillingAnswerList)), // 填空题-选项列表
...@@ -95,15 +103,18 @@ class NewQuestionTab extends Component { ...@@ -95,15 +103,18 @@ class NewQuestionTab extends Component {
} }
shouldComponentUpdate(nextProps, nextState) { shouldComponentUpdate(nextProps, nextState) {
console.log("nextProps", nextProps)
const { questionInfo } = nextProps; const { questionInfo } = nextProps;
if (this.props.questionInfo !== questionInfo) { if (this.props.questionInfo !== questionInfo) {
// if (questionInfo.gapFillingAnswerList !== this.state.gapFillingAnswer) { console.log("4. 组件更新:", questionInfo.gapFillingAnswerList);
console.log("4. 组件更新:", questionInfo.gapFillingAnswerList) this.setState(
this.setState({ {
gapFillingAnswer: JSON.parse( gapFillingAnswer: JSON.parse(
JSON.stringify(questionInfo.gapFillingAnswerList)), JSON.stringify(questionInfo.gapFillingAnswerList)
}, () => console.log("___________________", this.state.gapFillingAnswer)); ),
// } },
() => console.log("___________________", this.state.gapFillingAnswer)
);
this.setState( this.setState(
{ {
stemContent: JSON.parse( stemContent: JSON.parse(
...@@ -575,13 +586,9 @@ class NewQuestionTab extends Component { ...@@ -575,13 +586,9 @@ class NewQuestionTab extends Component {
} }
changeBlankCount = (data, idx) => { changeBlankCount = (data, idx) => {
console.log("__changeBlankCount_data___", data) console.log(111, data, idx);
const { gapFillingAnswer } = this.state; const { gapFillingAnswer } = this.state;
console.log("88888___gapFillingAnswer__", this.state.gapFillingAnswer)
let _gap = this.state.gapFillingAnswer; let _gap = this.state.gapFillingAnswer;
console.log("___gap0000", _gap, this.state.gapFillingAnswer )
console.log("___changeBlankCount__gapFillingAnswer____", gapFillingAnswer)
console.log("***_gap:111", _gap)
if (data.length <= idx) { if (data.length <= idx) {
_gap.splice(idx, 1); _gap.splice(idx, 1);
} else { } else {
...@@ -603,7 +610,6 @@ class NewQuestionTab extends Component { ...@@ -603,7 +610,6 @@ class NewQuestionTab extends Component {
item.editInput = false; item.editInput = false;
return item; return item;
}); });
console.log("***_gap:222", _gap)
} }
this.setState( this.setState(
...@@ -694,7 +700,6 @@ class NewQuestionTab extends Component { ...@@ -694,7 +700,6 @@ class NewQuestionTab extends Component {
renderGapFillingAnswer = (optionItem, optionIndex) => { renderGapFillingAnswer = (optionItem, optionIndex) => {
const { gapFillingAnswer } = this.state; const { gapFillingAnswer } = this.state;
console.log("5. 答案渲染:", gapFillingAnswer)
const list = const list =
gapFillingAnswer[optionIndex] && gapFillingAnswer[optionIndex] &&
gapFillingAnswer[optionIndex].correctAnswerList; gapFillingAnswer[optionIndex].correctAnswerList;
...@@ -1183,7 +1188,20 @@ class NewQuestionTab extends Component { ...@@ -1183,7 +1188,20 @@ class NewQuestionTab extends Component {
label={ label={
<span> <span>
答案{" "} 答案{" "}
<Popover content={<div><div style={{marginBottom: "16px"}}>一空可设置多个答案,答对任意一个即视为正确</div><img width="400px" src="https://image.xiaomaiketang.com/xm/gaptip.png" alt=""/></div>}> <Popover
content={
<div>
<div style={{ marginBottom: "16px" }}>
一空可设置多个答案,答对任意一个即视为正确
</div>
<img
width="400px"
src="https://image.xiaomaiketang.com/xm/gaptip.png"
alt=""
/>
</div>
}
>
<span <span
className="icon iconfont" className="icon iconfont"
style={{ color: "#BFBFBF", fontSize: 14 }} style={{ color: "#BFBFBF", fontSize: 14 }}
......
...@@ -160,7 +160,6 @@ class QuestionEditor extends Component { ...@@ -160,7 +160,6 @@ class QuestionEditor extends Component {
} }
editorRoot.config.onchange = (html) => { editorRoot.config.onchange = (html) => {
console.log("onchange")
const conLen = html.replace(/<(?!img|input).*?>/g, "").length; const conLen = html.replace(/<(?!img|input).*?>/g, "").length;
counter++; counter++;
const { focusFlag } = this.state; const { focusFlag } = this.state;
......
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