glcc二期 新增课题详情页

This commit is contained in:
谢思 2022-05-28 14:17:34 +08:00 committed by caishi
parent bbe65c9442
commit b93f387ca3
13 changed files with 313 additions and 63 deletions

View File

@ -88,4 +88,12 @@ export function studentApplyList(params) {
method: 'get',
params
});
}
// 课题详情
export function getTaskById(id) {
return fetch({
url: `/api/applyInformation/task/${id}`,
method: 'get'
});
}

View File

@ -14,7 +14,7 @@ import apply2 from "../img/apply2.png";
import './index.scss';
export default (props) => {
const { current_user, isGlccApplyDate, showNotification } = props;
const { current_user, isGlccApplyDate, showNotification, studentApplyStart } = props;
function goToApply() {
if (isGlccApplyDate) {
if (current_user && current_user.login) {
@ -30,9 +30,10 @@ export default (props) => {
function goToStudent(){
//
const studentApply = Date.parse(new Date()) > 1653494400000;
if(!studentApply){
if(!studentApplyStart){
showNotification("不在报名时间报名开始时间为5月26日");
}else{
window.location.href="/glcc/student/2";
}
}
@ -76,7 +77,7 @@ export default (props) => {
</div>
</div>
</div>
<Lightspot isGlccApplyDate={isGlccApplyDate} current_user={current_user} showNotification={showNotification} />
<Lightspot isGlccApplyDate={isGlccApplyDate} current_user={current_user} showNotification={showNotification} studentApplyStart={studentApplyStart}/>
<TimerShaft />
<Award />
<News />

View File

@ -12,7 +12,7 @@ import { Link } from 'react-router-dom';
function Lightspot(props) {
const {current_user, isGlccApplyDate, showNotification} = props;
const {current_user, isGlccApplyDate, showNotification, studentApplyStart} = props;
function goToApply(){
if(isGlccApplyDate){
@ -29,9 +29,10 @@ function Lightspot(props) {
function goToStudent(){
//
const studentApply = Date.parse(new Date()) > 1653494400000;
if(!studentApply){
if(!studentApplyStart){
showNotification("不在报名时间报名开始时间为5月26日");
}else{
window.location.href="/glcc/student/2";
}
}

BIN
src/glcc/img/bgPng.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -12,6 +12,8 @@ import Loadable from "react-loadable";
import Loading from "../Loading";
import { ImageLayerOfCommentHOC } from "../modules/page/layers/ImageLayerOfCommentHOC";
import { useState } from "react";
import { useEffect } from "react";
import { getStudentApplyInfo } from "./api";
//
@ -40,11 +42,41 @@ const Project = Loadable({
loader: () => import("./project"),
loading: Loading,
});
//
const TaskDetail = Loadable({
loader: () => import("./project/taskDetail"),
loading: Loading,
});
const Glcc = (propsF) => {
const {current_user} = propsF;
// 415~520
const isGlccApplyDate = Date.parse(new Date()) < 1653062400000;
// new Date().getTime() > new Date('2022-05-26').getTime()
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').getTime();
const studentApplyEnd = new Date().getTime() > new Date('2022-06-25').getTime();
// id
const [applyTaskId, setApplyTaskId] = useState({});
//
const [studentInfoReset, setStudentInfoReset] = useState(undefined);
useEffect(()=>{
// current_user user_id
current_user && current_user.login && getStudentApplyInfo({userId: current_user.user_id}).then(response=>{
if(response && response.message === "success"){
// setData(response.data.rows);
const data = {};
response.data && response.data.registrationStudentTaskList.map(item=>{
data[item.taskId] = item.id;
})
setApplyTaskId(data);
}
})
},[studentInfoReset, current_user])
return (
<div className="newMain clearfix">
<Switch {...propsF}>
@ -52,7 +84,7 @@ const Glcc = (propsF) => {
<Route
path="/glcc/student/apply/:taskId"
render={(props) => (
<Student {...propsF} {...props} isGlccApplyDate={isGlccApplyDate}/>
<Student {...propsF} {...props} isGlccApplyDate={isGlccApplyDate} setStudentInfoReset={setStudentInfoReset}/>
)}
></Route>
{/* 开源夏令营报名页面 */}
@ -69,18 +101,24 @@ const Glcc = (propsF) => {
<Help {...propsF} {...props} />
)}
></Route>
<Route
path="/glcc/student/detail/:taskId"
render={(props) => (
<TaskDetail {...propsF} {...props} isStudentApplyDate={isStudentApplyDate} studentApplyEnd={studentApplyEnd} applyTaskId={applyTaskId}/>
)}
></Route>
{/* 项目/课题列表 */}
<Route
path="/glcc/student"
render={(props) => (
<Project {...propsF} {...props}/>
<Project {...propsF} {...props} isStudentApplyDate={isStudentApplyDate} studentApplyEnd={studentApplyEnd} applyTaskId={applyTaskId} setStudentInfoReset={setStudentInfoReset}/>
)}
></Route>
{/* 首页 */}
<Route
path="/glcc"
render={(props) => (
<Home {...propsF} {...props} isGlccApplyDate={isGlccApplyDate}/>
<Home {...propsF} {...props} studentApplyStart={studentApplyStart}/>
)}
></Route>

View File

@ -1,5 +1,5 @@
import React, { useState } from 'react';
import { Button, message } from 'antd';
import { Button, message, Tooltip } from 'antd';
import Nodata from '../../../forge/Nodata';
import { useEffect } from 'react';
import { getProjectById } from '../../api';
@ -45,16 +45,19 @@ export default ({ detail, projectId, applyTaskId, current_user, showLoginDialog,
{info.registrationTaskList && info.registrationTaskList.length > 0 ? info.registrationTaskList.map(item=>{
return <div className='taskItem mt20'>
<div className="left">
<div className="taskTitle">{item.taskName}</div>
<div className="taskTitle" onClick={()=>{window.location.href=`/glcc/student/detail/${item.id}`}}><Tooltip title={item.taskName}>{item.taskName}</Tooltip></div>
<div className='mt20 oneLine leftWidth'>导师姓名: &nbsp;&nbsp;{item.tutorName}</div>
<div className='mb20 email oneLine leftWidth'>邮箱地址: &nbsp;&nbsp;<span>{item.tutorMail}</span></div>
</div>
<div className="center">
<div className="taskDesc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{item.taskDesc}</div>
<div className="right oneLine taskUrl mt5">奖金: &nbsp;&nbsp;<span className='taskReward'>{item.taskReward}</span></div>
{item.taskUrl && <div className="taskUrl">课题链接: &nbsp;&nbsp;<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>
{item.taskUrl && <div className="taskUrl oneLine">课题链接: &nbsp;&nbsp;<a href={item.taskUrl}>{item.taskUrl}</a></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 mr10'>报名详情</Button> : isStudentApplyDate && <Button type='primary' className='applyBut mr10' onClick={()=>{applyTask(item.id)}}>申请课题</Button>)}
<Button onClick={()=>{window.location.href=`/glcc/student/detail/${item.id}`}} className='lookDetail'>课题详情</Button>
</div>
</div>
<div className="right oneLine taskUrl"><span className='taskReward'>{item.taskReward}</span></div>
</div>
}) : <Nodata _html="课题暂无数据" small={true}/>}
</div>: <div className="projectDetailBox nodata"><Nodata _html="暂无数据" small={true}/></div>

View File

@ -1,4 +1,4 @@
import React , { useEffect , useState } from 'react';
import React from 'react';
import { Spin } from 'antd';
import { Route, Switch } from "react-router-dom";
import banner from "../img/studentProject.png";
@ -6,7 +6,6 @@ import './index.scss';
import Loadable from "react-loadable";
import Loading from "../../Loading";
import { Link } from 'react-router-dom';
import { getStudentApplyInfo } from '../api';
//
const ProjectList = Loadable({
@ -20,31 +19,9 @@ const TaskList = Loadable({
});
function Project(propsF) {
const {location, current_user, showLoginDialog} = propsF;
const {location, current_user, showLoginDialog, isStudentApplyDate, studentApplyEnd, applyTaskId, setStudentInfoReset} = propsF;
const {pathname} = location;
const isStudentApplyDate = Date.parse(new Date()) > 1653494400000 && Date.parse(new Date()) < 1656086400000;
const studentApplyEnd = Date.parse(new Date()) > 1656086400000;
// const studentApplyEnd = false;
// const isStudentApplyDate = true;
// id
const [applyTaskId, setApplyTaskId] = useState({});
//
const [studentInfoReset, setStudentInfoReset] = useState(undefined);
useEffect(()=>{
// current_user user_id
current_user && current_user.login && getStudentApplyInfo({userId: current_user.user_id}).then(response=>{
if(response && response.message === "success"){
// setData(response.data.rows);
const data = {};
response.data && response.data.registrationStudentTaskList.map(item=>{
data[item.taskId] = item.id;
})
setApplyTaskId(data);
}
})
},[studentInfoReset, current_user])
return(
<div className="glcc_project">
<img className="glcc-banner" src={banner} alt=''></img>
@ -67,7 +44,7 @@ function Project(propsF) {
<Route
path="/glcc/student/2"
render={(props) => (
<TaskList applyTaskId={applyTaskId} studentInfoReset={studentInfoReset} setStudentInfoReset={setStudentInfoReset} current_user={current_user} showLoginDialog={showLoginDialog} isStudentApplyDate={isStudentApplyDate} studentApplyEnd={studentApplyEnd}/>
<TaskList applyTaskId={applyTaskId} setStudentInfoReset={setStudentInfoReset} current_user={current_user} showLoginDialog={showLoginDialog} isStudentApplyDate={isStudentApplyDate} studentApplyEnd={studentApplyEnd}/>
)}
></Route>
<Route

View File

@ -32,9 +32,12 @@
}
.listBox{
background-image:linear-gradient(180deg,#ebf2ff 0%,#ebf2ff 43.09%,#f3f4f8 100%);
position: relative;
.list{
width: 1200px;
margin: 0 auto;
position: relative;
z-index: 1;
.search{
width: 40%;
margin: 0 auto;
@ -64,9 +67,18 @@
background-color:#466aff;
border-color: #466aff;
}
// .ant-input:hover{
// border-color: #466aff;
// }
}
.bgPng3, .bgPng4{
width: 146px;
position: absolute;
z-index: 0;
top: 162px;
left: 100px;
}
.bgPng4{
top: 450px;
left: auto;
right: 310px;
}
}
}
@ -83,9 +95,8 @@
padding: 30px 30px 50px;
.taskItem{
.center{
// width: 60%;
width: 640px;
}
.right{padding-right: 10px;}
}
}
&.nodata{width: 200px;}
@ -130,14 +141,20 @@
padding: 22px 20px;
color:#25304a;
.taskTitle{
cursor: pointer;
color:#1834a7;
font-size:18px;
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
}
.email span{color:#466aff;}
.leftWidth{width: 270px;}
}
.center{
// width: 650px;
width: 665px;
text-align: left;
padding: 20px;
display: flex;
@ -145,6 +162,11 @@
justify-content: space-between;
.taskDesc{
color:#6b6b6b;
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
}
.taskUrl{
color:#465474;
@ -161,13 +183,14 @@
}
.taskReward{color:#ff8800;}
}
// .right{
// min-width: 150px;
// font-weight:700;
// color:#ff8800;
// font-size:24px;
// padding: 30px 30px 0 0;
// }
.right{
margin-top: 35px;
padding-right: 10px;
width: 120px;
font-weight:700;
color:#ff8800;
font-size:24px;
}
}
}
.projectItemPopover{

View File

@ -1,9 +1,10 @@
import React , { useEffect , useState } from 'react';
import { Input, Popover, Spin, Table, Tooltip } from 'antd';
import { Input, Popover, Spin } from 'antd';
import { main_site_url } from '../../fetch';
import './index.scss';
import { projectList } from '../../api';
import ProjectDetail from '../component/projectDetail';
import bgPng from "../../img/bgPng.png";
const {Search} = Input;
//
@ -47,6 +48,8 @@ function ProjectList({applyTaskId, current_user, showLoginDialog, isStudentApply
</div>
</Spin>
</div>
<img src={bgPng} alt='' className='bgPng3'/>
<img src={bgPng} alt='' className='bgPng4'/>
</div>
)
}

View File

@ -0,0 +1,76 @@
import React, {useEffect, useState } from 'react';
import { Button, message, Spin} from 'antd';
import '../index.scss';
import './index.scss';
import { getTaskById } from '../../api';
import banner from "../../img/studentProject.png";
import bgPng from "../../img/bgPng.png";
//
function TaskDetail(props) {
const {match, current_user, showLoginDialog, isStudentApplyDate, studentApplyEnd, applyTaskId} = props
const taskId = Number(match.params.taskId);
const [detail, setDetail] = useState(undefined);
useEffect(()=>{
getTaskById(taskId).then(res=>{
if(res && res.message === "success"){
setDetail(res.data);
}
})
},[])
//
function applyTask(id){
//
if(current_user && current_user.login){
//
if(applyTaskId && Object.keys(applyTaskId).length >= 2){
message.error('最多只能同时报名两个课题');
}else{
//
window.location.href=`/glcc/student/apply/${id}`;
}
}else{
showLoginDialog();
}
}
return (
<div className="taskDetailBgBox">
<img className="glcc-banner" src={banner} alt=''></img>
<Spin spinning={!detail}>
{detail && <div className="bgBox">
<div className="detailBox">
<div className='goBackBox'>
<a href='/glcc'>开源夏令营 / </a>
<a href='/glcc/student/2'>课题及项目列表 / </a>
课题详情
</div>
</div>
<div className="detailContent">
<div className="detailHead">
<div className="title">{detail.taskName}</div>
<div className='box'>
{detail.projectType && <span className='classify'>{detail.projectType}</span>}
{detail.taskUrl && <span>课题链接: <a href={detail.taskUrl} className='link'>{detail.taskUrl}</a></span>}
</div>
</div>
<div className="detailCont">
<div><span className='smallTil'>所属项目</span>{detail.projectName}</div>
<div className='moneyBox'><span className='smallTil'>课题奖金</span><span className='money'>{detail.taskReward}</span></div>
<div><span className='smallTil'>导师信息</span>{detail.tutorName} | {detail.tutorMail}</div>
<div className="bor"></div>
<div><span className='smallTil'>课题简介</span></div>
<div>{detail.taskDesc}</div>
</div>
{(isStudentApplyDate || studentApplyEnd) && (applyTaskId && taskId && Object.keys(applyTaskId).includes(taskId.toString()) ? <Button onClick={()=>{window.location.href=`/glcc/student/apply/${taskId}`}} className='lookDetail detailBut'>报名详情</Button> : isStudentApplyDate && <Button type='primary' className='applyBut detailBut' onClick={()=>{applyTask(taskId)}}>申请课题</Button>)}
</div>
<img src={bgPng} alt='' className='bgPng1'/>
<img src={bgPng} alt='' className='bgPng2'/>
</div>}
</Spin>
</div>
)
}
export default TaskDetail;

View File

@ -0,0 +1,116 @@
.taskDetailBgBox{
text-align: center;
.glcc-banner {
width: 100%;
}
.goBackBox{
width: 1200px;
margin: 0 auto;
padding: 25px 0 12px;
color: #202d40;
font-size: 16px;
border-bottom: 1px dashed #bec5d5;
a{
color:#a4aabb;
}
}
.bgBox{
text-align: left;
background-image:linear-gradient(180deg,#ebf2ff 0%,#ebf2ff 43.09%,#f3f4f8 100%);
padding-bottom: 100px;
position: relative;
.bgPng1{
width: 146px;
position: absolute;
top: 230px;
left: 110px;
z-index: 0;
}
.bgPng2{
width: 186px;
position: absolute;
top: 520px;
right: 310px;
z-index: 0;
}
}
.detailContent{
position: relative;
z-index: 1;
width: 1200px;
margin: 25px auto 0;
background-image:linear-gradient(180deg,#f1f5ff 0%,#f3f8ff 100%);
border:1px solid #ffffff;
border-radius:4px;
padding: 40px 30px 30px;
.detailHead{
border-bottom: 1px dashed #bec5d5;
.title{
font-weight:700;
color:#3753c5;
font-size:20px;
}
.box{
color:#465474;
font-size:15px;
margin: 15px 0;
.classify{
padding: 0px 8px;
display: inline-block;
border:1px solid #6680bb;
border-radius: 4px;
margin-right: 25px;
}
}
.link{margin-left: 6px;}
}
}
.detailCont{
background-color:#e9efff;
padding: 20px 15px;
color:#465474;
font-size:15px;
margin-top: 20px;
.bor{
margin: 0 -15px 20px -15px;
border-bottom: 1px dashed #bec5d5;;
}
.smallTil{
font-weight:500;
color:#000000;
margin-right: 15px;
}
.moneyBox{
display: flex;
align-items: center;
}
.money{
font-weight:700;
color:#ff8800;
font-size:20px;
}
div{
margin-bottom: 15px;
}
}
.link{
color:#466aff;
&:hover{
color: #5d7cff !important;
}
&:active{
color: #1140ff !important;
}
}
.applyBut{
background-color:#466aff;
border-color: #466aff;
&:hover{background-color:#5d7cff;}
&:focus{background-color:#1140ff;}
}
.detailBut{
height: 36px;
line-height: 36px;
margin-top: 25px;
}
}

View File

@ -1,12 +1,13 @@
import React, { Fragment, useEffect, useState } from 'react';
import { Checkbox, Input, message, Modal, Table, Tooltip } from 'antd';
import './index.scss';
import { cancelTaskApply, taskList, studentApplyList } from '../../api';
import { cancelTaskApply, taskList } from '../../api';
import ProjectDetail from '../component/projectDetail';
import bgPng from "../../img/bgPng.png";
const { Search } = Input;
//
function TaskList({applyTaskId, setStudentInfoReset, current_user, showLoginDialog, isStudentApplyDate, studentApplyEnd, studentInfoReset}) {
function TaskList({applyTaskId, setStudentInfoReset, current_user, showLoginDialog, isStudentApplyDate, studentApplyEnd}) {
const [visible, setVisible] = useState(false);
const [deleteTaskId, setDeleteTaskId] = useState(undefined);
//
@ -23,7 +24,7 @@ function TaskList({applyTaskId, setStudentInfoReset, current_user, showLoginDial
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: 'taskName', className:"taskTableColumns taskName", width: '28%', ellipsis: true, render: (text, item) => <Tooltip title={text} placement="topLeft"><span onClick={()=>{window.location.href=`/glcc/student/detail/${item.id}`}}>{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", ellipsis: true, width: `${isStudentApplyDate || studentApplyEnd ? '15%' : ''}`, render: (text) => <Tooltip title={text} placement="topLeft"><span>{text}</span></Tooltip> },
{
@ -124,7 +125,8 @@ function TaskList({applyTaskId, setStudentInfoReset, current_user, showLoginDial
const params = {
curPage: current,
keyword,
pageSize
pageSize,
userId: apply ? current_user.user_id : ''
}
taskList(params).then(response => {
if (response && response.message === "success") {
@ -139,7 +141,7 @@ function TaskList({applyTaskId, setStudentInfoReset, current_user, showLoginDial
}
setLoading(false);
})
}, [keyword, current, pageSize, applyTaskId])
}, [keyword, current, pageSize, applyTaskId, apply])
useEffect(()=>{
// if(apply){
@ -160,7 +162,7 @@ function TaskList({applyTaskId, setStudentInfoReset, current_user, showLoginDial
<div className="taskList listBox">
<div className="list">
<div className='search task'>
<Checkbox onChange={(e)=>{setApply(e.target.checked)}}>已报名</Checkbox>
<Checkbox onChange={(e)=>{setCurrent(1);setApply(e.target.checked)}}>已报名</Checkbox>
<Search className='taskSearch' placeholder='请输入课题名称进行搜索' allowClear enterButton onSearch={(value) => { setCurrent(1); setKeyword(value) }} />
<div></div>
</div>
@ -178,6 +180,8 @@ function TaskList({applyTaskId, setStudentInfoReset, current_user, showLoginDial
pagination={{current: current, pageSize: pageSize, total: total, showSizeChanger: true, onShowSizeChange:onShowSizeChange, showQuickJumper: true, onChange: changePage}}
/>
</div>
<img src={bgPng} alt='' className='bgPng3'/>
<img src={bgPng} alt='' className='bgPng4'/>
<Modal
okText="确认删除"
okType='default'

View File

@ -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);
history.push(`/glcc/student/2`)
@ -200,7 +200,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);
history.push(`/glcc/student/2`)