diff --git a/config/webpack.config.prod.js b/config/webpack.config.prod.js index 9f73041c8..165638663 100644 --- a/config/webpack.config.prod.js +++ b/config/webpack.config.prod.js @@ -90,6 +90,7 @@ module.exports = { src: path.join(paths.appSrc), forge: path.join(paths.appSrc, 'forge'), military: path.join(paths.appSrc, 'military'), + components: path.join(paths.appSrc, 'components'), // Support React Native Web // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/ "react-native": "react-native-web", diff --git a/src/home/index.scss b/src/home/index.scss index 2a1b113cf..ef329f786 100644 --- a/src/home/index.scss +++ b/src/home/index.scss @@ -106,52 +106,6 @@ line-height: 1.6875em; opacity: 0.8; } - - // 首页特定头部样式起 - - &.newHeaders { - // background-color: #1a2358; - background-color: #0037af; - z-index: 1000; - } - .newFooter{ - background: inherit; - } - .head-nav { - min-width: auto; - } - .head-nav ul#header-nav li a { - font-size: 1em; - color: #fff; - } - .head-nav ul#header-nav li:hover a, - .head-nav ul#header-nav li.active a { - color: #ffa13a; - } - .head-nav ul#header-nav li.active a::after { - background-color: #ffa13a; - } - - .logoDiv img { - min-width: 2.8125em; - height: 2.8125em; - } - - .color-home { - color: #fff; - } - - .color-home:hover { - color: #4154f1; - } - - .register-button { - height: 3em; - margin-left: 1.25em; - padding: 0 1.5625em; - font-size: 0.875em; - } - // 首页特定头部样式止 } // 波浪样式起 diff --git a/src/managements/components/layouts/config.js b/src/managements/components/layouts/config.js new file mode 100644 index 000000000..db07a8eca --- /dev/null +++ b/src/managements/components/layouts/config.js @@ -0,0 +1,148 @@ + +/** + * 路由配置表 + * key:必填,唯一标识 + * name:必填,菜单名称 + * location:路由地址 + * icon:左侧图标 + * target:打开方式,参考HTML标签的target属性 + * urltype:路由类别,用于拓展其它项目管理菜单,self为在当前项目下跳转路由,main_web_site_url或其它为匹配setting中对应路参数径 + * children:子元素数组 + */ + + export default [ + { + "key": "task", + "name": "创客空间", + "location": "", + "icon": "icon-jinggao", + "target": "_self", + "urltype": "self", + "children": [{ + "key": "basics", + "name": "基础数据", + "location": "", + "menustatus": "Y", + "parentKey": 'task', + "icon": "", + "target": "_self", + "urltype": "", + "children": [ { + "key": "categories", + "name": "任务领域", + "location": "/admin/categories/list", + "menustatus": "Y", + "parentKey": 'task', + "icon": "", + "target": "_self", + "urltype": "main_web_site_url", + "children": [], + },{ + "key": "industries", + "name": "行业信息", + "location": "/managements/industries/list", + "menustatus": "Y", + "parentKey": 'task', + "icon": "", + "target": "_self", + "urltype": "main_web_site_url", + "children": [], + },{ + "key": "placements", + "name": "职位信息", + "location": "/managements/placements/list", + "menustatus": "Y", + "parentKey": 'task', + "icon": "", + "target": "_self", + "urltype": "main_web_site_url", + "children": [], + }], + }, + { + "key": "commission", + "name": "代办事项", + "location": "", + "menustatus": "Y", + "parentKey": 'task', + "icon": "", + "target": "_self", + "urltype": "", + "children": [{ + "key": "categories", + "name": "延期任务处理", + "location": "/managements/task/delayManage", + "menustatus": "Y", + "parentKey": 'task', + "icon": "", + "target": "_self", + "urltype": "self", + "children": [], + },{ + "key": "industries", + "name": "支付报酬凭证上传", + "location": "/managements/task/payProof", + "menustatus": "Y", + "parentKey": 'task', + "icon": "", + "target": "_self", + "urltype": "self", + "children": [], + }], + }, + { + "key": "placements", + "name": "创客任务列表", + "location": "/managements/task/taskAdmin", + "menustatus": "Y", + "parentKey": 'task', + "icon": "", + "target": "", + "urltype": "self", + "children": [], + } + ], + }, + { + "key": "competition", + "name": "竞赛活动", + "location": "", + "icon": "icon-ioon", + "target": "_self", + "urltype": "self", + "children": [{ + "key": "competitionList", + "name": "竞赛列表", + "location": "/managements/competition/list", + "menustatus": "Y", + "parentKey": 'task', + "icon": "", + "target": "", + "urltype": "self", + "children": [], + }, + { + "key": "competitionRegion", + "name": "赛区配置", + "location": "/admin/competitions/region_zone_edit", + "menustatus": "Y", + "parentKey": 'task', + "icon": "", + "target": "_blank", + "urltype": "main_web_site_url", + "children": [], + }, + { + "key": "competitionExpert", + "name": "竞赛评审列表", + "location": "/managements/expert/competition", + "menustatus": "Y", + "parentKey": 'task', + "icon": "", + "target": "", + "urltype": "self", + "children": [], + } + ], + }, +] \ No newline at end of file diff --git a/src/managements/components/layouts/index.jsx b/src/managements/components/layouts/index.jsx index b31d0696c..3605e0cd8 100644 --- a/src/managements/components/layouts/index.jsx +++ b/src/managements/components/layouts/index.jsx @@ -1,37 +1,74 @@ -import React, { useState ,useEffect } from 'react'; +import React, { useState, useEffect } from 'react'; import { Link } from "react-router-dom"; -import { Menu,Icon, Dropdown, } from 'antd'; +import { Menu, Icon, Dropdown, } from 'antd'; +import urlConfig from './config'; + import './index.scss'; const { SubMenu } = Menu; export default (props) => { - const {current_user,history}=props; - const main_web_site_url =localStorage.chromesetting&& JSON.parse(localStorage.chromesetting).main_web_site_url; - const current_main_site_url =localStorage.chromesetting&& JSON.parse(localStorage.chromesetting).current_main_site_url; - const noticeUrl =localStorage.chromesetting&& JSON.parse(localStorage.chromesetting).api_urls.notice; - useEffect(()=>{ - sessionStorage.setItem('current_user',JSON.stringify(current_user)); - },[current_user.login]); - + const { current_user, history } = props; + const setting = localStorage.chromesetting && JSON.parse(localStorage.chromesetting) ||{}; + const main_web_site_url = localStorage.chromesetting && JSON.parse(localStorage.chromesetting).main_web_site_url; + useEffect(() => { + sessionStorage.setItem('current_user', JSON.stringify(current_user)); + }, [current_user.login]); - const [current,setCurrent]=useState(JSON.parse(sessionStorage.adminRouter||'[]')); - const [title,setTitle]=useState(''); - function handleClick (e){ + const [current, setCurrent] = useState(JSON.parse(sessionStorage.adminRouter || '[]')); + const [title, setTitle] = useState(''); + + function handleClick(e) { setCurrent([e.key]); - setTitle(e.item.props.title); - sessionStorage.setItem( 'adminRouter',JSON.stringify([e.key])); + // setTitle(e.item.props.title); + // sessionStorage.setItem( 'adminRouter',JSON.stringify([e.key])); }; + function getMenuList(menus) { + return menus.map(function (item) { + if (Array.isArray(item.children) && item.children.length > 0) { + let list = []; + let title = ({item.name}); + item.children.map((it) => { + list.push(