临时修改

This commit is contained in:
谢思 2025-09-14 12:08:08 +08:00
parent e04b532f99
commit bde05b06b1
3 changed files with 49 additions and 7 deletions

View File

@ -78,6 +78,7 @@ function CoderDepot(props){
const [ releaseVersions , setReleaseVersions] = useState(undefined);
const [ licenseVisible ,setLicenseVisible] = useState(false);
const [ checkVisible ,setCheckVisible] = useState(false);
const [ collaborators, setCollaborators] = useState([]);
const owner = props.match.params.owner;
const projectsId = props.match.params.projectsId;
@ -188,6 +189,21 @@ function CoderDepot(props){
}
},[platform,mirror_status])
useEffect(()=>{
const {current_user} = props;
const url = `/${owner}/${projectsId}/collaborators.json`;
current_user && current_user.login && axios.get(url, {
params: {
page: 1, role: "Manager", limit: 100,
},
})
.then((result) => {
if (result) {
setCollaborators(result.data.members || []);
}
}).catch((error) => {});
},[props.current_user && props.current_user.login])
// readme
function getReadmeInfo(path, ref) {
axios.get(`/${owner}/${projectsId}/readme.json`, {
@ -659,13 +675,13 @@ function CoderDepot(props){
<div className="ShortWidth">
<div className="Gap" style={{paddingLeft:"30px"}}>
<div className="panelmenu">
<div className="font-18 color-ooo mb20 FlexAJ" style={{lineHeight:"28px"}}>关于
<div className="font-18 color-ooo mb20 FlexAJ" style={{lineHeight:"28px"}}>{desc ? '制品库' : '关于'}
{
projectDetail.permission && (projectDetail.permission==="Admin" || projectDetail.permission==="Owner" || projectDetail.permission==="Manager") &&
<i onClick={()=>setOpenModal(true)} className="iconfont icon-a-shezhi color-grey-9 font-15 pointer"></i>
}
</div>
{desc && <p className="font-14 color-grey-3 mb15 task-hide-2" style={{lineHeight:"24px",WebkitLineClamp:"4",textAlign:"justify",wordBreak:"break-all"}} title={desc}>{desc}</p>}
{desc && <p className="font-14 color-grey-3 mb15" style={{lineHeight:"24px",WebkitLineClamp:"4",textAlign:"justify",wordBreak:"break-all"}} title={desc} dangerouslySetInnerHTML={{__html: desc}}></p>}
{/* 项目标签 */}
{topics && <div className='projectHomeTopics'>
{topics.map(item=><Link to={`/explore/topic/${item.id}/${encodeURIComponent(item.name)}`} className='proHomeTopic mr15 mb10 font-13 task-hide'>{item.name}</Link>)}
@ -728,6 +744,18 @@ function CoderDepot(props){
</React.Fragment>
}
{/* {__CLIENT__ && projectDetail && projectDetail.project_id && !projectDetail.private && <ProjectCompass owner={owner} projectsId={projectsId} />} */}
{/* 贡献单位:取项目管理员 */}
{collaborators.length > 0 && <div className='halfs'>
<div className='font-16 color-ooo hoverA mb10'>贡献单位</div>
<div className='df' style={{flexWrap: 'wrap', gap: '15px'}}>
{collaborators.map(item=>{
return <a key={item.login} href={`/${item.login}`} className='mb10'>
<img src={getImageUrl(`/${item.image_url}`)} alt="" className='collaborators_img mr5'/>
<span>{item.name}</span>
</a>
})}
</div>
</div>}
{/* 贡献者 */}
{mirror_status ===0 && <Contributors owner={owner} projectsId={projectsId} /> }
{/* 项目画像: 导入/fork项目不展示 */}

View File

@ -103,7 +103,7 @@ class Index extends Component {
axios.get(url, {
params: {
user_id: current_user && current_user.user_id,
page,
page: page > parseInt(this.state.total/limit) ? 1 : page,
limit,
search,
sort_by: sort,
@ -259,10 +259,17 @@ class Index extends Component {
}
render() {
const { current_user } = this.props;
const { current_user, mygetHelmetapi} = this.props;
const {common: {projectTotal}} = mygetHelmetapi || {}
const project_total = +projectTotal.split("/").pop();
const { projectsList , recommendList , languageList , languageId, isSpin, total, search, limit, page, typeList, categoryList, recommendOriList , CategoryList , category_id, project_type } = this.state;
// 第一个类别 总数+300
let total1 = total
if(CategoryList && CategoryList[0] && (CategoryList[0].id == category_id)){
total1 = total+project_total
}
// const setting={
// dots: true,
// infinite: true,
@ -343,11 +350,12 @@ class Index extends Component {
<li className="MenuTitle" onClick={() => this.changeCategory(undefined)}><i className="iconfont icon-xiangmuleibie color-grey-9 font-15 mr5"></i></li>
{
CategoryList && CategoryList.length > 0 ? CategoryList.map((item,key)=>{
const projects_count = !key ? item.projects_count+project_total : item.projects_count
return(
<li key={key} className={category_id && parseInt(category_id) === item.id ? 'active' : ''} onClick={() => this.changeCategory(`${item.id}`)}>
<p>
<span className="font-16">{item.name}</span>
<span className="color-blue">{item.projects_count}</span>
<span className="color-blue">{projects_count}</span>
</p>
</li>
)
@ -419,7 +427,7 @@ class Index extends Component {
</div>
</div>
<ListItem {...this.props} {...this.state} projects={projectsList}></ListItem>
{this.pagination(total,limit,page)}
{this.pagination(total1,limit,page)}
</Spin>
</div>
</div>

View File

@ -577,4 +577,10 @@
img{
margin-bottom: 35px;
}
}
.collaborators_img{
width: 40px;
height: 40px;
border-radius: 50%;
}