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
8f36b76c
Commit
8f36b76c
authored
Dec 08, 2022
by
崔佳豪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 处理退出登录未请求配置信息
parent
7a610533
Pipeline
#65196
passed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
82 deletions
+71
-82
BasicLayout.js
src/layouts/BasicLayout.js
+71
-82
No files found.
src/layouts/BasicLayout.js
View file @
8f36b76c
// @eslint-disable
import
React
,
{
Suspense
,
useEffect
,
useRef
,
useState
,
}
from
'react'
;
import
React
,
{
Suspense
,
useEffect
,
useRef
,
useState
}
from
'react'
;
import
{
Anchor
,
Popover
,
Radio
,
Spin
,
}
from
'antd'
;
import
{
Anchor
,
Popover
,
Radio
,
Spin
}
from
'antd'
;
import
classNames
from
'classnames'
;
import
Cookies
from
'js-cookie'
;
import
_
from
'lodash'
;
...
...
@@ -19,23 +9,16 @@ import memoized from 'nano-memoize';
import
KeepAlive
from
'react-activation'
;
import
{
connect
}
from
'react-redux'
;
import
{
matchRoutes
}
from
'react-router-dom'
;
import
Loading
from
'../components/Loading'
;
import
RightContent
from
'@/components/GlobalHeader/SimpleRiightContent'
;
import
defaultSetting
from
'@wisdom-utils/components/lib/AppLayout/layouts/defaultSettings'
;
// import SettingDrawer from '@wisdom-utils/components/lib/layout/components/SettingDrawer';
import
{
actionCreators
}
from
'@/containers/App/store'
;
import
Icon
,
{
LoadingOutlined
}
from
'@ant-design/icons'
;
import
BasicLayout
from
'@wisdom-utils/components/lib/layout/BasicLayout'
;
import
{
useHistory
,
useLocation
,
}
from
'@wisdom-utils/runtime'
;
import
{
helpers
,
store
,
event
}
from
'@wisdom-utils/utils'
;
import
{
useHistory
,
useLocation
}
from
'@wisdom-utils/runtime'
;
import
{
helpers
,
store
,
event
}
from
'@wisdom-utils/utils'
;
import
{
Storeage
as
Store
}
from
'@wisdom-utils/utils/lib/helpers'
;
import
Loading
from
'../components/Loading'
;
import
{
waterMark
}
from
'../utils/mark'
;
import
layoutStyles
from
'./BasicLayout.less'
;
...
...
@@ -49,28 +32,26 @@ const { getParamsV1 } = params;
// const AMap = React.lazy(() => import('../pages/map/amap'));
const
CesiumMap
=
React
.
lazy
(()
=>
import
(
'../pages/map/cesiumMap'
));
const
waitTime
=
(
time
=
100
)
=>
{
return
new
Promise
((
resolve
)
=>
{
const
waitTime
=
(
time
=
100
)
=>
new
Promise
(
resolve
=>
{
setTimeout
(()
=>
{
resolve
(
true
);
},
time
);
});
};
const
antIcon
=
<
LoadingOutlined
style
=
{{
fontSize
:
12
}}
spin
/>
;
const
arrowSvg
=
({
fillColor
=
'#fff'
})
=>
(
<
svg
t
=
'1543324489942'
className
=
'icon'
viewBox
=
'0 0 1024 1024'
version
=
'1.1'
xmlns
=
'http://www.w3.org/2000/svg'
width
=
'16'
height
=
'16'
t
=
"1543324489942"
className
=
"icon"
viewBox
=
"0 0 1024 1024"
version
=
"1.1"
xmlns
=
"http://www.w3.org/2000/svg"
width
=
"16"
height
=
"16"
>
<
path
d
=
'M511.700683 639.423111 191.917496 319.596945 319.830771 319.596945 511.700683 511.715521 703.570595 319.596945 831.48387 319.596945Z'
p
-
id
=
'8626'
d
=
"M511.700683 639.423111 191.917496 319.596945 319.830771 319.596945 511.700683 511.715521 703.570595 319.596945 831.48387 319.596945Z"
p
-
id
=
"8626"
// fill={fillColor}
/>
<
/svg
>
...
...
@@ -102,9 +83,15 @@ const StationsItem = (item, action, onChangeVisible, actionRef, setMenuLoading)
const
OnlyFocusStations
=
props
=>
{
const
data
=
props
.
data
.
stations
;
return
(
<
Spin
spinning
=
{
props
.
loading
}
tip
=
'加载中'
size
=
'small'
>
<
Spin
spinning
=
{
props
.
loading
}
tip
=
"加载中"
size
=
"small"
>
<
div
className
=
{
layoutStyles
.
focusStations
}
style
=
{{
border
:
'none'
}}
>
<
ul
>
{
Array
.
isArray
(
data
)
?
data
.
map
(
item
=>
StationsItem
(
item
,
props
.
action
,
props
.
setVisible
,
props
.
actionRef
,
props
.
setMenuLoading
))
:
null
}
<
/ul
>
<
ul
>
{
Array
.
isArray
(
data
)
?
data
.
map
(
item
=>
StationsItem
(
item
,
props
.
action
,
props
.
setVisible
,
props
.
actionRef
,
props
.
setMenuLoading
),
)
:
null
}
<
/ul
>
<
/div
>
<
/Spin
>
);
...
...
@@ -128,15 +115,21 @@ const AllStations = props => {
setDefaultTab
(
event
.
target
.
value
);
};
return
(
<
Spin
spinning
=
{
props
.
loading
}
tip
=
'加载中'
>
<
Spin
spinning
=
{
props
.
loading
}
tip
=
"加载中"
>
<
div
className
=
{
layoutStyles
.
focusStations
}
>
<
ul
>
{
Array
.
isArray
(
data
)
?
data
.
map
(
item
=>
StationsItem
(
item
,
props
.
action
,
props
.
setVisible
,
props
.
actionRef
,
props
.
setMenuLoading
))
:
null
}
<
/ul
>
<
ul
>
{
Array
.
isArray
(
data
)
?
data
.
map
(
item
=>
StationsItem
(
item
,
props
.
action
,
props
.
setVisible
,
props
.
actionRef
,
props
.
setMenuLoading
),
)
:
null
}
<
/ul
>
<
/div
>
<
Radio
.
Group
options
=
{
optionsWith
}
optionType
=
'button'
buttonStyle
=
'solid'
size
=
'small'
optionType
=
"button"
buttonStyle
=
"solid"
size
=
"small"
value
=
{
defaultTab
}
onChange
=
{
handleTabChange
}
style
=
{{
marginTop
:
'6px'
}}
...
...
@@ -159,7 +152,7 @@ const AllStations = props => {
<
/Anchor
>
<
/div
>
)
:
(
<
div
className
=
'city_pane city_container'
>
{
props
.
data
.
citySelector
}
<
/div
>
<
div
className
=
"city_pane city_container"
>
{
props
.
data
.
citySelector
}
<
/div
>
)}
<
/div
>
<
/Spin
>
...
...
@@ -181,26 +174,32 @@ const renderSite = ({ data, config, loading, setLoading, action, actionRef, setM
if
(
config
&&
config
.
userInfo
&&
config
.
userInfo
.
site
===
''
)
{
loaded
=
false
;
}
if
(
!
data
.
allStation
||
!
_
.
isArray
(
data
.
allStation
)
||
data
.
allStation
.
length
<=
1
)
return
<><
/>
;
if
(
!
data
.
allStation
||
!
_
.
isArray
(
data
.
allStation
)
||
data
.
allStation
.
length
<=
1
)
return
<><
/>
;
return
(
<>
<
Spin
indicator
=
{
antIcon
}
spinning
=
{
loaded
}
size
=
'small'
size
=
"small"
style
=
{{
marginLeft
:
'10px'
}}
tip
=
''
tip
=
""
wrapperClassName
=
{
layoutStyles
.
spinLoadding
}
>
<>
<
Popover
placement
=
'bottomLeft'
trigger
=
'click'
placement
=
"bottomLeft"
trigger
=
"click"
visible
=
{
visible
}
content
=
{
<
Stations
data
=
{
data
}
loading
=
{
loading
}
setLoading
=
{
setLoading
}
setVisible
=
{
setVisible
}
action
=
{
action
}
actionRef
=
{
actionRef
}
setMenuLoading
=
{
setMenuLoading
}
/
>
<
Stations
data
=
{
data
}
loading
=
{
loading
}
setLoading
=
{
setLoading
}
setVisible
=
{
setVisible
}
action
=
{
action
}
actionRef
=
{
actionRef
}
setMenuLoading
=
{
setMenuLoading
}
/
>
}
arrowPointAtCenter
overlayClassName
=
{
classNames
(
layoutStyles
.
stationsWrapper
,
layoutStyles
.
stationsTop
)}
...
...
@@ -228,7 +227,6 @@ const renderSite = ({ data, config, loading, setLoading, action, actionRef, setM
// import defaultProps from '../defaultProps';
const
pickRoutes
=
memoized
((
routes
,
pathname
,
locale
)
=>
{
const
matches
=
matchRoutes
(
routes
,
{
pathname
});
const
routeConfig
=
matches
?
matches
[
matches
.
length
-
1
].
route
:
null
;
...
...
@@ -246,7 +244,7 @@ const transformFloatMenu = (routes, homepage) => {
return
routes
.
concat
(
route
);
};
const
Layout
=
(
props
)
=>
{
const
Layout
=
props
=>
{
const
currentProduct
=
new
Store
(
`__global__recent_productIndex__micro_
${
window
.
location
.
hostname
}
`
);
const
menuState
=
sessionStorage
.
getItem
(
'menuState'
)
||
'open'
;
const
[
cityData
,
setCityData
]
=
useState
({});
...
...
@@ -273,20 +271,19 @@ const Layout = (props) => {
});
},
[]);
useEffect
(()
=>
{
siteAction
.
setGlobalConfig
(
props
.
global
);
const
tk
=
Cookies
.
get
(
'token'
)
||
props
.
global
.
token
;
const
isLogin
=
tk
!==
null
&&
tk
!==
'undefined'
&&
tk
!==
(
void
0
)
;
const
isLogin
=
tk
!==
null
&&
tk
!==
'undefined'
&&
tk
!==
void
0
;
if
(
!
isLogin
)
{
let
client
=
props
?.
global
?.
client
||
sessionStorage
.
getItem
(
'client'
)
||
null
;
client
=
client
!==
'undefined'
&&
!
_
.
isNull
(
client
)
&&
!
_
.
isUndefined
(
client
)
?
client
:
'city'
;
let
generateType
=
props
.
global
&&
props
.
global
.
hasOwnProperty
(
'get'
)
?
props
.
global
.
get
(
'generateType'
)
:
null
;
generateType
=
!
_
.
isNull
(
generateType
)
&&
!
_
.
isUndefined
(
generateType
)
&&
generateType
!==
'undefined'
?
`&generateType=
${
generateType
}
`
:
''
;
history
.
replace
(
`/user/login?client=
${
client
}${
generateType
}
`
);
//
let client = props?.global?.client || sessionStorage.getItem('client') || null;
//
client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client : 'city';
//
let generateType = props.global && props.global.hasOwnProperty('get') ? props.global.get('generateType') : null;
//
generateType =
//
!_.isNull(generateType) && !_.isUndefined(generateType) && generateType !== 'undefined'
//
? `&generateType=${generateType}`
//
: '';
//
history.replace(`/user/login?client=${client}${generateType}`);
props
.
logout
();
}
},
[
history
,
props
,
props
.
global
,
siteAction
]);
...
...
@@ -305,7 +302,6 @@ const Layout = (props) => {
}
},
[
cityData
,
props
.
global
,
props
.
global
.
userInfo
,
siteAction
]);
useEffect
(()
=>
{
window
.
share
.
event
.
on
(
'updateSite'
,
res
=>
{
setCityData
(
res
);
...
...
@@ -333,8 +329,7 @@ const Layout = (props) => {
});
}
};
},
[
props
.
global
.
userInfo
]);
},
[
props
.
global
.
isHaveMark
,
props
.
global
.
userInfo
]);
const
onMenuHeaderClick
=
event
=>
{
// 非云平台不做响应
...
...
@@ -359,8 +354,8 @@ const Layout = (props) => {
const
logo
=
props
.
global
&&
_
.
isFunction
(
props
.
global
.
get
)
&&
props
.
global
.
get
(
'bannerLogo'
)
?
props
.
global
&&
_
.
isFunction
(
props
.
global
.
transformDevAssetsBaseURL
)
&&
props
.
global
.
transformDevAssetsBaseURL
(
props
.
global
.
get
(
'bannerLogo'
))
_
.
isFunction
(
props
.
global
.
transformDevAssetsBaseURL
)
&&
props
.
global
.
transformDevAssetsBaseURL
(
props
.
global
.
get
(
'bannerLogo'
))
:
defaultSetting
.
logo
;
// 添加一个路由跳转事件
...
...
@@ -368,7 +363,7 @@ const Layout = (props) => {
const
{
share
,
history
}
=
window
;
const
findMenuPath
=
(
flatMenu
,
url
)
=>
{
const
[
path
,
param
=
''
]
=
url
.
split
(
'|'
);
le
t
params
=
param
.
split
(
'&'
).
reduce
((
pre
,
item
)
=>
{
cons
t
params
=
param
.
split
(
'&'
).
reduce
((
pre
,
item
)
=>
{
if
(
!
item
)
return
pre
;
const
[
key
,
value
]
=
item
.
split
(
'='
);
pre
[
key
]
=
value
;
...
...
@@ -393,18 +388,14 @@ const Layout = (props) => {
return
()
=>
{
share
&&
share
.
event
&&
share
.
event
.
removeListener
(
'route:pushState'
,
skipHandler
);
};
},
[]);
},
[
props
.
flatMenu
]);
if
(
props
.
global
&&
props
.
global
.
userInfo
)
{
if
(
!
props
.
global
.
userInfo
.
site
)
{
if
(
props
.
global
&&
props
.
global
.
userInfo
)
{
if
(
!
props
.
global
.
userInfo
.
site
)
{
props
.
global
.
userInfo
.
site
=
''
;
}
}
return
(
<
SecurityLayout
{...
props
}
>
<
BasicLayout
...
...
@@ -412,7 +403,7 @@ const Layout = (props) => {
route
=
{
props
.
route
}
location
=
{
location
}
navTheme
=
{
props
.
global
?.
variableTheme
?.
navTheme
??
'dark'
}
mode
=
'MDI'
mode
=
"MDI"
fixedHeader
headerHeight
=
{
52
}
routeConfig
=
{
routeConfig
}
...
...
@@ -449,16 +440,15 @@ const Layout = (props) => {
}
menuItemRender
=
{(
item
,
dom
)
=>
(
<
a
onClick
=
{
(
event
)
=>
{
onClick
=
{
event
=>
{
event
.
preventDefault
();
window
.
history
.
pushState
(
null
,
''
,
'/civbase'
+
item
.
path
);
window
.
history
.
pushState
(
null
,
''
,
`/civbase
${
item
.
path
}
`
);
}}
>
{
dom
}
<
/a
>
)}
>
<
Suspense
fallback
=
{
<><
/>}
>
{
/* {window.location.pathname.startsWith('/civbase/civ_3d') ? ( */
}
{
/* <KeepAlive> */
}
...
...
@@ -475,14 +465,13 @@ const Layout = (props) => {
<
KeepAlive
>
<
CesiumMap
/>
<
/KeepAlive
>
)
:
(
window
.
location
.
pathname
.
startsWith
(
'/civbase/civ_webgis'
)
&&
null
)}
<
/Suspense
>
{
subLoading
&&
<
Loading
loading
=
{
subLoading
}
/>
}
<
div
id
=
'micro-container'
className
=
'subapp-container'
>
<
div
id
=
"micro-container"
className
=
"subapp-container"
>
{
props
.
children
}
<
/div
>
<
/BasicLayout
>
...
...
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