pull new server branch

This commit is contained in:
caishi 2023-06-13 11:18:16 +08:00
commit 3a2314248c
10 changed files with 71 additions and 128 deletions

View File

@ -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 = () => {

View File

@ -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(() => {

View File

@ -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 && <Tooltip title="此学生已入选其他课题"><Button disabled type="primary" className='redColBor'>已被选</Button></Tooltip>}
{/* 学生未被锁定 */}
{!record.locked && !record.used && (text ? <Button disabled={disabledCheck} type="default" onClick={() => { checkStudent(record.id, 0) }}>撤销</Button> :
<Button disabled={disabledCheck || havePass} type="primary" onClick={() => { checkStudent(record.id, 1) }}>通过</Button>)}
{!record.locked && !record.used && (text ? <Button type="default" onClick={() => { checkStudent(record.id, 0) }}>撤销</Button> :
<Button disabled={havePass} type="primary" onClick={() => { checkStudent(record.id, 1) }}>通过</Button>)}
</div>
)
})
},
];
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)) {

View File

@ -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) => {
</div>
<div className="pt6">选择课题开启您的开源之旅</div>
</div>}
{/* 导师审核 */}
{showMatchingBut && <div className="apply" onClick={()=>{history.push("/glcc/mentoradmin");}}>
<div>
<img src={teacher} alt="" className="applyIcon" />
<span className="til">导师审核</span>
</div>
<div className="pt6">以赛代筛挖掘高潜力人才</div>
</div>}
{/* 6.28.-7.1 审核结果仅对导师可见7.1之后对所有用户可见*/}
{/* {resultTime2 && <div className="apply" onClick={goToCheckResult}>
<div>
@ -145,7 +118,7 @@ export default (props) => {
</div>} */}
{/* 学生结项考核 */}
{/* {!hasRole && checkTime1 && checkedTaskId && <Link className="apply" to={`/glcc/submission`}>
{/* {!hasRole && checkedTaskId && <Link className="apply" to={`/glcc/submission`}>
<div>
<img src={img1} alt="" className="applyIcon" />
<span className="til">结项考核</span>
@ -161,22 +134,13 @@ export default (props) => {
<div className="pt6">导师拟定结项考核结果</div>
</Link>} */}
{/* 结项考核结果公示页 */}
{/* {checkTime3 && <Link className="apply" to={`/glcc/final/result`}>
{/* {<Link className="apply" to={`/glcc/final/result`}>
<div>
<img src={img1} alt="" className="applyIcon" />
<span className="til">考核结果</span>
</div>
<div className="pt6">结项课题考核结果公示</div>
</Link>} */}
{/* 导师审核 */}
{/* {hasRole && new Date().getTime() < new Date('2022/07/01 0:0').getTime() && <div className="apply" onClick={goToCheck}>
<div>
<img src={teacher} alt="" className="applyIcon" />
<span className="til">导师审核</span>
</div>
<div className="pt6">以赛代筛挖掘高潜力人才</div>
</div>} */}
</div>}
{/* </div> */}
<div className="introduce">

View File

