diff --git a/src/App.js b/src/App.js index 0fc569b14..7f4617f53 100644 --- a/src/App.js +++ b/src/App.js @@ -80,16 +80,6 @@ const http500 = Loadable({ loader: () => import('./modules/500/http500'), loading: Loading, }) -// const InfosIndex = Loadable({ -// loader: () => import('./forge/users/Index'), -// loading: Loading, -// }) -// 组织 -// const OrganizeIndex = Loadable({ -// loader: () => import('./forge/Team/Index'), -// loading: Loading, -// }) - class App extends Component { constructor(props) { super(props); diff --git a/src/AppConfig.js b/src/AppConfig.js index cd01c04b7..5103c6bc9 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -59,7 +59,7 @@ export function initAxiosInterceptors(props) { // TODO 避免重复的请求 https://github.com/axios/axios#cancellation var proxy = "http://localhost:3000" - proxy = "https://testforgeplus.trustie.net" + proxy = "https://forum.trustie.net" const requestMap = {}; window.setfalseInRequestMap = function (keyName) { diff --git a/src/exchange/index.js b/src/exchange/index.js index 761e4f0b0..20c92ae8a 100644 --- a/src/exchange/index.js +++ b/src/exchange/index.js @@ -39,6 +39,13 @@ class Index extends Component{ }) } + componentDidUpdate=()=>{ + this.props.history.listen(()=>{ + if (document.body.scrollTop || document.documentElement.scrollTop > 0) { + window.scrollTo(0, 0) + } + }) + } render(){ return( diff --git a/src/forums/Index.jsx b/src/forums/Index.jsx index 09382a4a2..068faecba 100644 --- a/src/forums/Index.jsx +++ b/src/forums/Index.jsx @@ -27,7 +27,9 @@ const New = Loadable({ class Index extends Component { componentDidUpdate=()=>{ this.props.history.listen(()=>{ - + if (document.body.scrollTop || document.documentElement.scrollTop > 0) { + window.scrollTo(0, 0) + } }) } render() { diff --git a/src/user_info/Index.jsx b/src/user_info/Index.jsx index e9a69fdcf..ed75be454 100644 --- a/src/user_info/Index.jsx +++ b/src/user_info/Index.jsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useEffect } from "react"; import { TPMIndexHOC } from "../modules/tpm/TPMIndexHOC"; import { SnackbarHOC } from "educoder"; import { CNotificationHOC } from "../modules/courses/common/CNotificationHOC"; @@ -31,6 +31,15 @@ const Blocks = Loadable({ }); function Index(props) { + const history = props.history; + useEffect(()=>{ + history.listen(()=>{ + if (document.body.scrollTop || document.documentElement.scrollTop > 0) { + window.scrollTo(0, 0) + } + }) + },[history]) + return (