window.open("/glcc/help")}>
-
- 帮助中心
+
+
+
+
+ QQ交流
+
+
+
window.open("/glcc/help")}>
+
+ 帮助中心
+
)
}
diff --git a/src/glcc/student/index.jsx b/src/glcc/student/index.jsx
new file mode 100644
index 00000000..05f4dbf4
--- /dev/null
+++ b/src/glcc/student/index.jsx
@@ -0,0 +1,514 @@
+import React, { useCallback, useEffect, useState, Fragment } from 'react';
+import { Breadcrumb, Button, Form, Input, Select, Upload, Cascader, Spin } from 'antd';
+import { getUploadActionUrl, getUrl, appendFileSizeToUploadFileAll } from 'educoder';
+import { locData } from '../../forge/Utils/locData';
+import { getStudentApplyInfo, taskList, studentApply, studentApplyEdit } from '../api';
+import TextArea from 'antd/lib/input/TextArea';
+import { httpUrl } from '../fetch';
+import banner from "../img/banner.png";
+import studentSvg from "../img/student.png";
+import './index.scss';
+import { Link } from 'react-router-dom';
+
+const Option = Select.Option;
+const gradeList = [
+ { id: '大一', name: '大一' },
+ { id: '大二', name: '大二' },
+ { id: '大三', name: '大三' },
+ { id: '大四', name: '大四' },
+ { id: '大五', name: '大五' },
+ { id: '研一', name: '研一' },
+ { id: '研二', name: '研二' },
+ { id: '研三', name: '研三' }];
+function Apply(props) {
+ const { form, current_user, showNotification, match, setStudentInfoReset } = props;
+ const taskId = Number(match.params.taskId);
+ // 可用于开发时不同账号报名
+ // 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').getTime();
+
+ const { getFieldDecorator, validateFields, setFieldsValue, validateFieldsAndScroll } = form;
+ const [imageUrl, setImageUrl] = useState(undefined);
+ const [loading, setLoading] = useState(false);
+ const [reload, setReload] = useState();
+ const [userApplyInfo, setUserApplyInfo] = useState(undefined);
+ const [editable, setEditable] = useState(isStudentApplyDate);
+ const [files, setFiles] = useState([]);
+ const [files1, setFiles1] = useState([]);
+ const initTask = {
+ taskId,
+ memo: '',
+ memoAttachmentId: ''
+ };
+ const [myTaskList, setMyTaskList] = useState([]);
+ const [allTaskList, setAllTaskList] = useState([]);
+
+ // 学生报名时间范围内
+ // 已过学生报名时间
+
+ useEffect(() => {
+ // 进入此页面到填写页面
+ setTimeout(()=>{
+ let clientWidth = document.body.clientWidth;
+ let scrollHeight = 500 * clientWidth / 1920;
+ window.scrollTo(0, scrollHeight);
+ });
+ // window.scrollTo(0, 50);
+
+ if (new Date().getTime() < new Date('2022-05-26').getTime()) {
+ // 不在开源夏令营报名时间之内
+ window.location.href = "/glcc/student/2";
+ } else if (current_user && current_user.login) {
+
+ } else {
+ window.location.href = `/login?go_page=/glcc/student/apply/${taskId}`;
+ }
+ }, [])
+
+
+ useEffect(() => {
+ const params = {
+ curPage: 1,
+ pageSize: 10000
+ }
+ taskList(params).then(response => {
+ if (response && response.message === "success") {
+ setAllTaskList(response.data.rows);
+ }
+ })
+ }, [])
+
+
+ useEffect(() => {
+ // 获取当前用户报名信息
+ current_user && getStudentApplyInfo({ userId: current_user.user_id }).then(response => {
+ if (response && response.message === "success" && response.data) {
+ let data = response.data;
+ let applyInfo = {
+ grade: data.grade,
+ location: data.location && data.location.split(','),
+ mail: data.mail,
+ phone: data.phone,
+ proveAttachmentId: data.proveAttachmentId,
+ school: data.school,
+ studentName: data.studentName,
+ userId: current_user.user_id,
+ profession: data.profession,
+ };
+
+ if (Array.isArray(data.registrationStudentTaskList)) {
+ if (data.registrationStudentTaskList.length) {
+ let initTaskList = [];
+ for (const [i, item] of data.registrationStudentTaskList.entries()) {
+ applyInfo['memo' + i] = item.memo;
+ applyInfo['taskId' + i] = item.taskId;
+ applyInfo['memoAttachmentId' + i] = item.memoAttachmentId;
+
+ if (i == 0) {
+ item.memoAttachment && setFiles([{
+ name: item.memoAttachment && item.memoAttachment.fileName || '已上传文件',
+ id: item.memoAttachmentId,
+ uid: item.memoAttachmentId
+ }]);
+ } else {
+ item.memoAttachment && setFiles1([{
+ name: item.memoAttachment && item.memoAttachment.fileName || '已上传文件',
+ id: item.memoAttachmentId,
+ uid: item.memoAttachmentId,
+ }]);
+ }
+
+ initTaskList.push({
+ id: item.id,
+ memo: item.memo,
+ memoAttachmentId: item.memoAttachmentId,
+ taskId: item.taskId,
+ });
+ }
+ setMyTaskList(initTaskList);
+
+ // 如果只有一条报名数据,且课题id与当前id不一致,那么新增一条默认数据
+ if (data.registrationStudentTaskList.length === 1 && data.registrationStudentTaskList[0].taskId != taskId) {
+ addTask(data.registrationStudentTaskList);
+ }
+ } else {
+ // 先增加数据再给选择框赋默认值,否则不生效
+ new Promise((resove) => {
+ setMyTaskList(() => {
+ resove();
+ return [initTask]
+ });
+ }).then(res => setFieldsValue({ 'taskId0': taskId }))
+ }
+ }
+
+ setFieldsValue(applyInfo);
+ setUserApplyInfo(response.data);
+ } else {
+ // 先增加数据再给选择框赋默认值,否则不生效
+ new Promise((resove) => {
+ setMyTaskList(() => {
+ resove();
+ return [initTask]
+ });
+ }).then(res => setFieldsValue({ 'taskId0': taskId }))
+ }
+ })
+ }, [current_user, reload])
+
+ // 当用户输入结束时 检验用户输入是否符合规范
+ function verify(dataIndex) {
+ validateFields([dataIndex], (error, values) => {
+ if (error && error[dataIndex]) {
+ return;
+ }
+ })
+ }
+
+ // 学生报名夏令营
+ function handleSubmit(e) {
+ e.preventDefault();
+ validateFieldsAndScroll((err, values) => {
+ if (!err) {
+ setLoading(true);
+ const params = {
+ grade: values.grade,
+ location: Array.isArray(values.location) && values.location.join(),
+ mail: values.mail,
+ phone: values.phone,
+ proveAttachmentId: values.proveAttachmentId.file ? values.proveAttachmentId.file.response.id : userApplyInfo.proveAttachmentId,
+ school: values.school,
+ profession: values.profession,
+ studentName: values.studentName,
+ userId: current_user.user_id,
+ registrationStudentTaskList: myTaskList
+ }
+
+ if (userApplyInfo) {
+ params.id = userApplyInfo.id;
+ studentApplyEdit(params).then(response => {
+ if (response && response.message === "success") {
+ showNotification("修改信息成功");
+ // setStudentInfoReset(Math.random());
+ setReload(Math.random());
+ setLoading(false);
+ }
+ });
+ } else {
+ studentApply(params).then(response => {
+ if (response && response.message === "success") {
+ showNotification("报名成功");
+ // setStudentInfoReset(Math.random());
+ setReload(Math.random());
+ setLoading(false);
+ }
+ });
+ }
+ }
+ });
+ };
+
+ const helper = useCallback(
+ (label, extra, name, rules, widget) => (
+
+ {getFieldDecorator(name, { rules, validateFirst: true })(widget)}
+
+ ),
+ []
+ );
+
+
+ // 检查图片文件上传是否符合规定
+ 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 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));
+ reader.readAsDataURL(img);
+ reader.onload = function (e) {
+ setImageUrl(e.target.result); // 上传的图片的编码
+ }
+ }
+
+ // 图片上传完成后
+ function handleChange(info) {
+ if (info && info.file && info.file.status === "done") {
+ getBase64(info.file.originFileObj, imageUrl =>
+ setImageUrl(imageUrl)
+ );
+ }
+ }
+
+ // 自荐书上传
+ function bookChange(info, i) {
+ if (info.file.status === 'uploading' || info.file.status === "done" || info.file.status === 'removed') {
+ // setLoading(true);
+ if (info.file.status === "done") {
+ changeTaskItem('memoAttachmentId', info.fileList[0].response && info.fileList[0].response.data.id, i)
+ }
+ if (info.file.status === 'removed') {
+ changeTaskItem('memoAttachmentId', '', i);
+ }
+ console.log(info.fileList);
+ if (i) {
+ setFiles1(appendFileSizeToUploadFileAll(info.fileList).slice(-1));
+ } else {
+ setFiles(appendFileSizeToUploadFileAll(info.fileList).slice(-1));
+ }
+ }
+
+ // if (info.file.status === "done" || info.file.status === 'removed') {
+ // setLoading(false);
+ // }
+ }
+
+ // 支持文件下载
+ function download(file) {
+ const fileId = file.id || file.response.data.id;
+ window.open(`${httpUrl}/busiAttachments/download/${fileId}`);
+ }
+
+ function addTask(List) {
+ let taskListNew = List ? [...List] : [...myTaskList];
+ if (taskId != taskListNew[0].taskId) {
+ taskListNew.push(initTask);
+ // 先增加数据再给选择框赋默认值,否则不生效
+ new Promise((resove) => {
+ setMyTaskList(() => {
+ resove();
+ return taskListNew
+ });
+ }).then(res => setFieldsValue({ 'taskId1': 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([]);
+ }
+
+ taskListNew.splice(i, 1);
+ setMyTaskList(taskListNew);
+ setFieldsValue(reWriteInfo);
+ }
+
+ function changeTaskItem(field, val, i) {
+ let taskListNew = [...myTaskList];
+ taskListNew[i][field] = val;
+ setMyTaskList(taskListNew);
+ }
+
+ const chooseArr = myTaskList.map(i => { return i.taskId });
+
+ return (
+
+

+
+
+
+ 开源夏令营
+ 课题及项目列表
+ 学生报名
+
+
+
+
申请说明:
+
1、学生报名时间为2022年5月26日-6月24日,请在报名截止时间(北京时间2022年6月24日24点)前提交报名信息。
+
2、本次GLCC夏令营基于GitLink代码托管平台完成编程任务,若您没有平台账户,请先注册后完成课题申请
+
3、每位学员最多可申请2个课题,至多有且仅有1个课题可以入选
+
4、建议在提交课题申请,与课题导师邮件沟通,详细了解课题描述、编码任务、技能要求&编程语言、预期产出结果等信息,以便您能够选择最适合的课题
+
5、提交申请后,请耐心等待,我们会在2022年7月1日公布入围结果。如有任何问题,请添加开源夏令营微信群进行咨询
+
+
+
学生报名
+
+
+
申请课题
+
+ {getFieldDecorator("location", {
+ rules: []
+ })(
+
+ )}
+
+ {helper('所在年级',
+ '',
+ 'grade',
+ [],
+
+ )}
+ {helper('联系电话',
+ '',
+ 'phone',
+ [{ 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} />
+ )}
+ {helper('邮箱地址',
+ '',
+ 'mail',
+ [
+ { type: 'email', message: '请输入正确的邮箱地址', },
+ { required: true, message: "请输入邮箱地址" },
+ { max: 50, message: '超出限制长度50位字符,请重新编辑' },
+ ],
+
{ verify("mail") }} className={editable ? "" : "disabledInput"} disabled={editable ? false : true} />
+ )}
+
+
{helper('学生证明',
+ '请以图片的形式上传学生证明,大小不超过5M,格式为png、jpg、jpeg',
+ 'proveAttachmentId',
+ [{ required: true, message: "请正确上传学生证明" }],
+
+ {imageUrl ?
: userApplyInfo && userApplyInfo.proveAttachmentId ?
+ : }
+
+ )}
+
+ {
+ myTaskList.map((item, i) => {
+ return (
+
+ 课题信息({i + 1}/2) {myTaskList.length > 1 && { deleteTask(i) }}>删除}
+ {helper('课题名称',
+ '',
+ 'taskId' + i,
+ [{ required: true, message: "请选择课题名称" }],
+
+ )}
+ {helper('自荐书',
+
,
+ 'memo' + i,
+ [{ required: true, message: "请正确输入自荐书" },
+ { max: 500, message: '超出限制长度500位字符,请重新编辑' }],
+
+
+ {helper('附件',
+ '可以上传自荐书文件,大小不超过5M',
+ 'memoAttachmentId' + i,
+ [],
+
{ bookChange(info, i) }}
+ onDownload={download}
+ beforeUpload={beforeUpload2}
+ showUploadList={{
+ showDownloadIcon: true,
+ downloadIcon: ,
+ showRemoveIcon: true
+ }}
+ >
+ 上传自荐书
+
+ )}
+
+ )
+ })
+ }
+
+ {
+ myTaskList.length < 2 &&
+ }
+
+
+
+
+
+
+
+
+
+ )
+}
+export default Form.create()(Apply);
\ No newline at end of file
diff --git a/src/glcc/student/index.scss b/src/glcc/student/index.scss
new file mode 100644
index 00000000..ecd5dccb
--- /dev/null
+++ b/src/glcc/student/index.scss
@@ -0,0 +1,337 @@
+.glcc_student_apply {
+ font-family: PingFang SC;
+ background-image: linear-gradient(
+ 180deg,
+ #ebf2ff 0%,
+ #ebf2ff 43.09%,
+ #f3f4f8 100%
+ );
+ padding-bottom: 120px;
+
+ .has-error .ant-form-explain,
+ .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;
+ }
+ .glcc_breadcrumb {
+ padding: 18px 0;
+ border-bottom: 1px dashed #bec5d5;
+ margin-bottom: 30px;
+ }
+ .head_introduce {
+ background: #e4edff;
+ padding: 20px;
+ }
+ .head_tit {
+ color: #000000;
+ font-size: 15px;
+ line-height: 2;
+ }
+ .head_content {
+ color: #6c7283;
+ font-size: 14px;
+ line-height: 38px;
+ }
+ .head_bold {
+ font-weight: 700;
+ color: #333;
+ }
+ .main-tit {
+ margin: 25px 0;
+ img {
+ width: 25px;
+ margin-right: 10px;
+ }
+ .tit-text {
+ color: #333333;
+ font-size: 18px;
+ line-height: 30px;
+ }
+ }
+ .form-tit {
+ background-color: #e1e8ff;
+ color: #333333;
+ font-size: 18px;
+ line-height: 56px;
+ font-weight: 500;
+ text-align: center;
+ }
+ .item-tit {
+ width: 100%;
+ line-height: 66px;
+ color: #333333;
+ font-size: 16px;
+ border-bottom: 1px dashed #bec5d5;
+ margin-bottom: 20px !important;
+
+ &::before {
+ position: relative;
+ top: 2px;
+ content: "";
+ display: inline-block;
+ width: 5px;
+ height: 14px;
+ margin-right: 10px;
+ background-color: #466aff;
+ }
+
+ .item-tit-num {
+ color: #466aff;
+ }
+ }
+ .form-content {
+ background-color: rgba(255, 255, 255, 0.27);
+ border: 1px solid #fff;
+ }
+ .glcc_info_form {
+ padding: 0 15px;
+ }
+ .glcc_info_form {
+ display: flex;
+ flex-wrap: wrap;
+ .ant-row.ant-form-item {
+ margin-bottom: 20px;
+ display: flex;
+ width: 50%;
+ justify-content: flex-end;
+ }
+ .ant-form-item:nth-child(2n) {
+ .ant-form-item-control-wrapper {
+ padding-right: 3%;
+ }
+ }
+ .ant-col.ant-form-item-control-wrapper {
+ width: 85%;
+ }
+ .ant-form-item-label {
+ margin-right: 15px;
+ & > label::after {
+ content: none;
+ }
+ }
+ .ant-upload.ant-upload-select-picture-card {
+ margin-bottom: 0;
+ width: 118px;
+ height: 118px;
+ border: 1px solid;
+ }
+ .icon-tianjiadaohang:before {
+ color: #b3c3db;
+ }
+ .ant-upload-text {
+ color: #a4aabb;
+ }
+ .ant-input,
+ .ant-select-selection,
+ .ant-upload.ant-upload-select-picture-card {
+ background: none !important;
+ border-color: #b3c3db;
+ color: #202d40;
+ &:hover {
+ border-color: #466aff;
+ }
+ }
+ .has-error .ant-input:not([disabled]) {
+ border-color: #ef0000;
+ }
+ .disabledInput,
+ .disabledInput .ant-select-selection {
+ background-color: #e5ebf9 !important;
+ border: none;
+ color: #202d40;
+ }
+ .projectLogo {
+ width: 120px;
+ height: 120px;
+ border: 1px dashed #b3c3db;
+ border-radius: 4px;
+ line-height: 120px;
+ text-align: center;
+ img {
+ max-width: 100px;
+ max-height: 100px;
+ }
+ }
+ }
+ .ant-cascader-picker {
+ background: none;
+ &:hover {
+ .ant-cascader-input {
+ border: 1px solid #466aff;
+ }
+ }
+ &:focus .ant-cascader-input {
+ box-shadow: none;
+ }
+ }
+ .introArea {
+ width: 100%;
+ .ant-row.ant-form-item {
+ width: auto;
+ justify-content: flex-start;
+ }
+ .ant-col.ant-form-item-control-wrapper {
+ width: 90%;
+ }
+ .ant-form-item-label {
+ width: 74px;
+ }
+ &.tips {
+ margin-left: 40px;
+ color: #e90000;
+ }
+ }
+ .update_item {
+ .ant-form-explain {
+ bottom: 17px;
+ }
+ }
+ .glcc_info_form .introArea.subInfo {
+ width: 100%;
+ text-align: center;
+ margin: 40px 0 70px -60px;
+ .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 {
+ background-color: #f6f9fe;
+ border: 2px solid;
+ border-color: #ffffff;
+ color: #6c7283;
+ padding: 20px 30px 30px 20px;
+ .c000 {
+ color: #000000;
+ }
+ div > .c000 {
+ font-weight: bold;
+ }
+ > div {
+ margin: 10px 0;
+ }
+ .link {
+ color: rgba(70, 106, 255, 1);
+ &:hover {
+ opacity: 0.8;
+ }
+ }
+ }
+ .applySuccess {
+ height: 45px;
+ border: 1px solid;
+ border-color: #466aff;
+ line-height: 45px;
+ padding-left: 20px;
+ color: #466aff;
+ }
+
+ .glcc_btn {
+ width: 90px;
+ height: 32px;
+ border: 1px solid;
+ border-color: #b3c3db;
+ border-radius: 4px;
+ color: #466aff;
+ font-size: 14px;
+ line-height: 30px;
+ text-align: center;
+ cursor: pointer;
+ &:hover {
+ opacity: 0.8;
+ }
+ }
+
+ .add_task {
+ margin-left: 90px;
+ }
+
+ .delete {
+ float: right;
+ color: #466aff;
+ cursor: pointer;
+ :hover {
+ color: #1140ff;
+ }
+ .icon-shanchu {
+ position: relative;
+ top: 1px;
+ }
+ }
+ // .icon-shanchu{
+ // color: #466aff;
+ // cursor: pointer;
+ // :hover{
+ // color: #1140ff;
+ // }
+ // }
+ .memoExtra {
+ margin-top: 12px;
+ margin-bottom: -10px;
+ a {
+ color: #466aff;
+ }
+ }
+
+ .memoText {
+ padding: 9px 11px;
+ line-height: 1.75;
+ }
+
+}
+.glcc-banner {
+ width: 100%;
+}
+.glcc_select,.ant-cascader-menus.glcc_cascader{
+ background-image: linear-gradient(180deg, #eef3ff 0%, #ffffff 100%);
+ border: 1px solid #fff;
+ border-radius: 4px;
+ box-shadow: 0px 0px 12px rgba(203, 220, 255, 0.47);
+
+ .ant-select-dropdown-menu-item{
+ &:hover{
+ background-color: #e9efff;
+ }
+ }
+}
+.glcc_cascader{
+ .ant-cascader-menu{
+ width: 240px;
+
+ &::-webkit-scrollbar-track{
+ background-color: #E2E9FF;
+ }
+
+ &::-webkit-scrollbar-thumb{
+ background-color: #BCCCFF;
+ }
+ }
+ .ant-cascader-menu:first-child{
+ width: 250px;
+ }
+}
diff --git a/src/modules/tpm/TPMIndexHOC.js b/src/modules/tpm/TPMIndexHOC.js
index b675fb35..1fdf5f2a 100644
--- a/src/modules/tpm/TPMIndexHOC.js
+++ b/src/modules/tpm/TPMIndexHOC.js
@@ -226,6 +226,7 @@ export function TPMIndexHOC(WrappedComponent) {
this.setState({
showNotice:false
})
+ this.getAppdatausr();
}
showCompeleteDialog=()=>{