@ -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;
// round20221 20232
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]
}
// 415~520
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" && <Route
path="/glcc/student/apply/:taskId"
render={(props) => (
<Student {...propsF} {...props} round={round} period={period} isGlccApplyDate={isGlccApplyDate} setStudentInfoReset={setStudentInfoReset}/>
<Student {...propsF} {...props} round={round} period={period} setStudentInfoReset={setStudentInfoReset}/>
)}
></Route>}
{/* 开源夏令营报名页面 */}
@ -206,20 +211,20 @@ const Glcc = (propsF) => {
<Apply round={round} {...propsF} {...props}/>
)}
></Route>}
{/* 导师报名课题路由通道 */}
{/* 导师报名课题路由通道(补录) */}
{applyRepo && <Route
path="/glcc/sign"
render={(props) => (
<Apply round={round} {...propsF} {...props}/>
)}
></Route>}
{/* 教师审核 */}
<Route
{/* 导师-学生配对阶段 */}
{isMatching && hasRole && <Route
path="/glcc/mentoradmin"
render={(props) => (
<Check {...propsF} {...props} isGlccApplyDate={isGlccApplyDate}/>
<Check {...propsF} {...props} currentRound={currentRound}/>
)}
></Route>
></Route>}
{/* 帮助中心 */}
<Route
path="/glcc/help"
@ -237,7 +242,7 @@ const Glcc = (propsF) => {
{!(round === 2 && !repoPublic) && <Route
path="/glcc/:id/projects"
render={(props) => (
<Project period={period} round={round} {...propsF} {...props} isStudentApplyDate={isStudentApplyDate} secondStudentApplyDate={secondStudentApplyDate} applyTaskId={applyTaskId} setStudentInfoReset={setStudentInfoReset} applyTask={applyTask}/>
<Project period={period} round={round} {...propsF} {...props} applyTaskId={applyTaskId} setStudentInfoReset={setStudentInfoReset} applyTask={applyTask}/>
)}
></Route>}
@ -245,7 +250,7 @@ const Glcc = (propsF) => {
{!(round === 2 && !repoPublic) && <Route
path="/glcc/:id/subjects"
render={(props) => (
<Project 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} applyTaskId={applyTaskId} setStudentInfoReset={setStudentInfoReset} cancelCount={cancelCount} applyTask={applyTask}/>
)}
></Route>}
@ -253,7 +258,7 @@ const Glcc = (propsF) => {
<Route
path="/glcc/openmmlab"
render={(props) => (
<Openmmlab {...propsF} {...props} isStudentApplyDate={isStudentApplyDate} secondStudentApplyDate={secondStudentApplyDate} applyTaskId={applyTaskId} setStudentInfoReset={setStudentInfoReset} applyTask={applyTask}/>
<Openmmlab {...propsF} {...props} applyTaskId={applyTaskId} setStudentInfoReset={setStudentInfoReset} applyTask={applyTask}/>
)}
></Route>
@ -269,7 +274,7 @@ const Glcc = (propsF) => {
<Route
path="/glcc/:id/final/result"
render={(props) => (
<MiddleResult id={id} round={round} current_user={current_user} history={props.history} checkTime3={checkTime3}/>
<MiddleResult id={id} round={round} current_user={current_user} history={props.history}/>
)}
></Route>
@ -277,7 +282,7 @@ const Glcc = (propsF) => {
<Route
path="/glcc/submission"
render={(props) => (
<StudentSubmit current_user={current_user} history={props.history} checkedTaskId={checkedTaskId} checkTime1={checkTime1} studentRegId={studentRegId}/>
<StudentSubmit current_user={current_user} history={props.history} checkedTaskId={checkedTaskId} studentRegId={studentRegId}/>
)}
></Route>
@ -285,7 +290,7 @@ const Glcc = (propsF) => {
<Route
path="/glcc/final/examination"
render={(props) => (
<TutorReview current_user={current_user} history={props.history} checkTime2={checkTime2}/>
<TutorReview current_user={current_user} history={props.history} />
)}
></Route>
@ -293,7 +298,7 @@ const Glcc = (propsF) => {
<Route
path="/glcc/:id"
render={(props) => (
<Home repoPublic={repoPublic} period={period} round={round} {...propsF} {...props} studentApplyStart={studentApplyStart} isStudentApplyDate={isStudentApplyDate} secondStudentApplyDate={secondStudentApplyDate} checkedTaskId={checkedTaskId} checkTime1={checkTime1} checkTime2={checkTime2} checkTime3={checkTime3} glccSettings={glccSettings}/>
<Home repoPublic={repoPublic} period={period} round={round} {...propsF} {...props} checkedTaskId={checkedTaskId} glccSettings={glccSettings} showMatchingBut={isMatching && hasRole}/>
)}
></Route>
@ -301,7 +306,7 @@ const Glcc = (propsF) => {
<Route
path="/glcc"
render={(props) => (
<Home repoPublic={repoPublic} period={period} round={round} {...propsF} {...props} studentApplyStart={studentApplyStart} isStudentApplyDate={isStudentApplyDate} secondStudentApplyDate={secondStudentApplyDate} checkedTaskId={checkedTaskId} checkTime1={checkTime1} checkTime2={checkTime2} checkTime3={checkTime3} glccSettings={glccSettings}/>
<Home repoPublic={repoPublic} period={period} round={round} {...propsF} {...props} checkedTaskId={checkedTaskId} glccSettings={glccSettings} showMatchingBut={isMatching && hasRole}/>
)}
></Route>

View File

@ -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([]);

View File

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

View File

@ -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){
)}
<div className="wordNum">{wordNum} / 2000</div>
</div>
{checkTime2 && <Form.Item className="referItem oneCont">
{/* 导师结项考核时间为true */}
{false && <Form.Item className="referItem oneCont">
{(!detail.glccTutorEvaluation || (detail.glccTutorEvaluation && isEdit)) && <Button style={{width: '100px', height: '36px'}} className="mt20" type="primary" htmlType="submit" disabled={disabled}>{detail.glccTutorEvaluation ? '保存' : '提交'}</Button>}
{detail.glccTutorEvaluation && !isEdit && <Button style={{width: '100px', height: '36px'}} className="mt20" type="primary" onClick={()=>{setIsEdit(true);setDisabled(false);}}>修改</Button>}
</Form.Item>}

View File

@ -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 + ''} >
<div className="tab_content">
<div className="openmmlab_tab_content">
<ProjectDetail detail={item} applyTaskId={applyTaskId} current_user={current_user} showLoginDialog={showLoginDialog} isStudentApplyDate={isStudentApplyDate} secondStudentApplyDate={secondStudentApplyDate} applyTask={applyTask}/>
<ProjectDetail detail={item} applyTaskId={applyTaskId} current_user={current_user} showLoginDialog={showLoginDialog} applyTask={applyTask}/>
</div>
</div>

View File

@ -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())) && <Button type='primary' className='applyBut mr10' onClick={()=>{applyTask(item.id)}}>申请课题</Button>}
{false && !(applyTaskId && Object.keys(applyTaskId).includes(item.id.toString())) && <Button type='primary' className='applyBut mr10' onClick={()=>{applyTask(item.id)}}>申请课题</Button>}
{/* 第二次报名 锁定状态 */}
{secondStudentApplyDate && !(applyTaskId && Object.keys(applyTaskId).includes(item.id.toString())) && (item.locked ? <Tooltip title={"该课题已有学生入选"}><Button type='primary' className='mr10' disabled>申请课题</Button></Tooltip> : <Button type='primary' className='applyBut mr10' onClick={()=>{applyTask(item.id)}}>申请课题</Button>)}
{false && !(applyTaskId && Object.keys(applyTaskId).includes(item.id.toString())) && (item.locked ? <Tooltip title={"该课题已有学生入选"}><Button type='primary' className='mr10' disabled>申请课题</Button></Tooltip> : <Button type='primary' className='applyBut mr10' onClick={()=>{applyTask(item.id)}}>申请课题</Button>)}
{/* 查看课题详情按钮 */}
<Button onClick={()=>{window.open(`/glcc/subjects/detail/${item.id}`)}} className='lookDetail'>课题详情</Button>