Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivWeb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
CivWeb
Commits
7eed81cf
Commit
7eed81cf
authored
3 years ago
by
邓晓峰
Browse files
Options
Browse Files
Download
Plain Diff
merge master branch
parents
c286dbf1
63d38dc6
master
dev
devNew
feat/layout-flat
feat/zhilian
patch-1
soundai
test
zhongyi
No related merge requests found
Pipeline
#35392
passed with stages
in 57 minutes 49 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
41 deletions
+69
-41
proxy.js
config/proxy.js
+1
-1
index.js
src/containers/App/index.js
+4
-4
BasicLayout1.js
src/layouts/BasicLayout1.js
+3
-2
UserLayout.js
src/layouts/UserLayout.js
+1
-1
routes.js
src/utils/routes.js
+60
-33
No files found.
config/proxy.js
View file @
7eed81cf
/* eslint-disable */
// const proxyURL = process.env.NODE_ENV !== 'production' ? 'http://192.168.10.150:8777' : window.location.origin;
const
proxyURL
=
'http://172.16.10.
152
:8666'
;
const
proxyURL
=
'http://172.16.10.
206
:8666'
;
module
.
exports
=
{
assetsRoot
:
process
.
env
.
NODE_ENV
!==
'production'
?
proxyURL
:
'./'
,
dev
:
{
...
...
This diff is collapsed.
Click to expand it.
src/containers/App/index.js
View file @
7eed81cf
...
...
@@ -2,9 +2,9 @@ import React, { Suspense } from 'react';
import
{
Helmet
}
from
'react-helmet'
;
import
{
connect
}
from
'react-redux'
;
import
{
renderRoutes
}
from
'react-router-config'
;
// import { RouteWithSubRoutes, renderRoutes
} from '../../utils/routes'
import
BootPage
from
'../../pages/bootpage'
;
//
import { renderRoutes } from 'react-router-config';
import
{
renderRoutes
}
from
'../../utils/routes'
//
import BootPage from '../../pages/bootpage';
import
{
Router
,
Switch
,
...
...
@@ -13,7 +13,7 @@ import {
}
from
'@wisdom-utils/runtime'
;
import
{
dyRoutes
}
from
'../../routes/config'
;
import
routeContext
from
'@ant-design/pro-layout/lib/RouteContext'
;
//
import routeContext from '@ant-design/pro-layout/lib/RouteContext';
// import { Route } from 'react-router-dom';
const
pkg
=
require
(
'../../../package.json'
);
...
...
This diff is collapsed.
Click to expand it.
src/layouts/BasicLayout1.js
View file @
7eed81cf
...
...
@@ -18,7 +18,8 @@ import {
Tooltip
}
from
'antd'
;
// import { RouteWithSubRoutes, renderRoutes } from '../utils/routes';
import
{
renderRoutes
}
from
'react-router-config'
;
// import { renderRoutes } from 'react-router-config';
import
{
renderRoutes
}
from
'../utils/routes'
import
{
PageContainer
}
from
'@ant-design/pro-layout'
;
import
Icon
from
'@ant-design/icons'
;
import
{
store
}
from
'microser-data'
;
...
...
@@ -272,7 +273,7 @@ const BasicLayout = props => {
true
,
);
const
parentMenuName
=
initSelectRoute
&&
initSelectRoute
.
parent
.
label
;
const
parentMenuName
=
initSelectRoute
&&
initSelectRoute
.
parent
&&
initSelectRoute
.
parent
.
label
;
if
(
parentMenuName
)
{
let
currentChildrenRoute
=
currentRoutes
.
routes
.
find
(
item
=>
item
.
name
===
parentMenuName
);
if
(
!
currentChildrenRoute
)
{
...
...
This diff is collapsed.
Click to expand it.
src/layouts/UserLayout.js
View file @
7eed81cf
...
...
@@ -5,7 +5,7 @@ import {
HelmetProvider
,
}
from
'react-helmet-async'
;
import
{
connect
}
from
'react-redux'
;
import
{
renderRoutes
}
from
'
react-router-config
'
;
import
{
renderRoutes
}
from
'
../utils/routes
'
;
import
{
getMenuData
,
...
...
This diff is collapsed.
Click to expand it.
src/utils/routes.js
View file @
7eed81cf
import
{
transformURL
}
from
'./utils'
;
import
{
Route
,
Switch
}
from
'@wisdom-utils/runtime'
;
import
{
matchPath
,
Route
,
Switch
}
from
'react-router'
;
import
React
,
{
Suspense
,
Fragment
}
from
'react'
;
export
const
isURL
=
function
(
url
)
{
// eslint-disable-next-line no-useless-escape
...
...
@@ -149,35 +147,64 @@ export function RouteWithSubRoutes(route) {
<
Route
path
=
{
route
.
path
}
render
=
{
props
=>
(
<
route
.
component
{...
props
}
route
=
{
route
}
routes
=
{
route
.
routes
}
params
=
{
route
.
params
}
/>
)
}></
Route
>
)
}
export
function
renderRoutes
(
routes
)
{
return
routes
.
map
((
route
,
index
)
=>
(
<
Route
key
=
{
index
}
path
=
{
route
.
path
}
exact
=
{
route
.
exact
}
render
=
{(
props
)
=>
{
// 利用render 方法处理
if
(
route
.
routes
){
return
(
<>
<
route
.
component
{...
props
}
route
=
{
route
}
routes
=
{
route
.
routes
}
params
=
{
route
.
params
}
><
/route.component
>
<
Switch
>
{
route
.
routes
.
map
((
child
,
i
)
=>
(
RouteWithSubRoutes
(
child
)
))
}
{
/* <Redirect to={route.routes[0].path}></Redirect> // 子路由找不到,重定向到第一个子路由 */
}
<
/Switch
>
<
/
>
)
}
else
{
return
(
<
route
.
component
{...
props
}
route
=
{
route
}
routes
=
{
route
.
routes
}
params
=
{
route
.
params
}
><
/route.component
>
)
function
matchRoutes
(
routes
,
pathname
,
branch
)
{
if
(
branch
===
void
0
)
{
branch
=
[];
}
routes
.
some
(
function
(
route
)
{
var
match
=
route
.
path
?
matchPath
(
pathname
,
route
)
:
branch
.
length
?
branch
[
branch
.
length
-
1
].
match
// use parent match
:
Router
.
computeRootMatch
(
pathname
);
// use default "root" match
if
(
match
)
{
branch
.
push
({
route
:
route
,
match
:
match
});
if
(
route
.
routes
)
{
matchRoutes
(
route
.
routes
,
pathname
,
branch
);
}
}}
/
>
))
}
return
match
;
});
return
branch
;
}
function
renderRoutes
(
routes
,
extraProps
,
switchProps
)
{
if
(
extraProps
===
void
0
)
{
extraProps
=
{};
}
if
(
switchProps
===
void
0
)
{
switchProps
=
{};
}
return
routes
?
React
.
createElement
(
Switch
,
switchProps
,
routes
.
map
(
function
(
route
,
i
)
{
return
React
.
createElement
(
Route
,
{
key
:
route
.
key
||
i
,
path
:
route
.
path
,
exact
:
route
.
exact
,
strict
:
route
.
strict
,
render
:
function
render
(
props
)
{
return
route
.
render
?
route
.
render
(
Object
.
assign
({},
props
,
{},
extraProps
,
{
routes
:
route
.
routes
,
params
:
route
.
params
,
route
:
route
}))
:
React
.
createElement
(
route
.
component
,
Object
.
assign
({},
props
,
extraProps
,
{
route
:
route
,
routes
:
route
.
routes
,
params
:
route
.
params
,
}));
}
});
}))
:
null
;
}
export
{
renderRoutes
,
matchPath
}
export
default
generRotes
;
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment