From 3c22b78b5f24d4e64b604b86635a364fb4b32358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Wed, 17 Apr 2024 08:50:22 +0800 Subject: [PATCH 1/4] =?UTF-8?q?glcc2024=E9=A1=B9=E7=9B=AE=E8=AF=BE?= =?UTF-8?q?=E9=A2=98=E6=8A=A5=E5=90=8D+=E9=A1=B9=E7=9B=AE=E8=AF=BE?= =?UTF-8?q?=E9=A2=98=E5=85=AC=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/UrlTool.js | 4 +- src/glcc/api.js | 13 + src/glcc/apply/editInfo.jsx | 74 ++++-- src/glcc/apply/index.jsx | 26 +- src/glcc/apply/repoInfo.jsx | 7 +- src/glcc/apply/taskApply.jsx | 104 +++++--- src/glcc/freeProject/index.scss | 1 + src/glcc/home/index.jsx | 39 ++- src/glcc/home/lightspot/index.jsx | 32 +-- src/glcc/home/lightspot/index.scss | 3 +- src/glcc/home/news/index.jsx | 9 +- src/glcc/home/news/index.scss | 8 +- src/glcc/home/previousReview/index.jsx | 175 ++++++++++++++ src/glcc/home/timerShaft/index.jsx | 241 +++++++++---------- src/glcc/home/timerShaft/index.scss | 61 ++++- src/glcc/img/banner2024.jpg | Bin 0 -> 1658342 bytes src/glcc/img/lightspot-bg.png | Bin 163310 -> 469921 bytes src/glcc/img/newsBg.png | Bin 0 -> 897680 bytes src/glcc/img/time-bg1.png | Bin 0 -> 715588 bytes src/glcc/index.jsx | 42 ++-- src/glcc/index.scss | 35 +++ src/glcc/news/index.jsx | 65 +++++ src/glcc/news/index.scss | 27 +++ src/glcc/openmmlab/projectTab/index.scss | 1 + src/glcc/project/component/projectDetail.jsx | 5 +- src/glcc/project/index.jsx | 8 +- src/glcc/project/index.scss | 2 +- src/glcc/project/taskDetail/index.jsx | 7 +- src/glcc/project/taskDetail/index.scss | 1 + src/glcc/project/taskList/index.jsx | 7 +- src/glcc/siderBarHelp.js | 27 ++- 31 files changed, 735 insertions(+), 289 deletions(-) create mode 100644 src/glcc/home/previousReview/index.jsx create mode 100644 src/glcc/img/banner2024.jpg create mode 100644 src/glcc/img/newsBg.png create mode 100644 src/glcc/img/time-bg1.png create mode 100644 src/glcc/news/index.jsx create mode 100644 src/glcc/news/index.scss diff --git a/src/common/UrlTool.js b/src/common/UrlTool.js index 965387554..cc82ec16b 100644 --- a/src/common/UrlTool.js +++ b/src/common/UrlTool.js @@ -6,7 +6,7 @@ const { Search } = Input; const $ = window.$; const isDev = window.location.port == 3007; const isdev2= window.location.hostname ==='www.educoder.net' -export const TEST_HOST = "https://testforgeplus.trustie.net/" +export const TEST_HOST = "https://testforgeplus.trustie.net" export function getImageUrl(path) { // https://www.educoder.net // https://testbdweb.trustie.net @@ -144,7 +144,7 @@ export function getUrl(path, goTest) { // if (isDev) { // return `${local}${path?path:''}` // } - return `${path ? path: ''}`; + return `${path ? path: TEST_HOST}`; } export function getZoneUrl(path) { diff --git a/src/glcc/api.js b/src/glcc/api.js index 56d033149..7b25151c8 100644 --- a/src/glcc/api.js +++ b/src/glcc/api.js @@ -1,5 +1,10 @@ import fetch from './fetch'; +// 当前glcc +export const currentRound = 3; +export const rewardMoney = "现金奖励" +export const rewardSettingRound = 3; + // 获取当前用户项目报名信息(项目、课题) export function getUserApplyInfo(params) { return fetch({ @@ -281,6 +286,14 @@ export function formatParsedResult(setting, type= "range") { result= `${startYear}年${startMonth}月${startDay}日${startHour}点`; }else if(type === "end"){ result= `${endYear}年${endMonth}月${endDay}日${endHour}点`; + } else if(type === "rangeDay"){ + result = `${startYear}年${startMonth}月${startDay}日-${endYear}年${endMonth}月${endDay}日`; + } else if(type === "startMonthDay"){ + result= `${startMonth}.${startDay}`; + } else if(type === "endMonthDay"){ + result= `${endMonth}.${endDay}`; + } else if(type === "rangeConcatDot"){ + result = `${startMonth}.${startDay}-${endMonth}.${endDay}`; } return result; diff --git a/src/glcc/apply/editInfo.jsx b/src/glcc/apply/editInfo.jsx index cd037a6b6..86ecbf46f 100644 --- a/src/glcc/apply/editInfo.jsx +++ b/src/glcc/apply/editInfo.jsx @@ -1,5 +1,5 @@ import React , { useCallback, useEffect , useState } from 'react'; -import { Button, Form, Input, Select, Upload, message, Popconfirm } from 'antd'; +import { Button, Form, Input, Select, Upload, message, Popconfirm, Checkbox } from 'antd'; import {getUploadActionUrl} from 'educoder'; import {applyGlcc, findStudentTaskByTaskId, updateApplyGlcc} from '../api'; import TextArea from 'antd/lib/input/TextArea'; @@ -10,10 +10,10 @@ import { FlexAJ } from '../../forge/Component/layout'; const Option = Select.Option; // 编辑项目、课题报名信息 function EditRepoApplyInfo(props) { - const {form, applyInfo, current_user, round, cateList, setReload, isAddRepo, setIsAddRepo, setIsEdit, setEditRepoCount} = props; + const {form, applyInfo, current_user, round, cateList, setReload, isAddRepo, setIsAddRepo, setIsEdit, setEditRepoCount, rewardList} = props; const phonereg = /(^|\s*\+?0?0?86|\D)(1\d{2})[-\s]{0,3}(\d{4})[-\s]{0,3}(\d{4})(?=\D|$)/ const emailreg = /^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/ - const {getFieldDecorator, validateFields, setFieldsValue, validateFieldsAndScroll, getFieldValue } = form; + const {getFieldDecorator, validateFields, setFieldsValue, validateFieldsAndScroll, getFieldValue, resetFields } = form; const [imageUrl, setImageUrl] = useState(undefined); // 提交按钮loading效果 const [loading, setLoading] = useState(false); @@ -22,30 +22,41 @@ function EditRepoApplyInfo(props) { useEffect(()=>{ if(applyInfo){ - const {projectName, projectType, gitlinkUrl, contactName, contactPhone, projectIntro, registrationTaskList, projectLogoId, contactMail} = applyInfo; + const {projectName, projectType, gitlinkUrl, contactName, contactPhone, projectIntro, registrationTaskList, projectLogoId, contactMail, joinCooperativeCommunity} = applyInfo; const taskInfo = {}; + const taskRewardRemark = {}; const taskCountArr = [] registrationTaskList.map((item, index)=>{ taskCountArr.push(index+1); - const{taskName, taskUrl, taskDifficulty, taskReward, tutorName, tutorMail, taskDesc, tutorPhone, id} = item; + const{taskName, taskUrl, taskDifficulty, tutorName, tutorMail, taskDesc, tutorPhone, id, settingRewardId, settingRewardRemark, tutorAddress} = item; taskInfo[`taskName${index+1}`] = taskName; taskInfo[`taskUrl${index+1}`] = taskUrl; taskInfo[`taskDifficulty${index+1}`] = taskDifficulty; - taskInfo[`taskReward${index+1}`] = taskReward; taskInfo[`tutorName${index+1}`] = tutorName; taskInfo[`tutorMail${index+1}`] = tutorMail; taskInfo[`taskDesc${index+1}`] = taskDesc; taskInfo[`tutorPhone${index+1}`] = tutorPhone; + taskInfo[`tutorAddress${index+1}`] = tutorAddress; taskInfo[`taskId${index+1}`] = id; + taskInfo[`settingRewardId${index+1}`] = parseInt(settingRewardId); + // taskInfo[`settingRewardRemark${index+1}`] = settingRewardRemark; + taskRewardRemark[`settingRewardRemark${index+1}`] = settingRewardRemark; }) setTaskCount(taskCountArr); setTimeout(() => { setFieldsValue({ projectName, projectType, gitlinkUrl, contactName, contactPhone, projectIntro, contactMail, ...taskInfo, - logo: {file:{response:{id: projectLogoId}}} + logo: {file:{response:{id: projectLogoId}}}, + joinCooperativeCommunity, }) }, 100); + // 课题奖励备注要根据奖励方式注入select/input + setTimeout(() => { + setFieldsValue({ + ...taskRewardRemark, + }) + }, 300); }else{ setTaskCount([1]) } @@ -81,17 +92,19 @@ function EditRepoApplyInfo(props) { taskName: values[`taskName${item}`], taskUrl: values[`taskUrl${item}`], taskDifficulty: values[`taskDifficulty${item}`], - taskReward: values[`taskReward${item}`], + settingRewardId: values[`settingRewardId${item}`], + settingRewardRemark: values[`settingRewardRemark${item}`], tutorName: values[`tutorName${item}`], tutorMail: values[`tutorMail${item}`], + tutorAddress: values[`tutorAddress${item}`], taskDesc: values[`taskDesc${item}`], tutorPhone: values[`tutorPhone${item}`], round }) }) - const {projectName, projectType, gitlinkUrl, contactName, contactPhone, projectIntro, contactMail} = values; + const {projectName, projectType, gitlinkUrl, contactName, contactPhone, projectIntro, contactMail, joinCooperativeCommunity=false} = values; const params ={ - projectName, projectType, gitlinkUrl, contactName, contactPhone, projectIntro, registrationTaskList, round, contactMail, + projectName, projectType, gitlinkUrl, contactName, contactPhone, projectIntro, registrationTaskList, round, contactMail, joinCooperativeCommunity, projectLogoId: values.logo.file.response.id+"", userId: current_user.user_id, userName: current_user.username @@ -101,27 +114,31 @@ function EditRepoApplyInfo(props) { // 用户已经报名项目 params[`id`] = applyInfo.id; updateApplyGlcc(params).then(response=>{ + setLoading(false); if(response && response.message === "success"){ message.success("修改成功"); setReload(); } - setLoading(false); setIsEdit(false); setEditRepoCount(0); setTimeout(() => { scrollToRepoInfo() }, 100); + }).catch(error=>{ + setLoading(false); }) return } applyGlcc(params).then(response=>{ + setLoading(false); if(response && response.message === "success"){ message.success("报名成功"); isAddRepo && setIsAddRepo(false); setReload(); } - setLoading(false); window.scrollTo(0,950); + }).catch(error=>{ + setLoading(false); }) } }); @@ -221,7 +238,25 @@ function EditRepoApplyInfo(props) { { max: 252, message: '超出限制长度252位字符,请重新编辑' }], {verify("gitlink")}}/> )} - {helper('联系人姓名', + + {getFieldDecorator("contactName", { rules: [{ required: true, message: "请输入项目联系人姓名" }, + { max: 32, message: '超出限制长度32位字符,请重新编辑' }], validateFirst: true, initialValue: current_user.username })( + {verify("name")}}/> + )} + + + {getFieldDecorator("contactPhone", { rules: [{ required: true, message: "输入项目联系人手机号码" }, + { pattern: phonereg, message: "请输入正确的手机号码"},], validateFirst: true, initialValue: current_user.phone })( + {verify("name")}}/> + )} + + + {getFieldDecorator("contactMail", { rules: [{ required: true, message: "输入项目联系人邮箱" }, + { pattern: emailreg, message: "请输入正确的邮箱地址"},], validateFirst: true, initialValue: current_user.email })( + {verify("name")}}/> + )} + + {/* {helper('联系人姓名', '', 'contactName', [{ required: true, message: "请输入项目联系人姓名" }, @@ -241,7 +276,7 @@ function EditRepoApplyInfo(props) { [{ required: true, message: "输入项目联系人邮箱" }, { pattern: emailreg, message: "请输入正确的邮箱地址"},], {verify("name")}}/> - )} + )} */}
{helper('项目简介', '', 'projectIntro', @@ -268,13 +303,20 @@ function EditRepoApplyInfo(props) {
} )} +
+ + {getFieldDecorator("joinCooperativeCommunity", { rules: [], validateFirst: true, valuePropName: "checked" })( + 授权将社区加入合作社区名单,项目logo可用于GLCC网站和海报宣传 + )} + +
{taskCount.map((item, index)=>{ return
课题信息({index+1}/5)
{index>0 && }
- +
})} {taskCount && taskCount.length<5 &&
@@ -282,7 +324,7 @@ function EditRepoApplyInfo(props) {
} {(isAddRepo || applyInfo) && 取消编辑将清除已填写的所有项目信息,请谨慎操作} + title={取消将不保存所有修改,请谨慎操作} onConfirm={cancelEdit} okText="确定" cancelText="取消" diff --git a/src/glcc/apply/index.jsx b/src/glcc/apply/index.jsx index 7ee5d1782..fd70553c8 100644 --- a/src/glcc/apply/index.jsx +++ b/src/glcc/apply/index.jsx @@ -1,6 +1,6 @@ import React , { useEffect , useState } from 'react'; import { Breadcrumb, message } from 'antd'; -import {getUserApplyInfo} from '../api'; +import {getUserApplyInfo, getGlccSettings, currentRound, formatParsedResult} from '../api'; import axios from 'axios'; import RepoInfo from './repoInfo'; import EditInfo from './editInfo'; @@ -10,7 +10,7 @@ import './index.scss'; import { FlexAJ } from '../../forge/Component/layout'; // 项目、课题报名 function Apply(props) { - const {current_user, round} = props; + const {current_user, round, glccSettings} = props; const [reload, setReload] = useState(undefined); const [cateList, setCateList] = useState([]); const [userApplyInfo, setUserApplyInfo] = useState([]); @@ -18,6 +18,9 @@ function Apply(props) { const [isAddRepo, setIsAddRepo] = useState(false); // 编辑项目个数 const [editRepoCount, setEditRepoCount] = useState(0); + // 课题奖励-后台配置 + const [rewardList, setRewardList] = useState([]); + const applyTime = glccSettings && glccSettings.filter(item=>item.name === "repoApply"); useEffect(()=>{ // 进入此页面置顶 @@ -30,6 +33,12 @@ function Apply(props) { setCateList(result.data.project_categories); } }).catch(error=>{}) + // 获取课题奖励分类 + getGlccSettings({round: currentRound, type: "rewardSetting"}).then(res=>{ + if(res && res.data){ + setRewardList(res.data); + } + }) }else{ window.location.href="/login?go_page=/glcc/apply"; } @@ -74,20 +83,21 @@ function Apply(props) { {userApplyInfo.length > 0 &&
您已报名成功,可实时修改您的报名信息再次提交。请关注夏令营首页新闻公告获得更多活动资讯!
}

申请说明

-
1、项目报名时间为4月29日—5月30日,请在报名截止时间(北京时间2023年5月30日24点)前提交报名信息。
-
2、本次GLCC夏令营建议使用GitLink为代码托管平台,学生基于GitLink上项目完成编程任务。同时也欢迎使用其他代码托管平台的项目参与活动。目前GLCC只对夏令营期间使用GitLink托管的项目提供部分奖金支持。
-
3、如果您的项目还未迁移到GitLink上,迁移事项请查看迁移说明文档。如在迁移过程中遇到问题,请加qq群: 1071514693 联系qq群管理员。
+
1、项目报名时间为{formatParsedResult(applyTime, "rangeDay")},请在报名截止时间(北京时间{formatParsedResult(applyTime, "end")})前提交报名信息。
+
2、本次GLCC夏令营建议使用GitLink为代码托管平台,学生基于GitLink上项目完成编程任务。同时也欢迎使用其他代码托管平台的项目参与活动。目前GLCC只对夏令营期间使用GitLink托管的项目提供部分奖励支持。
+
3、如果您的项目还未迁移到GitLink上,迁移事项请查看迁移说明文档。如在迁移过程中遇到问题,请加qq群: 1071514693 联系qq群管理员。
4、提交社区和题目信息后,欢迎与组委会联系沟通宣传推广和后续合作工作。联系人微信: _TigerWang(备注GitLink编程夏令营)
-
5、奖金默认由项目方支持,请根据课题难度设定金额。若您可能无法支撑本课题奖金,GLCC组委会将进行资助评审,择优资助。如未获得资助,将下线该课题
+
5、在项目报名期间({formatParsedResult(applyTime, "rangeDay")}),您可以随时进入当前页调整项目或课题报名信息
+
6、课题奖励默认由项目方支持,可提供现金或者实习机会等其他形式的奖励,请根据课题难度设定奖励内容。若您可能无法支撑本课题奖励,GLCC组委会将进行资助评审,择优资助。如未获得资助,将下线该课题
项目报名 {userApplyInfo.length > 0 && 添加项目} {userApplyInfo.length > 0 &&
- {userApplyInfo.map((item, index)=>
{setReload(Math.random())}} isAddRepo={isAddRepo} editRepoCount={editRepoCount} setEditRepoCount={setEditRepoCount} repoCount={userApplyInfo.length} scrollToEdit={scrollToEdit}/>
)} + {userApplyInfo.map((item, index)=>
{setReload(Math.random())}} isAddRepo={isAddRepo} editRepoCount={editRepoCount} setEditRepoCount={setEditRepoCount} repoCount={userApplyInfo.length} scrollToEdit={scrollToEdit} rewardList={rewardList}/>
)}
} - {(!userApplyInfo.length || isAddRepo) && {setReload(Math.random())}}/>} + {(!userApplyInfo.length || isAddRepo) && {setReload(Math.random())}} rewardList={rewardList}/>} ) diff --git a/src/glcc/apply/repoInfo.jsx b/src/glcc/apply/repoInfo.jsx index fdd7d104e..b45ad0d01 100644 --- a/src/glcc/apply/repoInfo.jsx +++ b/src/glcc/apply/repoInfo.jsx @@ -4,7 +4,7 @@ import EditInfo from "./editInfo"; import { FlexAJ } from "../../forge/Component/layout"; import { main_site_url } from "../fetch"; import './index.scss'; -import { deleteApplyInfo } from "../api"; +import { deleteApplyInfo, rewardMoney } from "../api"; // 项目、课题信息展示 function RepoInfo(props) { const {applyInfo:{id, projectLogoId, projectName, projectType, contactName, contactPhone, contactMail, gitlinkUrl, projectIntro, registrationTaskList}, setReload, editRepoCount, setEditRepoCount, repoCount, isAddRepo, scrollToEdit} = props; @@ -34,20 +34,21 @@ function RepoInfo(props) { // 课题信息展示 const showTask = (task) => { - const {id, taskDifficulty, taskName, taskReward, tutorName, tutorPhone, tutorMail, taskDesc, taskUrl} = task; + const {id, taskDifficulty, taskName, taskReward, tutorName, tutorPhone, tutorMail, taskDesc, taskUrl, settingRewardValue, settingRewardRemark} = task; return
{difficultyList[taskDifficulty]}
{taskName}
- ¥ {taskReward} + {settingRewardValue === rewardMoney ? `¥ ${settingRewardRemark}` : settingRewardValue}
导师信息:{tutorName}({tutorPhone} | {tutorMail})
课题链接:{taskUrl}
+ {settingRewardValue !== rewardMoney &&
奖励备注:{settingRewardRemark}
}
课题简介:{taskDesc}
diff --git a/src/glcc/apply/taskApply.jsx b/src/glcc/apply/taskApply.jsx index 86ed6c5f0..8fe90d38a 100644 --- a/src/glcc/apply/taskApply.jsx +++ b/src/glcc/apply/taskApply.jsx @@ -1,27 +1,27 @@ -import React from 'react'; -import {Form, Input, Select } from 'antd'; +import React, { useEffect, useState } from 'react'; +import {Form, Input, Radio, Select } from 'antd'; import TextArea from 'antd/lib/input/TextArea'; +import { rewardMoney } from '../api'; const Option = Select.Option; // 课题信息编辑 function TaskApply(props) { - const {helper, disabled, taskKey, phonereg, emailreg, getFieldDecorator} = props; + const {helper, disabled, taskKey, phonereg, emailreg, getFieldDecorator, rewardList, getFieldValue, resetFields} = props; // 低、中、高 const difficultyList = [ {id: 1, name: "低"}, {id: 2, name: "中"}, {id: 3, name: "高"} ] - // 奖金 - const rewardList = [ - {id: 12000}, - {id: 11000}, - {id: 10000}, - {id: 9000}, - {id: 8000}, - {id: 7000}, - {id: 6000}, - {id: 0}, - ] + // 奖金数额 + const amountList = [12000, 11000, 10000, 9000, 8000, 7000, 6000] + const disabledProps = { + disabled: disabled, + className: disabled? "disabledInput":"" + } + // 选中的奖励方式 + const rewardId = getFieldValue(`settingRewardId${taskKey}`); + const rewardItem = rewardId && rewardList && rewardList.filter(item=>item.id === rewardId); + const rewardName = rewardItem && rewardItem[0] && rewardItem[0].value; return(
@@ -34,67 +34,95 @@ function TaskApply(props) { `taskName${taskKey}`, [{ required: true, message: "请输入课题名称,长度限制32个字符" }, { max: 32, message: '超出限制长度32位字符,请重新编辑' }], - + )} {helper('课题链接', '', `taskUrl${taskKey}`, [{ required: true, message: "请输入课题链接" }, { max: 252, message: '超出限制长度252位字符,请重新编辑' }], - + )} {helper('课题难度', '', `taskDifficulty${taskKey}`, [{ required: true, message: "请选择课题难度" }], - {difficultyList && difficultyList.map(item=> {return })} )} - {helper('课题奖金', - '', - `taskReward${taskKey}`, - [{ required: true, message: "请选择课题奖金" }, - // {pattern: /^[1-9]+[0-9]*]*$/, message: "请输入正整数" }, - // { validator: (rule,val,callback) =>{ - // if(val>=6000 && val<=12000){ - // callback(); - // }else{ - // callback("区间为6000-12000元"); - // } - // }} - ], - - )} +
+ {helper('课题奖励', + '', + `settingRewardId${taskKey}`, + [{ required: true, message: "请选择课题奖励" }, + ], + { + resetFields([`settingRewardRemark${taskKey}`]); + }}> + {rewardList && rewardList.map(item=> {return {item.value}})} + + )} +
+ {/* + {getFieldDecorator(`settingRewardRemark${taskKey}`, { + initialValue: '1233', + rules: rewardName === rewardMoney ? [{ required: true, message: "请选择课题奖金" }] : [] + })(rewardName === rewardMoney ? : )} + */} + {rewardName &&
+ {helper(rewardName === rewardMoney ? "奖金数额": "奖励备注", + '', + `settingRewardRemark${taskKey}`, + rewardName === rewardMoney ? [{ required: true, message: "请选择课题奖金" }] : [], + rewardName === rewardMoney ? : + )} +
} + {/* {helper(rewardName === rewardMoney ? "奖金数额": "奖励备注", + '', + `settingRewardRemark${taskKey}`, + rewardName === rewardMoney ? [{ required: true, message: "请选择课题奖金" }] : [], + rewardName === rewardMoney ? : + )} */} {helper('导师姓名', '', `tutorName${taskKey}`, [{ required: true, message: "请输入导师姓名" }, { max: 32, message: '超出限制长度32位字符,请重新编辑' }], - + )} {helper('导师手机号', '', `tutorPhone${taskKey}`, [{ required: true, message: "请输入导师手机号" }, { pattern: phonereg, message: "请输入正确的电话号码"},], - + )} {helper('导师邮箱', '', `tutorMail${taskKey}`, [{ required: true, message: "请输入导师邮箱地址" }, { pattern: emailreg, message: "请输入正确的邮箱地址"},], - + + )} + {helper('导师邮寄地址', + '', + `tutorAddress${taskKey}`, + [{ required: true, message: "请输入导师地址" }], + )}
{helper('课题简介', '', `taskDesc${taskKey}`, [{ required: true, message: "请输入课题简介" }, { max: 200, message: '超出限制长度200位字符,请重新编辑' }], -