forked from Gitlink/forgeplus-react
构建列表
This commit is contained in:
parent
a05d06bc1f
commit
d76416bf1a
|
@ -4,6 +4,7 @@ import { Blueback , FlexAJ } from '../Component/layout';
|
||||||
import { Dropdown, Input , Menu , Pagination } from 'antd';
|
import { Dropdown, Input , Menu , Pagination } from 'antd';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import UploadSource from './UploadSource';
|
import UploadSource from './UploadSource';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
const { Search } = Input;
|
const { Search } = Input;
|
||||||
const sort = [
|
const sort = [
|
||||||
|
@ -12,6 +13,7 @@ const sort = [
|
||||||
"按引用排序"
|
"按引用排序"
|
||||||
]
|
]
|
||||||
const limit = 15;
|
const limit = 15;
|
||||||
|
const https = 'https://testfiles.trustie.net';
|
||||||
function Index(props){
|
function Index(props){
|
||||||
const [ sortValue , setSortValue ] = useState(0);
|
const [ sortValue , setSortValue ] = useState(0);
|
||||||
const [ page , setPage ] = useState(1);
|
const [ page , setPage ] = useState(1);
|
||||||
|
@ -19,10 +21,31 @@ function Index(props){
|
||||||
const [ search , setSearch ] = useState(undefined);
|
const [ search , setSearch ] = useState(undefined);
|
||||||
|
|
||||||
const [ visible , setVisible ] = useState(false);
|
const [ visible , setVisible ] = useState(false);
|
||||||
|
const repo_id = props.projectDetail && props.projectDetail.repo_id;
|
||||||
|
const owner = props.match.params.owner;
|
||||||
|
|
||||||
useEffect(()=>{
|
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){
|
function onSearch(value){
|
||||||
|
@ -31,6 +54,7 @@ function Index(props){
|
||||||
|
|
||||||
// 切换排序方式
|
// 切换排序方式
|
||||||
function changeSort(e,index){
|
function changeSort(e,index){
|
||||||
|
console.log(index);
|
||||||
setSortValue(index);
|
setSortValue(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +64,7 @@ function Index(props){
|
||||||
{
|
{
|
||||||
sort && sort.map((item,key)=>{
|
sort && sort.map((item,key)=>{
|
||||||
return(
|
return(
|
||||||
<Menu.Item onClick={(e)=>changeSort(e,key)} value={key} className={key === sortValue ?"color-blue":""}>{item}</Menu.Item>
|
<Menu.Item onClick={(e)=>changeSort(e,key)} value={key} className={key=== sortValue ?"color-blue":""}>{item}</Menu.Item>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -55,12 +79,19 @@ function Index(props){
|
||||||
</Menu>
|
</Menu>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 上传资源确定
|
||||||
function onOk(){
|
function onOk(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 删除标签
|
||||||
|
function removeTagFunc(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<div className="sourcePanel">
|
<div className="sourcePanel">
|
||||||
<UploadSource visible={visible} onCancel={()=>setVisible(false)} onOk={onOk}/>
|
<UploadSource visible={visible} onCancel={()=>setVisible(false)} onOk={onOk} showNotification={props.showNotification}/>
|
||||||
<div className="headtitle">
|
<div className="headtitle">
|
||||||
<FlexAJ>
|
<FlexAJ>
|
||||||
<span className="font-18">资源库(18)</span>
|
<span className="font-18">资源库(18)</span>
|
||||||
|
@ -98,7 +129,7 @@ function Index(props){
|
||||||
</p>
|
</p>
|
||||||
<p className="infodesc task-hide-2">资源描述资源描述资源描述资源描述资源描述资源描述资源描述</p>
|
<p className="infodesc task-hide-2">资源描述资源描述资源描述资源描述资源描述资源描述资源描述</p>
|
||||||
<div className="infotag">
|
<div className="infotag">
|
||||||
<span>软件版本<i className="iconfont icon-guanbi font-12 ml2"></i></span>
|
<span>软件版本<i className="iconfont icon-guanbi font-12 ml2" onClick={removeTagFunc}></i></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in New Issue