forked from Gitlink/forgeplus-react
47 lines
2.3 KiB
JavaScript
47 lines
2.3 KiB
JavaScript
import React, { useState } from 'react';
|
|
import { Button, Tooltip } from 'antd';
|
|
import Nodata from '../../../forge/Nodata';
|
|
import { useEffect } from 'react';
|
|
import { getProjectById } from '../../api';
|
|
|
|
export default ({ detail, projectId }) => {
|
|
const [info, setInfo] = useState(detail);
|
|
|
|
useEffect(()=>{
|
|
if(!detail && projectId){
|
|
// 通过项目Id查询项目详情
|
|
getProjectById(projectId, {round: 2, isFree: true}).then(response=>{
|
|
if(response && response.message === 'success'){
|
|
setInfo(response.data)
|
|
}
|
|
})
|
|
}
|
|
},[detail])
|
|
|
|
return (
|
|
info ? <div className={`projectDetailBox ${detail ? '':'byTask'}`}>
|
|
<div className={`projectDetailHead`}>
|
|
<span className='name'>{info.projectName}</span>
|
|
{info.projectType && <span className='type'>{info.projectType}</span>}
|
|
<p>GitLink项目地址: <a href={info.gitlinkUrl} className='linkUrl' target={"_blank"}>{info.gitlinkUrl}</a></p>
|
|
<div>项目简介: {info.projectIntro}</div>
|
|
</div>
|
|
{/* 课题列表 */}
|
|
{info.registrationTaskList && info.registrationTaskList.length ? info.registrationTaskList.map((item, index)=>{
|
|
return <div className='taskItem mt20' key={index}>
|
|
<div className="left">
|
|
<div className="taskTitle"><Tooltip title={item.taskName}>{item.taskName}</Tooltip></div>
|
|
<div className='mt20 oneLine leftWidth'>导师姓名: {item.tutorName}</div>
|
|
{item.tutorMail && <div className='mb20 email oneLine leftWidth'>邮箱地址: <span><Tooltip title={item.tutorMail}>{item.tutorMail}</Tooltip></span></div>}
|
|
</div>
|
|
<div className="center">
|
|
<div className="taskDesc"><Tooltip title={item.taskDesc}>{item.taskDesc}</Tooltip></div>
|
|
{item.taskUrl && <div className="taskUrl oneLine">课题链接: <a href={item.taskUrl} target={"_blank"}>{item.taskUrl}</a></div>}
|
|
<div></div>
|
|
</div>
|
|
<div className="right oneLine taskUrl"><span className='taskReward'>¥{item.taskReward}</span></div>
|
|
</div>
|
|
}) : <Nodata _html="课题暂无数据" small={true}/>}
|
|
</div>: <div className="projectDetailBox nodata"><Nodata _html="暂无数据" small={true}/></div>
|
|
)
|
|
} |