Compare commits

...

3 Commits

Author SHA1 Message Date
caishi 7ccc1221ef style 2021-05-11 14:22:01 +08:00
caishi 6a6f0ca784 组件之间进行页面跳转时,滚动条未返回至顶部 2021-05-10 17:24:49 +08:00
caishi b70dd5928e details 2021-05-10 11:34:30 +08:00
10 changed files with 34 additions and 25 deletions

10
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "forge", "name": "forge",
"version": "0.1.0", "version": "3.0.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -2065,9 +2065,8 @@
}, },
"babel-polyfill": { "babel-polyfill": {
"version": "6.26.0", "version": "6.26.0",
"resolved": "https://registry.npm.taobao.org/babel-polyfill/download/babel-polyfill-6.26.0.tgz", "resolved": "https://registry.nlark.com/babel-polyfill/download/babel-polyfill-6.26.0.tgz",
"integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=", "integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=",
"dev": true,
"requires": { "requires": {
"babel-runtime": "^6.26.0", "babel-runtime": "^6.26.0",
"core-js": "^2.5.0", "core-js": "^2.5.0",
@ -2076,9 +2075,8 @@
"dependencies": { "dependencies": {
"regenerator-runtime": { "regenerator-runtime": {
"version": "0.10.5", "version": "0.10.5",
"resolved": "https://registry.npm.taobao.org/regenerator-runtime/download/regenerator-runtime-0.10.5.tgz?cache=0&sync_timestamp=1595456367497&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fregenerator-runtime%2Fdownload%2Fregenerator-runtime-0.10.5.tgz", "resolved": "https://registry.nlark.com/regenerator-runtime/download/regenerator-runtime-0.10.5.tgz",
"integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=", "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg="
"dev": true
} }
} }
}, },

View File

@ -1,6 +1,6 @@
{ {
"name": "forge", "name": "forge",
"version": "0.1.0", "version": "3.0.0",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@monaco-editor/react": "^2.3.0", "@monaco-editor/react": "^2.3.0",
@ -113,7 +113,8 @@
"whatwg-fetch": "2.0.3", "whatwg-fetch": "2.0.3",
"wrap-md-editor": "^0.2.20", "wrap-md-editor": "^0.2.20",
"xterm": "4.8.1", "xterm": "4.8.1",
"xterm-addon-fit": "0.4.0" "xterm-addon-fit": "0.4.0",
"babel-polyfill": "^6.26.0"
}, },
"scripts": { "scripts": {
"start": "node --max_old_space_size=15360 scripts/start.js", "start": "node --max_old_space_size=15360 scripts/start.js",

View File

@ -124,12 +124,6 @@ class App extends Component {
componentDidMount() { componentDidMount() {
document.title = "loading..."; document.title = "loading...";
this.disableVideoContextMenu(); this.disableVideoContextMenu();
history.listen(() => {
this.forceUpdate()
const $ = window.$
$("html").animate({ scrollTop: $('html').scrollTop() - 0 })
});
initAxiosInterceptors(this.props); initAxiosInterceptors(this.props);
this.getAppdata(); this.getAppdata();

View File

@ -31,6 +31,14 @@ const Infos = Loadable({
loading: Loading, loading: Loading,
}); });
class Index extends Component { class Index extends Component {
componentDidUpdate=()=>{
this.props.history.listen(()=>{
if (document.body.scrollTop || document.documentElement.scrollTop > 0) {
window.scrollTo(0, 0)
}
})
}
render() { render() {
return ( return (
<div className="newMain clearfix"> <div className="newMain clearfix">

View File

@ -389,7 +389,7 @@ function CoderDepot(props){
website && website &&
<p className="color-grey-6 df"> <p className="color-grey-6 df">
<i className="iconfont icon-lianjie2 font-15 mr10 color-grey-9"></i> <i className="iconfont icon-lianjie2 font-15 mr10 color-grey-9"></i>
<a href={website} target="_blank" style={{wordBreak:"break-all",lineHeight:"20px",marginTop:"5px",textDecoration:"underline"}}>{website}</a> <a href={website} className="color-grey-6" target="_blank" style={{wordBreak:"break-all",lineHeight:"20px",marginTop:"5px",textDecoration:"underline"}}>{website}</a>
</p> </p>
} }
<p> <p>
@ -397,13 +397,13 @@ function CoderDepot(props){
<a href="#readme" className="color-grey-6">README.md</a> <a href="#readme" className="color-grey-6">README.md</a>
</p> </p>
<p className="color-grey-6"> <p className="color-grey-6">
<i className="iconfont icon-dataBase font-15 mr10 color-grey-9"></i> <i className="iconfont icon-dataBase font-15 mr10 color-grey-6"></i>
<span>{projectDetail && projectDetail.size}</span> <span>{projectDetail && projectDetail.size}</span>
</p> </p>
{ {
projectDetail && projectDetail.license_name && projectDetail && projectDetail.license_name &&
<p className="color-grey-6"> <p className="color-grey-6">
<i className="iconfont icon-tianping font-16 mr10 color-grey-9"></i> <i className="iconfont icon-tianping font-16 mr10 color-grey-3"></i>
<span>{projectDetail.license_name}</span> <span>{projectDetail.license_name}</span>
</p> </p>
} }

View File

@ -46,11 +46,13 @@ class IndexItem extends Component {
: "" : ""
} }
{ {
item.type && item.type !== 0 ? item.type && item.type === 2 ?
item.type === 2 ?
<Tooltip title="该项目是一个镜像" className="ml5"> <Tooltip title="该项目是一个镜像" className="ml5">
<i className="iconfont icon-banbenku font-18 color-green" /> <i className="iconfont icon-banbenku font-18 color-green" />
</Tooltip>: </Tooltip>:""
}
{
item.type && item.type === 1 ?
<span className="ml5"> <span className="ml5">
<i className="iconfont icon-jingxiang font-18 color-green" /> <i className="iconfont icon-jingxiang font-18 color-green" />
</span>:"" </span>:""
@ -65,8 +67,6 @@ class IndexItem extends Component {
<div className="p-r-about"> <div className="p-r-about">
<span className="p-r-detail"> <span className="p-r-detail">
{/* <span><label>浏览量:</label>{item.visits}</span> */}
{/* {item.category && item.category.id && <span>{item.category.name}</span>} */}
{item.last_update_time ? <span><label>更新于</label>{item.time_ago}</span> : ""} {item.last_update_time ? <span><label>更新于</label>{item.time_ago}</span> : ""}
{item.language && item.language.id ? <span className="color-grey-3">{item.language.name}</span> : ""} {item.language && item.language.id ? <span className="color-grey-3">{item.language.name}</span> : ""}
</span> </span>

View File

@ -42,7 +42,7 @@ function Contribute(props){
<WhiteBack> <WhiteBack>
<Spin spinning={isSpin}> <Spin spinning={isSpin}>
<div className="boxPanel"> <div className="boxPanel">
<p className="font-18 mb20">贡献者列表</p> <p className="font-18 padding10-20" style={{borderBottom:"1px solid #eee"}}>贡献者列表</p>
{ {
list && list.length > 0 ? list && list.length > 0 ?
<div className="contrbuteList"> <div className="contrbuteList">

View File

@ -1,11 +1,13 @@
.boxPanel{ .boxPanel{
width: 1200px; width: 1200px;
margin:0px auto; margin:20px auto;
padding:20px 0px; border-radius: 4px;
border:1px solid #eee;
min-height: 500px; min-height: 500px;
.contrbuteList{ .contrbuteList{
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
padding:20px;
& > div{ & > div{
width: 20%; width: 20%;
} }

View File

@ -67,6 +67,11 @@ class Infos extends Component {
if(prevUser && username && prevUser !== username){ if(prevUser && username && prevUser !== username){
this.fetchUser(); this.fetchUser();
} }
this.props.history.listen(()=>{
if (document.body.scrollTop || document.documentElement.scrollTop > 0) {
window.scrollTo(0, 0)
}
})
} }
fetchUser = () => { fetchUser = () => {

View File

@ -13,6 +13,7 @@ configureUrlQuery({ history });
window.__useKindEditor = false; window.__useKindEditor = false;
const render = (Component) => { const render = (Component) => {
ReactDOM.render( ReactDOM.render(
<AppContainer > <AppContainer >