diff --git a/public/css/iconfont.css b/public/css/iconfont.css index 8e911f346..07e6f622f 100644 --- a/public/css/iconfont.css +++ b/public/css/iconfont.css @@ -1,8 +1,8 @@ @font-face { font-family: "iconfont"; /* Project id 2340181 */ - src: url('iconfont.woff2?t=1680498859493') format('woff2'), - url('iconfont.woff?t=1680498859493') format('woff'), - url('iconfont.ttf?t=1680498859493') format('truetype'); + src: url('iconfont.woff2?t=1682485448664') format('woff2'), + url('iconfont.woff?t=1682485448664') format('woff'), + url('iconfont.ttf?t=1682485448664') format('truetype'); } .iconfont { @@ -13,6 +13,42 @@ -moz-osx-font-smoothing: grayscale; } +.icon-zanting:before { + content: "\e96a"; +} + +.icon-cangkuyuyanicon:before { + content: "\e962"; +} + +.icon-dongtaiicon1:before { + content: "\e963"; +} + +.icon-jingxuanxiangmu:before { + content: "\e964"; +} + +.icon-zuzhichengyuan1:before { + content: "\e965"; +} + +.icon-zuzhijieshao:before { + content: "\e966"; +} + +.icon-zuzhituandui:before { + content: "\e967"; +} + +.icon-shezhi6:before { + content: "\e968"; +} + +.icon-zidingyi:before { + content: "\e969"; +} + .icon-a-zu37:before { content: "\e961"; } diff --git a/public/css/iconfont.js b/public/css/iconfont.js index 3f3eaec7c..b024dbaed 100644 --- a/public/css/iconfont.js +++ b/public/css/iconfont.js @@ -1 +1 @@ -window._iconfont_svg_string_2340181='',function(c){var a=(a=document.getElementsByTagName("script"))[a.length-1],l=a.getAttribute("data-injectcss"),a=a.getAttribute("data-disable-injectsvg");if(!a){var h,i,o,z,t,p=function(a,l){l.parentNode.insertBefore(a,l)};if(l&&!c.__iconfont__svg__cssinject__){c.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(a){console&&console.log(a)}}h=function(){var a,l=document.createElement("div");l.innerHTML=c._iconfont_svg_string_2340181,(l=l.getElementsByTagName("svg")[0])&&(l.setAttribute("aria-hidden","true"),l.style.position="absolute",l.style.width=0,l.style.height=0,l.style.overflow="hidden",l=l,(a=document.body).firstChild?p(l,a.firstChild):a.appendChild(l))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(h,0):(i=function(){document.removeEventListener("DOMContentLoaded",i,!1),h()},document.addEventListener("DOMContentLoaded",i,!1)):document.attachEvent&&(o=h,z=c.document,t=!1,m(),z.onreadystatechange=function(){"complete"==z.readyState&&(z.onreadystatechange=null,v())})}function v(){t||(t=!0,o())}function m(){try{z.documentElement.doScroll("left")}catch(a){return void setTimeout(m,50)}v()}}(window); \ No newline at end of file +window._iconfont_svg_string_2340181='',function(c){var a=(a=document.getElementsByTagName("script"))[a.length-1],l=a.getAttribute("data-injectcss"),a=a.getAttribute("data-disable-injectsvg");if(!a){var h,i,o,z,t,p=function(a,l){l.parentNode.insertBefore(a,l)};if(l&&!c.__iconfont__svg__cssinject__){c.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(a){console&&console.log(a)}}h=function(){var a,l=document.createElement("div");l.innerHTML=c._iconfont_svg_string_2340181,(l=l.getElementsByTagName("svg")[0])&&(l.setAttribute("aria-hidden","true"),l.style.position="absolute",l.style.width=0,l.style.height=0,l.style.overflow="hidden",l=l,(a=document.body).firstChild?p(l,a.firstChild):a.appendChild(l))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(h,0):(i=function(){document.removeEventListener("DOMContentLoaded",i,!1),h()},document.addEventListener("DOMContentLoaded",i,!1)):document.attachEvent&&(o=h,z=c.document,t=!1,m(),z.onreadystatechange=function(){"complete"==z.readyState&&(z.onreadystatechange=null,v())})}function v(){t||(t=!0,o())}function m(){try{z.documentElement.doScroll("left")}catch(a){return void setTimeout(m,50)}v()}}(window); \ No newline at end of file diff --git a/public/css/iconfont.json b/public/css/iconfont.json index 04f995369..fe3dd5ae9 100644 --- a/public/css/iconfont.json +++ b/public/css/iconfont.json @@ -5,6 +5,69 @@ "css_prefix_text": "icon-", "description": "", "glyphs": [ + { + "icon_id": "887857", + "name": "暂停", + "font_class": "zanting", + "unicode": "e96a", + "unicode_decimal": 59754 + }, + { + "icon_id": "34965902", + "name": "仓库语言icon", + "font_class": "cangkuyuyanicon", + "unicode": "e962", + "unicode_decimal": 59746 + }, + { + "icon_id": "34965903", + "name": "动态icon", + "font_class": "dongtaiicon1", + "unicode": "e963", + "unicode_decimal": 59747 + }, + { + "icon_id": "34965904", + "name": "精选项目", + "font_class": "jingxuanxiangmu", + "unicode": "e964", + "unicode_decimal": 59748 + }, + { + "icon_id": "34965905", + "name": "组织成员", + "font_class": "zuzhichengyuan1", + "unicode": "e965", + "unicode_decimal": 59749 + }, + { + "icon_id": "34965906", + "name": "组织介绍", + "font_class": "zuzhijieshao", + "unicode": "e966", + "unicode_decimal": 59750 + }, + { + "icon_id": "34965907", + "name": "组织团队", + "font_class": "zuzhituandui", + "unicode": "e967", + "unicode_decimal": 59751 + }, + { + "icon_id": "34965908", + "name": "设置", + "font_class": "shezhi6", + "unicode": "e968", + "unicode_decimal": 59752 + }, + { + "icon_id": "34965909", + "name": "自定义", + "font_class": "zidingyi", + "unicode": "e969", + "unicode_decimal": 59753 + }, { "icon_id": "34875122", "name": "组 37", diff --git a/public/css/iconfont.ttf b/public/css/iconfont.ttf index 6a5a417bf..e2e08f823 100644 Binary files a/public/css/iconfont.ttf and b/public/css/iconfont.ttf differ diff --git a/public/css/iconfont.woff b/public/css/iconfont.woff index de9899f07..a6c9635da 100644 Binary files a/public/css/iconfont.woff and b/public/css/iconfont.woff differ diff --git a/public/css/iconfont.woff2 b/public/css/iconfont.woff2 index 7c5a61f6c..d66d11e38 100644 Binary files a/public/css/iconfont.woff2 and b/public/css/iconfont.woff2 differ diff --git a/src/App.js b/src/App.js index 26fb64694..47ee52dc9 100644 --- a/src/App.js +++ b/src/App.js @@ -449,6 +449,10 @@ class App extends Component { > {/*glcc */} + } + > } diff --git a/src/glcc/api.js b/src/glcc/api.js index 20d024c41..d52ae65e2 100644 --- a/src/glcc/api.js +++ b/src/glcc/api.js @@ -1,6 +1,6 @@ import fetch from './fetch'; -// 获取当前用户项目报名信息 +// 获取当前用户项目报名信息(项目、课题) export function getUserApplyInfo(params) { return fetch({ url: `/api/applyInformation/getUserApplyInfo`, @@ -9,7 +9,7 @@ export function getUserApplyInfo(params) { }); } -//报名夏令营 +//报名夏令营(项目、课题报名) export function applyGlcc(data) { return fetch({ url: '/api/applyInformation/create', @@ -18,6 +18,15 @@ export function applyGlcc(data) { }); } +// 修改报名信息 +export function updateApplyGlcc(data) { + return fetch({ + url: '/api/applyInformation/update', + method: 'post', + data: data + }); +} + //提交报名信息(学生) export function studentApply(data) { return fetch({ @@ -194,4 +203,13 @@ export function getMediumTermExamineInfoList(params) { method: 'get', params, }); +} + +// 查看GLCC配置信息列表 +export function getGlccSettings(params) { + return fetch({ + url: `/api/glccSettings/settingList`, + method: 'get', + params, + }); } \ No newline at end of file diff --git a/src/glcc/apply/index.jsx b/src/glcc/apply/index.jsx index 74f23fd94..07ddfb38a 100644 --- a/src/glcc/apply/index.jsx +++ b/src/glcc/apply/index.jsx @@ -1,24 +1,29 @@ import React , { useCallback, useEffect , useState } from 'react'; -import { Breadcrumb, Button, Form, Input, Select, Upload, Modal } from 'antd'; +import { Breadcrumb, Button, Form, Input, Select, Upload, Modal, message } from 'antd'; import {getUploadActionUrl} from 'educoder'; -import {getUserApplyInfo, applyGlcc} from '../api'; +import {getUserApplyInfo, applyGlcc, updateApplyGlcc} from '../api'; import axios from 'axios'; import TextArea from 'antd/lib/input/TextArea'; import { main_site_url } from '../fetch'; +import TaskApply from './taskApply'; import banner from "../img/banner.png"; +import apply1 from "../img/apply1.png"; import './index.scss'; +import { FlexAJ } from '../../forge/Component/layout'; const Option = Select.Option; function Apply(props) { - const {form, current_user, showNotification, isGlccApplyDate} = props; - // 可用于开发时不同账号报名 - // current_user && (current_user.user_id = 6) - // current_user && (current_user.userName = "创新使者") + 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 {form, current_user, showNotification, round} = props; const {getFieldDecorator, validateFields, setFieldsValue, validateFieldsAndScroll } = form; const [reload, setReload] = useState(undefined); const [imageUrl, setImageUrl] = useState(undefined); + // 提交按钮loading效果 const [loading, setLoading] = useState(false); const [cateList, setCateList] = useState([]); const [userApplyInfo, setUserApplyInfo] = useState(undefined); + // 课题报名个数 + const [taskCount, setTaskCount] = useState([1]); const helper = useCallback( (label, extra, name, rules, widget) => ( @@ -32,10 +37,7 @@ function Apply(props) { useEffect(()=>{ // 进入此页面置顶 window.scrollTo(0,0); - if(!isGlccApplyDate){ - // 不在开源夏令营报名时间之内 - window.location.href="/glcc"; - }else if(current_user && current_user.login){ + if(current_user && current_user.login){ // 获取项目分类参数 const url = `/project_categories/pinned_index.json`; axios.get(url).then(result=>{ @@ -50,15 +52,36 @@ function Apply(props) { useEffect(()=>{ // 获取当前用户报名信息 - current_user && getUserApplyInfo({userId: current_user.user_id}).then(response=>{ + current_user && round && getUserApplyInfo({userId: current_user.user_id, round}).then(response=>{ if(response && response.message === "success"){ - response.data && setFieldsValue({ - ...response.data - }) setUserApplyInfo(response.data); + if(!response.data){ + return + } + const {projectName, projectType, gitlinkUrl, contactName, contactPhone, projectIntro, registrationTaskList, projectLogoId, contactMail} = response.data; + const taskInfo = {}; + const taskCountArr = [] + registrationTaskList.map((item, index)=>{ + taskCountArr.push(index+1); + const{taskName, taskUrl, taskDifficulty, taskReward, tutorName, tutorMail, taskDesc, tutorPhone} = 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; + }) + setTaskCount(taskCountArr); + setFieldsValue({ + projectName, projectType, gitlinkUrl, contactName, contactPhone, projectIntro, contactMail, + ...taskInfo, + logo: {file:{response:{id: projectLogoId}}} + }) } }) - }, [reload]) + }, []) // 当用户输入结束时 检验用户输入是否符合规范 function verify(dataIndex){ @@ -74,32 +97,58 @@ function Apply(props) { e.preventDefault(); validateFieldsAndScroll((err, values) => { if (!err) { - Modal.confirm({ - title: "报名", - content: "确定提交报名信息,提交后报名信息将无法修改", - onOk: ()=>{ - const params ={ - ...values, - projectLogoId: values.logo.file.response.id, - userId: current_user.user_id, - userName: current_user.username + const registrationTaskList = [] + taskCount && taskCount.map(item=>{ + registrationTaskList.push({ + taskName: values[`taskName${item}`], + taskUrl: values[`taskUrl${item}`], + taskDifficulty: values[`taskDifficulty${item}`], + taskReward: values[`taskReward${item}`], + tutorName: values[`tutorName${item}`], + tutorMail: values[`tutorMail${item}`], + taskDesc: values[`taskDesc${item}`], + tutorPhone: values[`tutorPhone${item}`], + round + }) + }) + const {projectName, projectType, gitlinkUrl, contactName, contactPhone, projectIntro, contactMail} = values; + const params ={ + projectName, projectType, gitlinkUrl, contactName, contactPhone, projectIntro, registrationTaskList, round, contactMail, + projectLogoId: values.logo.file.response.id+"", + userId: current_user.user_id, + userName: current_user.username + } + setLoading(true); + if(userApplyInfo){ + // 用户已经报名项目 + params[`id`] = userApplyInfo.id; + updateApplyGlcc(params).then(response=>{ + if(response && response.message === "success"){ + message.success("修改成功"); + setReload(Math.random()); } - applyGlcc(params).then(response=>{ - if(response && response.message === "success"){ - showNotification("报名成功"); - setReload(Math.random()); - } - }) + setLoading(false); + window.scrollTo(0,0); + }) + return + } + applyGlcc(params).then(response=>{ + if(response && response.message === "success"){ + message.success("报名成功"); + setReload(Math.random()); } - })} + setLoading(false); + window.scrollTo(0,0); + }) + } }); }; // 检查文件上传是否符合规定 function beforeUpload(file){ - const isLt100M = file.size / 1024 / 1024 < 2; + const isLt100M = file.size / 1024 / 1024 < 20; if (!isLt100M) { - showNotification(`文件大小必须小于${2}MB!`); + showNotification(`文件大小必须小于${20}M!`); } const isType = file.type === "image/png" || file.type === "image/jpg" || file.type === "image/jpeg"; if (!isType) { @@ -124,83 +173,123 @@ function Apply(props) { ); } } + + // 添加课题输入框 + function addTaskApplyForm(){ + setTaskCount(taskCount.concat([taskCount.length+1])); + } + + // 删除课题报名 + function deleteTaskApply(index){ + const arr = [...taskCount]; + arr.splice(index-1, 1) + setTaskCount(arr); + } return(
- + 开源夏令营 项目报名 - {userApplyInfo &&
- 您已报名成功,请关注活动后续新闻公告! -
} -
- {helper('项目名称', - '', - 'projectName', - [{ required: true, message: "请正确输入项目名称" }, - { max: 32, message: '超出限制长度32位字符,请重新编辑' }], - {verify("name")}} disabled = {userApplyInfo ? true : false} className={userApplyInfo? "disabledInput":""}/> - )} - {helper('项目分类', - '', - 'projectType', - [], - - )} - {helper('GitLink项目地址', - '', - 'gitlinkUrl', - [{ required: true, message: "请正确输入预申报项目在GitLink平台的地址" }, - { max: 252, message: '超出限制长度252位字符,请重新编辑' }], - {verify("gitlink")}} disabled = {userApplyInfo ? true : false} className={userApplyInfo? "disabledInput":""}/> - )} - {helper('官网地址', - '', - 'officialWebsiteUrl', - [{ max: 252, message: '超出限制长度252位字符,请重新编辑' }], - - )} -
{helper('项目简介', - '', - 'projectIntro', - [{ required: true, message: "请正确输入项目简介" }, - { max: 200, message: '超出限制长度200位字符,请重新编辑' }], -