部分页面跳转点击后页面需要跳到顶部#2659

This commit is contained in:
caishi 2023-03-28 10:12:33 +08:00
parent 099fd1727e
commit 1e09a04193
12 changed files with 24 additions and 17 deletions

View File

@ -68,11 +68,11 @@
window.onload=function(){
$(".newContainer").delegate("a.anchors","click",function(){
let h = $(this).offset().top - 180;
console.log($(this).offset().top,document.body.scrollTop);
$("html,body").animate({scrollTop:h},10);
window.location.hash = $(this).attr("name");
return false;
});
}
</script>

View File

@ -166,7 +166,7 @@ function Contributors({owner,projectsId,currentLogin}){
return(
total > 0 ?
<div className="halfs">
<Link to={`/${owner}/${projectsId}/contribute`} className="font-16 color-ooo hoverA">
<Link to={`/${owner}/${projectsId}/contribute`} onClick={()=>{window.scrollTo(0,0)}} className="font-16 color-ooo hoverA">
<span>贡献者</span>
{ total > 0 && <span className="infoCount">{total}</span>}
</Link>

View File

@ -5,7 +5,7 @@ import { Link } from 'react-router-dom';
function Releases({ owner, projectsId, releaseVersions, distribution }) {
return(
<div>
<Link to={`/${owner}/${projectsId}/releases`} className="font-16 color-ooo hoverA">
<Link to={`/${owner}/${projectsId}/releases`} onClick={()=>{window.scrollTo(0,0)}} className="font-16 color-ooo hoverA">
<span>发行版</span>
{ releaseVersions && releaseVersions.total_count > 0 && <span className="infoCount">{releaseVersions.total_count}</span>}
</Link>

View File

@ -275,6 +275,7 @@ function Details(props){
...params
}).then(result=>{
if(result){
window.scrollTo(0,0);
props.showNotification("疑修更新成功!");
//
setCommentReload(Math.random());
@ -303,6 +304,7 @@ function Details(props){
due_date
}).then(result=>{
if(result && result.data && result.data.project_issues_index){
window.scrollTo(0,0);
props.showNotification("任务复制成功!");
props.history.push(`/${owner}/${projectsId}/issues/${result.data.project_issues_index}`);
}

View File

@ -197,6 +197,7 @@ function New(props){
blockchain_token_num:rewardAmount
}).then(result=>{
if(result && result.data && result.data.project_issues_index){
window.scrollTo(0,0);
props.showNotification("任务创建成功!");
props.history.push(`/${owner}/${projectsId}/issues/${result.data.project_issues_index}`);
}

View File

@ -61,18 +61,18 @@ function Tags(props) {
render: (txt, item) => {
return (
<div className="tagBranch">
<Link className="hover tagClass font-16" to={`/${owner}/${projectsId}/tree/${item.name}`}>{item.name}</Link>
<Link className="hover tagClass font-16" to={`/${owner}/${projectsId}/tree/${item.name}`} onClick={()=>{window.scrollTo(0,0)}}>{item.name}</Link>
<div className="tagModel">
{
item.tagger &&
<Tooltip placement="top" title={item.tagger.name}>
{
item.tagger.id ?
<Link className="mr3 tagModelImg" to={`/${item.tagger.login}`} >
<Link className="mr3 tagModelImg" to={`/${item.tagger.login}`} onClick={()=>{window.scrollTo(0,0)}}>
<img src={getImageUrl(`/${item.tagger && item.tagger.image_url}`)} alt="" />
</Link>
:
<span className="mr3 tagModelImg" style={{ cursor: "default" }}>
<span className="mr3 tagModelImg" style={{ cursor: "default" }} onClick={()=>{window.scrollTo(0,0)}}>
<img src={getImageUrl(`/${item.tagger && item.tagger.image_url}`)} alt="" />
</span>
}
@ -97,7 +97,7 @@ function Tags(props) {
<span style={{lineHeight: '30px'}}>
<img src={Tree} alt="sha" width={"16px"}/>
<Tooltip placement="top" title={`最后提交日期:${item.created_at_unix ? moment(item.created_at_unix * 1000).format('YYYY-MM-DD') : ''}`}>
<Link className="hover color-blue" to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.id}`)}`}>{truncateCommitId(item.id)}</Link>
<Link className="hover color-blue" to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.id}`)}`} onClick={()=>{window.scrollTo(0,0)}}>{truncateCommitId(item.id)}</Link>
</Tooltip>
<input type="text" id={`value${truncateCommitId(`${item.id}`)}`} value={`${truncateCommitId(item.id)}`}/>
</span>

View File

@ -75,7 +75,7 @@ function Index(props) {
className: "branchNameColumn",
render: (txt, item) => {
return (
<Link to={`/${owner}/${projectsId}/tree/${turnbar(txt)}`} className="task-hide">{txt}</Link>
<Link to={`/${owner}/${projectsId}/tree/${turnbar(txt)}`} onClick={()=>{window.scrollTo(0,0)}} className="task-hide">{txt}</Link>
)
}
},

View File

@ -71,16 +71,16 @@ function version(props) {
<span className={`${item.draft === "稳定" ?"versionTag green":"versionTag orange"}`}>{item.draft}</span>
<span className="color-grey-3 mt15 font-12">
<i className="iconfont icon-biaoqianicon mr3 font-14"></i>
<Link className="hover" to={`/${owner}/${projectsId}/tree/${item.tag_name}`} >{item.tag_name}</Link>
<Link className="hover" to={`/${owner}/${projectsId}/tree/${item.tag_name}`} onClick={()=>{window.scrollTo(0,0)}}>{item.tag_name}</Link>
</span>
<span className="color-grey-3 font-12">
<img src={Tree} width="16px" color="#333333" className="mr3"/>
<Link className="hover" to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`}>{truncateCommitId(item.sha)}</Link>
<img src={Tree} width="16px" color="#333333" className="mr3" alt=""/>
<Link onClick={()=>{window.scrollTo(0,0)}} className="hover" to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`}>{truncateCommitId(item.sha)}</Link>
</span>
</span>
<div className="versionInfo_right">
<div className="versionName">
<Link to={`/${owner}/${projectsId}/tree/${item.tag_name}`} className="task-hide color-blue hover font-18">{item.name}</Link>
<Link onClick={()=>{window.scrollTo(0,0)}} to={`/${owner}/${projectsId}/tree/${item.tag_name}`} className="task-hide color-blue hover font-18">{item.name}</Link>
<span>
{data && data.user_admin_permission && type !== 2 && <Link to={{pathname:`/${owner}/${projectsId}/releases/${item.version_id}/update`,state:{"stable":item.draft==="稳定"}}} className="ml15"><i className="iconfont icon-a-bianji1 font-16 color-grey-6"></i></Link>}
{data && data.user_admin_permission && type !== 2 &&

View File

@ -56,6 +56,7 @@ class MergeItem extends Component {
<i className={`iconfont icon-hebingqingqiu1 font-14 mr3 i_${status}`}></i>
<Link
to={`/${owner}/${projectsId}/pulls/${item.pull_request_number || item.pull_request_id}`}
onClick={()=>{window.scrollTo(0,0)}}
className="hide-1 font-15 color-grey-3 fwb lineh-30 mr10"
style={{ maxWidth: "600px" }}
>

View File

@ -92,6 +92,7 @@ class UpdateMilepost extends Component {
}).then(result => {
if (result) {
this.setState({ isSpin: false })
window.scrollTo(0,0);
this.props.history.push(`/${owner}/${projectsId}/milestones/${meilid}`);
}

View File

@ -77,6 +77,7 @@ class NewMilepost extends Component {
}).then(result => {
if (result) {
this.setState({ isSpin: false })
window.scrollTo(0,0);
this.props.history.push(`/${owner}/${projectsId}/milestones`);
const { getDetail } = this.props;
getDetail && getDetail();

View File

@ -1,5 +1,5 @@
import React, { Component } from "react";
import { Form, Input, Checkbox, Select , Spin } from "antd";
import { Form, Input, Checkbox, Select , Spin, Button } from "antd";
import Title from '../Component/Title';
import {WhiteBack} from '../Component/layout';
import DivertModal from '../Divert/DivertModal';
@ -208,6 +208,7 @@ class Setting extends Component {
store_id: project_id,
store_identifier: projectsId
})
window.scrollTo(0,0);
this.props.showNotification("仓库删除成功!");
this.props.history.push(`/${owner}`);
})
@ -409,9 +410,9 @@ class Setting extends Component {
</div>
{
is_transfering ?
<a onClick={this.CancelDivertProject} className="red_deleteBtn">取消转移</a>
<Button onClick={this.CancelDivertProject} className="red_deleteBtn">取消转移</Button>
:
<a onClick={this.DivertProject} className="red_deleteBtn">转移</a>
<Button onClick={this.DivertProject} className="red_deleteBtn">转移</Button>
}
</div>
<div className="flex-a-center padding15-10">
@ -422,9 +423,9 @@ class Setting extends Component {
无法撤消且删除后与仓库关联的项目/任务/合并请求/版本发布等均会被删除
</p>
</div>
<a onClick={this.deleteProject} className="red_deleteBtn">
<Button onClick={this.deleteProject} className="red_deleteBtn">
删除本仓库
</a>
</Button>
</div>
</div>
</WhiteBack>