forked from Gitlink/forgeplus-react
Merge pull request 'glcc更新' (#540) from durian/forgeplus-react:gitlink_server into gitlink_server
This commit is contained in:
commit
9ef0838210
|
|
@ -86,6 +86,8 @@ const Glcc = (propsF) => {
|
|||
const [glccSettings, setGLccSetting] = useState(undefined);
|
||||
// 是否展示项目、课题列表入口
|
||||
const [repoPublic, setRepoPublic] = useState(false);
|
||||
// 是否处于项目/课题补录阶段
|
||||
const [applyRepo, setApplyRepo] = useState(false);
|
||||
|
||||
useEffect(()=>{
|
||||
if(id && id === "2022"){
|
||||
|
|
@ -101,8 +103,11 @@ const Glcc = (propsF) => {
|
|||
// 判断是否展示项目、课题
|
||||
const publicRepoTask = res.data.filter(item=>item.name === "repoPublic");
|
||||
publicRepoTask[0] && setRepoPublic(judge(nowTime, publicRepoTask[0].value, "range"))
|
||||
// 过滤掉 项目课题公示时间
|
||||
const filterRepoPublic = res.data.filter(item=>item.name !== "repoPublic");
|
||||
// 是否处于项目/课题补录阶段
|
||||
const repoApply1 = res.data.filter(item=>item.name === "repoApply1");
|
||||
repoApply1[0] && setApplyRepo(judge(nowTime, repoApply1[0].value, "range"))
|
||||
// 过滤掉 项目课题公示时间、项目/课题补录
|
||||
const filterRepoPublic = res.data.filter(item=>["repoPublic", "repoApply1"].indexOf(item.name) === -1);
|
||||
const periodIndex = filterRepoPublic.findIndex(item=>judge(nowTime, item.value, "range"));
|
||||
periodIndex !== -1 && setPeriod(filterRepoPublic[periodIndex].name);
|
||||
}
|
||||
|
|
@ -188,12 +193,12 @@ const Glcc = (propsF) => {
|
|||
<div className="newMain clearfix">
|
||||
<Switch {...propsF}>
|
||||
{/* 学生报名 */}
|
||||
<Route
|
||||
{period === "stuApply" && <Route
|
||||
path="/glcc/student/apply/:taskId"
|
||||
render={(props) => (
|
||||
<Student {...propsF} {...props} round={round} period={period} isGlccApplyDate={isGlccApplyDate} setStudentInfoReset={setStudentInfoReset}/>
|
||||
)}
|
||||
></Route>
|
||||
></Route>}
|
||||
{/* 开源夏令营报名页面 */}
|
||||
{period === "repoApply" && <Route
|
||||
path="/glcc/apply"
|
||||
|
|
@ -201,6 +206,13 @@ const Glcc = (propsF) => {
|
|||
<Apply round={round} {...propsF} {...props}/>
|
||||
)}
|
||||
></Route>}
|
||||
{/* 导师报名课题路由通道 */}
|
||||
{applyRepo && <Route
|
||||
path="/glcc/sign"
|
||||
render={(props) => (
|
||||
<Apply round={round} {...propsF} {...props}/>
|
||||
)}
|
||||
></Route>}
|
||||
{/* 教师审核 */}
|
||||
<Route
|
||||
path="/glcc/mentoradmin"
|
||||
|
|
@ -215,27 +227,27 @@ const Glcc = (propsF) => {
|
|||
<Help {...propsF} {...props} />
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
{!(round === 2 && !repoPublic) && <Route
|
||||
path="/glcc/:id/subjects/detail/:taskId"
|
||||
render={(props) => (
|
||||
<TaskDetail {...propsF} {...props} applyTaskId={applyTaskId} applyTask={applyTask} period={period}/>
|
||||
)}
|
||||
></Route>
|
||||
></Route>}
|
||||
{/* 项目/课题列表 */}
|
||||
<Route
|
||||
{!(round === 2 && !repoPublic) && <Route
|
||||
path="/glcc/:id/projects"
|
||||
render={(props) => (
|
||||
<Project repoPublic={repoPublic} period={period} round={round} {...propsF} {...props} isStudentApplyDate={isStudentApplyDate} secondStudentApplyDate={secondStudentApplyDate} applyTaskId={applyTaskId} setStudentInfoReset={setStudentInfoReset} applyTask={applyTask}/>
|
||||
<Project period={period} round={round} {...propsF} {...props} isStudentApplyDate={isStudentApplyDate} secondStudentApplyDate={secondStudentApplyDate} applyTaskId={applyTaskId} setStudentInfoReset={setStudentInfoReset} applyTask={applyTask}/>
|
||||
)}
|
||||
></Route>
|
||||
></Route>}
|
||||
|
||||
{/* 课题列表 */}
|
||||
<Route
|
||||
{!(round === 2 && !repoPublic) && <Route
|
||||
path="/glcc/:id/subjects"
|
||||
render={(props) => (
|
||||
<Project repoPublic={repoPublic} period={period} round={round} {...propsF} {...props} isStudentApplyDate={isStudentApplyDate} secondStudentApplyDate={secondStudentApplyDate} applyTaskId={applyTaskId} setStudentInfoReset={setStudentInfoReset} cancelCount={cancelCount} applyTask={applyTask}/>
|
||||
<Project period={period} round={round} {...propsF} {...props} isStudentApplyDate={isStudentApplyDate} secondStudentApplyDate={secondStudentApplyDate} applyTaskId={applyTaskId} setStudentInfoReset={setStudentInfoReset} cancelCount={cancelCount} applyTask={applyTask}/>
|
||||
)}
|
||||
></Route>
|
||||
></Route>}
|
||||
|
||||
{/* openmmlab列表 */}
|
||||
<Route
|
||||
|
|
|
|||
|
|
@ -20,11 +20,8 @@ const TaskList = Loadable({
|
|||
});
|
||||
|
||||
function Project(propsF) {
|
||||
const {location, match:{params:{id}}, repoPublic, history} = propsF;
|
||||
const {location, match:{params:{id}}} = propsF;
|
||||
const {pathname} = location;
|
||||
if(id==="2023" && !repoPublic){
|
||||
history.push('/glcc')
|
||||
}
|
||||
useEffect(()=>{
|
||||
window.scrollTo(0, 0);
|
||||
},[])
|
||||
|
|
@ -33,7 +30,7 @@ function Project(propsF) {
|
|||
<div className="glcc_project">
|
||||
<div className='projectBannerBox'>
|
||||
<img className="glcc-banner" src={banner} alt=''></img>
|
||||
<div className='stuApplytimeBox'>学生报名时间: {id === '2023' ? '2023年6月4日-6月21日' : '2022年5月26日-6月24日'}</div>
|
||||
<div className='stuApplytimeBox'>学生报名时间: {id === '2022' ? '2022年5月26日-6月24日' : '2023年6月4日-6月21日'}</div>
|
||||
</div>
|
||||
<div className='head'>
|
||||
<Link to={`/glcc/${id}/subjects`} className={!pathname.endsWith('projects') ? 'active' : ''}>课题列表</Link>
|
||||
|
|
|
|||
|
|
@ -31,8 +31,10 @@ function ProjectList({ applyTaskId, location, match, applyTask, round, period, m
|
|||
if (response && response.message === "success") {
|
||||
let dataArr = response.data.rows;
|
||||
dataArr.forEach(i => {
|
||||
let urlArr = i.gitlinkUrl.split('/');
|
||||
i.gitlinkLastUrl = urlArr.pop() || urlArr.pop();
|
||||
// 兼容url最后带/的情况
|
||||
let urlArr = i.gitlinkUrl.endsWith('/') ? i.gitlinkUrl.substring(0, i.gitlinkUrl.length-1).split('/') : i.gitlinkUrl.split('/');
|
||||
// 直接使用last url会导致命中css
|
||||
i.gitlinkLastUrl = `${urlArr.pop()}glcc`;
|
||||
i.gitlinkLastUrl = i.gitlinkLastUrl.replace(/\./g, '');
|
||||
});
|
||||
if (gitlinkLastUrl) {
|
||||
|
|
@ -90,7 +92,7 @@ function ProjectList({ applyTaskId, location, match, applyTask, round, period, m
|
|||
overlayClassName='projectItemPopover'
|
||||
autoAdjustOverflow={false}
|
||||
>
|
||||
<div className={`projectItem ${(index + 1) % 3 === 0 || (index + 1) % 3 % 2 === 0 ? '' : 'firstBox'} ${item.projectName.replace(/ /g, '')} ${item.gitlinkLastUrl.replace(/\./g, '')}`}>
|
||||
<div className={`projectItem ${(index + 1) % 3 === 0 || (index + 1) % 3 % 2 === 0 ? '' : 'firstBox'} ${item.projectName.replace(/ /g, '')} ${item.gitlinkLastUrl}`}>
|
||||
<div className="border"></div>
|
||||
{!gitlinkLastUrl && !openmmlab && item.recommendFlag ? <img className="projectLogoStar" src={star} alt=''/> : ''}
|
||||
<div className="projectLogo">
|
||||
|
|
|
|||
|
|
@ -53,19 +53,9 @@ function Apply(props) {
|
|||
|
||||
useEffect(() => {
|
||||
// 进入此页面到填写页面
|
||||
// setTimeout(()=>{
|
||||
// let clientWidth = document.body.clientWidth;
|
||||
// let scrollHeight = 500 * clientWidth / 1920;
|
||||
// window.scrollTo(0, scrollHeight);
|
||||
// },200);
|
||||
window.scrollTo(0, 50);
|
||||
|
||||
if (new Date().getTime() < new Date('2022/05/26').getTime()) {
|
||||
// 不在开源夏令营报名时间之内
|
||||
window.location.href = "/glcc/subjects";
|
||||
} else if (current_user && current_user.login) {
|
||||
|
||||
} else {
|
||||
// 未登录
|
||||
if (current_user && !current_user.login){
|
||||
window.location.href = `/login?go_page=/glcc/student/apply/${taskId}`;
|
||||
}
|
||||
}, [])
|
||||
|
|
|
|||
Loading…
Reference in New Issue