diff --git a/src/glcc/student/index.jsx b/src/glcc/student/index.jsx index 51948a58..45341f6b 100644 --- a/src/glcc/student/index.jsx +++ b/src/glcc/student/index.jsx @@ -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 (