构建列表

This commit is contained in:
caishi 2021-04-02 11:57:48 +08:00
parent 1cf7655e63
commit 898ad15343
2 changed files with 37 additions and 5 deletions

View File

@ -58,6 +58,7 @@ function Structure(props,ref){
return {
...item,
author:item.author && item.author.name,
image_url:item.author && item.author.image_url,
message: {
branch: item.branch_target,
message: item.message,
@ -244,7 +245,7 @@ function Structure(props,ref){
{meg.sha && <span className="color-orange">{meg.sha}</span>}
</div>
<AlignCenter>
<img style={{borderRadius:"50%",marginRight:"10px",width:"25px",height:"25px"}} src={`${current_user && getUrl(`/images/${current_user.image_url}`)}`} />
<img style={{borderRadius:"50%",marginRight:"10px",width:"25px",height:"25px"}} alt="" src={`${item.image_url && getUrl(`/images/${item.image_url}`)}`} />
<div className="task-hide ml5" style={{ maxWidth: "300px" }}>
{meg.message}
</div>

View File

@ -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(
<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>
)
//
function onOk(){
}
//
function removeTagFunc(){
}
return(
<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">
<FlexAJ>
<span className="font-18">资源库(18)</span>
@ -98,7 +129,7 @@ function Index(props){
</p>
<p className="infodesc task-hide-2">资源描述资源描述资源描述资源描述资源描述资源描述资源描述</p>
<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>
</li>