From c7aae77629d96ff702873e08003a1a3cf520f29a Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Thu, 21 May 2020 17:13:08 +0800 Subject: [PATCH] data problem --- src/forge/Branch/branch.css | 2 +- src/forge/Main/CoderRootDirectory.js | 2 +- src/forge/Main/CoderRootTag.js | 92 +++++++++++++++------------- src/forge/Main/Detail.js | 6 +- 4 files changed, 54 insertions(+), 48 deletions(-) diff --git a/src/forge/Branch/branch.css b/src/forge/Branch/branch.css index cbef2e241..2e6db3545 100644 --- a/src/forge/Branch/branch.css +++ b/src/forge/Branch/branch.css @@ -17,7 +17,7 @@ } .branchOptions{ width: 220px; - box-shadow: 0px 0px 1px 1px rgba(134, 134, 134, 0.1); + box-shadow: 0px 0px 3px 1px rgba(134, 134, 134, 0.4); border-radius: 3px; background: #fff; max-height: 300px; diff --git a/src/forge/Main/CoderRootDirectory.js b/src/forge/Main/CoderRootDirectory.js index 2d8412213..1de890c7c 100644 --- a/src/forge/Main/CoderRootDirectory.js +++ b/src/forge/Main/CoderRootDirectory.js @@ -286,7 +286,7 @@ class CoderRootDirectory extends Component{ width:"100%", render: (text,item) => ( this.goToSubRoot(item.path)}> - {text} + {text} ), } diff --git a/src/forge/Main/CoderRootTag.js b/src/forge/Main/CoderRootTag.js index 07de53210..583d1d28d 100644 --- a/src/forge/Main/CoderRootTag.js +++ b/src/forge/Main/CoderRootTag.js @@ -1,66 +1,72 @@ -import React , { useState, useEffect } from 'react'; +import React, { useState, useEffect } from 'react'; import axios from 'axios'; import { Spin } from 'antd'; import { truncateCommitId } from '../common/util'; +import Nodata from '../Nodata'; export default ({ projectDetail }) => { - const [ isSpin , setSpin ] = useState(true); - const [ data , setData ] = useState(undefined); + const [isSpin, setSpin] = useState(true); + const [data, setData] = useState(undefined); const repo_id = projectDetail && projectDetail.repo_id; - useEffect(()=>{ - if(repo_id){ - const url = `/repositories/${repo_id}/tags.json`; - axios.get(url).then((result)=>{ - if(result){ - setData(result.data); + useEffect(() => { + if (repo_id) { + const url = `/repositories/${repo_id}/tags.json`; + axios.get(url).then((result) => { + if (result) { setSpin(false); + setData(result.data); } - }).catch(error=>{ + }).catch(error => { console.log(error); }) } - },[repo_id]); + }, [repo_id]); - return( + return (
-
-
    -
  • - 标签名 - {/* 描述 */} - 提交信息 - 下载 -
  • -
-
    - { - data && data.length > 0 && data.map((item,key)=>{ - return( + { + data && data.length > 0 ? +
    +
    • - - - {item.name} - - {/* 坎坎坷坷死二无一额坎坎坷坷死二无一额坎坎坷坷死二无一额 */} - - {truncateCommitId(`${item.id}`)} - {/* 2020-05-18 16:30 */} - - - TAR - ZIP - + 标签名 + {/* 描述 */} + 提交信息 + 下载
    • - ) - }) - } -
    -
    +
+
    + { + data && data.length > 0 && data.map((item, key) => { + return ( +
  • + + + {item.name} + + {/* 坎坎坷坷死二无一额坎坎坷坷死二无一额坎坎坷坷死二无一额 */} + + {truncateCommitId(`${item.id}`)} + {/* 2020-05-18 16:30 */} + + + TAR + ZIP + +
  • + ) + }) + } +
+
+ : + + }
) diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index 0c6b28a23..569e986ad 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -339,19 +339,19 @@ class Detail extends Component {
  • -1 || urlFlag) ? "active" : ""}> 代码库 - {projectDetail && projectDetail.commits_count && {projectDetail.commits_count}} + { projectDetail && projectDetail.commits_count ? {projectDetail.commits_count}:""}
  • -1 && !(url.indexOf("Milepost") > 0 || url.indexOf("meilpost") > 0 || url.indexOf("tags") > 0)) ? "active" : ""}> 任务 - {projectDetail && projectDetail.issues_count && {projectDetail.issues_count}} + { projectDetail && projectDetail.issues_count ? {projectDetail.issues_count} :""}
  • -1 ? "active" : ""}> 合并请求 - {projectDetail && projectDetail.pull_requests_count && {projectDetail.issues_count}} + { projectDetail && projectDetail.pull_requests_count ? {projectDetail.issues_count} : "" }
  • {/*
  • -1 ? "active" : ""}>