diff --git a/public/css/iconfont.css b/public/css/iconfont.css index 5e40b0dc3..080d38a72 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 4a0868c43..709a100e6 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 0fb7117e4..d1a1779fe 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 e4b21c0be..976c59a38 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 2fb7db942..c2a9a1512 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 228840c62..a7418992b 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 0e413b26c..082e7023d 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' @@ -286,13 +287,13 @@ class App extends Component { }; render() { - const { pathType } = this.state; + const { pathType, pathName } = this.state; return ( this.Modifyloginvalue()}> - + {pathName && pathName.indexOf("glcc") === -1 ? : } {/* */} {/* wiki预览 */} diff --git a/src/forge/javaFetch.js b/src/forge/javaFetch.js index 912eca533..8f55e3bff 100644 --- a/src/forge/javaFetch.js +++ b/src/forge/javaFetch.js @@ -23,7 +23,7 @@ export default function javaFetch(actionUrl){ } 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 index a3cee6599..f0f99d61a 100644 --- a/src/glcc/api.js +++ b/src/glcc/api.js @@ -3,45 +3,17 @@ import fetch from './fetch'; // 获取当前用户报名信息 export function getUserApplyInfo(params) { return fetch({ - url: '/api/applyInformation/getUserApplyInfo', + url: `/api/applyInformation/getUserApplyInfo`, method: 'get', params }); } -// 获取单个wiki -export function getWiki(params) { +//报名夏令营 +export function applyGlcc(data) { return fetch({ - url: '/api/wiki/getWiki', - method: 'get', - params - }); -} - -//新增wiki -export function addWiki(data) { - return fetch({ - url: '/api/wiki/createWiki', + url: '/api/applyInformation/create', method: 'post', data: data }); -} - -//更新wiki -export function updateWiki(data) { - return fetch({ - url: '/api/wiki/updateWiki', - method: 'PUT', - data: data - }); -} - -//删除wiki -export function deleteWiki(data) { - return fetch({ - url: '/api/wiki/deleteWiki', - method: 'DELETE', - data, - }); -} - +} \ No newline at end of file diff --git a/src/glcc/apply/index.jsx b/src/glcc/apply/index.jsx index db999ec33..57fe176f2 100644 --- a/src/glcc/apply/index.jsx +++ b/src/glcc/apply/index.jsx @@ -1,18 +1,23 @@ import React , { useCallback, useEffect , useState } from 'react'; -import { Breadcrumb, Button, Form, Icon, Input, Select, Upload } from 'antd'; -import {classify} from '../static'; -import {getUserApplyInfo} from '../api'; +import { Breadcrumb, Button, Form, Input, Select, Upload } from 'antd'; +import {getUserApplyInfo, applyGlcc} from '../api'; import axios from 'axios'; -import './index.scss'; import TextArea from 'antd/lib/input/TextArea'; +import { httpUrl } from '../fetch'; +import './index.scss'; const Option = Select.Option; function Apply(props) { - const {form, qzDetail, enrollStatus, setReload, current_user, history} = props; + const {form, current_user, showNotification} = props; + // 可用于开发时不同账号报名 + // current_user && (current_user.user_id = 1061) + // 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) => ( @@ -22,19 +27,28 @@ function Apply(props) { [] ); - // 获取当前用户报名信息 useEffect(()=>{ + // 获取项目分类参数 const url = `/project_categories/pinned_index.json`; axios.get(url).then(result=>{ if(result && result.data){ setCateList(result.data.project_categories); } }).catch(error=>{}) - current_user && getUserApplyInfo({userId: current_user.user_id}).then(response=>{ - console.log(response); - }) }, []) + 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)=>{ @@ -44,14 +58,56 @@ function Apply(props) { }) } + // 报名夏令营 function handleSubmit(e){ e.preventDefault(); validateFieldsAndScroll((err, values) => { if (!err) { - console.log('Received values of form: ', values); + const params ={ + ...values, + projectLogoId: values.logo.file.response.data.id, + userId: current_user.user_id, + userName: current_user.username + } + applyGlcc(params).then(response=>{ + if(response && response.message === "success"){ + 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(
@@ -62,50 +118,51 @@ function Apply(props) {
{helper('项目名称', '', - 'name', + 'projectName', [{ required: true, message: "请正确输入项目名称" }, { max: 32, message: '超出限制长度32位字符,请重新编辑' }], - {verify("name")}}/> + {verify("name")}} disabled = {userApplyInfo ? true : false} className={userApplyInfo? "disabledInput":""}/> )} {helper('项目分类', '', - 'classify', + 'projectType', [], - + {cateList && cateList.map(item=> {return })} )} {helper('官网地址', '', - 'area', + 'officialWebsiteUrl', [], - + )} {helper('GitLink地址', '', - 'gitlink', + 'gitlinkUrl', [{ required: true, message: "请正确输入GitLink地址" }], - {verify("gitlink")}}/> + {verify("gitlink")}} disabled = {userApplyInfo ? true : false} className={userApplyInfo? "disabledInput":""}/> )}
{helper('项目简介', '', - 'intro', + 'projectIntro', [{ required: true, message: "请正确输入项目简介" }, { max: 200, message: '超出限制长度200位字符,请重新编辑' }], -