diff --git a/src/glcc/apply/index.jsx b/src/glcc/apply/index.jsx new file mode 100644 index 00000000..47bfc21c --- /dev/null +++ b/src/glcc/apply/index.jsx @@ -0,0 +1,117 @@ +import React , { useCallback, useEffect , useState } from 'react'; +import { Breadcrumb, Button, Form, Icon, Input, Select, Upload } from 'antd'; +import {classify} from '../static'; +import Axios from 'axios'; +import './index.scss'; +import TextArea from 'antd/lib/input/TextArea'; +const Option = Select.Option; +function Apply(props) { + console.log(props); + const {form, qzDetail, enrollStatus, setReload, current_user, history} = props; + const {getFieldDecorator, validateFields, setFieldsValue, validateFieldsAndScroll } = form; + const [imageUrl, setImageUrl] = useState(undefined); + const [loading, setLoading] = useState(false); + + const helper = useCallback( + (label, extra, name, rules, widget) => ( + + {getFieldDecorator(name, { rules, validateFirst: true })(widget)} + + ), + [] + ); + + // 当用户输入结束时 检验用户输入是否符合规范 + function verify(dataIndex){ + validateFields([dataIndex],(error, values)=>{ + if(error && error[dataIndex]){ + return; + } + }) + } + + function handleSubmit(e){ + e.preventDefault(); + validateFieldsAndScroll((err, values) => { + if (!err) { + console.log('Received values of form: ', values); + } + }); + }; + return( +
+
+ + 开源夏令营 + 项目报名 + +
+ {helper('项目名称', + '', + 'name', + [{ required: true, message: "请正确输入项目名称" }, + { max: 32, message: '超出限制长度32位字符,请重新编辑' }], + {verify("name")}}/> + )} + {helper('项目分类', + '', + 'classify', + [], + + )} + {helper('官网地址', + '', + 'area', + [], + + )} + {helper('GitLink地址', + '', + 'gitlink', + [{ required: true, message: "请正确输入GitLink地址" }], + {verify("gitlink")}}/> + )} +
{helper('项目简介', + '', + 'intro', + [{ required: true, message: "请正确输入项目简介" }, + { max: 200, message: '超出限制长度200位字符,请重新编辑' }], +