forked from Gitlink/forgeplus-react
修改glcc issue
This commit is contained in:
parent
38a9155769
commit
b81610f7d3
|
@ -43,8 +43,12 @@ function Apply(props) {
|
|||
const [allTaskList, setAllTaskList] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
// 进入此页面置顶
|
||||
window.scrollTo(0, 0);
|
||||
// 进入此页面到填写页面
|
||||
// setTimeout(()=>{
|
||||
let clientWidth = document.body.clientWidth;
|
||||
let scrollHeight = 500 * clientWidth / 1920;
|
||||
window.scrollTo(0, scrollHeight);
|
||||
|
||||
if (!isGlccApplyDate) {
|
||||
// 不在开源夏令营报名时间之内
|
||||
window.location.href = "/glcc";
|
||||
|
@ -55,6 +59,7 @@ function Apply(props) {
|
|||
}
|
||||
}, [])
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const params = {
|
||||
curPage: 1,
|
||||
|
@ -94,13 +99,13 @@ function Apply(props) {
|
|||
applyInfo['memoAttachmentId' + i] = item.memoAttachmentId;
|
||||
|
||||
if (i == 0) {
|
||||
setFiles([{
|
||||
item.memoAttachment && setFiles([{
|
||||
name: item.memoAttachment && item.memoAttachment.fileName || '已上传文件',
|
||||
id: item.memoAttachmentId,
|
||||
uid: item.memoAttachmentId
|
||||
}]);
|
||||
} else {
|
||||
setFiles1([{
|
||||
item.memoAttachment && setFiles1([{
|
||||
name: item.memoAttachment && item.memoAttachment.fileName || '已上传文件',
|
||||
id: item.memoAttachmentId,
|
||||
uid: item.memoAttachmentId,
|
||||
|
@ -205,15 +210,29 @@ function Apply(props) {
|
|||
);
|
||||
|
||||
|
||||
// 检查文件上传是否符合规定
|
||||
// 检查图片文件上传是否符合规定
|
||||
function beforeUpload(file) {
|
||||
const isLittle = file.size / 1024 / 1024 < 5;
|
||||
if (!isLittle) {
|
||||
showNotification(`文件大小必须小于${5}MB!`);
|
||||
}
|
||||
const isType = file.type === "image/png" || file.type === "image/jpg" || file.type === "image/jpeg";
|
||||
if (!isType) {
|
||||
showNotification("只能上传png、jpg、jpeg格式文件");
|
||||
}
|
||||
return isType;
|
||||
return isLittle && isType;
|
||||
}
|
||||
|
||||
// 检查文件上传是否符合规定
|
||||
function beforeUpload2(file) {
|
||||
const isLittle = file.size / 1024 / 1024 < 5;
|
||||
if (!isLittle) {
|
||||
showNotification(`文件大小必须小于${5}MB!`);
|
||||
}
|
||||
return isLittle;
|
||||
}
|
||||
|
||||
|
||||
function getBase64(img, callback) {
|
||||
const reader = new FileReader();
|
||||
reader.addEventListener('load', () => callback(reader.result));
|
||||
|
@ -313,6 +332,8 @@ function Apply(props) {
|
|||
setMyTaskList(taskListNew);
|
||||
}
|
||||
|
||||
const chooseArr=myTaskList.map(i=>{return i.taskId});
|
||||
|
||||
return (
|
||||
<div className="glcc_student_apply">
|
||||
<img className="glcc-banner" src={banner} alt=''></img>
|
||||
|
@ -326,7 +347,7 @@ function Apply(props) {
|
|||
|
||||
<div className="head_introduce">
|
||||
<h4 className="head_tit">申请说明:</h4>
|
||||
<div className="head_content">1、学生报名时间为<span className="head_bold">2022年5月21日-6月19日</span>,请在报名截止时间(北京时间<span className="head_bold">2022年6月19日18点</span>)前提交报名信息。</div>
|
||||
<div className="head_content">1、学生报名时间为<span className="head_bold">2022年5月26日-6月24日</span>,请在报名截止时间(北京时间<span className="head_bold">2022年6月24日24点</span>)前提交报名信息。</div>
|
||||
<div className="head_content">2、本次GLCC夏令营基于GitLink代码托管平台完成编程任务,若您没有平台账户,请先注册后完成课题申请</div>
|
||||
<div className="head_content">3、每位学员最多可申请2个课题,至多有且仅有1个课题可以入选</div>
|
||||
<div className="head_content">4、建议在提交课题申请,与课题导师邮件沟通,详细了解课题描述、编码任务、技能要求&编程语言、预期产出结果等信息,以便您能够选择最适合的课题</div>
|
||||
|
@ -376,18 +397,24 @@ function Apply(props) {
|
|||
{helper('联系电话',
|
||||
'',
|
||||
'phone',
|
||||
[{ required: true, message: "请正确输入联系电话" }],
|
||||
[{ required: true, message: "请正确输入联系电话" },
|
||||
{ max: 14, message: '超出限制长度14位字符,请重新编辑' },
|
||||
{ pattern: /^(^(\d{3,4}-)?\d{7,8})$|(13[0-9]{9})$/, message: '请正确输入联系电话' }],
|
||||
<Input placeholder="请输入联系电话" onBlur={() => { verify("phone") }} className={editable ? "" : "disabledInput"} disabled={editable ? false : true} />
|
||||
)}
|
||||
{helper('邮箱地址',
|
||||
'',
|
||||
'mail',
|
||||
[{ required: true, message: "请正确输入邮箱地址" }],
|
||||
[
|
||||
{ type: 'email', message: '请输入正确的邮箱地址', },
|
||||
{ required: true, message: "请输入邮箱地址" },
|
||||
{ max: 50, message: '超出限制长度50位字符,请重新编辑' },
|
||||
],
|
||||
<Input placeholder="请输入邮箱地址" onBlur={() => { verify("mail") }} className={editable ? "" : "disabledInput"} disabled={editable ? false : true} />
|
||||
)}
|
||||
|
||||
<div className='introArea update_item'>{helper('学生证明',
|
||||
'请以图片的形式上传学生证明,格式为png、jpg、jpeg',
|
||||
'请以图片的形式上传学生证明,大小不超过5M,格式为png、jpg、jpeg',
|
||||
'proveAttachmentId',
|
||||
[{ required: true, message: "请正确上传学生证明" }],
|
||||
userApplyInfo && userApplyInfo.proveAttachmentId ? <div className='projectLogo'><img src={`${getUrl()}/api/attachments/${userApplyInfo.proveAttachmentId}`} alt='' /></div>
|
||||
|
@ -425,7 +452,7 @@ function Apply(props) {
|
|||
onBlur={() => { verify("taskId" + i) }}
|
||||
onChange={(val) => { changeTaskItem("taskId", val, i) }}
|
||||
>
|
||||
{allTaskList.map(item => { return <Option value={item.id} key={item.id + ''}>{item.taskName}</Option> })}
|
||||
{allTaskList.map(item => { return <Option value={item.id} disabled={chooseArr.includes(item.id)} key={item.id + ''}>{item.taskName}</Option> })}
|
||||
</Select>
|
||||
)}
|
||||
<div className='introArea'>{helper('自荐书',
|
||||
|
@ -437,7 +464,7 @@ function Apply(props) {
|
|||
)}</div>
|
||||
|
||||
<div className='introArea'>{helper('附件',
|
||||
'',
|
||||
'可以上传自荐书文件,大小不超过5M',
|
||||
'memoAttachmentId' + i,
|
||||
[],
|
||||
<Upload
|
||||
|
@ -446,6 +473,7 @@ function Apply(props) {
|
|||
fileList={i ? files1 : files}
|
||||
onChange={(info) => { bookChange(info, i) }}
|
||||
onDownload={download}
|
||||
beforeUpload={beforeUpload2}
|
||||
showUploadList={{
|
||||
showDownloadIcon: true,
|
||||
downloadIcon: <i className="iconfont icon-xiazai-icon"></i>,
|
||||
|
|
Loading…
Reference in New Issue