Commit e126925f authored by 陈前坚's avatar 陈前坚

feat: menus

parent 7e3bce54
import React from 'react';
// import React from 'react';
const AuthorizedRoute = ({
component,
render,
authority,
redirectPath,
// eslint-disable-next-line no-unused-vars
...rest
}) => {};
......
......@@ -24,7 +24,7 @@ export default class PromiseRender extends React.Component {
}
setRenderComponent(props) {
const on = this.checkIsInstantiation(props.ok);
const ok = this.checkIsInstantiation(props.ok);
const error = this.checkIsInstantiation(props.error);
props.promise
.then(() => {
......
......@@ -25,7 +25,6 @@
<div id="app"></div>
<!-- Open Sans Font -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700" rel="stylesheet">
<!-- A lot of magic happens in this file. HtmlWebpackPlugin automatically injects all assets (e.g. bundle.js, main.css) with the correct HTML tags, which is why they are missing in this file. Don't add any assets here! (Check out webpack.dev.babel.js and webpack.prod.babel.js if you want to know more) -->
</body>
......
import React, { useState, useEffect } from 'react';
import axios from 'axios';
import React, { useState } from 'react';
import { matchRoutes, renderRoutes } from 'react-router-config';
import { Link } from 'react-router-dom';
import { GithubOutlined } from '@ant-design/icons';
import ProLayout, { DefaultFooter } from '@ant-design/pro-layout';
import menuConfig from '../routes/menuConfig';
import logo from '../assets/logo.svg';
import RightContent from '../components/GlobalHeader/RightContent';
// import config from '../routes/config';
// const noMatch = (
// <Result
......@@ -20,6 +19,7 @@ import RightContent from '../components/GlobalHeader/RightContent';
// />
// );
// eslint-disable-next-line no-unused-vars
const defaultFooterDom = (
<DefaultFooter
copyright={`${new Date().getFullYear()} 蚂蚁金服体验技术部出品`}
......@@ -46,90 +46,9 @@ const defaultFooterDom = (
/>
);
const BasicMenu = [
{
path: '/dbm',
component: 'BasicLayout',
name: '数据库管理',
icon: 'icon-dashboard',
routes: [
{
path: '/dbm/dbInit',
name: '数据库初始化',
},
{
path: '/dbm/dbsm',
name: '数据库标准化管理',
},
],
},
{
path: '/ou',
component: 'BasicLayout',
name: '机构与用户管理',
icon: 'icon-dashboard',
routes: [
{
path: '/ou/orgList',
name: '机构列表',
},
],
},
{
path: '/basicConfig',
component: 'BasicLayout',
name: '基础通用配置',
icon: 'icon-dashboard',
},
{
path: '/web5',
component: 'BasicLayout',
name: 'Web5配置',
icon: 'icon-dashboard',
routes: [
{
path: '/web5/integration',
name: '集成网站',
},
{
path: '/web5/single',
name: '一般网站',
},
],
},
{
path: '/app',
component: 'BasicLayout',
name: '手持系统配置',
icon: 'icon-dashboard',
},
{
path: '/miniPro',
component: 'BasicLayout',
name: '小程序配置',
authority: ['admin', 'user'],
icon: 'icon-dashboard',
},
{
path: '/log',
component: 'BasicLayout',
name: '日志管理',
icon: 'icon-dashboard',
routes: [
{
path: '/log/service',
name: '服务日志',
},
{
path: '/log/login',
name: '登录日志',
},
],
},
];
const userMode = localStorage.getItem('userMode');
if (userMode == 'common') {
BasicMenu.shift();
if (userMode === 'common') {
menuConfig.shift();
}
const BasicLayout = props => {
......@@ -143,7 +62,7 @@ const BasicLayout = props => {
logo={logo}
onCollapse={handleMenuCollapse}
onMenuHeaderClick={() => {}}
footerRender={() => defaultFooterDom}
// footerRender={() => defaultFooterDom}
rightContentRender={() => <RightContent />}
route={
{
......@@ -153,7 +72,7 @@ const BasicLayout = props => {
location={{
pathname,
}}
menuDataRender={() => BasicMenu}
menuDataRender={() => menuConfig}
menuItemRender={(menuItemProps, defaultDom) => {
if (menuItemProps.isUrl || !menuItemProps.path) {
return defaultDom;
......
......@@ -21,7 +21,7 @@ const UserLayout = props => {
// const { formatMessage } = useIntl();
const { breadcrumb } = getMenuData(route.routes);
const title = getPageTitle({
pathname: location.pathname,
pathname: window.location.pathname,
// formatMessage,
breadcrumb,
...props,
......
......@@ -2,7 +2,10 @@ import UserLayout from '../layouts/UserLayout';
import Login from '../pages/user/login';
import BasicLayout from '../layouts/BasicLayout';
import Welcome from '../pages/Welcome';
import RequestTest from '../pages/testPages/request';
import InitDataBase from '../pages/database/InitDataBase';
import ManagementDataBase from '../pages/database/ManagementDataBase';
// import OrgAndUser from '../pages/organization/OrgAndUser';
export default {
routes: [
{
......@@ -16,17 +19,6 @@ export default {
},
],
},
{
path: '/test',
component: UserLayout,
routes: [
{
name: '接口测试页',
path: '/test/request',
component: RequestTest,
},
],
},
{
path: '/',
component: BasicLayout,
......@@ -34,42 +26,61 @@ export default {
{
path: '/dbm/dbInit',
name: '数据库初始化',
component: Welcome,
component: InitDataBase,
},
{
path: '/dbm/dbsm',
name: '数据库标准化管理',
component: Welcome,
component: ManagementDataBase,
},
{
path: '/ou/orgList',
path: '/userCenter/orgList',
name: '机构列表',
component: Welcome,
},
{
path: '/basicConfig',
name: '基础通用配置',
path: '/platformCenter/gis',
name: 'GIS平台',
component: Welcome,
},
{
path: '/web5/integration',
name: '集成网站',
path: '/platformCenter/order',
name: '工单平台',
component: Welcome,
},
{
path: '/web5/single',
name: '一般网站',
path: '/platformCenter/notify',
name: '消息平台',
component: Welcome,
},
{
path: '/app',
name: '手持系统配置',
path: '/platformCenter/vedio',
name: '视频管理',
component: Welcome,
},
{
path: '/miniPro',
path: '/platformCenter/emq',
name: '宿主管理',
component: Welcome,
},
{
path: '/platformCenter/dictionary',
name: '数据字典',
component: Welcome,
},
{
path: '/productCenter/web',
name: 'web配置',
component: Welcome,
},
{
path: '/productCenter/app',
name: 'app配置',
component: Welcome,
},
{
path: '/productCenter/miniProgram',
name: '小程序配置',
authority: ['admin', 'user'],
component: Welcome,
},
{
......@@ -77,6 +88,26 @@ export default {
name: '日志管理',
component: Welcome,
},
{
path: '/log/service',
name: '服务日志',
component: Welcome,
},
{
path: '/log/login',
name: '登录日志',
component: Welcome,
},
{
path: '/log/omsOperation',
name: '运维操作日志',
component: Welcome,
},
{
path: '/log/omsError',
name: '运维错误日志',
component: Welcome,
},
],
},
],
......
import React from 'react';
import {
DatabaseOutlined,
UsergroupAddOutlined,
SettingOutlined,
HomeOutlined,
// AndroidOutlined,
// CommentOutlined,
CopyOutlined,
} from '@ant-design/icons';
const iconStyle = { verticalAlign: '0.125em' };
const menuConfig = [
{
path: '/dbm',
component: 'BasicLayout',
name: '数据库管理',
icon: <DatabaseOutlined style={iconStyle} />,
routes: [
{
path: '/dbm/dbInit',
name: '数据库初始化',
},
{
path: '/dbm/dbsm',
name: '数据库标准化管理',
},
],
},
{
path: '/userCenter',
component: 'BasicLayout',
name: '用户中心',
icon: <UsergroupAddOutlined style={iconStyle} />,
routes: [
{
path: '/userCenter/orgList',
name: '机构列表',
},
],
},
{
path: '/platformCenter',
component: 'BasicLayout',
name: '平台中心',
icon: <SettingOutlined style={iconStyle} />,
routes: [
{
path: '/platformCenter/gis',
name: 'GIS平台',
},
{
path: '/platformCenter/order',
name: '工单平台',
},
{
path: '/platformCenter/notify',
name: '消息平台',
},
{
path: '/platformCenter/vedio',
name: '视频管理',
},
{
path: '/platformCenter/emq',
name: '宿主管理',
},
{
path: '/platformCenter/dictionary',
name: '数据字典',
},
],
},
{
path: '/productCenter',
component: 'BasicLayout',
name: '产品中心',
icon: <HomeOutlined style={iconStyle} />,
routes: [
{
path: '/productCenter/web',
name: 'web配置',
},
{
path: '/productCenter/app',
name: 'app配置',
},
{
path: '/productCenter/miniProgram',
name: '小程序配置',
},
],
},
{
path: '/log',
component: 'BasicLayout',
name: '日志管理',
icon: <CopyOutlined style={iconStyle} />,
routes: [
{
path: '/log/service',
name: '服务日志',
},
{
path: '/log/login',
name: '登录日志',
},
{
path: '/log/omsOperation',
name: '运维操作日志',
},
{
path: '/log/omsError',
name: '运维错误日志',
},
],
},
];
export default menuConfig;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment