Commit 5cafb6c1 by yuananting

fix:填空新增编辑bug

parent 69d82f3b
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-25 13:46:35
* @LastEditors: yuananting
* @LastEditTime: 2021-03-18 14:12:22
* @LastEditTime: 2021-03-19 19:29:42
* @Description: 助学工具-题库-题目管理-新增题目
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -336,6 +336,7 @@ class AddNewQuestion extends Component {
}}
questionInfo={gapFillingContent}
onSetState={(newContent) => {
console.log("gapFillingContent:" ,newContent)
Object.assign(gapFillingContent, newContent);
}}
/>
......
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-25 14:34:29
* @LastEditors: yuananting
* @LastEditTime: 2021-03-19 10:51:45
* @LastEditTime: 2021-03-19 20:33:05
* @Description: 助学工具-题库-题目管理-新建题目Tab
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -111,7 +111,7 @@ class NewQuestionTab extends Component {
),
},
() => {
if(this.props.questionTypeKey==="GAP_FillING") {
// if(this.props.questionTypeKey==="GAP_FillING") {
const con = questionInfo.questionStemList[0].content;
const input = con.match(/<input([^<>]*)>/g)
const _blanksList = input.map(item => {
......@@ -119,7 +119,7 @@ class NewQuestionTab extends Component {
})
console.log("-----", _blanksList)
this.setState({blanksList:_blanksList})
}
// }
}
); // 题干内容
this.setState({
......
......@@ -143,7 +143,6 @@ class QuestionEditor extends Component {
if (isEdit) {
const stemDom = document.getElementsByClassName("add-fill-line");
prevList = [...stemDom].map(item => item.id)
console.log('!!!!!!!!!', prevList)
localStorage.setItem('gap_ques_prevList', JSON.stringify(prevList));
}
let counter = 0
......@@ -166,7 +165,6 @@ class QuestionEditor extends Component {
if (this.state.isGapFilling && this.state.contentType === "QUESTION_STEM") {
const stemHtml = this.transferStemDocument(html);
var _blanksList = stemHtml.getElementsByClassName("add-fill-line")
const ids = [..._blanksList].map(item => item.id);
const isEdit = getParameterByName('id');
......@@ -175,15 +173,11 @@ class QuestionEditor extends Component {
prevList = prev && JSON.parse(prev);
}
console.log(prevList, '++++++++++++++++', ids)
let idx = 0;
if (prevList && ids) {
idx = this.getNewArr(prevList, ids);
const oldLen = prevList.length;
console.log(555, idx, oldLen)
idx = idx >= oldLen ? idx - oldLen : idx
}
......@@ -271,7 +265,7 @@ class QuestionEditor extends Component {
this.setState({
visiblePlacehold: false,
});
this.props.changeBlankCount(_blanksList);
// this.props.changeBlankCount(_blanksList);
};
render() {
......
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