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
f5dcfd8f
Commit
f5dcfd8f
authored
Oct 13, 2021
by
邓晓峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复三级菜单高亮选中
parent
aef6f532
Pipeline
#35951
passed with stages
in 30 minutes 4 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
28 deletions
+54
-28
app.js
src/app.js
+16
-25
index.js
src/components/ErrorBoundary/index.js
+32
-0
BasicLayout1.js
src/layouts/BasicLayout1.js
+6
-3
No files found.
src/app.js
View file @
f5dcfd8f
...
...
@@ -12,22 +12,15 @@ import 'sanitize.css/sanitize.css';
import
React
from
'react'
;
import
ReactDOM
from
'react-dom'
;
import
{
Button
,
ConfigProvider
,
message
,
notification
,
}
from
'antd'
;
import
{
Button
,
ConfigProvider
,
message
,
notification
}
from
'antd'
;
import
{
ConnectedRouter
}
from
'connected-react-router/immutable'
;
import
Immutable
from
'immutable'
;
import
{
params
,
Storeage
,
}
from
'kit_utils'
;
import
{
params
,
Storeage
}
from
'kit_utils'
;
import
{
Provider
}
from
'react-redux'
;
import
{
useIntl
}
from
'@/locales/localeExports'
;
import
{
ErrorBoundary
}
from
'@ant-design/pro-utils'
;
import
{
history
}
from
'@wisdom-utils/runtime'
;
import
ErrorBoundary
from
'./components/ErrorBoundary'
;
import
{
useIntl
}
from
'@/locales/localeExports'
;
// import { ErrorBoundary } from '@ant-design/pro-utils';
import
defaultSettings
from
'../config/defaultSetting'
;
// import themePluginConfig from '../config/themePluginConfig';
...
...
@@ -40,10 +33,7 @@ import { actionCreators } from './containers/App/store';
import
{
LocaleContainer
}
from
'./locales/locale'
;
import
{
initMicroApps
}
from
'./micro'
;
import
Login
from
'./pages/user/login/login'
;
import
{
getToken
,
isString
,
}
from
'./utils/utils'
;
import
{
getToken
,
isString
}
from
'./utils/utils'
;
import
'./utils/event'
;
import
Cookies
from
'js-cookie'
;
const
isHttps
=
document
.
location
.
protocol
===
'https:'
;
...
...
@@ -62,13 +52,13 @@ const render = () => {
<
Provider
store
=
{
store
}
>
<
ConnectedRouter
history
=
{
history
}
>
<
LocaleContainer
>
<
ErrorBoundary
>
<
Container
>
<
Con
figProvider
prefixCls
=
"panda-console-base"
>
<
ConfigProvider
prefixCls
=
"panda-console-base"
>
<
ErrorBoundary
>
<
Con
tainer
>
<
App
/>
<
/Con
figProvid
er
>
<
/
Container
>
<
/
ErrorBoundary
>
<
/Con
tain
er
>
<
/
ErrorBoundary
>
<
/
ConfigProvider
>
<
/LocaleContainer
>
<
/ConnectedRouter
>
<
/Provider>
,
...
...
@@ -130,7 +120,9 @@ const initGlobalConfig = () => {
});
// eslint-disable-next-line react-hooks/rules-of-hooks
appService
.
queryConfig
({
client
:
params
.
getParams
(
'client'
)
||
Cookies
.
get
(
'city'
)
||
'city'
})
.
queryConfig
({
client
:
params
.
getParams
(
'client'
)
||
Cookies
.
get
(
'city'
)
||
'city'
,
})
.
then
(
res
=>
{
if
(
res
)
{
const
data
=
res
;
...
...
@@ -158,7 +150,7 @@ const initGlobalConfig = () => {
updateConfig
:
data
=>
store
.
dispatch
(
actionCreators
.
getConfig
(
data
)),
isInit
:
false
,
logout
:
()
=>
store
.
dispatch
(
actionCreators
.
logout
())
logout
:
()
=>
store
.
dispatch
(
actionCreators
.
logout
())
,
},
()
=>
{
(
async
()
=>
{
...
...
@@ -232,7 +224,6 @@ window.share &&
initMicroApps
(
loader
,
store
);
});
if
(
pwa
)
{
// const appPWA = window.i18n.getI18n('app');
window
.
addEventListener
(
'sw.offline'
,
()
=>
{
...
...
src/components/ErrorBoundary/index.js
0 → 100644
View file @
f5dcfd8f
import
React
from
'react'
;
import
{
Result
}
from
'antd'
;
class
ErrorBoundary
extends
React
.
Component
{
state
=
{
hasError
:
false
,
errorInfo
:
''
};
static
getDerivedStateFromError
(
error
)
{
return
{
hasError
:
true
,
errorInfo
:
error
.
message
};
}
componentDidCatch
(
error
,
errorInfo
)
{
// You can also log the error to an error reporting service
// eslint-disable-next-line no-console
console
.
log
(
error
,
errorInfo
);
}
render
()
{
if
(
this
.
state
.
hasError
)
{
// You can render any custom fallback UI
return
(
<
Result
status
=
"error"
title
=
"Something went wrong."
extra
=
{
this
.
state
.
errorInfo
}
/
>
);
}
return
this
.
props
.
children
;
}
}
export
default
ErrorBoundary
;
src/layouts/BasicLayout1.js
View file @
f5dcfd8f
...
...
@@ -352,8 +352,11 @@ const BasicLayout = props => {
useEffect
(()
=>
{
const
routes
=
currentRoutes
.
routes
[
selectIndex
];
if
(
routes
)
{
const
route
=
routes
&&
routes
.
routes
.
find
(
item
=>
item
.
path
===
decodeURI
(
window
.
location
.
pathname
.
replace
(
'/civbase'
,
''
)));
setTabActiveKey
(
route
.
path
)
if
(
routes
&&
routes
.
routes
)
{
const
route
=
routes
&&
routes
.
routes
&&
routes
.
routes
.
find
(
item
=>
item
.
path
===
decodeURI
(
window
.
location
.
pathname
.
replace
(
'/civbase'
,
''
)));
setTabActiveKey
(
route
.
path
)
}
}
},
[
props
.
location
]);
// window.share.event.on('event:history', params => {
...
...
@@ -614,7 +617,7 @@ const BasicLayout = props => {
item
.
routes
?
renderChildrenMenu
(
item
)
:
(
<>
{
item
.
icon
?
item
.
icon
:
item
.
extData
&&
/.svg/
.
test
(
item
.
extData
.
icon
)
?
<
ReactSVG
src
=
{
item
.
extData
.
icon
}
style
=
{{
width
:
'18px'
,
height
:
'18px'
}}
/>:item.extData && <img src={item.extData.icon} style={{width: '18px', height: '18px'}}/
>
item
.
icon
?
item
.
icon
:
item
.
extData
&&
/.svg/
.
test
(
item
.
extData
.
icon
)
?
<
ReactSVG
src
=
{
item
.
extData
.
icon
}
beforeInjection
=
{
svg
=>
console
.
log
(
svg
)}
style
=
{{
width
:
'18px'
,
height
:
'18px'
}}
/>:item.extData && <img src={item.extData.icon} style={{width: '18px', height: '18px'}}/
>
}
<
span
className
=
{
layoutStyles
[
'menu-item-name'
]}
>
{
item
.
name
}
<
/span
>
{
...
...
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