diff --git a/src/forge/Head/Header.js b/src/forge/Head/Header.js index 9c5fabbaf..ccd9ba00c 100644 --- a/src/forge/Head/Header.js +++ b/src/forge/Head/Header.js @@ -75,9 +75,9 @@ class NewHeader extends Component { this.setState({ user: newProps.user }) - if(!newProps.user ||(newProps.user && !newProps.user.login)){ - cookie.remove("login"); - } + // if(!newProps.user ||(newProps.user && !newProps.user.login)){ + // cookie.remove("login"); + // } } educoderlogin = () => { diff --git a/src/forge/Issues/Component/date.jsx b/src/forge/Issues/Component/date.jsx index f2e0659e4..7df519fd9 100644 --- a/src/forge/Issues/Component/date.jsx +++ b/src/forge/Issues/Component/date.jsx @@ -18,10 +18,10 @@ function Date({name , today , setDate , editFlag},ref){ const refBox = useRef(null); useEffect(()=>{ - if(!visible){ + if(!visible && !editFlag &&time){ setDate(time); } - },[visible]) + },[visible,editFlag,time]) useEffect(() => { diff --git a/src/glcc/check/index.jsx b/src/glcc/check/index.jsx index 5a7822c02..74ab5162b 100644 --- a/src/glcc/check/index.jsx +++ b/src/glcc/check/index.jsx @@ -3,13 +3,13 @@ import { Modal, Table, Tooltip, Breadcrumb, Tabs, Button } from 'antd'; import { Link } from 'react-router-dom'; import moment from 'moment'; import './index.scss'; -import { auditPassTask, getStudentList, getAuditList, hasAuditRole } from '../api'; +import { auditPassTask, getStudentList, getAuditList } from '../api'; import {httpUrl} from '../fetch'; const { TabPane } = Tabs; -function Check({ current_user, showNotification, history }) { +function Check({ current_user, showNotification, currentRound }) { // 输入搜索框 const [data, setData] = useState([]); @@ -23,8 +23,6 @@ function Check({ current_user, showNotification, history }) { const [taskId, setTaskId] = useState(); const [havePass, setHavePass] = useState(false); - const disabledCheck = new Date().getTime() > new Date('2022/07/01 00:00:00').getTime(); - const columns = [ { title: '学生姓名', @@ -134,32 +132,18 @@ function Check({ current_user, showNotification, history }) { {/* 学生已经被其他导师锁定 */} {record.locked && record.used && } {/* 学生未被锁定 */} - {!record.locked && !record.used && (text ? : - )} + {!record.locked && !record.used && (text ? : + )} ) }) }, ]; - useEffect(() => { - if(new Date().getTime() > new Date('2022/07/01 0:0').getTime()){ - history.push('/403'); - } - if (!current_user.user_id) { - history.push('/403'); - } - hasAuditRole({ userId: current_user.user_id }).then(res => { - if (!(res && res.message == 'success' && res.data.hasRole)) { - history.push('/403'); - } - }) - }, []) - useEffect(() => { - getAuditList({ userId: current_user.user_id }).then(res => { - if (res.message == 'success') { + getAuditList({ userId: current_user.user_id, round: currentRound }).then(res => { + if (res.message === 'success') { setTaskList(res.data.rows); res.data.rows.length && setTaskId(res.data.rows[0].id); } else { @@ -172,6 +156,7 @@ function Check({ current_user, showNotification, history }) { auditPassTask({ id, status, + round: currentRound }).then(res => { if (res && res.message === 'success') { showNotification(status ? '已通过该学生课题申请' : '撤销成功') @@ -264,9 +249,10 @@ function Check({ current_user, showNotification, history }) { setLoading(true); const params = { curPage: 1, - pageSize: 10000, + pageSize: 999, keyword: '', taskId, + round: currentRound } taskId && getStudentList(params).then(res => { if (res.data && Array.isArray(res.data.rows)) { diff --git a/src/glcc/home/index.jsx b/src/glcc/home/index.jsx index 51387b812..22720eb2f 100644 --- a/src/glcc/home/index.jsx +++ b/src/glcc/home/index.jsx @@ -22,50 +22,14 @@ import './index.scss'; // period: 项目报名阶段("repoApply") // match:{params:{id=2023}} 注意默认值记得每届修改 export default (props) => { - const { current_user, isGlccApplyDate, showNotification, studentApplyStart, history, secondStudentApplyDate, isStudentApplyDate, checkedTaskId, checkTime1, checkTime2, checkTime3, round, match:{params:{id=2023}}, period, showLoginDialog, glccSettings, repoPublic} = props; - function goToApply() { - if (isGlccApplyDate) { - if (current_user && current_user.login) { - window.location.href = "https://wj.qq.com/s2/10175205/e8df/"; - } else { - window.location.href = "/login?go_page=https://wj.qq.com/s2/10175205/e8df/"; - } - } else { - showNotification("不在报名时间,报名时间为4月15日~5月20日"); - window.location.href = "/glcc"; - } - } - - const [hasRole, setHasRole] = useState(false); - const resultTime1 = new Date().getTime() > new Date('2022/06/28 1:0').getTime() && new Date().getTime() < new Date('2022/07/01 0:0').getTime(); - const resultTime2 = new Date().getTime() > new Date('2022/07/01 12:0').getTime() && new Date().getTime() < new Date('2022/08/12 0:0').getTime(); + const { current_user, history, round, match:{params:{id=2023}}, period, showLoginDialog, glccSettings, repoPublic, showMatchingBut} = props; useEffect(() => { if (!current_user.user_id) { history.push('/403'); } - hasAuditRole({ userId: current_user.user_id }).then(res => { - if (res && res.message == 'success' && res.data.hasRole) { - setHasRole(true); - } - }) }, []) - function goToStudent() { - // 学生报名时间 - if (!studentApplyStart) { - showNotification("不在报名时间,报名开始时间为5月26日"); - } else if(!isStudentApplyDate && !secondStudentApplyDate) { - showNotification("课题申请时间已截止"); - } else{ - history.push("/glcc/subjects"); - } - } - - function goToCheck() { - history.push("/glcc/mentoradmin"); - } - function goToCheckResult(){ history.push("/glcc/result"); } @@ -135,6 +99,15 @@ export default (props) => {
选择课题,开启您的开源之旅
} + + {/* 导师审核 */} + {showMatchingBut &&
{history.push("/glcc/mentoradmin");}}> +
+ + 导师审核 +
+
以赛代筛,挖掘高潜力人才
+
} {/* 6.28.-7.1 审核结果仅对导师可见,7.1之后对所有用户可见*/} {/* {resultTime2 &&
@@ -145,7 +118,7 @@ export default (props) => {
} */} {/* 学生结项考核 */} - {/* {!hasRole && checkTime1 && checkedTaskId && + {/* {!hasRole && checkedTaskId &&
结项考核 @@ -161,22 +134,13 @@ export default (props) => {
导师拟定结项考核结果
} */} {/* 结项考核结果公示页 */} - {/* {checkTime3 && + {/* {
考核结果
结项课题考核结果公示
} */} - - {/* 导师审核 */} - {/* {hasRole && new Date().getTime() < new Date('2022/07/01 0:0').getTime() &&
-
- - 导师审核 -
-
以赛代筛,挖掘高潜力人才
-
} */}
} {/*
*/}
diff --git a/src/glcc/index.jsx b/src/glcc/index.jsx index 894f9e9df..701c1021b 100644 --- a/src/glcc/index.jsx +++ b/src/glcc/index.jsx @@ -11,7 +11,7 @@ import "./index.scss"; import Loadable from "react-loadable"; import Loading from "../Loading"; import { ImageLayerOfCommentHOC } from "../modules/page/layers/ImageLayerOfCommentHOC"; -import { getGlccSettings, getStudentApplyInfo } from "./api"; +import { getGlccSettings, getStudentApplyInfo, hasAuditRole } from "./api"; import { message } from "antd"; @@ -78,6 +78,8 @@ const MiddleResult = Loadable({ }); const Glcc = (propsF) => { const {current_user, showLoginDialog, match:{params:{id}}} = propsF; + // 当届 + const currentRound = 2; // round:2022届(1) 2023届(2) const [round, setRound] = useState(2); // glcc 所处阶段 repoApply(项目报名) stuApply(学生报名阶段) @@ -88,6 +90,8 @@ const Glcc = (propsF) => { const [repoPublic, setRepoPublic] = useState(false); // 是否处于项目/课题补录阶段 const [applyRepo, setApplyRepo] = useState(false); + // 导师-学生配对阶段 + const [isMatching, setIsMatching] = useState(false); useEffect(()=>{ if(id && id === "2022"){ @@ -96,7 +100,7 @@ const Glcc = (propsF) => { }, [id]) useEffect(()=>{ // 获取当前glcc配置 - getGlccSettings({round: 2}).then(res=>{ + getGlccSettings({round: currentRound}).then(res=>{ if(res && res.message === "success"){ setGLccSetting(res.data); const nowTime = new Date().getTime(); @@ -106,6 +110,9 @@ const Glcc = (propsF) => { // 是否处于项目/课题补录阶段 const repoApply1 = res.data.filter(item=>item.name === "repoApply1"); repoApply1[0] && setApplyRepo(judge(nowTime, repoApply1[0].value, "range")) + // 是否处于导师-学生配对阶段 + const matching = res.data.filter(item=>item.name === "matching"); + matching[0] && setIsMatching(judge(nowTime, matching[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")); @@ -123,20 +130,6 @@ const Glcc = (propsF) => { return type === "range" ? nowTime > timeArr[0] && nowTime < timeArr[1] : nowTime > timeArr[0] } - // 判断时间是否在开源夏令营报名时间内(4月15日~5月20日) - const isGlccApplyDate = Date.parse(new Date()) < 1653062400000; - - // 学生报名时间 - const studentApplyStart = new Date().getTime() > new Date('2022/05/26').getTime(); - const isStudentApplyDate = new Date().getTime() > new Date('2022/05/26').getTime() && new Date().getTime() < new Date('2022/06/25 0:0').getTime(); - const secondStudentApplyDate = new Date().getTime() > new Date('2022/06/29 1:0').getTime() && new Date().getTime() < new Date('2022/06/30 0:0').getTime(); - // 学生结项考核入口可见时间 - const checkTime1 = new Date().getTime() > new Date('2022/10/01 8:0').getTime(); - // 导师结项考核时间 - const checkTime2 = new Date().getTime() > new Date('2022/10/01 8:0').getTime() && new Date().getTime() < new Date('2022/10/24 24:0').getTime(); - // 结项考核结果公示 - const checkTime3 = new Date().getTime() > new Date('2022/10/24 10:0').getTime(); - // 用户已报名课题id数组 const [applyTaskId, setApplyTaskId] = useState({}); // 刷新用户课题报名信息 @@ -152,6 +145,18 @@ const Glcc = (propsF) => { document.title='开源夏令营'; }, []) + // 是否为导师身份 + const [hasRole, setHasRole] = useState(false); + + useEffect(() => { + // 登录状态+导师-学生配对阶段 + current_user && current_user.user_id && isMatching && hasAuditRole({ userId: current_user.user_id, round: currentRound }).then(res => { + if (res && res.message === 'success' && res.data.hasRole) { + setHasRole(true); + } + }) + }, [current_user, isMatching]) + useEffect(()=>{ // 获取用户课题报名信息(todo:学生报名阶段请求) (period === "stuApply" || period === "stuApply1") && current_user && current_user.login && getStudentApplyInfo({userId: current_user.user_id, round: round}).then(response=>{ @@ -196,7 +201,7 @@ const Glcc = (propsF) => { {period === "stuApply" && ( - + )} >} {/* 开源夏令营报名页面 */} @@ -206,20 +211,20 @@ const Glcc = (propsF) => { )} >} - {/* 导师报名课题路由通道 */} + {/* 导师报名课题路由通道(补录) */} {applyRepo && ( )} >} - {/* 教师审核 */} - ( - + )} - > + >} {/* 帮助中心 */} { {!(round === 2 && !repoPublic) && ( - + )} >} @@ -245,7 +250,7 @@ const Glcc = (propsF) => { {!(round === 2 && !repoPublic) && ( - + )} >} @@ -253,7 +258,7 @@ const Glcc = (propsF) => { ( - + )} > @@ -269,7 +274,7 @@ const Glcc = (propsF) => { ( - + )} > @@ -277,7 +282,7 @@ const Glcc = (propsF) => { ( - + )} > @@ -285,7 +290,7 @@ const Glcc = (propsF) => { ( - + )} > @@ -293,7 +298,7 @@ const Glcc = (propsF) => { ( - + )} > @@ -301,7 +306,7 @@ const Glcc = (propsF) => { ( - + )} > diff --git a/src/glcc/interimReview/result.jsx b/src/glcc/interimReview/result.jsx index 32a6e6958..a32c810d5 100644 --- a/src/glcc/interimReview/result.jsx +++ b/src/glcc/interimReview/result.jsx @@ -11,7 +11,7 @@ import '../project/index.scss'; const { Search } = Input; // 课题列表 -function CheckResult({current_user, history, checkTime3, round, id}) { +function CheckResult({current_user, history, round, id}) { // 输入搜索框 const [keyword, setKeyword] = useState(undefined); const [data, setData] = useState([]); @@ -22,13 +22,6 @@ function CheckResult({current_user, history, checkTime3, round, id}) { const [loading, setLoading] = useState(false); const [expandedRowKeys, setExpandedRowKeys] = useState([]); - useEffect(()=>{ - // 未到时间 - if(!checkTime3){ - history.push('/glcc'); - } - },[]) - useEffect(() => { setLoading(true); setExpandedRowKeys([]); diff --git a/src/glcc/interimReview/studentSubmit.jsx b/src/glcc/interimReview/studentSubmit.jsx index 776e5f3d9..75974551e 100644 --- a/src/glcc/interimReview/studentSubmit.jsx +++ b/src/glcc/interimReview/studentSubmit.jsx @@ -9,7 +9,7 @@ import {getMediumTermExamineInfo, submitMedium} from '../api'; import './index.scss'; function StudentSubmit(props){ - const {form, checkedTaskId, checkTime1, studentRegId, history} = props; + const {form, checkedTaskId, studentRegId, history} = props; const {getFieldDecorator, validateFieldsAndScroll } = form; const [detail, setDetail] = useState(undefined); const [reload, setReload] = useState(undefined); @@ -21,12 +21,6 @@ function StudentSubmit(props){ // 学生提醒导师评分时间 const lookTime = new Date().getTime() > new Date('2022/10/15 0:0').getTime() && new Date().getTime() < new Date('2022/10/23 24:0').getTime(); - useEffect(()=>{ - if(!checkTime1){ - history.push("/glcc"); - } - }, []) - useEffect(()=>{ // 查询是否已经提交考核材料 checkedTaskId && getMediumTermExamineInfo(checkedTaskId,{term: 2}).then(res=>{ diff --git a/src/glcc/interimReview/tutorReview.jsx b/src/glcc/interimReview/tutorReview.jsx index 2df95f08d..0820ce2a5 100644 --- a/src/glcc/interimReview/tutorReview.jsx +++ b/src/glcc/interimReview/tutorReview.jsx @@ -11,7 +11,7 @@ const { TabPane } = Tabs; const { TextArea } = Input; function TutorReview(props){ - const {form, current_user, showNotification, checkTime2, history} = props; + const {form, current_user, showNotification, history} = props; const {getFieldDecorator, setFieldsValue, validateFieldsAndScroll, resetFields } = form; const [taskId, setTaskId] = useState(); const [taskList, setTaskList] = useState([]); @@ -174,7 +174,8 @@ function TutorReview(props){ )}
{wordNum} / 2000
- {checkTime2 && + {/* 导师结项考核时间为true */} + {false && {(!detail.glccTutorEvaluation || (detail.glccTutorEvaluation && isEdit)) && } {detail.glccTutorEvaluation && !isEdit && } } diff --git a/src/glcc/openmmlab/projectTab/index.jsx b/src/glcc/openmmlab/projectTab/index.jsx index ba493833f..9dfc1e1ef 100644 --- a/src/glcc/openmmlab/projectTab/index.jsx +++ b/src/glcc/openmmlab/projectTab/index.jsx @@ -7,7 +7,7 @@ const $ = window.$; const { TabPane } = Tabs; -function ProjectTabs({ list, applyTaskId, history, current_user, showLoginDialog, isStudentApplyDate, secondStudentApplyDate, applyTask }) { +function ProjectTabs({ list, applyTaskId, history, current_user, showLoginDialog, applyTask }) { useEffect(()=>{ setTimeout(()=>{ @@ -34,7 +34,7 @@ function ProjectTabs({ list, applyTaskId, history, current_user, showLoginDialog key={i + ''} >
- +
diff --git a/src/glcc/openmmlab/projectTab/projectDetail.jsx b/src/glcc/openmmlab/projectTab/projectDetail.jsx index 8e334f934..fd7c0b1dc 100644 --- a/src/glcc/openmmlab/projectTab/projectDetail.jsx +++ b/src/glcc/openmmlab/projectTab/projectDetail.jsx @@ -3,7 +3,7 @@ import { Button, message, Tooltip } from 'antd'; import Nodata from '../../../forge/Nodata'; import { getProjectById } from '../../api'; -export default ({ detail, projectId, applyTaskId, isStudentApplyDate, secondStudentApplyDate, applyTask }) => { +export default ({ detail, projectId, applyTaskId, applyTask }) => { const [info, setInfo] = useState(detail); useEffect(()=>{ @@ -39,9 +39,9 @@ export default ({ detail, projectId, applyTaskId, isStudentApplyDate, secondStud {/* 课题申请时间范围内: 申请课题 */} {/* 第一次报名 */} - {isStudentApplyDate && !(applyTaskId && Object.keys(applyTaskId).includes(item.id.toString())) && } + {false && !(applyTaskId && Object.keys(applyTaskId).includes(item.id.toString())) && } {/* 第二次报名 锁定状态 */} - {secondStudentApplyDate && !(applyTaskId && Object.keys(applyTaskId).includes(item.id.toString())) && (item.locked ? : )} + {false && !(applyTaskId && Object.keys(applyTaskId).includes(item.id.toString())) && (item.locked ? : )} {/* 查看课题详情按钮 */}