forked from Gitlink/forgeplus-react
merge 学生报名通道关闭
This commit is contained in:
parent
95c4bed0cb
commit
7b52b4676d
|
@ -18,6 +18,25 @@ export function applyGlcc(data) {
|
|||
});
|
||||
}
|
||||
|
||||
//提交报名信息(学生)
|
||||
export function studentApply(data) {
|
||||
return fetch({
|
||||
url: '/api/studentApply/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
//修改报名信息(学生)
|
||||
export function studentApplyEdit(data) {
|
||||
return fetch({
|
||||
url: '/api/studentApply/update',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
// 获取当前学生用户报名信息
|
||||
// 课题列表
|
||||
export function projectList(params) {
|
||||
return fetch({
|
||||
|
@ -44,7 +63,7 @@ export function getProjectById(id) {
|
|||
});
|
||||
}
|
||||
|
||||
// 获取用户 课题报名信息
|
||||
// 获取用户(学生)课题报名信息
|
||||
export function getStudentApplyInfo(params) {
|
||||
return fetch({
|
||||
url: `/api/studentApply/getUserApplyInfo`,
|
||||
|
@ -60,4 +79,13 @@ export function cancelTaskApply(data) {
|
|||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
// 学生报名课题列表
|
||||
export function studentApplyList(params) {
|
||||
return fetch({
|
||||
url: `/api/studentApply/list`,
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
|
@ -28,6 +28,14 @@ export default (props) => {
|
|||
}
|
||||
}
|
||||
|
||||
function goToStudent(){
|
||||
// 学生报名时间
|
||||
const studentApply = Date.parse(new Date()) > 1653494400000;
|
||||
if(!studentApply){
|
||||
showNotification("不在报名时间,报名开始时间为5月26日");
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="glcc">
|
||||
{/* <Banner /> */}
|
||||
|
@ -50,7 +58,7 @@ export default (props) => {
|
|||
<div className="pt6">项目报名开启,导师席位虚位以待</div>
|
||||
</div>
|
||||
{/* 学生报名 */}
|
||||
<div className="apply" onClick={()=>{window.location.href="/glcc/student/2"}}>
|
||||
<div className="apply" onClick={goToStudent}>
|
||||
<div>
|
||||
<img src={apply2} alt="" className="applyIcon"/>
|
||||
<span className="til">学生报名</span> >
|
||||
|
|
|
@ -27,6 +27,14 @@ function Lightspot(props) {
|
|||
}
|
||||
}
|
||||
|
||||
function goToStudent(){
|
||||
// 学生报名时间
|
||||
const studentApply = Date.parse(new Date()) > 1653494400000;
|
||||
if(!studentApply){
|
||||
showNotification("不在报名时间,报名开始时间为5月26日");
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="lightspot">
|
||||
<div className="glcc-content">
|
||||
|
@ -44,7 +52,7 @@ function Lightspot(props) {
|
|||
<h3 className="teacher-invite">你是开源新手,有兴趣参加GLCC吗?</h3>
|
||||
<div className="teacher-content">想要参与一线开源项目开发,熟悉开源社区运作流程,接受资深开源软件专家指导,获得丰厚奖金和实习机会。参加GLCC,开启全新的开源之旅。</div>
|
||||
{/* <Link className='applyBut' to={isGlccApplyDate ? current_user && current_user.login ? 'https://wj.qq.com/s2/10175205/e8df/' : '/login?go_page=/glcc/apply' : '/glcc'} onClick={()=>{!isGlccApplyDate && showNotification("不在报名时间,报名时间为4月15日~5月20日")}}>立即报名</Link> */}
|
||||
<div className='applyBut' onClick={()=>{window.location.href="/glcc/student/2"}}>学生报名</div>
|
||||
<div className='applyBut' onClick={goToStudent}>学生报名</div>
|
||||
</div>
|
||||
{/* <img className="teacher-img" src={teacherImg} alt=''></img> */}
|
||||
</div>
|
||||
|
|
|
@ -44,8 +44,6 @@ const Project = Loadable({
|
|||
const Glcc = (propsF) => {
|
||||
// 判断时间是否在开源夏令营报名时间内(4月15日~5月20日)
|
||||
const isGlccApplyDate = Date.parse(new Date()) < 1653062400000;
|
||||
// 刷新用户课题报名信息
|
||||
const [studentInfoReset, setStudentInfoReset] = useState(undefined);
|
||||
|
||||
return (
|
||||
<div className="newMain clearfix">
|
||||
|
@ -54,7 +52,7 @@ const Glcc = (propsF) => {
|
|||
<Route
|
||||
path="/glcc/student/apply/:taskId"
|
||||
render={(props) => (
|
||||
<Student {...propsF} {...props} isGlccApplyDate={isGlccApplyDate} setStudentInfoReset={setStudentInfoReset}/>
|
||||
<Student {...propsF} {...props} isGlccApplyDate={isGlccApplyDate}/>
|
||||
)}
|
||||
></Route>
|
||||
{/* 开源夏令营报名页面 */}
|
||||
|
@ -75,7 +73,7 @@ const Glcc = (propsF) => {
|
|||
<Route
|
||||
path="/glcc/student"
|
||||
render={(props) => (
|
||||
<Project {...propsF} {...props} studentInfoReset={studentInfoReset} setStudentInfoReset={setStudentInfoReset}/>
|
||||
<Project {...propsF} {...props}/>
|
||||
)}
|
||||
></Route>
|
||||
{/* 首页 */}
|
||||
|
|
|
@ -50,11 +50,11 @@ export default ({ detail, projectId, applyTaskId, current_user, showLoginDialog,
|
|||
<div className='mb20 email oneLine leftWidth'>邮箱地址: <span>{item.tutorMail}</span></div>
|
||||
</div>
|
||||
<div className="center">
|
||||
<div className="taskDesc">{item.taskDesc}</div>
|
||||
<div className="taskUrl">课题链接: <span><a href={info.gitlinkUrl}>{item.taskUrl}</a></span></div>
|
||||
<div className="taskDesc"> {item.taskDesc}</div>
|
||||
<div className="right oneLine taskUrl mt5">奖金: <span className='taskReward'>{item.taskReward}</span></div>
|
||||
{item.taskUrl && <div className="taskUrl">课题链接: <span><a href={info.taskUrl}>{item.taskUrl}</a></span></div>}
|
||||
<div>{(isStudentApplyDate || studentApplyEnd) && (applyTaskId && item.id && Object.keys(applyTaskId).includes(item.id.toString()) ? <Button onClick={()=>{window.location.href=`/glcc/student/apply/${item.id}`}} className='lookDetail'>报名详情</Button> : isStudentApplyDate && <Button type='primary' className='applyBut' onClick={()=>{applyTask(item.id)}}>申请课题</Button>)}</div>
|
||||
</div>
|
||||
<div className="right oneLine">¥ {item.taskReward}</div>
|
||||
</div>
|
||||
}) : <Nodata _html="课题暂无数据" small={true}/>}
|
||||
</div>: <div className="projectDetailBox nodata"><Nodata _html="暂无数据" small={true}/></div>
|
||||
|
|
|
@ -20,7 +20,7 @@ const TaskList = Loadable({
|
|||
});
|
||||
|
||||
function Project(propsF) {
|
||||
const {location, current_user, showLoginDialog, studentInfoReset, setStudentInfoReset} = propsF;
|
||||
const {location, current_user, showLoginDialog} = propsF;
|
||||
const {pathname} = location;
|
||||
const isStudentApplyDate = Date.parse(new Date()) > 1653494400000 && Date.parse(new Date()) < 1656086400000;
|
||||
const studentApplyEnd = Date.parse(new Date()) > 1656086400000;
|
||||
|
@ -29,6 +29,8 @@ function Project(propsF) {
|
|||
|
||||
// 用户已报名课题id数组
|
||||
const [applyTaskId, setApplyTaskId] = useState({});
|
||||
// 刷新用户课题报名信息
|
||||
const [studentInfoReset, setStudentInfoReset] = useState(undefined);
|
||||
|
||||
useEffect(()=>{
|
||||
// 获取用户课题报名信息current_user user_id
|
||||
|
@ -65,7 +67,7 @@ function Project(propsF) {
|
|||
<Route
|
||||
path="/glcc/student/2"
|
||||
render={(props) => (
|
||||
<TaskList applyTaskId={applyTaskId} setStudentInfoReset={setStudentInfoReset} current_user={current_user} showLoginDialog={showLoginDialog} isStudentApplyDate={isStudentApplyDate} studentApplyEnd={studentApplyEnd}/>
|
||||
<TaskList applyTaskId={applyTaskId} studentInfoReset={studentInfoReset} setStudentInfoReset={setStudentInfoReset} current_user={current_user} showLoginDialog={showLoginDialog} isStudentApplyDate={isStudentApplyDate} studentApplyEnd={studentApplyEnd}/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
|
|
|
@ -39,6 +39,13 @@
|
|||
width: 40%;
|
||||
margin: 0 auto;
|
||||
padding: 25px 0 40px;
|
||||
&.task{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
.ant-input-group-wrapper{width: 40%;}
|
||||
}
|
||||
}
|
||||
.search .ant-btn, .search .ant-input{
|
||||
height: 48px;
|
||||
|
@ -130,7 +137,7 @@
|
|||
.leftWidth{width: 270px;}
|
||||
}
|
||||
.center{
|
||||
width: 650px;
|
||||
// width: 650px;
|
||||
text-align: left;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
|
@ -142,6 +149,8 @@
|
|||
.taskUrl{
|
||||
color:#465474;
|
||||
font-size:16px;
|
||||
line-height: 28px;
|
||||
margin-bottom: 5px;
|
||||
a{color:#466aff;}
|
||||
}
|
||||
.applyBut{
|
||||
|
@ -150,14 +159,15 @@
|
|||
&:hover{background-color:#5d7cff;}
|
||||
&:focus{background-color:#1140ff;}
|
||||
}
|
||||
.taskReward{color:#ff8800;}
|
||||
}
|
||||
.right{
|
||||
min-width: 150px;
|
||||
font-weight:700;
|
||||
color:#ff8800;
|
||||
font-size:24px;
|
||||
padding: 30px 30px 0 0;
|
||||
}
|
||||
// .right{
|
||||
// min-width: 150px;
|
||||
// font-weight:700;
|
||||
// color:#ff8800;
|
||||
// font-size:24px;
|
||||
// padding: 30px 30px 0 0;
|
||||
// }
|
||||
}
|
||||
}
|
||||
.projectItemPopover{
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import React, { Fragment, useEffect, useState } from 'react';
|
||||
import { Input, message, Modal, Table, Tooltip } from 'antd';
|
||||
import { Checkbox, Input, message, Modal, Table, Tooltip } from 'antd';
|
||||
import './index.scss';
|
||||
import { cancelTaskApply, taskList } from '../../api';
|
||||
import { cancelTaskApply, taskList, studentApplyList } from '../../api';
|
||||
import ProjectDetail from '../component/projectDetail';
|
||||
const { Search } = Input;
|
||||
|
||||
// 课题列表
|
||||
function TaskList({applyTaskId, setStudentInfoReset, current_user, showLoginDialog, isStudentApplyDate, studentApplyEnd}) {
|
||||
function TaskList({applyTaskId, setStudentInfoReset, current_user, showLoginDialog, isStudentApplyDate, studentApplyEnd, studentInfoReset}) {
|
||||
const [visible, setVisible] = useState(false);
|
||||
const [deleteTaskId, setDeleteTaskId] = useState(undefined);
|
||||
// 输入搜索框
|
||||
|
@ -18,12 +18,14 @@ function TaskList({applyTaskId, setStudentInfoReset, current_user, showLoginDial
|
|||
const [pageSize, setPageSize] = useState(20);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [expandedRowKeys, setExpandedRowKeys] = useState([]);
|
||||
// 已报名
|
||||
const [apply, setApply] = useState(false);
|
||||
|
||||
const columns = [
|
||||
{ title: '序号', dataIndex: 'index', align: 'center', className:"taskTableColumns", width: '6%', render: (text, item, index) => <span>{(current-1)*pageSize+index + 1}</span> },
|
||||
{ title: '课题名称', dataIndex: 'taskName', className:"taskTableColumns taskName", width: '28%', ellipsis: true, render: (text, item) => <Tooltip title={text} placement="topLeft"><span onClick={()=>{window.location.href=item.taskUrl}}>{text}</span></Tooltip> },
|
||||
{ title: '项目名称', dataIndex: 'projectName', className:"taskTableColumns", width: '28%', ellipsis: true, render: (text) => <Tooltip title={text} placement="topLeft">{text}</Tooltip> },
|
||||
{ title: '课题奖金', dataIndex: 'taskReward', className:"taskTableColumns", width: `${isStudentApplyDate || studentApplyEnd ? '15%' : ''}`, render: (text) => <span>¥ {text}</span> },
|
||||
{ title: '课题奖金', dataIndex: 'taskReward', className:"taskTableColumns", ellipsis: true, width: `${isStudentApplyDate || studentApplyEnd ? '15%' : ''}`, render: (text) => <Tooltip title={text} placement="topLeft"><span>{text}</span></Tooltip> },
|
||||
{
|
||||
title: '操作', dataIndex: 'action', align: 'center', className:"actionColumns taskTableColumns", render: ((text, item, index) => {
|
||||
return (
|
||||
|
@ -132,17 +134,36 @@ function TaskList({applyTaskId, setStudentInfoReset, current_user, showLoginDial
|
|||
data.map((item, index)=>{
|
||||
ids.includes(item.id.toString()) && toFirst(data, index);
|
||||
})
|
||||
setData(response.data.rows);
|
||||
setData(data);
|
||||
setTotal(response.data.total);
|
||||
}
|
||||
setLoading(false);
|
||||
})
|
||||
}, [keyword, current, pageSize])
|
||||
}, [keyword, current, pageSize, applyTaskId])
|
||||
|
||||
useEffect(()=>{
|
||||
// if(apply){
|
||||
// // 判断用户是否已经登录
|
||||
// if(current_user && current_user.login){
|
||||
// apply && studentApplyList().then(response => {
|
||||
// if (response && response.message === "success") {
|
||||
// console.log(response);
|
||||
// }
|
||||
// })
|
||||
// }else{
|
||||
// showLoginDialog();
|
||||
// }
|
||||
// }
|
||||
},[apply])
|
||||
|
||||
return (
|
||||
<div className="taskList listBox">
|
||||
<div className="list">
|
||||
<div className='search'><Search placeholder='请输入课题名称进行搜索' allowClear enterButton onSearch={(value) => { setCurrent(1); setKeyword(value) }} /></div>
|
||||
<div className='search task'>
|
||||
<Checkbox onChange={(e)=>{setApply(e.target.checked)}}>已报名</Checkbox>
|
||||
<Search className='taskSearch' placeholder='请输入课题名称进行搜索' allowClear enterButton onSearch={(value) => { setCurrent(1); setKeyword(value) }} />
|
||||
<div></div>
|
||||
</div>
|
||||
<Table
|
||||
loading={loading}
|
||||
columns={columns}
|
||||
|
|
|
@ -96,4 +96,15 @@ tr:hover .actionColumns .cancelApply{
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.task.search{
|
||||
.ant-checkbox-wrapper:hover .ant-checkbox-inner, .ant-checkbox:hover .ant-checkbox-inner, .ant-checkbox-input:focus + .ant-checkbox-inner{border-color: #466aff;}
|
||||
.ant-checkbox-checked{
|
||||
.ant-checkbox-inner {
|
||||
background-color: #466aff;
|
||||
}
|
||||
}
|
||||
.ant-checkbox::selection{border-color: #466aff;}
|
||||
.ant-checkbox-input::after{border:1px solid #466aff;}
|
||||
.ant-checkbox-checked::after{border:1px solid #466aff;}
|
||||
}
|
|
@ -190,7 +190,7 @@ function Apply(props) {
|
|||
studentApplyEdit(params).then(response => {
|
||||
if (response && response.message === "success") {
|
||||
showNotification("修改信息成功");
|
||||
setStudentInfoReset(Math.random());
|
||||
// setStudentInfoReset(Math.random());
|
||||
setReload(Math.random());
|
||||
setLoading(false);
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ function Apply(props) {
|
|||
studentApply(params).then(response => {
|
||||
if (response && response.message === "success") {
|
||||
showNotification("报名成功");
|
||||
setStudentInfoReset(Math.random());
|
||||
// setStudentInfoReset(Math.random());
|
||||
setReload(Math.random());
|
||||
setLoading(false);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue