This commit is contained in:
谢思 2022-05-20 14:23:36 +08:00 committed by caishi
parent 6b79378cc6
commit 95c4bed0cb
4 changed files with 22 additions and 6 deletions

View File

@ -11,6 +11,7 @@ import "./index.scss";
import Loadable from "react-loadable";
import Loading from "../Loading";
import { ImageLayerOfCommentHOC } from "../modules/page/layers/ImageLayerOfCommentHOC";
import { useState } from "react";
//
@ -28,6 +29,12 @@ const Help = Loadable({
loader: () => import("./help"),
loading: Loading,
});
//
const Student = Loadable({
loader: () => import("./student"),
loading: Loading,
});
//
const Project = Loadable({
loader: () => import("./project"),
@ -37,10 +44,19 @@ const Project = Loadable({
const Glcc = (propsF) => {
// 415~520
const isGlccApplyDate = Date.parse(new Date()) < 1653062400000;
//
const [studentInfoReset, setStudentInfoReset] = useState(undefined);
return (
<div className="newMain clearfix">
<Switch {...propsF}>
{/* 学生报名 */}
<Route
path="/glcc/student/apply/:taskId"
render={(props) => (
<Student {...propsF} {...props} isGlccApplyDate={isGlccApplyDate} setStudentInfoReset={setStudentInfoReset}/>
)}
></Route>
{/* 开源夏令营报名页面 */}
<Route
path="/glcc/apply"
@ -59,7 +75,7 @@ const Glcc = (propsF) => {
<Route
path="/glcc/student"
render={(props) => (
<Project {...propsF} {...props} />
<Project {...propsF} {...props} studentInfoReset={studentInfoReset} setStudentInfoReset={setStudentInfoReset}/>
)}
></Route>
{/* 首页 */}

View File

@ -20,7 +20,7 @@ const TaskList = Loadable({
});
function Project(propsF) {
const {location, current_user, showLoginDialog} = propsF;
const {location, current_user, showLoginDialog, studentInfoReset, setStudentInfoReset} = propsF;
const {pathname} = location;
const isStudentApplyDate = Date.parse(new Date()) > 1653494400000 && Date.parse(new Date()) < 1656086400000;
const studentApplyEnd = Date.parse(new Date()) > 1656086400000;
@ -29,8 +29,6 @@ function Project(propsF) {
// id
const [applyTaskId, setApplyTaskId] = useState({});
//
const [studentInfoReset, setStudentInfoReset] = useState(undefined);
useEffect(()=>{
// current_user user_id

View File

@ -133,7 +133,7 @@ function TaskList({applyTaskId, setStudentInfoReset, current_user, showLoginDial
ids.includes(item.id.toString()) && toFirst(data, index);
})
setData(response.data.rows);
setTotal(response.data.total)
setTotal(response.data.total);
}
setLoading(false);
})

View File

@ -21,7 +21,7 @@ const gradeList = [
{ id: '研二', name: '研二' },
{ id: '研三', name: '研三' }];
function Apply(props) {
const { form, current_user, showNotification, match } = props;
const { form, current_user, showNotification, match, setStudentInfoReset } = props;
const taskId = Number(match.params.taskId);
//
// current_user && (current_user.user_id = 6)
@ -190,6 +190,7 @@ function Apply(props) {
studentApplyEdit(params).then(response => {
if (response && response.message === "success") {
showNotification("修改信息成功");
setStudentInfoReset(Math.random());
setReload(Math.random());
setLoading(false);
}
@ -198,6 +199,7 @@ function Apply(props) {
studentApply(params).then(response => {
if (response && response.message === "success") {
showNotification("报名成功");
setStudentInfoReset(Math.random());
setReload(Math.random());
setLoading(false);
}