From 5edf45988e84d064c7ae7f5a44d6da1fb76b41ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= Date: Fri, 8 Apr 2022 13:47:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E6=BA=90=E5=A4=8F=E4=BB=A4=E8=90=A5?= =?UTF-8?q?=E6=8A=A5=E5=90=8D=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/glcc/apply/index.jsx | 117 ++++++++++++++++++++++++++++++++++++++ src/glcc/apply/index.scss | 69 ++++++++++++++++++++++ src/glcc/index.jsx | 12 ++++ src/glcc/static.js | 6 ++ 4 files changed, 204 insertions(+) create mode 100644 src/glcc/apply/index.jsx create mode 100644 src/glcc/apply/index.scss create mode 100644 src/glcc/static.js 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位字符,请重新编辑' }], +