diff --git a/src/forge/Branch/CloneAddress.js b/src/forge/Branch/CloneAddress.js index c2e6dd74..b3e31ccc 100644 --- a/src/forge/Branch/CloneAddress.js +++ b/src/forge/Branch/CloneAddress.js @@ -7,10 +7,10 @@ function CloneAddress({http_url , ssh_url , zip_url , tar_url}) { const [ key , setKey ] = useState("HTTP"); return (
-
+
{setKey(e.key)}}>HTTP - {setKey(e.key)}}>SSH + {ssh_url && {setKey(e.key)}}>SSH}
@@ -18,8 +18,8 @@ function CloneAddress({http_url , ssh_url , zip_url , tar_url}) {
- 下载 ZIP - 下载 TAR.GZ + {zip_url && 下载 ZIP} + {tar_url && 下载 TAR.GZ}
) diff --git a/src/forge/Component/Contributors.jsx b/src/forge/Component/Contributors.jsx index e88acc05..f6dade6a 100644 --- a/src/forge/Component/Contributors.jsx +++ b/src/forge/Component/Contributors.jsx @@ -7,7 +7,7 @@ import './Component.scss'; import { getUser } from '../GetData/getData'; import axios from 'axios'; -function Contributors({contributors,owner,projectsId,currentLogin}){ +function Contributors({owner,projectsId,currentLogin}){ const [ menuList ,setMenuList ]= useState([]); const [ list , setList ]= useState(undefined); const [ total , setTotal ]= useState(0); @@ -16,11 +16,18 @@ function Contributors({contributors,owner,projectsId,currentLogin}){ const [ isSpin , setIsSpin ] = useState(false); useEffect(()=>{ - if(contributors && contributors.total_count>0){ - setTotal(contributors.total_count); - setList(contributors.list); - } - },[contributors]) + getData(); + },[]) + + function getData(){ + const url = `/${owner}/${projectsId}/contributors.json`; + axios.get(url).then(result=>{ + if(result){ + setTotal(result.data.total_count); + setList(result.data.list); + } + }).catch(error=>{}) + } useEffect(()=>{ if(login){ @@ -148,15 +155,15 @@ function Contributors({contributors,owner,projectsId,currentLogin}){ } return( + total > 0 ?
贡献者 - { contributors && contributors.total_count > 0 && {contributors.total_count}} + { total > 0 && {total}}
setVisibleFunc(false)}> { - total > 0 ? - list.map((item,key)=>{ + list && list.length>0 && list.map((item,key)=>{ return( @@ -165,10 +172,9 @@ function Contributors({contributors,owner,projectsId,currentLogin}){ ) }) - :"" }
-
+
:"" ) } export default Contributors; \ No newline at end of file diff --git a/src/forge/Component/LanguagePower.jsx b/src/forge/Component/LanguagePower.jsx index 8d3e361b..b2fb174b 100644 --- a/src/forge/Component/LanguagePower.jsx +++ b/src/forge/Component/LanguagePower.jsx @@ -1,18 +1,41 @@ import React, { useEffect, useState } from 'react'; import { FlexAJ } from '../Component/layout'; +import { Divider } from 'antd'; +import axios from 'axios'; -function LanguagePower({languages}){ +function LanguagePower({owner,projectsId}){ const [ array , setArray ] = useState(undefined); + useEffect(()=>{ - if(languages){ - let arr = []; - Object.keys(languages).map((item,key)=>{ - arr.push({name:item,percent:languages[item],color:getColor()}); - }) - setArray(arr); - } - },[languages]) + getData(); + },[]) + + function getData(){ + const url = `/${owner}/${projectsId}/languages.json`; + axios.get(url).then(result=>{ + if(result){ + let languages = result.data; + if(languages){ + let arr = []; + Object.keys(languages).map((item,key)=>{ + arr.push({name:item,percent:languages[item],color:getColor()}); + }) + setArray(arr); + } + } + }).catch(error=>{}) + } + + // useEffect(()=>{ + // if(languages){ + // let arr = []; + // Object.keys(languages).map((item,key)=>{ + // arr.push({name:item,percent:languages[item],color:getColor()}); + // }) + // setArray(arr); + // } + // },[languages])  function getColor(){ let str = "#"; @@ -24,7 +47,9 @@ function LanguagePower({languages}){ return str; } return( + (array && array.length > 0) ?
+

开发语言

{ @@ -47,8 +72,7 @@ function LanguagePower({languages}){ } } - -
+
:"" ) } export default LanguagePower; \ No newline at end of file diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index 11521dc0..76bce5c7 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -319,9 +319,9 @@ function CoderDepot(props){ const downloadMenu = ( ) // 确认修改简介、website、实践课程链接 @@ -582,17 +582,9 @@ function CoderDepot(props){ } {/* 贡献者 */} - { - projectDetail && projectDetail.contributors && projectDetail.contributors.total_count >0 && - - } + {/* 语言 */} - { projectDetail && projectDetail.languages && - - - - - } + } diff --git a/src/forge/Main/CoderRootCommit.js b/src/forge/Main/CoderRootCommit.js index b542c390..99637c91 100644 --- a/src/forge/Main/CoderRootCommit.js +++ b/src/forge/Main/CoderRootCommit.js @@ -133,7 +133,7 @@ class CoderRootCommit extends Component{ render(){ const { commitDatas , dataCount , limit , page , isSpining , branchList } = this.state; - const { projectDetail, commit_class , defaultBranch } = this.props; + const { projectDetail, commit_class , defaultBranch , platform } = this.props; const { projectsId , owner , branchName } = this.props.match.params; let branch = returnbar(branchName || defaultBranch); return( @@ -159,7 +159,16 @@ class CoderRootCommit extends Component{
-
+
+ { + platform ? + + + + : + + } +

sha - {truncateCommitId(`${item.sha}`)} + { + platform ? + {truncateCommitId(`${item.sha}`)} + : + {truncateCommitId(`${item.sha}`)} + } diff --git a/src/forge/css/index.scss b/src/forge/css/index.scss index 9ff62ada..ad1aad36 100644 --- a/src/forge/css/index.scss +++ b/src/forge/css/index.scss @@ -109,7 +109,7 @@ ul,ol,dl{ width: 49rem; overflow: hidden; white-space: normal; - &:hover{ + & a:hover{ text-decoration: underline; & .markdown-body{ color: #466AFF;