From e1d59c99067bd5f08abb1a8456a4c61d8ae79f05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 31 Aug 2019 16:13:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/poll/PollNewQuestbank.js | 24 ++++++++++++++----- .../shixunHomework/Trainingjobsetting.js | 18 +++++++------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/public/react/src/modules/courses/poll/PollNewQuestbank.js b/public/react/src/modules/courses/poll/PollNewQuestbank.js index 482eb6f6b..366e8f62b 100644 --- a/public/react/src/modules/courses/poll/PollNewQuestbank.js +++ b/public/react/src/modules/courses/poll/PollNewQuestbank.js @@ -407,7 +407,7 @@ class PollNewQuestbank extends Component { } this.addMytopic(1, this.state.pollid, Insertposition, false, 0); - // } + this.scrollToAnchor("publishtimeid"); } //添加多选题目 @@ -431,6 +431,7 @@ class PollNewQuestbank extends Component { } this.addMytopic(2, this.state.pollid, Insertposition, false, 0); + this.scrollToAnchor("publishtimeid"); // } } @@ -451,7 +452,7 @@ class PollNewQuestbank extends Component { } this.addMytopic(3, this.state.pollid, Insertposition, false, 0); - // } + this.scrollToAnchor("publishtimeid"); } //编辑方法 @@ -2476,8 +2477,18 @@ class PollNewQuestbank extends Component { // console.log("toWorkDetail"); this.props.history.push(`/banks/poll/${this.props.match.params.workid}`); // this.props.initPublic(undefined); + }; + //跳转道描点的地方 + scrollToAnchor = (anchorName) => { + if (anchorName) { + // 找到锚点 + let anchorElement = document.getElementById(anchorName); + // 如果对应id的锚点存在,就跳转到锚点 + if(anchorElement) { anchorElement.scrollIntoView(); } + } } + render() { let { addonAfter, @@ -3473,17 +3484,17 @@ class PollNewQuestbank extends Component { {/*新建单选多选2*/} -