diff --git a/public/react/src/modules/courses/poll/PollNew.js b/public/react/src/modules/courses/poll/PollNew.js index 71de4a28b..a36180e9e 100644 --- a/public/react/src/modules/courses/poll/PollNew.js +++ b/public/react/src/modules/courses/poll/PollNew.js @@ -71,6 +71,7 @@ class PollNew extends Component { first_category_url:"", left_banner_id:"", publishtimeid_int:0, + boolneweied:undefined, } // console.log("试卷新建和编辑"); // console.log(JSON.stringify(props)); @@ -380,6 +381,7 @@ class PollNew extends Component { } this.setState({ Newdisplay:true, + boolneweied:true, }) var Insertposition = this.state.poll_questions.length; // console.log(JSON.stringify(this.state.poll_questions)); @@ -409,6 +411,7 @@ class PollNew extends Component { } this.setState({ Newdisplay:true, + boolneweied:true, }) var Insertposition = this.state.poll_questions.length; // console.log(JSON.stringify(this.state.poll_questions)); @@ -432,6 +435,7 @@ class PollNew extends Component { } this.setState({ Newdisplay:true, + boolneweied:true, }) var Insertposition = this.state.poll_questions.length; // console.log(JSON.stringify(this.state.poll_questions)); @@ -451,15 +455,24 @@ class PollNew extends Component { adddomedit = (object,indexysl) => { // console.log("adddomedit 76"); if (this.state.q_countst > 0) { + if(this.state.boolneweied !== undefined){ + if(this.state.boolneweied===true){ + this.scrollToAnchor("publishtimeids"); + }else{ + this.scrollToAnchor("publishtimeid"+this.state.publishtimeid_int); + } + }else{ + this.scrollToAnchor("publishtimeids"); + } this.props.showNotification(`不能同时编辑两题`); - this.scrollToAnchor("publishtimeids"); return; } var anserbool = false; this.setState({ q_countst: 1, bindingid:object.question.id, - publishtimeid_int:indexysl + publishtimeid_int:indexysl, + boolneweied:false, }) // window.scrollTo(0, this.refs.targetElement.offsetTops) let {adddom} = this.state; @@ -617,11 +630,19 @@ class PollNew extends Component { // console.log(pollid) // console.log(Insertposition) // console.log(Whether) - console.log("addMytopic"); - console.log(id); + // console.log("addMytopic"); + // console.log(id); if (this.state.q_countst > 0) { if(Whether===true){ - this.scrollToAnchor("publishtimeids"); + if(this.state.boolneweied !== undefined){ + if(this.state.boolneweied===true){ + this.scrollToAnchor("publishtimeids"); + }else{ + this.scrollToAnchor("publishtimeid"+this.state.publishtimeid_int); + } + }else{ + this.scrollToAnchor("publishtimeids"); + } } this.props.showNotification(`不能同时编辑两题`); return; @@ -639,6 +660,7 @@ class PollNew extends Component { this.setState({ Insertposition: Insertposition, q_countst: 1, + boolneweied:false, }) // window.scrollTo(0, this.refs.targetElement.offsetTop) var arrr = this.state.adddom; @@ -847,6 +869,7 @@ class PollNew extends Component { bindingid:undefined, Newdisplay:false, newoption: false, + boolneweied:undefined }) }else{ @@ -857,6 +880,7 @@ class PollNew extends Component { problemtopicbool: false, Newdisplay:false, newoption: false, + boolneweied:undefined }) } @@ -1405,6 +1429,7 @@ class PollNew extends Component { adddom: newarr, problemtopic: null, problemtopicbool: false, + boolneweied:undefined // mysingles: this.state.mysingles, // mydoubles: this.state.mydoubles, // mymainsint: this.state.mymainsint @@ -1923,6 +1948,9 @@ class PollNew extends Component { } this.Deleteadddom(indexo); // console.log(indexo) + this.setState({ + boolneweied:undefined + }) }