From 074a9d69d825dcd53c3981166342fc5ba46780ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 28 Oct 2019 14:54:19 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=B0=83=E6=95=B4md=E7=9A=84hash=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 20 ++++++++--------- .../Competitioncommon/CompetitionContents.js | 11 +++++----- .../CompetitionContentsChart.js | 14 ++++++------ .../coursesPublic/OneSelfOrderModal.js | 5 ++--- .../page/layers/ImageLayerOfCommentHOC.js | 22 +++++++++++++++++-- public/react/src/modules/tpm/TPMIndexHOC.js | 16 ++++++++++++++ 6 files changed, 60 insertions(+), 28 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 8c6f3be0b..ece36b61c 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -150,16 +150,16 @@ export function initAxiosInterceptors(props) { throw new axios.Cancel('Operation canceled by the user.'); } else { // hash跳转 - var hash = window.location.hash; - if (hash) { - hashTimeout && window.clearTimeout(hashTimeout) - hashTimeout = setTimeout(() => { - var element = document.querySelector(hash); - if (element) { - element.scrollIntoView(); - } - }, 400) - } + // var hash = window.location.hash; + // if (hash) { + // hashTimeout && window.clearTimeout(hashTimeout) + // hashTimeout = setTimeout(() => { + // var element = document.querySelector(hash); + // if (element) { + // element.scrollIntoView(); + // } + // }, 400) + // } } // if(response.data.status === 401){ // console.log("401401401") diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionContents.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionContents.js index ca99fde8e..df21e4872 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionContents.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionContents.js @@ -9,20 +9,19 @@ class CompetitionContents extends Component{ constructor(props) { super(props) this.state={ - + hash:undefined } } componentDidMount(){ window.document.title = '竞赛'; - + this.props.MdifHasAnchorJustScorll(); } - - render() { - let{mdContentdata}=this.props; - // + let{mdContentdata}=this.props; + //mdhash滚动 + this.props.MdifHasAnchorJustScorll(); return ( <div className={"fr"}> diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js index 57db59c1b..f4c3a94d5 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsChart.js @@ -76,40 +76,40 @@ class CompetitionContents extends Component{ title: 'usersum', dataIndex: 'usersum', key: 'name', - render: text => <a className={"color-blue"}>{text}</a>, + render: text => <span className={"color-blue"}>{text}</span>, }, { title: 'userimg', dataIndex: 'userimg', key: 'userimg', render: (text, record) =>( - <a href={`/users/${record.user_login}`} className="color-dark"> + <span href={`/users/${record.user_login}`} className="color-dark"> <img className={"Competitionuserimg"} src={getImageUrl(`images/${record.userimg===null?`avatars/User/0?1442652658`:record.userimg}`)}/> - </a>), + </span>), }, { title: 'username', dataIndex: 'username', key: 'username', - render: text => <a title={text}>{text}</a>, + render: text => <span title={text}>{text}</span>, }, { title: 'school', dataIndex: 'school', key: 'school', - render: text => <a title={text}>{text}</a>, + render: text => <span title={text}>{text}</span>, }, { title: 'spendtime', dataIndex: 'spendtime', key: 'spendtime', - render: text => <a>{text}</a>, + render: text => <span>{text}</span>, }, { title: 'score', dataIndex: 'score', key: 'score', - render: text => <a className={"color-blue"}>{text}</a>, + render: text => <span className={"color-blue"}>{text}</span>, }, ]; diff --git a/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js b/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js index 4261a4937..e42ce3df3 100644 --- a/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js +++ b/public/react/src/modules/courses/coursesPublic/OneSelfOrderModal.js @@ -391,9 +391,8 @@ class OneSelfOrderModal extends Component{ {this.props.modaltype===undefined||this.props.modaltype===2 || this.props.usingCheckBeforePost ?"":<div className="clearfix edu-txt-center lineh-40 F4FAFF"> <li style={{ width: '100%',padding: "0px 10px"}} className={"mb10"}> - <span style={{"float":"left","color":"#05101A"}} className="task-hide color-grey-name ml50">分班名称</span> - - <span style={{"float":"right","color":"#05101A"}} className="task-hide color-grey-name mr70">截止时间</span> + <span style={{"float":"left","color":"#05101A"}} className="task-hide color-grey-name color-grey-9">分班名称</span> + <span style={{"float":"right","color":"#05101A","margin-right": "145px"}} className="task-hide color-grey-name color-grey-9">截止时间</span> </li> </div>} {this.props.modaltype===undefined||this.props.modaltype===2 diff --git a/public/react/src/modules/page/layers/ImageLayerOfCommentHOC.js b/public/react/src/modules/page/layers/ImageLayerOfCommentHOC.js index d19aa03ec..7c10b90d7 100644 --- a/public/react/src/modules/page/layers/ImageLayerOfCommentHOC.js +++ b/public/react/src/modules/page/layers/ImageLayerOfCommentHOC.js @@ -14,6 +14,7 @@ export function ImageLayerOfCommentHOC(options = {}) { imageSrc: '' } } + onDelegateClick = (event) => { const imageSrc = event.target.src || event.target.getAttribute('src') || event.target.getAttribute('href') // 判断imageSrc是否是图片 @@ -35,6 +36,7 @@ export function ImageLayerOfCommentHOC(options = {}) { return false; } } + // jQuery._data( $('.newMain')[0], "events" ) componentDidMount() { this.props.wrappedComponentRef && this.props.wrappedComponentRef(this.refs['wrappedComponentRef']) @@ -45,6 +47,7 @@ export function ImageLayerOfCommentHOC(options = {}) { .delegate(options.imgSelector || ".J_Comment_Reply .comment_content img, .J_Comment_Reply .childrenCommentsView img","click", this.onDelegateClick); }, 1200) } + componentWillUnmount() { $(options.parentSelector || ".commentsDelegateParent", 'click', this.onDelegateClick) } @@ -55,9 +58,24 @@ export function ImageLayerOfCommentHOC(options = {}) { imageSrc: '', }) } - + + MdifHasAnchorJustScorll=()=>{ + //mdhash滚动 + let anchor = decodeURI(this.props.location.hash).replace('#', ''); + // 对应id的话, 滚动到相应位置 + if (!!anchor) { + let anchorElement = document.getElementsByName(anchor); + if (anchorElement) { + if (anchorElement.length!=0) { + anchorElement[0].scrollIntoView(); + } + } + } + } + + render() { - + this.MdifHasAnchorJustScorll(); return ( <React.Fragment> <ImageLayer {...this.state} onImageLayerClose={this.onImageLayerClose}></ImageLayer> diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index ee42ace21..77f04c0be 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -609,6 +609,21 @@ export function TPMIndexHOC(WrappedComponent) { hideGlobalLoading = () => { this.setState({ globalLoading: false }) } + + MdifHasAnchorJustScorll=()=>{ + //mdhash滚动 + let anchor = decodeURI(this.props.location.hash).replace('#', ''); + // 对应id的话, 滚动到相应位置 + if (!!anchor) { + let anchorElement = document.getElementsByName(anchor); + if (anchorElement) { + if (anchorElement.length!=0) { + anchorElement[1].scrollIntoView(); + } + } + } + } + render() { let{Headertop,Footerdown, isRender, AccountProfiletype,mygetHelmetapi}=this.state; const common = { @@ -643,6 +658,7 @@ export function TPMIndexHOC(WrappedComponent) { hideGlobalLoading: this.hideGlobalLoading, yslslowCheckresults:this.yslslowCheckresults, yslslowCheckresultsNo:this.yslslowCheckresultsNo, + MdifHasAnchorJustScorll:this.MdifHasAnchorJustScorll }; // console.log("this.props.mygetHelmetapi"); From 22ca5ad17cd688a6ce34605c2539a65f0b19cb5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 28 Oct 2019 15:00:38 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/competition/Registration.js | 56 ++++++++++++++++++- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/competition/Registration.js b/public/react/src/modules/competition/Registration.js index 3517236bf..4f8d3affe 100644 --- a/public/react/src/modules/competition/Registration.js +++ b/public/react/src/modules/competition/Registration.js @@ -68,7 +68,8 @@ class Registration extends React.Component { mutiple_limited: false, teamutiple_limited: false, members_count: 0, - mode: 0 + mode: 0, + region_schools: [], } } @@ -82,8 +83,8 @@ class Registration extends React.Component { // //// //////console.log(this.props.isAdmin()) try { const {keyword, page, per_page} = this.state; - this.Getdata(keyword, page, per_page, this.props.user.admin); - this.GetenrollmentAPI(); + this.Getdata(keyword, page, per_page, this.props.user.admin);// 获取列表数据 + this.GetenrollmentAPI();//获取我的报名配置 } catch (e) { // const {keyword, page, per_page} = this.state; // this.Getdata(keyword, page, per_page, this.props.isAdmin()); @@ -116,6 +117,7 @@ class Registration extends React.Component { if (result.data) { this.setState({ mode: result.data.mode, + region_schools: result.data.region_schools }) } @@ -454,6 +456,31 @@ class Registration extends React.Component { return } + let {region_schools} = this.state; + //判断是否是否是同一个学校,数组元素为0就不用判断 + try { + if (region_schools.length > 0) { + let i = 0; + for (var r = 0; r < region_schools.length; r++) { + if (region_schools[r] !== this.props.user.user_school) { + // 终止循环 + break; + + } + i = i + 1; + } + if (i === region_schools.length) { + //如果i 等于region_schools.length,说明本次循环中没有相同的学校,本人不支持报名 + this.props.showNotification(`本竞赛只面向部分学校/单位开放,你暂时没有参赛资格!`); + return + } + + } + } catch (e) { + + } + + if (this.props.user.is_teacher === true) { try { @@ -541,6 +568,29 @@ class Registration extends React.Component { return } + let {region_schools} = this.state; + //判断是否是否是同一个学校,数组元素为0就不用判断 + try { + if (region_schools.length > 0) { + let i = 0; + for (var r = 0; r < region_schools.length; r++) { + if (region_schools[r] !== this.props.user.user_school) { + // 终止循环 + break; + + } + i = i + 1; + } + if (i === region_schools.length) { + //如果i 等于region_schools.length,说明本次循环中没有相同的学校,本人不支持报名 + this.props.showNotification(`本竞赛只面向部分学校/单位开放,你暂时没有参赛资格!`); + return + } + + } + } catch (e) { + + } if (this.props.user.is_teacher === true) { From a6425a2150e9e972f3a15adad1db152b601ab0fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 28 Oct 2019 15:10:26 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/competition/Registration.js | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/competition/Registration.js b/public/react/src/modules/competition/Registration.js index 4f8d3affe..c7cc102a4 100644 --- a/public/react/src/modules/competition/Registration.js +++ b/public/react/src/modules/competition/Registration.js @@ -105,6 +105,8 @@ class Registration extends React.Component { this.Getdata(keyword, page, per_page, this.props.user.admin); //取报名配置 this.GetenrollmentAPI(); + //取模式 + this.Getdataheader(); } } @@ -462,7 +464,7 @@ class Registration extends React.Component { if (region_schools.length > 0) { let i = 0; for (var r = 0; r < region_schools.length; r++) { - if (region_schools[r] !== this.props.user.user_school) { + if (region_schools[r] === this.props.user.user_school) { // 终止循环 break; @@ -471,7 +473,13 @@ class Registration extends React.Component { } if (i === region_schools.length) { //如果i 等于region_schools.length,说明本次循环中没有相同的学校,本人不支持报名 - this.props.showNotification(`本竞赛只面向部分学校/单位开放,你暂时没有参赛资格!`); + try { + this.props.showNotification(`本竞赛只面向部分学校/单位开放,你暂时没有参赛资格!`); + + } catch (e) { + + } + this.Getdataheader(); return } @@ -574,7 +582,7 @@ class Registration extends React.Component { if (region_schools.length > 0) { let i = 0; for (var r = 0; r < region_schools.length; r++) { - if (region_schools[r] !== this.props.user.user_school) { + if (region_schools[r] === this.props.user.user_school) { // 终止循环 break; @@ -583,7 +591,12 @@ class Registration extends React.Component { } if (i === region_schools.length) { //如果i 等于region_schools.length,说明本次循环中没有相同的学校,本人不支持报名 - this.props.showNotification(`本竞赛只面向部分学校/单位开放,你暂时没有参赛资格!`); + try { + this.props.showNotification(`本竞赛只面向部分学校/单位开放,你暂时没有参赛资格!`); + } catch (e) { + + } + this.Getdataheader(); return }