This commit is contained in:
caishi 2023-06-06 11:58:56 +08:00
commit 96ed41c24b
4 changed files with 33 additions and 32 deletions

View File

@ -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

View File

@ -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>

View File

@ -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 urlcss
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">

View File

@ -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}`;
}
}, [])