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] =?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 (
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 =>
{text},
+ render: text =>
{text},
},
{
title: 'userimg',
dataIndex: 'userimg',
key: 'userimg',
render: (text, record) =>(
-
+
- ),
+ ),
},
{
title: 'username',
dataIndex: 'username',
key: 'username',
- render: text =>
{text},
+ render: text =>
{text},
},
{
title: 'school',
dataIndex: 'school',
key: 'school',
- render: text =>
{text},
+ render: text =>
{text},
},
{
title: 'spendtime',
dataIndex: 'spendtime',
key: 'spendtime',
- render: text =>
{text},
+ render: text =>
{text},
},
{
title: 'score',
dataIndex: 'score',
key: 'score',
- render: text =>
{text},
+ render: text =>
{text},
},
];
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 ?"":
- 分班名称
-
- 截止时间
+ 分班名称
+ 截止时间
}
{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 (
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");