diff --git a/package-lock.json b/package-lock.json index 10c675b3..9535b090 100644 --- a/package-lock.json +++ b/package-lock.json @@ -152,7 +152,7 @@ }, "source-map": { "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "resolved": "https://registry.nlark.com/source-map/download/source-map-0.5.7.tgz", "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" } } @@ -1190,13 +1190,13 @@ "dependencies": { "inherits": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "resolved": "https://registry.nlark.com/inherits/download/inherits-2.0.1.tgz", "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", "dev": true }, "util": { "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "https://registry.nlark.com/util/download/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -2367,7 +2367,7 @@ "dependencies": { "define-property": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "resolved": "https://registry.nlark.com/define-property/download/define-property-1.0.0.tgz", "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", "requires": { "is-descriptor": "^1.0.0" @@ -2656,7 +2656,7 @@ "dependencies": { "resolve": { "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "resolved": "https://registry.npm.taobao.org/resolve/download/resolve-1.1.7.tgz", "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=" } } @@ -3429,7 +3429,7 @@ "dependencies": { "define-property": { "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "resolved": "https://registry.nlark.com/define-property/download/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "requires": { "is-descriptor": "^0.1.0" @@ -5790,7 +5790,7 @@ }, "path-to-regexp": { "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "resolved": "https://registry.nlark.com/path-to-regexp/download/path-to-regexp-0.1.7.tgz?cache=0&sync_timestamp=1618847046445&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fpath-to-regexp%2Fdownload%2Fpath-to-regexp-0.1.7.tgz", "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" }, "qs": { @@ -6242,7 +6242,7 @@ "dependencies": { "core-js": { "version": "1.2.7", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", + "resolved": "https://registry.npmmirror.com/core-js/download/core-js-1.2.7.tgz", "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=" }, "promise": { @@ -7919,7 +7919,7 @@ "dependencies": { "pify": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "resolved": "https://registry.nlark.com/pify/download/pify-3.0.0.tgz", "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" } } @@ -11152,7 +11152,7 @@ }, "punycode": { "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "resolved": "https://registry.nlark.com/punycode/download/punycode-1.4.1.tgz", "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", "dev": true } @@ -15315,7 +15315,7 @@ "dependencies": { "jsesc": { "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "resolved": "https://registry.nlark.com/jsesc/download/jsesc-0.5.0.tgz", "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=" } } @@ -16016,7 +16016,7 @@ "dependencies": { "ms": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "resolved": "https://registry.npmmirror.com/ms/download/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" } } @@ -16119,7 +16119,7 @@ "dependencies": { "extend-shallow": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "requires": { "is-extendable": "^0.1.0" @@ -16594,7 +16594,7 @@ }, "define-property": { "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "resolved": "https://registry.nlark.com/define-property/download/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "requires": { "is-descriptor": "^0.1.0" @@ -16602,7 +16602,7 @@ }, "extend-shallow": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "requires": { "is-extendable": "^0.1.0" @@ -16610,7 +16610,7 @@ }, "source-map": { "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "resolved": "https://registry.nlark.com/source-map/download/source-map-0.5.7.tgz", "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" } } @@ -16627,7 +16627,7 @@ "dependencies": { "define-property": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "resolved": "https://registry.nlark.com/define-property/download/define-property-1.0.0.tgz", "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", "requires": { "is-descriptor": "^1.0.0" @@ -18454,7 +18454,7 @@ "dependencies": { "inherits": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "resolved": "https://registry.nlark.com/inherits/download/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true } @@ -18691,7 +18691,7 @@ "dependencies": { "extend-shallow": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { @@ -18872,7 +18872,7 @@ }, "fill-range": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "resolved": "https://registry.npm.taobao.org/fill-range/download/fill-range-4.0.0.tgz", "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", "dev": true, "requires": { @@ -18884,7 +18884,7 @@ "dependencies": { "extend-shallow": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "resolved": "https://registry.nlark.com/extend-shallow/download/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, "requires": { @@ -18950,7 +18950,7 @@ }, "is-number": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "resolved": "https://registry.nlark.com/is-number/download/is-number-3.0.0.tgz", "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", "dev": true, "requires": { @@ -18959,7 +18959,7 @@ "dependencies": { "kind-of": { "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "resolved": "https://registry.npm.taobao.org/kind-of/download/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { diff --git a/public/css/iconfont.css b/public/css/iconfont.css index 5e40b0dc..080d38a7 100644 --- a/public/css/iconfont.css +++ b/public/css/iconfont.css @@ -1,8 +1,8 @@ @font-face { font-family: "iconfont"; /* Project id 2340181 */ - src: url('iconfont.woff2?t=1640585290619') format('woff2'), - url('iconfont.woff?t=1640585290619') format('woff'), - url('iconfont.ttf?t=1640585290619') format('truetype'); + src: url('iconfont.woff2?t=1649726899310') format('woff2'), + url('iconfont.woff?t=1649726899310') format('woff'), + url('iconfont.ttf?t=1649726899310') format('truetype'); } .iconfont { @@ -13,6 +13,114 @@ -moz-osx-font-smoothing: grayscale; } +.icon-bangzhuzhongxinicon:before { + content: "\e926"; +} + +.icon-kaiyuanxiangmu:before { + content: "\e91d"; +} + +.icon-luntanjiaoliu:before { + content: "\e91e"; +} + +.icon-wangzhanpeizhi:before { + content: "\e91f"; +} + +.icon-weixuanze-chuangkekongjian:before { + content: "\e920"; +} + +.icon-tubiao:before { + content: "\e921"; +} + +.icon-gonggaofabu:before { + content: "\e922"; +} + +.icon-jingsaihuodong:before { + content: "\e923"; +} + +.icon-yonghuguanli:before { + content: "\e924"; +} + +.icon-shenpi:before { + content: "\e925"; +} + +.icon-zhuanli1:before { + content: "\e918"; +} + +.icon-daimaicon:before { + content: "\e91c"; +} + +.icon-jiangxiangicon:before { + content: "\e916"; +} + +.icon-shuju:before { + content: "\e917"; +} + +.icon-wendang:before { + content: "\e919"; +} + +.icon-lunwen:before { + content: "\e91a"; +} + +.icon-zhuanli:before { + content: "\e91b"; +} + +.icon-gailan1:before { + content: "\e914"; +} + +.icon-tuandui:before { + content: "\e915"; +} + +.icon-icon2:before { + content: "\e912"; +} + +.icon-a-21:before { + content: "\e913"; +} + +.icon-a-2:before { + content: "\e90f"; +} + +.icon-a-3:before { + content: "\e910"; +} + +.icon-icon1:before { + content: "\e911"; +} + +.icon-ioon:before { + content: "\e90e"; +} + +.icon-shanchu_tc_icon1:before { + content: "\e90c"; +} + +.icon-zhuanjiaicon:before { + content: "\e90d"; +} + .icon-shengming:before { content: "\e90b"; } diff --git a/public/css/iconfont.js b/public/css/iconfont.js index 4a0868c4..709a100e 100644 --- a/public/css/iconfont.js +++ b/public/css/iconfont.js @@ -1 +1 @@ -!function(a){var c,l,h,i,o,z='',t=(t=document.getElementsByTagName("script"))[t.length-1].getAttribute("data-injectcss"),p=function(a,c){c.parentNode.insertBefore(a,c)};if(t&&!a.__iconfont__svg__cssinject__){a.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(a){console&&console.log(a)}}function m(){o||(o=!0,h())}function v(){try{i.documentElement.doScroll("left")}catch(a){return void setTimeout(v,50)}m()}c=function(){var a,c;(c=document.createElement("div")).innerHTML=z,z=null,(a=c.getElementsByTagName("svg")[0])&&(a.setAttribute("aria-hidden","true"),a.style.position="absolute",a.style.width=0,a.style.height=0,a.style.overflow="hidden",c=a,(a=document.body).firstChild?p(c,a.firstChild):a.appendChild(c))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(c,0):(l=function(){document.removeEventListener("DOMContentLoaded",l,!1),c()},document.addEventListener("DOMContentLoaded",l,!1)):document.attachEvent&&(h=c,i=a.document,o=!1,v(),i.onreadystatechange=function(){"complete"==i.readyState&&(i.onreadystatechange=null,m())})}(window); \ No newline at end of file +!function(a){var l,c,h,i,o,z='',t=(t=document.getElementsByTagName("script"))[t.length-1].getAttribute("data-injectcss"),p=function(a,l){l.parentNode.insertBefore(a,l)};if(t&&!a.__iconfont__svg__cssinject__){a.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(a){console&&console.log(a)}}function v(){o||(o=!0,h())}function m(){try{i.documentElement.doScroll("left")}catch(a){return void setTimeout(m,50)}v()}l=function(){var a,l=document.createElement("div");l.innerHTML=z,z=null,(l=l.getElementsByTagName("svg")[0])&&(l.setAttribute("aria-hidden","true"),l.style.position="absolute",l.style.width=0,l.style.height=0,l.style.overflow="hidden",l=l,(a=document.body).firstChild?p(l,a.firstChild):a.appendChild(l))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(l,0):(c=function(){document.removeEventListener("DOMContentLoaded",c,!1),l()},document.addEventListener("DOMContentLoaded",c,!1)):document.attachEvent&&(h=l,i=a.document,o=!1,m(),i.onreadystatechange=function(){"complete"==i.readyState&&(i.onreadystatechange=null,v())})}(window); \ No newline at end of file diff --git a/public/css/iconfont.json b/public/css/iconfont.json index 0fb7117e..d1a1779f 100644 --- a/public/css/iconfont.json +++ b/public/css/iconfont.json @@ -5,6 +5,195 @@ "css_prefix_text": "icon-", "description": "", "glyphs": [ + { + "icon_id": "28888753", + "name": "帮助中心icon", + "font_class": "bangzhuzhongxinicon", + "unicode": "e926", + "unicode_decimal": 59686 + }, + { + "icon_id": "28163416", + "name": "开源项目", + "font_class": "kaiyuanxiangmu", + "unicode": "e91d", + "unicode_decimal": 59677 + }, + { + "icon_id": "28163417", + "name": "论坛交流", + "font_class": "luntanjiaoliu", + "unicode": "e91e", + "unicode_decimal": 59678 + }, + { + "icon_id": "28163418", + "name": "网站配置", + "font_class": "wangzhanpeizhi", + "unicode": "e91f", + "unicode_decimal": 59679 + }, + { + "icon_id": "28163419", + "name": "未选择-创客空间", + "font_class": "weixuanze-chuangkekongjian", + "unicode": "e920", + "unicode_decimal": 59680 + }, + { + "icon_id": "28163420", + "name": "图标", + "font_class": "tubiao", + "unicode": "e921", + "unicode_decimal": 59681 + }, + { + "icon_id": "28163421", + "name": "公告发布", + "font_class": "gonggaofabu", + "unicode": "e922", + "unicode_decimal": 59682 + }, + { + "icon_id": "28163422", + "name": "竞赛活动", + "font_class": "jingsaihuodong", + "unicode": "e923", + "unicode_decimal": 59683 + }, + { + "icon_id": "28163423", + "name": "用户管理", + "font_class": "yonghuguanli", + "unicode": "e924", + "unicode_decimal": 59684 + }, + { + "icon_id": "28163424", + "name": "审批", + "font_class": "shenpi", + "unicode": "e925", + "unicode_decimal": 59685 + }, + { + "icon_id": "22773568", + "name": "专利", + "font_class": "zhuanli1", + "unicode": "e918", + "unicode_decimal": 59672 + }, + { + "icon_id": "27680124", + "name": "代码icon", + "font_class": "daimaicon", + "unicode": "e91c", + "unicode_decimal": 59676 + }, + { + "icon_id": "27664463", + "name": "奖项icon", + "font_class": "jiangxiangicon", + "unicode": "e916", + "unicode_decimal": 59670 + }, + { + "icon_id": "27664464", + "name": "数据", + "font_class": "shuju", + "unicode": "e917", + "unicode_decimal": 59671 + }, + { + "icon_id": "27664466", + "name": "文档", + "font_class": "wendang", + "unicode": "e919", + "unicode_decimal": 59673 + }, + { + "icon_id": "27664467", + "name": "论文", + "font_class": "lunwen", + "unicode": "e91a", + "unicode_decimal": 59674 + }, + { + "icon_id": "27664468", + "name": "专利", + "font_class": "zhuanli", + "unicode": "e91b", + "unicode_decimal": 59675 + }, + { + "icon_id": "27664392", + "name": "概览", + "font_class": "gailan1", + "unicode": "e914", + "unicode_decimal": 59668 + }, + { + "icon_id": "27664393", + "name": "团队", + "font_class": "tuandui", + "unicode": "e915", + "unicode_decimal": 59669 + }, + { + "icon_id": "27299393", + "name": "icon", + "font_class": "icon2", + "unicode": "e912", + "unicode_decimal": 59666 + }, + { + "icon_id": "27299394", + "name": "2", + "font_class": "a-21", + "unicode": "e913", + "unicode_decimal": 59667 + }, + { + "icon_id": "27200759", + "name": "2", + "font_class": "a-2", + "unicode": "e90f", + "unicode_decimal": 59663 + }, + { + "icon_id": "27200760", + "name": "3", + "font_class": "a-3", + "unicode": "e910", + "unicode_decimal": 59664 + }, + { + "icon_id": "27200761", + "name": "icon", + "font_class": "icon1", + "unicode": "e911", + "unicode_decimal": 59665 + }, + { + "icon_id": "27041503", + "name": "ioon", + "font_class": "ioon", + "unicode": "e90e", + "unicode_decimal": 59662 + }, + { + "icon_id": "26470602", + "name": "shanchu_tc_icon", + "font_class": "shanchu_tc_icon1", + "unicode": "e90c", + "unicode_decimal": 59660 + }, + { + "icon_id": "26470603", + "name": "专家icon", + "font_class": "zhuanjiaicon", + "unicode": "e90d", + "unicode_decimal": 59661 + }, { "icon_id": "12505154", "name": "声明", diff --git a/public/css/iconfont.ttf b/public/css/iconfont.ttf index e4b21c0b..976c59a3 100644 Binary files a/public/css/iconfont.ttf and b/public/css/iconfont.ttf differ diff --git a/public/css/iconfont.woff b/public/css/iconfont.woff index 2fb7db94..c2a9a151 100644 Binary files a/public/css/iconfont.woff and b/public/css/iconfont.woff differ diff --git a/public/css/iconfont.woff2 b/public/css/iconfont.woff2 index 228840c6..a7418992 100644 Binary files a/public/css/iconfont.woff2 and b/public/css/iconfont.woff2 differ diff --git a/src/App.js b/src/App.js index 718017d6..3fdff34d 100644 --- a/src/App.js +++ b/src/App.js @@ -16,7 +16,8 @@ import marked from './common/marked'; import moment from 'moment' import { MuiThemeProvider, createMuiTheme } from 'material-ui/styles'; -import SiderBar from './forge/Component/SiderBar' +import SiderBar from './forge/Component/SiderBar'; +import SiderBarHelp from './glcc/siderBarHelp'; import { SnackbarHOC } from 'educoder'; import { initAxiosInterceptors } from './AppConfig' @@ -112,6 +113,12 @@ const Teaching = Loadable({ loader : () => import("./forge/TeachingPractice/Teaching"), loading: Loading, }) + +const Glcc = Loadable({ + loader : () => import("./glcc"), + loading: Loading, +}) + // const CreateMerge = Loadable({ // loader: () => import('./forge/Merge/NewMerge'), // loading: Loading, @@ -279,13 +286,13 @@ class App extends Component { }; render() { - const { pathType } = this.state; + const { pathType, pathName } = this.state; return ( this.Modifyloginvalue()}> - + {pathName && pathName.indexOf("glcc") === -1 ? : } {/* */} {/* wiki预览 */} @@ -376,6 +383,12 @@ class App extends Component { render={(props) => } > + {/*glcc */} + } + > + {/* 组织 */} { diff --git a/src/forge/Component/Component.scss b/src/forge/Component/Component.scss index da292d23..3e9b01cf 100644 --- a/src/forge/Component/Component.scss +++ b/src/forge/Component/Component.scss @@ -276,7 +276,7 @@ li.ant-menu-item{ .-task-sidebar { position: fixed; width: 40px; - right: 0; + right: 10px; bottom: 80px; z-index: 10; } diff --git a/src/forge/Upload/Index.js b/src/forge/Upload/Index.js index 20324211..f979fe7f 100644 --- a/src/forge/Upload/Index.js +++ b/src/forge/Upload/Index.js @@ -62,12 +62,14 @@ class Index extends Component { const { changeIsComplete } = this.props; changeIsComplete && changeIsComplete(true); const file = info.file; - if(file && file.type){ - if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { - let fileList = info.fileList; - this.setState({ fileList: appendFileSizeToUploadFileAll(fileList) }); - this.fileIdList(fileList); - } + if(file && !file.type){ + let flag = this.checkFile(file.name); + if(!flag) return; + } + if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { + let fileList = info.fileList; + this.setState({ fileList: appendFileSizeToUploadFileAll(fileList) }); + this.fileIdList(fileList); } } @@ -79,11 +81,26 @@ class Index extends Component { array && this.props.load && this.props.load(array); } + checkFile=(str)=>{ + const filestr = ['.rar','.iso',".flv", ".rmvb", ".mmf", ".ape", ".vsdx", ".msi",".md"]; + let flag = false; + for(var i= 0;i { - console.log(file); if(file && !file.type){ - this.props.showNotification(`暂不支持此格式文件的上传!`); - return; + let flag = this.checkFile(file.name); + if(!flag){ + this.props.showNotification(`暂不支持此格式文件的上传!`); + return; + } } const { size } = this.props; const isLt100M = file.size / 1024 / 1024 < size; diff --git a/src/forge/javaFetch.js b/src/forge/javaFetch.js index 02840a15..8f55e3bf 100644 --- a/src/forge/javaFetch.js +++ b/src/forge/javaFetch.js @@ -19,12 +19,11 @@ export default function javaFetch(actionUrl){ // request拦截器 service.interceptors.request.use(config => { if (cookie.load(TokenKey)) { - console.log(cookie.load(TokenKey)); config.headers['Authorization'] = cookie.load(TokenKey); // 让每个请求携带自定义token 请根据实际情况自行修改 } if (window.location.port === "3007") { // 模拟token为登录用户 - const token = sessionStorage.token; + const token = cookie.load(TokenKey); if (config.url.indexOf('?') === -1) { config.url = `${config.url}?token=${token}`; } else { diff --git a/src/glcc/api.js b/src/glcc/api.js new file mode 100644 index 00000000..f0f99d61 --- /dev/null +++ b/src/glcc/api.js @@ -0,0 +1,19 @@ +import fetch from './fetch'; + +// 获取当前用户报名信息 +export function getUserApplyInfo(params) { + return fetch({ + url: `/api/applyInformation/getUserApplyInfo`, + method: 'get', + params + }); +} + +//报名夏令营 +export function applyGlcc(data) { + return fetch({ + url: '/api/applyInformation/create', + method: 'post', + data: data + }); +} \ No newline at end of file diff --git a/src/glcc/apply/index.jsx b/src/glcc/apply/index.jsx new file mode 100644 index 00000000..bcc14677 --- /dev/null +++ b/src/glcc/apply/index.jsx @@ -0,0 +1,211 @@ +import React , { useCallback, useEffect , useState } from 'react'; +import { Breadcrumb, Button, Form, Input, Select, Upload, Modal } from 'antd'; +import {getUploadActionUrl} from 'educoder'; +import {getUserApplyInfo, applyGlcc} from '../api'; +import axios from 'axios'; +import TextArea from 'antd/lib/input/TextArea'; +import { main_site_url } from '../fetch'; +import banner from "../img/banner.png"; +import './index.scss'; +const Option = Select.Option; +function Apply(props) { + const {form, current_user, showNotification, isGlccApplyDate} = props; + // 可用于开发时不同账号报名 + // current_user && (current_user.user_id = 6) + // current_user && (current_user.userName = "创新使者") + const {getFieldDecorator, validateFields, setFieldsValue, validateFieldsAndScroll } = form; + const [reload, setReload] = useState(undefined); + const [imageUrl, setImageUrl] = useState(undefined); + const [loading, setLoading] = useState(false); + const [cateList, setCateList] = useState([]); + const [userApplyInfo, setUserApplyInfo] = useState(undefined); + + const helper = useCallback( + (label, extra, name, rules, widget) => ( + + {getFieldDecorator(name, { rules, validateFirst: true })(widget)} + + ), + [] + ); + + useEffect(()=>{ + // 进入此页面置顶 + window.scrollTo(0,0); + if(!isGlccApplyDate){ + // 不在开源夏令营报名时间之内 + window.location.href="/glcc"; + }else if(current_user && current_user.login){ + // 获取项目分类参数 + const url = `/project_categories/pinned_index.json`; + axios.get(url).then(result=>{ + if(result && result.data){ + setCateList(result.data.project_categories); + } + }).catch(error=>{}) + }else{ + window.location.href="/login?go_page=/glcc/apply"; + } + + }, []) + + useEffect(()=>{ + // 获取当前用户报名信息 + current_user && getUserApplyInfo({userId: current_user.user_id}).then(response=>{ + if(response && response.message === "success"){ + response.data && setFieldsValue({ + ...response.data + }) + setUserApplyInfo(response.data); + } + }) + }, [reload]) + + // 当用户输入结束时 检验用户输入是否符合规范 + function verify(dataIndex){ + validateFields([dataIndex],(error, values)=>{ + if(error && error[dataIndex]){ + return; + } + }) + } + + // 报名夏令营 + function handleSubmit(e){ + e.preventDefault(); + validateFieldsAndScroll((err, values) => { + if (!err) { + Modal.confirm({ + title: "报名", + content: "确定提交报名信息,提交后报名信息将无法修改", + onOk: ()=>{ + const params ={ + ...values, + projectLogoId: values.logo.file.response.id, + userId: current_user.user_id, + userName: current_user.username + } + applyGlcc(params).then(response=>{ + if(response && response.message === "success"){ + showNotification("报名成功"); + setReload(Math.random()); + } + }) + } + })} + }); + }; + + // 检查文件上传是否符合规定 + function beforeUpload(file){ + const isLt100M = file.size / 1024 / 1024 < 2; + if (!isLt100M) { + showNotification(`文件大小必须小于${2}MB!`); + } + const isType = file.type === "image/png" || file.type === "image/jpg" || file.type === "image/jpeg"; + if (!isType) { + showNotification("只能上传png、jpg、jpeg格式文件"); + } + return isLt100M && isType; + } + + 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) + ); + } + } + return( +
+ +
+ + 开源夏令营 + 项目报名 + + {userApplyInfo &&
+ 您已报名成功,请关注活动后续新闻公告! +
} +
+ {helper('项目名称', + '', + 'projectName', + [{ required: true, message: "请正确输入项目名称" }, + { max: 32, message: '超出限制长度32位字符,请重新编辑' }], + {verify("name")}} disabled = {userApplyInfo ? true : false} className={userApplyInfo? "disabledInput":""}/> + )} + {helper('项目分类', + '', + 'projectType', + [], + + )} + {helper('GitLink项目地址', + '', + 'gitlinkUrl', + [{ required: true, message: "请正确输入预申报项目在GitLink平台的地址" }, + { max: 252, message: '超出限制长度252位字符,请重新编辑' }], + {verify("gitlink")}} disabled = {userApplyInfo ? true : false} className={userApplyInfo? "disabledInput":""}/> + )} + {helper('官网地址', + '', + 'officialWebsiteUrl', + [{ max: 252, message: '超出限制长度252位字符,请重新编辑' }], + + )} +
{helper('项目简介', + '', + 'projectIntro', + [{ required: true, message: "请正确输入项目简介" }, + { max: 200, message: '超出限制长度200位字符,请重新编辑' }], +