From 47f3c33ae28380e5fa8e2bc4d0bf347098d807fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= Date: Mon, 27 Jun 2022 18:31:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9glcc=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E6=8A=A5=E5=90=8D=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/glcc/student/index.jsx | 172 ++++++++++++++++++++---------------- src/glcc/student/index.scss | 56 ++++++------ 2 files changed, 127 insertions(+), 101 deletions(-) diff --git a/src/glcc/student/index.jsx b/src/glcc/student/index.jsx index d0b0ac14..dcb21728 100644 --- a/src/glcc/student/index.jsx +++ b/src/glcc/student/index.jsx @@ -28,16 +28,19 @@ function Apply(props) { // 可用于开发时不同账号报名 // current_user && (current_user.user_id = 6) // current_user && (current_user.userName = "创新使者") - const isStudentApplyDate = new Date().getTime() > new Date('2022-05-26').getTime() && new Date().getTime() < new Date('2022-06-25 0:0').getTime(); - const studentApplyEnd = new Date().getTime() > new Date('2022-06-25 0:0').getTime(); + const isStudentApplyDate = new Date().getTime() > new Date('2022-06-29 01:00:00').getTime() && new Date().getTime() < new Date('2022-07-01 01:00:00').getTime(); + const studentApplyEnd = new Date().getTime() > new Date('2022-07-01 01:00:00').getTime(); const { getFieldDecorator, validateFields, setFieldsValue, validateFieldsAndScroll } = form; const [imageUrl, setImageUrl] = useState(undefined); const [loading, setLoading] = useState(false); const [reload, setReload] = useState(); + const [locked, setLocked] = useState(false); const [userApplyInfo, setUserApplyInfo] = useState(undefined); const [editable, setEditable] = useState(isStudentApplyDate); const [files, setFiles] = useState([]); const [files1, setFiles1] = useState([]); + const [files2, setFiles2] = useState([]); + console.log('isStudentApplyDate:' + isStudentApplyDate) const initTask = { taskId, memo: '', @@ -102,31 +105,40 @@ function Apply(props) { if (Array.isArray(data.registrationStudentTaskList)) { if (data.registrationStudentTaskList.length) { let initTaskList = []; + let lockedCurrent = false; for (const [i, item] of data.registrationStudentTaskList.entries()) { applyInfo['memo' + i] = item.memo; applyInfo['taskId' + i] = item.taskId; applyInfo['memoAttachmentId' + i] = item.memoAttachmentId; - + if (item.locked) { + lockedCurrent = item.locked; + } if (i == 0) { item.memoAttachment && setFiles([{ name: item.memoAttachment && item.memoAttachment.fileName || '已上传文件', id: item.memoAttachmentId, uid: item.memoAttachmentId }]); - } else { + } else if(i==1) { item.memoAttachment && setFiles1([{ name: item.memoAttachment && item.memoAttachment.fileName || '已上传文件', id: item.memoAttachmentId, uid: item.memoAttachmentId, }]); + } else { + item.memoAttachment && setFiles2([{ + name: item.memoAttachment && item.memoAttachment.fileName || '已上传文件', + id: item.memoAttachmentId, + uid: item.memoAttachmentId, + }]); } - if(item.enrollFirst){ - applyInfo.enrollFirst=i; - } + // if (item.enrollFirst) { + // applyInfo.enrollFirst = i; + // } - if(item.status==2){ - item.status==2 + if (item.status == 2) { + item.status == 2 } initTaskList.push(item); @@ -138,9 +150,9 @@ function Apply(props) { // }); } setMyTaskList(initTaskList); - - // 如果只有一条报名数据,且课题id与当前id不一致,那么新增一条默认数据 - if (data.registrationStudentTaskList.length === 1 && data.registrationStudentTaskList[0].taskId != taskId) { + setLocked(lockedCurrent); + // 如果未被锁定,且小于3条报名数据,且课题id与当前id不一致,那么新增一条默认数据 + if (!lockedCurrent && data.registrationStudentTaskList.length < 3 && data.registrationStudentTaskList[0].taskId != taskId) { addTask(data.registrationStudentTaskList); } } else { @@ -183,15 +195,15 @@ function Apply(props) { validateFieldsAndScroll((err, values) => { if (!err) { setLoading(true); - if (myTaskList.length === 2) { - if(values.enrollFirst==1){ - myTaskList[1].enrollFirst = true; - myTaskList[0].enrollFirst = false; - }else{ - myTaskList[1].enrollFirst = false; - myTaskList[0].enrollFirst = true; - } - } + // if (myTaskList.length === 2) { + // if (values.enrollFirst == 1) { + // myTaskList[1].enrollFirst = true; + // myTaskList[0].enrollFirst = false; + // } else { + // myTaskList[1].enrollFirst = false; + // myTaskList[0].enrollFirst = true; + // } + // } const params = { grade: values.grade, location: Array.isArray(values.location) && values.location.join(), @@ -205,6 +217,7 @@ function Apply(props) { registrationStudentTaskList: myTaskList } + if (userApplyInfo) { params.id = userApplyInfo.id; studentApplyEdit(params).then(response => { @@ -293,8 +306,10 @@ function Apply(props) { changeTaskItem('memoAttachmentId', '', i); } console.log(info.fileList); - if (i) { + if (i==1) { setFiles1(appendFileSizeToUploadFileAll(info.fileList).slice(-1)); + }else if (i==2) { + setFiles2(appendFileSizeToUploadFileAll(info.fileList).slice(-1)); } else { setFiles(appendFileSizeToUploadFileAll(info.fileList).slice(-1)); } @@ -315,46 +330,47 @@ function Apply(props) { let taskListNew = List ? [...List] : [...myTaskList]; if (taskId != taskListNew[0].taskId) { taskListNew.push(initTask); + let newTask = 'taskId' + (taskListNew.length - 1); // 先增加数据再给选择框赋默认值,否则不生效 new Promise((resove) => { setMyTaskList(() => { resove(); return taskListNew }); - }).then(res => setFieldsValue({ 'taskId1': taskId })) + }).then(res => setFieldsValue({ [newTask]: taskId })) } else { taskListNew.push({ ...initTask, taskId: '' }); setMyTaskList(taskListNew); } } - function deleteTask(i) { - let taskListNew = myTaskList.slice(); - let reWriteInfo; - if (i) { - reWriteInfo = { - taskId1: '', - memo1: '', - memoAttachmentId1: '' - } - setFiles1([]); - } else { - reWriteInfo = { - taskId0: taskListNew[1].taskId, - memo0: taskListNew[1].memo, - memoAttachmentId0: taskListNew[1].memoAttachmentId, - taskId1: '', - memo1: '', - memoAttachmentId1: '' - } - setFiles(files1); - setFiles1([]); - } + // function deleteTask(i) { + // let taskListNew = myTaskList.slice(); + // let reWriteInfo; + // if (i) { + // reWriteInfo = { + // taskId1: '', + // memo1: '', + // memoAttachmentId1: '' + // } + // setFiles1([]); + // } else { + // reWriteInfo = { + // taskId0: taskListNew[1].taskId, + // memo0: taskListNew[1].memo, + // memoAttachmentId0: taskListNew[1].memoAttachmentId, + // taskId1: '', + // memo1: '', + // memoAttachmentId1: '' + // } + // setFiles(files1); + // setFiles1([]); + // } - taskListNew.splice(i, 1); - setMyTaskList(taskListNew); - setFieldsValue(reWriteInfo); - } + // taskListNew.splice(i, 1); + // setMyTaskList(taskListNew); + // setFieldsValue(reWriteInfo); + // } function changeTaskItem(field, val, i) { let taskListNew = [...myTaskList]; @@ -390,31 +406,32 @@ function Apply(props) {
申请课题

基本信息

+ {/* className={editable ? "" : "disabledInput"} disabled={editable ?false : true} */} {helper('学生姓名', '', 'studentName', [{ required: true, message: "请正确输入学生姓名" }, { max: 32, message: '超出限制长度32位字符,请重新编辑' }], - { verify("studentName") }} className={editable ? "" : "disabledInput"} disabled={editable ? false : true} /> + { verify("studentName") }} className={"disabledInput"} disabled /> )} {helper('所在高校', '', 'school', [{ required: true, message: "请正确输入所在高校" }, { max: 32, message: '超出限制长度32位字符,请重新编辑' }], - { verify("school") }} className={editable ? "" : "disabledInput"} disabled={editable ? false : true} /> + { verify("school") }} className={"disabledInput"} disabled /> )} {helper('所学专业', '', 'profession', [{ max: 32, message: '超出限制长度32位字符,请重新编辑' }], - { verify("profession") }} className={editable ? "" : "disabledInput"} disabled={editable ? false : true} /> + { verify("profession") }} className={"disabledInput"} disabled /> )} {getFieldDecorator("location", { rules: [] })( - + )} {helper('所在年级', @@ -431,7 +448,7 @@ function Apply(props) { [{ required: true, message: "请正确输入联系电话" }, { max: 14, message: '超出限制长度14位字符,请重新编辑' }, { pattern: /(^(\d{3,4}-)?\d{7,8})$|([1][3,4,5,6,7,8,9][0-9]{9})/, message: '请正确输入联系电话' }], - { verify("phone") }} className={editable ? "" : "disabledInput"} disabled={editable ? false : true} /> + { verify("phone") }} className={"disabledInput"} disabled /> )} {helper('邮箱地址', '', @@ -441,7 +458,7 @@ function Apply(props) { { required: true, message: "请输入邮箱地址" }, { max: 50, message: '超出限制长度50位字符,请重新编辑' }, ], - { verify("mail") }} className={editable ? "" : "disabledInput"} disabled={editable ? false : true} /> + { verify("mail") }} className={"disabledInput"} disabled /> )}
{helper('学生证明', @@ -456,7 +473,7 @@ function Apply(props) { accept=".png,.jpg,.jpeg" beforeUpload={beforeUpload} onChange={handleChange} - disabled={studentApplyEnd} + disabled > {imageUrl ? avatar : userApplyInfo && userApplyInfo.proveAttachmentId ?
:
@@ -470,12 +487,12 @@ function Apply(props) { myTaskList.map((item, i) => { return ( -

课题信息({i + 1}/2) +

课题信息({i + 1}/3) {/* {myTaskList.length > 1 && { deleteTask(i) }}>删除} */}

{item.status == 1 && item.auditRemark &&
欢迎您报名CCF GitLink开源编程夏令营,感谢您对GLCC项目及课题的关注和支持!本次您的报名信息未通过初审,原因如下:
-
+
希望您尽快修改并重新提交报名信息,我们将再次审核,万分感谢!
} {helper('课题名称', @@ -495,6 +512,7 @@ function Apply(props) { {allTaskList.map(item => { return })} )} + {item.locked && item.passStatus &&
您已通过审核,成功入选该课题
}
{helper('自荐书', , 'memo' + i, @@ -507,7 +525,10 @@ function Apply(props) { 4、课题实施规划:课题实施拆解、工作规划以及时间安排; 5、个人简介:编程技能、过往经验; 6、提示:文本框表达内容有限,建议您提供内容的pdf或url链接方式展示更精彩的陈述" - onBlur={(e) => { verify("memo" + i); changeTaskItem("memo", e.currentTarget.value, i) }} rows={7} className={editable ? "memoText disabledInput" : "memoText disabledInput"} disabled={studentApplyEnd} /> + onBlur={(e) => { verify("memo" + i); changeTaskItem("memo", e.currentTarget.value, i) }} + rows={7} + className={editable ? "memoText disabledInput" : "memoText disabledInput"} + disabled={!(isStudentApplyDate && !item.id)} /> )}
{helper('附件', @@ -517,7 +538,7 @@ function Apply(props) { { bookChange(info, i) }} onDownload={download} beforeUpload={beforeUpload2} @@ -526,9 +547,9 @@ function Apply(props) { downloadIcon: , showRemoveIcon: true }} - disabled={studentApplyEnd} + disabled={!(isStudentApplyDate && !item.id)} > -
上传自荐书
+
上传自荐书
)}
@@ -541,22 +562,23 @@ function Apply(props) { } { - myTaskList.length === 2 && 对您而言,哪个课题的优先级更高?注:优先级将决定您申请课题的入选顺序,若申请的2个课题同时通过审核,将以高优先级的课题作为入选标准} - > - {getFieldDecorator("enrollFirst", { - rules: [{ required: true, message: "请选择课题优先级" },] - })( - - 课题一 - 课题二 - - )} - + // myTaskList.length >= 2 && 对您而言,哪个课题的优先级更高?注:优先级将决定您申请课题的入选顺序,若申请的2个课题同时通过审核,将以高优先级的课题作为入选标准} + // > + // {getFieldDecorator("enrollFirst", { + // rules: [{ required: true, message: "请选择课题优先级" },] + // })( + // + // 课题一 + // 课题二 + // 课题三 + // + // )} + // } {!studentApplyEnd && - + }
diff --git a/src/glcc/student/index.scss b/src/glcc/student/index.scss index 4054a05a..8724fa2f 100644 --- a/src/glcc/student/index.scss +++ b/src/glcc/student/index.scss @@ -12,18 +12,6 @@ .has-error .ant-form-split { position: absolute; } - .ant-btn-primary { - background-color: #466aff; - border-color: #466aff; - &:hover { - background-color: #5d7cff; - border-color: #5d7cff; - } - &:active { - background-color: #1140ff; - border-color: #1140ff; - } - } .apply { width: 1200px; margin: 0 auto; @@ -196,16 +184,6 @@ .sub { width: 200px; height: 36px; - background-color: #466aff; - border-color: #466aff; - &:hover { - background-color: #5d7cff; - border-color: #5d7cff; - } - &:active { - background-color: #1140ff; - border-color: #1140ff; - } } } .explain { @@ -249,12 +227,19 @@ font-size: 14px; line-height: 30px; text-align: center; - cursor: not-allowed; + // cursor: not-allowed; + cursor: pointer; &:hover { opacity: 0.8; } } + .ant-upload-disabled { + .glcc_btn { + cursor: not-allowed; + } + } + .add_task { margin-left: 90px; } @@ -317,6 +302,25 @@ background-color: #466aff; } } + + .task-checked { + display: inline-block; + width: 287px; + height: 32px; + margin-left: 32px; + background-color: rgba(0, 223, 185, 0.1); + border: 1px solid #00be4c; + border-radius: 4px; + color: #00be4c; + font-size: 16px; + font-weight: 500; + line-height: 28px; + margin-top: 4px; + + .iconfont { + margin: 0 9px 0 18px; + } + } } .reject-reason { width: 100%; @@ -326,12 +330,12 @@ border: 1px solid #df4c4c; color: #595e82; font-size: 15px; - padding-left:22px; + padding-left: 22px; margin-bottom: 30px; - .icon-shanchudiao{ + .icon-shanchudiao { position: relative; - top:1px; + top: 1px; color: #e21b1b; margin-right: 5px; font-weight: 600;