From 2ffa835b841c3d02468121b6a6edc104cf919be2 Mon Sep 17 00:00:00 2001
From: caishi <1149225589@qq.com>
Date: Thu, 9 Dec 2021 09:48:47 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=BA=93-=E8=B4=A1=E7=8C=AE?=
=?UTF-8?q?=E8=80=85=E5=92=8C=E8=AF=AD=E8=A8=80=E4=BD=BF=E7=94=A8=E5=8D=95?=
=?UTF-8?q?=E7=8B=AC=E6=8E=A5=E5=8F=A3=EF=BC=8Cdetail.json=E6=8E=A5?=
=?UTF-8?q?=E5=8F=A3=E4=B8=8D=E8=BF=94=E5=9B=9E=E8=BF=99=E4=B8=A4=E4=B8=AA?=
=?UTF-8?q?=E6=95=B0=E7=BB=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/forge/Branch/CloneAddress.js | 8 ++---
src/forge/Component/Contributors.jsx | 28 +++++++++-------
src/forge/Component/LanguagePower.jsx | 46 ++++++++++++++++++++-------
src/forge/Main/CoderDepot.jsx | 18 +++--------
src/forge/Main/CoderRootCommit.js | 20 ++++++++++--
src/forge/css/index.scss | 2 +-
6 files changed, 79 insertions(+), 43 deletions(-)
diff --git a/src/forge/Branch/CloneAddress.js b/src/forge/Branch/CloneAddress.js
index c2e6dd746..b3e31cccb 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 (
-
)
diff --git a/src/forge/Component/Contributors.jsx b/src/forge/Component/Contributors.jsx
index e88acc056..f6dade6a4 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 8d3e361b5..b2fb174b1 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 11521dc01..76bce5c7b 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 b542c3905..99637c91e 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 ?
+
+
+
+ :
+
+ }
+
- {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 9ff62ada6..ad1aad360 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;