修改glcc issue

This commit is contained in:
何童崇 2022-05-19 17:13:42 +08:00 committed by caishi
parent 9c0c9dfc03
commit 5a4ee03587
1 changed files with 40 additions and 12 deletions

View File

@ -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>,