This commit is contained in:
caishi 2021-02-22 15:27:51 +08:00
parent 518d341ed5
commit fcd859638e
7 changed files with 84 additions and 80 deletions

View File

@ -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)=>{
</ul>
</React.Fragment>
)
}else if(data && data.length === 0){
return ( <Nodata _html="暂无数据"/>)
}
}
const menu =(zip_url,tar_url)=> (
@ -68,7 +70,7 @@ export default ((props)=>{
<Spin spinning={isSpin}>
<div className="branchTable">
<p className="branchTitle bor-bottom-greyE">分支列表</p>
{list()}
<div style={{minHeight:"400px"}}>{list()}</div>
</div>
</Spin>
</div>

View File

@ -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{
</div>
<div className="commitList">
{
commitDatas && commitDatas.length > 0 ? commitDatas.map((item,k)=>{
commitDatas && commitDatas.length > 0 && commitDatas.map((item,k)=>{
return(
<div key={k}>
<p className="f-wrap-alignCenter">
@ -144,8 +143,9 @@ class CoderRootCommit extends Component{
</p>
</div>
)
}):<Nodata _html="暂无数据"/>
})
}
{commitDatas && commitDatas.length > 0 && <Nodata _html="暂无数据"/>}
</div>
</div>
{

View File

@ -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 (
<Spin spinning={isSpin}>
<div className="main">
<div className="main" style={{minHeight:'400px'}}>
<div className="f-wrap-between mb20">
<div className="f-wrap-alignCenter">
{
@ -472,7 +473,6 @@ class CoderRootDirectory extends Component {
:
<span>分支<span className="color-grey-6">master</span></span>
}
{filePath && (
<span className="ml20 font-16">
@ -525,7 +525,7 @@ class CoderRootDirectory extends Component {
</div>
</div>
{/* 主目录列表 */}
{rootList && (
{rootList && rootList.length > 0 && (
<RootTable
columns={columns}
data={rootList}
@ -544,11 +544,11 @@ class CoderRootDirectory extends Component {
></CoderRootFileDetail>
)}
{
!rootList && !fileDetail && <Nodata _html="暂未发现当前文件!"/>
(rootList && rootList.length === 0) && (fileDetail && fileDetail.length === 0) && <Nodata _html="暂未发现文件!"/>
}
{ rootList && this.renderReadMeContent(readMeContent, isManager || isDeveloper)}
</div>
</Spin>
</div>
</Spin>
);
}
}

View File

@ -28,8 +28,9 @@ export default (( props, { projectDetail }) => {
return (
<div className="main">
<Spin spinning={isSpin}>
{
data && data.length > 0 ?
<div style={{minHeight:"400px"}}>
{
data && data.length > 0 &&
<div className="div_table">
<ul className="ul_thead">
<li>
@ -40,7 +41,7 @@ export default (( props, { projectDetail }) => {
</ul>
<ul className="ul_tbody">
{
data && data.length > 0 && data.map((item, key) => {
data.map((item, key) => {
return (
<li>
<span className="flex1">
@ -60,9 +61,9 @@ export default (( props, { projectDetail }) => {
}
</ul>
</div>
:
<Nodata _html={`暂无标签!`}/>
}
}
{ data && data.length === 0 && <Nodata _html={`暂无标签!`}/> }
</div>
</Spin>
</div>
)

View File

@ -18,60 +18,60 @@ class IndexItem extends Component {
const { projects } = this.props;
return (
<div className="project-list minH-670">
{projects && projects.length > 0 ? projects.map((item, key) => {
return (
<div className="p-r-Item" key={key}>
{
item.platform === "educoder" ?
<a href="javascript:void(0)" style={{cursor:"default"}} className="show-user-link">
<img className="p-r-photo" alt="" src={item.author && item.author.image_url} ></img>
</a>
:
<Link to={`/users/${item.author.login}`} className="show-user-link">
<img className="p-r-photo" alt="" src={getImageUrl(`${item.author && item.author.image_url}`)} ></img>
</Link>
}
<div className="p-r-Infos">
<div className="p-r-name">
<Link to={`/projects/${item.author.login}/${item.identifier}`} className="hide-1 color-grey-3 font-18 task-hide " style={{ whiteSpace: "wrap", display: 'flex', width: 400 }}>
{item.author.name}/{item.name}
{
item.forked_from_project_id ?
<span className="ml5">
<i className="iconfont icon-fork font-18 color-orange" />
</span>
: ""
}
{
item.type && item.type !== 0 ?
item.type === 2 ?
<Tooltip title="该项目是一个镜像" className="ml5">
<i className="iconfont icon-banbenku font-18 color-green" />
</Tooltip>:
<span className="ml5">
<i className="iconfont icon-jingxiang font-18 color-green" />
</span>:""
}
{ projects && projects.length > 0 ? projects.map((item, key) => {
return (
<div className="p-r-Item" key={key}>
{
item.platform === "educoder" ?
<a href="javascript:void(0)" style={{cursor:"default"}} className="show-user-link">
<img className="p-r-photo" alt="" src={item.author && item.author.image_url} ></img>
</a>
:
<Link to={`/users/${item.author.login}`} className="show-user-link">
<img className="p-r-photo" alt="" src={getImageUrl(`${item.author && item.author.image_url}`)} ></img>
</Link>
<span className="p-r-tags">
<span className="pariseTag"><img src={img_parise} alt="" className="pariseImg" /> {item.praises_count}</span>
<span><i className="iconfont icon-fork mr3 font-16" style={{ color: "#1B8FFF" }} />fork {item.forked_count}</span>
</span>
</div>
<p className="break_word task-hide-2 mt10" style={{ maxHeight: "44px",lineHeight:"22px" }}>{item.description}</p>
}
<div className="p-r-Infos">
<div className="p-r-name">
<Link to={`/projects/${item.author.login}/${item.identifier}`} className="hide-1 color-grey-3 font-18 task-hide " style={{ whiteSpace: "wrap", display: 'flex', width: 400 }}>
{item.author.name}/{item.name}
{
item.forked_from_project_id ?
<span className="ml5">
<i className="iconfont icon-fork font-18 color-orange" />
</span>
: ""
}
{
item.type && item.type !== 0 ?
item.type === 2 ?
<Tooltip title="该项目是一个镜像" className="ml5">
<i className="iconfont icon-banbenku font-18 color-green" />
</Tooltip>:
<span className="ml5">
<i className="iconfont icon-jingxiang font-18 color-green" />
</span>:""
}
</Link>
<span className="p-r-tags">
<span className="pariseTag"><img src={img_parise} alt="" className="pariseImg" /> {item.praises_count}</span>
<span><i className="iconfont icon-fork mr3 font-16" style={{ color: "#1B8FFF" }} />fork {item.forked_count}</span>
</span>
</div>
<p className="break_word task-hide-2 mt10" style={{ maxHeight: "44px",lineHeight:"22px" }}>{item.description}</p>
<div className="p-r-about">
<span className="p-r-detail">
{/* <span><label>浏览量:</label>{item.visits}</span> */}
{/* {item.category && item.category.id && <span>{item.category.name}</span>} */}
{item.last_update_time ? <span><label>更新于</label>{item.time_ago}</span> : ""}
{item.language && item.language.id ? <span className="color-grey-3">{item.language.name}</span> : ""}
</span>
<div className="p-r-about">
<span className="p-r-detail">
{/* <span><label>浏览量:</label>{item.visits}</span> */}
{/* {item.category && item.category.id && <span>{item.category.name}</span>} */}
{item.last_update_time ? <span><label>更新于</label>{item.time_ago}</span> : ""}
{item.language && item.language.id ? <span className="color-grey-3">{item.language.name}</span> : ""}
</span>
</div>
</div>
</div>
</div>
)
}) : <Nodata _html="暂无数据~"></Nodata>}
)
}) : <Nodata _html="暂无数据~"></Nodata>}
</div>
)
}

View File

@ -665,6 +665,7 @@ a.color-grey-ccc:hover{
.commitList{
padding:0px 30px;
min-height: 450px;
}
.commitList > div{
border-bottom: 1px solid #EEEEEE;

View File

@ -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 (
<div>
<Spin spinning={isSpin}>
{
releases.map((item, key) => {
return (
@ -94,12 +96,10 @@ class version extends Component {
)
})
}
</div>
)
} else {
return (
<NoneData _html="暂时还没有相关数据!" />
</Spin>
)
} else if (releases && releases.length === 0) {
return ( <NoneData _html="暂时还没有相关数据!" /> )
}
}