diff --git a/src/forge/Source/Index.jsx b/src/forge/Source/Index.jsx index 3ba406782..bcc27acda 100644 --- a/src/forge/Source/Index.jsx +++ b/src/forge/Source/Index.jsx @@ -4,6 +4,7 @@ import { Blueback , FlexAJ } from '../Component/layout'; import { Dropdown, Input , Menu , Pagination } from 'antd'; import { Link } from 'react-router-dom'; import UploadSource from './UploadSource'; +import axios from 'axios'; const { Search } = Input; const sort = [ @@ -12,6 +13,7 @@ const sort = [ "按引用排序" ] const limit = 15; +const https = 'https://testfiles.trustie.net'; function Index(props){ const [ sortValue , setSortValue ] = useState(0); const [ page , setPage ] = useState(1); @@ -19,10 +21,31 @@ function Index(props){ const [ search , setSearch ] = useState(undefined); const [ visible , setVisible ] = useState(false); + const repo_id = props.projectDetail && props.projectDetail.repo_id; + const owner = props.match.params.owner; useEffect(()=>{ + if(owner && repo_id){ + getData(); + } + },[repo_id,owner,search,sortValue,page]) - },[search,sort,page]) + function getData(){ + const url = https +`/api/project/achievement/`; + axios.get(url,{ + params:{ + projectId:repo_id, + curPage:page, + pageSize:limit, + name:search, + sort:sortValue+1, + } + }).then(result=>{ + if(result && result.data){ + + } + }).catch(error=>{}) + } // 搜索 function onSearch(value){ @@ -31,6 +54,7 @@ function Index(props){ // 切换排序方式 function changeSort(e,index){ + console.log(index); setSortValue(index); } @@ -40,7 +64,7 @@ function Index(props){ { sort && sort.map((item,key)=>{ return( -
资源描述资源描述资源描述资源描述资源描述资源描述资源描述