From fcd859638e7e96b2c3fb32cdbf77d1892f135e9a Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Mon, 22 Feb 2021 15:27:51 +0800 Subject: [PATCH] spining --- src/forge/Main/CoderRootBranch.js | 6 +- src/forge/Main/CoderRootCommit.js | 6 +- src/forge/Main/CoderRootDirectory.js | 24 +++---- src/forge/Main/CoderRootTag.js | 13 ++-- src/forge/Main/IndexItem.js | 100 +++++++++++++-------------- src/forge/Main/list.css | 1 + src/forge/Version/version.js | 14 ++-- 7 files changed, 84 insertions(+), 80 deletions(-) diff --git a/src/forge/Main/CoderRootBranch.js b/src/forge/Main/CoderRootBranch.js index 4369d2fe5..ace3aa581 100644 --- a/src/forge/Main/CoderRootBranch.js +++ b/src/forge/Main/CoderRootBranch.js @@ -3,7 +3,7 @@ import { Link } from "react-router-dom"; import { Dropdown , Menu , Icon , Tooltip , Spin } from 'antd'; import { truncateCommitId } from '../common/util'; import { getBranch } from '../GetData/getData'; - +import Nodata from '../Nodata'; import './list.css'; export default ((props)=>{ @@ -54,6 +54,8 @@ export default ((props)=>{ ) + }else if(data && data.length === 0){ + return ( ) } } const menu =(zip_url,tar_url)=> ( @@ -68,7 +70,7 @@ export default ((props)=>{

分支列表

- {list()} +
{list()}
diff --git a/src/forge/Main/CoderRootCommit.js b/src/forge/Main/CoderRootCommit.js index 11aacea49..9fc39cae7 100644 --- a/src/forge/Main/CoderRootCommit.js +++ b/src/forge/Main/CoderRootCommit.js @@ -4,7 +4,6 @@ import { getImageUrl } from 'educoder'; import { truncateCommitId } from '../common/util'; import SelectBranch from '../Branch/Select'; import Nodata from '../Nodata'; -import { getBranch } from '../GetData/getData'; import axios from 'axios'; import {Link} from "react-router-dom"; @@ -129,7 +128,7 @@ class CoderRootCommit extends Component{
{ - commitDatas && commitDatas.length > 0 ? commitDatas.map((item,k)=>{ + commitDatas && commitDatas.length > 0 && commitDatas.map((item,k)=>{ return(

@@ -144,8 +143,9 @@ class CoderRootCommit extends Component{

) - }): + }) } + {commitDatas && commitDatas.length > 0 && }
{ diff --git a/src/forge/Main/CoderRootDirectory.js b/src/forge/Main/CoderRootDirectory.js index 35ce2a49d..b4a31c0e5 100644 --- a/src/forge/Main/CoderRootDirectory.js +++ b/src/forge/Main/CoderRootDirectory.js @@ -123,7 +123,7 @@ class CoderRootDirectory extends Component { let entries = result.data && result.data.entries; this.setState({ filePath: undefined, - fileDetail: undefined, + fileDetail: [], isSpin: false, branchLastCommit: last_commit && last_commit.commit, lastCommitAuthor: @@ -209,12 +209,12 @@ class CoderRootDirectory extends Component { if(entries.type){ this.setState({ fileDetail:[entries], - rootList:undefined, + rootList:[], subFileType:false }) }else{ this.setState({ - fileDetail:undefined, + fileDetail:[], rootList:entries, branchLastCommit:result.data.last_commit && result.data.last_commit.commit, lastCommitAuthor:result.data.last_commit && (result.data.last_commit.author || (result.data.last_commit.commit && result.data.last_commit.commit.author)) @@ -223,8 +223,8 @@ class CoderRootDirectory extends Component { } }else{ this.setState({ - fileDetail:undefined, - rootList:undefined, + fileDetail:[], + rootList:[], isSpin:false, subFileType:false }) @@ -409,12 +409,14 @@ class CoderRootDirectory extends Component { } } + render(){ const { branchLastCommit , lastCommitAuthor , rootList ,filePath , fileDetail , subFileType , readMeContent, isSpin , zip_url , tar_url , branchList} = this.state; const { isManager , isDeveloper , projectDetail , platform , defaultBranch } = this.props; const { projectsId , owner , branchName } = this.props.match.params; let branch = branchName || defaultBranch; + const columns = [ { key:"name", @@ -450,12 +452,11 @@ class CoderRootDirectory extends Component { :"" }, ]; - const urlRoot = filePath === undefined ? "" : `/${filePath}`; let array = filePath && filePath.split("/"); return ( -
+
{ @@ -472,7 +473,6 @@ class CoderRootDirectory extends Component { : 分支:master } - {filePath && ( @@ -525,7 +525,7 @@ class CoderRootDirectory extends Component {
{/* 主目录列表 */} - {rootList && ( + {rootList && rootList.length > 0 && ( )} { - !rootList && !fileDetail && + (rootList && rootList.length === 0) && (fileDetail && fileDetail.length === 0) && } { rootList && this.renderReadMeContent(readMeContent, isManager || isDeveloper)} -
- +
+
); } } diff --git a/src/forge/Main/CoderRootTag.js b/src/forge/Main/CoderRootTag.js index 6a035fee8..6a5205abd 100644 --- a/src/forge/Main/CoderRootTag.js +++ b/src/forge/Main/CoderRootTag.js @@ -28,8 +28,9 @@ export default (( props, { projectDetail }) => { return (
- { - data && data.length > 0 ? +
+ { + data && data.length > 0 &&
  • @@ -40,7 +41,7 @@ export default (( props, { projectDetail }) => {
    { - data && data.length > 0 && data.map((item, key) => { + data.map((item, key) => { return (
  • @@ -60,9 +61,9 @@ export default (( props, { projectDetail }) => { }
- : - - } + } + { data && data.length === 0 && } +
) diff --git a/src/forge/Main/IndexItem.js b/src/forge/Main/IndexItem.js index 7443e8ec5..c334715a4 100644 --- a/src/forge/Main/IndexItem.js +++ b/src/forge/Main/IndexItem.js @@ -18,60 +18,60 @@ class IndexItem extends Component { const { projects } = this.props; return (
- {projects && projects.length > 0 ? projects.map((item, key) => { - return ( -
- { - item.platform === "educoder" ? - - - - : - - - - } -
-
- - {item.author.name}/{item.name} - { - item.forked_from_project_id ? - - - - : "" - } - { - item.type && item.type !== 0 ? - item.type === 2 ? - - - : - - - :"" - } + { projects && projects.length > 0 ? projects.map((item, key) => { + return ( +
+ { + item.platform === "educoder" ? + + + + : + + - - 赞 {item.praises_count} - fork {item.forked_count} - -
-

{item.description}

+ } +
+
+ + {item.author.name}/{item.name} + { + item.forked_from_project_id ? + + + + : "" + } + { + item.type && item.type !== 0 ? + item.type === 2 ? + + + : + + + :"" + } + + + 赞 {item.praises_count} + fork {item.forked_count} + +
+

{item.description}

-
- - {/* {item.visits} */} - {/* {item.category && item.category.id && {item.category.name}} */} - {item.last_update_time ? {item.time_ago} : ""} - {item.language && item.language.id ? {item.language.name} : ""} - +
+ + {/* {item.visits} */} + {/* {item.category && item.category.id && {item.category.name}} */} + {item.last_update_time ? {item.time_ago} : ""} + {item.language && item.language.id ? {item.language.name} : ""} + +
-
- ) - }) : } + ) + }) : }
) } diff --git a/src/forge/Main/list.css b/src/forge/Main/list.css index 272583d1c..c901fa1cf 100644 --- a/src/forge/Main/list.css +++ b/src/forge/Main/list.css @@ -665,6 +665,7 @@ a.color-grey-ccc:hover{ .commitList{ padding:0px 30px; + min-height: 450px; } .commitList > div{ border-bottom: 1px solid #EEEEEE; diff --git a/src/forge/Version/version.js b/src/forge/Version/version.js index 1893e967a..7a5368905 100644 --- a/src/forge/Version/version.js +++ b/src/forge/Version/version.js @@ -1,5 +1,6 @@ import React, { Component } from "react"; import { Link } from 'react-router-dom'; +import { Spin } from 'antd'; import NoneData from '../Nodata'; import './version.css'; import axios from 'axios'; @@ -19,7 +20,7 @@ class version extends Component { data: undefined, releases:undefined, issues: undefined, - isSpin: false, + isSpin: true, search: undefined, search_count: undefined, } @@ -57,9 +58,10 @@ class version extends Component { renderList = (releases) => { const { projectsId , owner } = this.props.match.params; + const { isSpin } = this.state; if (releases && releases.length > 0) { return ( -
+ { releases.map((item, key) => { return ( @@ -94,12 +96,10 @@ class version extends Component { ) }) } -
- ) - } else { - return ( - + ) + } else if (releases && releases.length === 0) { + return ( ) } }