|
|
|
@ -12,6 +12,10 @@ const FileNew = Loadable({
|
|
|
|
|
loader: () => import('../Newfile/Index'),
|
|
|
|
|
loading: Loading,
|
|
|
|
|
})
|
|
|
|
|
const OrderNew = Loadable({
|
|
|
|
|
loader: () => import('../Order/New'),
|
|
|
|
|
loading: Loading,
|
|
|
|
|
})
|
|
|
|
|
const OrderIndex = Loadable({
|
|
|
|
|
loader: () => import('../Order/order'),
|
|
|
|
|
loading: Loading,
|
|
|
|
@ -30,7 +34,10 @@ class Detail extends Component{
|
|
|
|
|
projectDetail:undefined,
|
|
|
|
|
isManager:false,
|
|
|
|
|
isReporter:false,
|
|
|
|
|
isDeveloper:false
|
|
|
|
|
isDeveloper:false,
|
|
|
|
|
watchers_count:undefined ,
|
|
|
|
|
praises_count:undefined ,
|
|
|
|
|
forked_count:undefined
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -48,16 +55,60 @@ class Detail extends Component{
|
|
|
|
|
projectDetail:result.data,
|
|
|
|
|
isManager:result.data.permission && result.data.permission === "Manager",
|
|
|
|
|
isReporter:result.data.permission && result.data.permission === "Reporter",
|
|
|
|
|
isDeveloper:result.data.permission && result.data.permission === "Developer"
|
|
|
|
|
isDeveloper:result.data.permission && result.data.permission === "Developer",
|
|
|
|
|
|
|
|
|
|
watchers_count:result.data.watchers_count,
|
|
|
|
|
praises_count:result.data.praises_count,
|
|
|
|
|
forked_count:result.data.forked_count,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}).catch((error)=>{})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 关注和取消关注
|
|
|
|
|
focusFunc =(flag)=>{
|
|
|
|
|
const { projectsId } = this.props.match.params;
|
|
|
|
|
if(flag){
|
|
|
|
|
const url = `/projects/${projectsId}/watchers/follow.json`;
|
|
|
|
|
axios.post(url).then(result=>{
|
|
|
|
|
if(result){
|
|
|
|
|
this.props.showNotification('关注成功');
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
const url = `/projects/${projectsId}/watchers/unfollow.json`;
|
|
|
|
|
axios.delete(url).then(result=>{
|
|
|
|
|
if(result){
|
|
|
|
|
this.props.showNotification('取消关注成功');
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 点赞和取消点赞
|
|
|
|
|
pariseFunc=(flag)=>{
|
|
|
|
|
const { projectsId } = this.props.match.params;
|
|
|
|
|
if(flag){
|
|
|
|
|
const url = `/projects/${projectsId}/praise_tread/like.json`;
|
|
|
|
|
axios.post(url).then(result=>{
|
|
|
|
|
if(result){
|
|
|
|
|
this.props.showNotification('点赞成功');
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
const url = `/projects/${projectsId}/praise_tread/unlike.json`;
|
|
|
|
|
axios.delete(url).then(result=>{
|
|
|
|
|
if(result){
|
|
|
|
|
this.props.showNotification('取消点赞成功');
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render(){
|
|
|
|
|
const { projectsId } = this.props.match.params;
|
|
|
|
|
|
|
|
|
|
const { projectDetail } = this.state;
|
|
|
|
|
const { projectDetail , watchers_count , praises_count , forked_count } = this.state;
|
|
|
|
|
const url = this.props.history.location.pathname;
|
|
|
|
|
return(
|
|
|
|
|
<div>
|
|
|
|
@ -65,10 +116,19 @@ class Detail extends Component{
|
|
|
|
|
<div className="normal f-wrap-between mb20">
|
|
|
|
|
<p className="font-18 color-blue df flex-1" style={{alignItems:"center"}}>{projectDetail && projectDetail.author && projectDetail.author.name} / <span className="hide-1 flex-1">{ projectDetail && projectDetail.identifier }</span></p>
|
|
|
|
|
|
|
|
|
|
<span className="p-r-tags large">
|
|
|
|
|
<span><label>关注</label><span>{projectDetail && projectDetail.watchers_count}</span></span>
|
|
|
|
|
<span><label>点赞</label><span>{projectDetail && projectDetail.praises_count}</span></span>
|
|
|
|
|
<span><label>Fork</label><span>{projectDetail && projectDetail.forked_count}</span></span>
|
|
|
|
|
<span className="p-r-btn large">
|
|
|
|
|
<span>
|
|
|
|
|
<a onClick={()=>this.focusFunc(true)}><i className="iconfont icon-xianshi font-18 mr5 color-grey-6"></i>关注</a>
|
|
|
|
|
<span>{watchers_count}</span>
|
|
|
|
|
</span>
|
|
|
|
|
<span>
|
|
|
|
|
<a onClick={()=>this.pariseFunc(true)}><i className="iconfont icon-dianzan-xian font-18 mr5 color-grey-6"></i>点赞</a>
|
|
|
|
|
<span>{praises_count}</span>
|
|
|
|
|
</span>
|
|
|
|
|
<span>
|
|
|
|
|
<a><i className="iconfont icon-fork font-18 mr5 color-grey-6"></i>Fork</a>
|
|
|
|
|
<span>{forked_count}</span>
|
|
|
|
|
</span>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="normal f-wrap-between">
|
|
|
|
@ -83,6 +143,7 @@ class Detail extends Component{
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<Switch {...this.props}>
|
|
|
|
|
{/* 新建文件 */}
|
|
|
|
|
<Route path="/projects/:projectsId/coder/:branch/newfile/:path"
|
|
|
|
|
render={
|
|
|
|
|
(props) => (<FileNew {...this.props} {...props} {...this.state}/>)
|
|
|
|
@ -93,6 +154,16 @@ class Detail extends Component{
|
|
|
|
|
(props) => (<FileNew {...this.props} {...props} {...this.state}/>)
|
|
|
|
|
}
|
|
|
|
|
></Route>
|
|
|
|
|
|
|
|
|
|
{/* 新建工单 */}
|
|
|
|
|
|
|
|
|
|
<Route path="/projects/:projectsId/orders/new"
|
|
|
|
|
render={
|
|
|
|
|
(props) => (<OrderNew {...this.props} {...props} {...this.state}/>)
|
|
|
|
|
}
|
|
|
|
|
></Route>
|
|
|
|
|
|
|
|
|
|
{/* 代码Index */}
|
|
|
|
|
<Route path="/projects/:projectsId/orders"
|
|
|
|
|
render={
|
|
|
|
|
(props) => (<OrderIndex {...this.props} {...props} {...this.state}/>)
|
|
|
|
|