详情:复刻按钮不能连续点击
This commit is contained in:
parent
cb514315a6
commit
876ee66a05
|
@ -1,5 +1,5 @@
|
|||
import React, { Component } from 'react';
|
||||
import { Spin, Tooltip } from 'antd';
|
||||
import { Spin, Tooltip , Button } from 'antd';
|
||||
import { Link, Route, Switch } from 'react-router-dom';
|
||||
import { Content , AlignTop } from '../Component/layout';
|
||||
import DetailBanner from './sub/DetailBanner';
|
||||
|
@ -176,6 +176,7 @@ class Detail extends Component {
|
|||
firstSync:false,
|
||||
secondSync:false,
|
||||
open_devops:false,
|
||||
forkSpin:false,
|
||||
// 默认分支
|
||||
defaultBranch:undefined,
|
||||
|
||||
|
@ -358,6 +359,9 @@ class Detail extends Component {
|
|||
forkFunc = () => {
|
||||
const { platform } = this.state;
|
||||
if(!platform)return;
|
||||
this.setState({
|
||||
forkSpin:true
|
||||
})
|
||||
const { current_user } = this.props
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
const url = `/${owner}/${projectsId}/forks.json`;
|
||||
|
@ -366,8 +370,13 @@ class Detail extends Component {
|
|||
this.props.history.push(`/projects/${current_user && current_user.login}/${result.data.identifier}`);
|
||||
this.props.showNotification(result.data.message);
|
||||
}
|
||||
this.setState({
|
||||
forkSpin:false
|
||||
})
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
this.setState({
|
||||
forkSpin:false
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -405,7 +414,7 @@ class Detail extends Component {
|
|||
const { projectDetail, watchers_count, praises_count,
|
||||
forked_count, firstSync , secondSync ,
|
||||
isManager, watched, praised,
|
||||
project , open_devops , platform , defaultBranch , bannerList } = this.state;
|
||||
project , open_devops , platform , defaultBranch , bannerList , forkSpin } = this.state;
|
||||
const url = this.props.history.location.pathname;
|
||||
const urlArr = url.split("/");
|
||||
const urlFlag = (urlArr.length === 3);
|
||||
|
@ -458,7 +467,7 @@ class Detail extends Component {
|
|||
((current_user && current_user.admin) || isManager) && (projectDetail && projectDetail.type && projectDetail.type === 2) ?
|
||||
<a className="synchronism ml30" onClick={this.synchronismMirror}>同步镜像</a> : ""
|
||||
}
|
||||
<span className="detail_tag_btn">
|
||||
<Button className="detail_tag_btn">
|
||||
<a className="detail_tag_btn_name" style={{cursor:platform?"pointer":"default"}} onClick={() => this.focusFunc(watched)}>
|
||||
<i className={watched ? "iconfont icon-shixing color-orange font-16 mr3":"iconfont icon-kongxing color-grey-9 font-16 mr3"}></i>
|
||||
<span>{watched ? '取消关注' : '关注'}</span>
|
||||
|
@ -473,8 +482,8 @@ class Detail extends Component {
|
|||
<span className="detail_tag_btn_count">{watchers_count}</span>
|
||||
:""
|
||||
}
|
||||
</span>
|
||||
<span className="detail_tag_btn">
|
||||
</Button>
|
||||
<Button className="detail_tag_btn">
|
||||
<a className="detail_tag_btn_name" style={{cursor:platform?"pointer":"default"}} onClick={() => this.pariseFunc(praised)}>
|
||||
<i className={praised ? "iconfont icon-weibiaoti105 color-orange font-14 mr3":"iconfont icon-guanzhu color-grey-9 font-14 mr3"}></i>
|
||||
<span>{praised ? '取消点赞' : '点赞'}</span>
|
||||
|
@ -488,8 +497,8 @@ class Detail extends Component {
|
|||
<span className="detail_tag_btn_count">{praises_count}</span>
|
||||
:""
|
||||
}
|
||||
</span>
|
||||
<span className="detail_tag_btn">
|
||||
</Button>
|
||||
<Button className="detail_tag_btn" loading={forkSpin}>
|
||||
<Tooltip title="复刻是fork的中文名,即复制代码仓库" placement="bottom">
|
||||
<a className="detail_tag_btn_name" style={{cursor:platform?"pointer":"default"}} onClick={this.forkFunc}>
|
||||
<i className="iconfont icon-fork color-grey-9 mr3"></i>复刻
|
||||
|
@ -505,7 +514,7 @@ class Detail extends Component {
|
|||
<span className="detail_tag_btn_count">{forked_count}</span>
|
||||
:""
|
||||
}
|
||||
</span>
|
||||
</Button>
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
|
|
|
@ -264,7 +264,10 @@
|
|||
border:1px solid #f1f1f1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-left: 30px
|
||||
margin-left: 30px;
|
||||
padding:0px;
|
||||
background-color: transparent;
|
||||
box-shadow: none;
|
||||
}
|
||||
.ant-tooltip {
|
||||
max-width: fit-content!important;
|
||||
|
|
Loading…
Reference in New Issue