diff --git a/src/glcc/project/component/index.scss b/src/glcc/project/component/index.scss new file mode 100644 index 000000000..bb4768444 --- /dev/null +++ b/src/glcc/project/component/index.scss @@ -0,0 +1,8 @@ +.lastLineScroll { + max-height: 220px; + overflow-y: scroll; +} +.lastTwoScroll { + max-height: 500px; + overflow-y: scroll; +} \ No newline at end of file diff --git a/src/glcc/project/component/projectDetail.jsx b/src/glcc/project/component/projectDetail.jsx index 66a613976..fb4bacdba 100644 --- a/src/glcc/project/component/projectDetail.jsx +++ b/src/glcc/project/component/projectDetail.jsx @@ -3,8 +3,9 @@ import { Button, message, Tooltip } from 'antd'; import Nodata from '../../../forge/Nodata'; import { useEffect } from 'react'; import { getProjectById } from '../../api'; +import './index.scss'; -export default ({ detail, projectId, applyTaskId, period, showTask=true, applyTask, id, round }) => { +export default ({ detail, projectId, applyTaskId, period, showTask=true, applyTask, id, round, listLen }) => { const [info, setInfo] = useState(detail); useEffect(()=>{ @@ -27,33 +28,41 @@ export default ({ detail, projectId, applyTaskId, period, showTask=true, applyTa
项目简介:  {info.projectIntro}
{/* 从项目、课题列表展开的显示课题列表,结果公示页展开的不显示课题列表 */} - {showTask && (info.registrationTaskList && info.registrationTaskList.length > 0 ? info.registrationTaskList.map((item, index)=>{ - return
-
-
{window.location.href=`/glcc/${id}/subjects/detail/${item.id}`}}>{item.taskName}
-
导师姓名:   {item.tutorName}
- {item.tutorMail &&
邮箱地址:   {item.tutorMail}
} -
-
-
{item.taskDesc}
- {item.taskUrl &&
课题链接:   {item.taskUrl}
} -
- {/* 报名详情按钮 */} - {round === 2 && applyTaskId && Object.keys(applyTaskId).includes(item.id.toString()) && } - - {/* 课题申请时间范围内: 申请课题 */} - {/* 第一次报名 */} - {round === 2 && period === "stuApply" && !(applyTaskId && Object.keys(applyTaskId).includes(item.id.toString())) && } - {/* 第二次报名 锁定状态 */} - {round === 2 && period === "stuApply1" && !(applyTaskId && Object.keys(applyTaskId).includes(item.id.toString())) && (item.locked ? : )} - - {/* 查看课题详情按钮 */} - +
= 2 + ? 'lastLineScroll' : listLen == 3 && + showTask && info.registrationTaskList.length >= 3 ? 'lastTwoScroll' : '' }> + {showTask && (info.registrationTaskList && info.registrationTaskList.length > 0 ? info.registrationTaskList.map((item, index)=>{ + return
+
+
{window.location.href=`/glcc/${id}/subjects/detail/${item.id}`}}>{item.taskName}
+
导师姓名:   {item.tutorName}
+ {item.tutorMail &&
邮箱地址:   {item.tutorMail}
}
+
+
{item.taskDesc}
+ {item.taskUrl &&
课题链接:   {item.taskUrl}
} +
+ {/* 报名详情按钮 */} + {round === 2 && applyTaskId && Object.keys(applyTaskId).includes(item.id.toString()) && } + + {/* 课题申请时间范围内: 申请课题 */} + {/* 第一次报名 */} + {round === 2 && period === "stuApply" && !(applyTaskId && Object.keys(applyTaskId).includes(item.id.toString())) && } + {/* 第二次报名 锁定状态 */} + {round === 2 && period === "stuApply1" && !(applyTaskId && Object.keys(applyTaskId).includes(item.id.toString())) && (item.locked ? : )} + + {/* 查看课题详情按钮 */} + +
+
+
¥{item.taskReward}
-
¥{item.taskReward}
-
- }) : )} + }) : )} +
:
) } \ No newline at end of file diff --git a/src/glcc/project/projectList/index.jsx b/src/glcc/project/projectList/index.jsx index 4ae2a9e9d..43732ea75 100644 --- a/src/glcc/project/projectList/index.jsx +++ b/src/glcc/project/projectList/index.jsx @@ -18,6 +18,7 @@ function ProjectList({ applyTaskId, location, match, applyTask, round, period, m const [keyword, setKeyword] = useState(openmmlab ? 'openmmlab' : undefined); const [data, setData] = useState([]); const [loading, setLoading] = useState(false); + const [listLen, setListLen] = useState(null); useEffect(() => { setLoading(true); @@ -67,11 +68,26 @@ function ProjectList({ applyTaskId, location, match, applyTask, round, period, m }) }, [keyword, round]) - function changeVisible(visible, item) { + function changeVisible(visible, item, index) { if (visible) { - let height = document.documentElement.clientWidth / 1920 * 500 + 70 + document.querySelector(`.${item.gitlinkLastUrl}`).offsetTop + item.registrationTaskList.length * 320; - document.querySelector('#taskList').style.height = height + 'px'; + // let height = document.documentElement.clientWidth / 1920 * 500 + 70 + document.querySelector(`.${item.gitlinkLastUrl}`).offsetTop + item.registrationTaskList.length * 320; + // document.querySelector('#taskList').style.height = height + 'px'; + document.querySelector('#taskList').style.height = 'auto'; + // 判断当前行数是否为最后两行,并添加滚动条样式 + if(data && data.length && data.length > 0){ + const len = data.length; + const num = len%3 == 0 ? 3 : len%3; + // 最后一行 + if(len - index <= num){ + setListLen(2) + } + // 最后两行 + if(len - index <= num + 3 && len - index > num){ + setListLen(3) + } + } } else { + setListLen(null) document.querySelector('#taskList').style.height = 'auto'; } } @@ -84,10 +100,10 @@ function ProjectList({ applyTaskId, location, match, applyTask, round, period, m
{data && data.map((item, index) => { return { changeVisible(visible, item) }} + onVisibleChange={(visible) => { changeVisible(visible, item, index) }} key={index} placement={(index + 1) % 3 === 0 ? 'bottomRight' : (index + 1) % 3 % 2 === 0 ? 'bottom' : 'bottomLeft'} - content={} + content={} trigger='click' overlayClassName='projectItemPopover' autoAdjustOverflow={false}