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
6a5e9f34
Commit
6a5e9f34
authored
Jul 03, 2024
by
杨思琦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 懒加载逻辑修改
parent
eb3b68a5
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
56 additions
and
1386 deletions
+56
-1386
webpack.prod.babel.js
internals/webpack/webpack.prod.babel.js
+3
-0
index.js
src/containers/App/index.js
+5
-1
BasicLayout.js
src/layouts/BasicLayout.js
+1
-23
BasicLayout_tags.js
src/layouts/BasicLayout_tags.js
+0
-383
HN.less
src/layouts/HN.less
+0
-564
HNLayout.js
src/layouts/HNLayout.js
+0
-363
index.js
src/pages/user/login/index.js
+46
-51
config.js
src/routes/config.js
+1
-1
No files found.
internals/webpack/webpack.prod.babel.js
View file @
6a5e9f34
...
...
@@ -59,7 +59,10 @@ module.exports = require('./webpack.base.babel')({
test
:
/
[\\/]
node_modules
[\\/]
/
,
name
(
module
)
{
const
packageName
=
module
.
context
.
match
(
/
[\\/]
node_modules
[\\/](
.*
?)([\\/]
|$
)
/
)[
1
];
// @ts-ignore
if
(
module
.
type
!==
'css/mini-extract'
)
{
return
`npm.
${
packageName
.
replace
(
'@'
,
''
)}
`
;
}
},
},
bizComponent
:
{
...
...
src/containers/App/index.js
View file @
6a5e9f34
/* eslint-disable global-require */
import
React
,
{
useEffect
}
from
'react'
;
import
React
,
{
useEffect
,
Suspense
}
from
'react'
;
import
{
Helmet
}
from
'react-helmet'
;
import
{
connect
}
from
'react-redux'
;
...
...
@@ -37,6 +37,7 @@ const App = props => {
<
Router
basename
=
{
config
.
base
||
pkg
.
name
.
toLocaleLowerCase
()
||
''
}
>
{
window
?.
qiankunIsCache
?
(
<
AliveScope
>
<
Suspense
fallback
=
{
<><
/>}
>
<
Switch
>
{
renderRoutes
(
'panda-console-base'
,
...
...
@@ -47,8 +48,10 @@ const App = props => {
).
routes
,
)}
<
/Switch
>
<
/Suspense
>
<
/AliveScope
>
)
:
(
<
Suspense
fallback
=
{
<><
/>}
>
<
Switch
>
{
renderRoutes
(
'panda-console-base'
,
...
...
@@ -59,6 +62,7 @@ const App = props => {
).
routes
,
)}
<
/Switch
>
<
/Suspense
>
)}
<
/Router
>
<
/
>
...
...
src/layouts/BasicLayout.js
View file @
6a5e9f34
...
...
@@ -8,7 +8,7 @@
/* eslint-disable react-hooks/rules-of-hooks */
/* eslint-disable global-require */
// @eslint-disable
import
React
,
{
Suspense
,
useEffect
,
useRef
,
useState
,
useContext
}
from
'react'
;
import
React
,
{
useEffect
,
useRef
,
useState
,
useContext
}
from
'react'
;
import
{
ConfigProvider
,
Anchor
,
Modal
,
Popover
,
Radio
,
Spin
,
notification
,
Button
}
from
'antd'
;
import
classNames
from
'classnames'
;
...
...
@@ -773,28 +773,6 @@ const Layout = props => {
: <></>
)}
>
{/* <Suspense fallback={<></>}> */}
{/* {window.location.pathname.startsWith('/civbase/civ_3d') ? ( */}
{/* <KeepAlive> */}
{/* <CesiumMap /> */}
{/* </KeepAlive> */}
{/* ) : window.location.pathname.startsWith('/civbase/civ_webgis') ? ( */}
{/* mapMode === 'AMap' ? ( */}
{/* <AMap /> */}
{/* ) : ( */}
{/* <ArcgisMap options={{ type: 'ArcgisMap' }} /> */}
{/* ) */}
{/* ) : null} */}
{/* <AliveScope> */}
{/* {window.location.pathname.startsWith('/civbase/civ_drainage/map') || isHaveMap() ? (
<KeepAlive when={true}>
<CesiumMap />
</KeepAlive>
) : (
window.location.pathname.startsWith('/civbase/civ_webgis') && null
)} */}
{/* </AliveScope> */}
{/* </Suspense> */}
<div id="micro-container" className="subapp-container">
{props.children}
...
...
src/layouts/BasicLayout_tags.js
deleted
100644 → 0
View file @
eb3b68a5
import
React
,
{
useEffect
,
useRef
,
useState
,
Suspense
}
from
'react'
;
import
{
Anchor
,
Popover
,
Radio
,
Spin
}
from
'antd'
;
import
Icon
,
{
LoadingOutlined
}
from
'@ant-design/icons'
;
import
{
store
,
helpers
}
from
'@wisdom-utils/utils'
;
import
classNames
from
'classnames'
;
import
Cookies
from
'js-cookie'
;
import
{
connect
}
from
'react-redux'
;
import
{
useHistory
}
from
'@wisdom-utils/runtime'
;
import
KeepAlive
from
'react-activation'
;
import
AMapLoader
from
'@amap/amap-jsapi-loader'
;
import
{
BasicLayout
}
from
'@wisdom-utils/components/lib/AppLayout'
;
import
defaultSetting
from
'@wisdom-utils/components/lib/AppLayout/layouts/defaultSettings'
;
import
RightContent
from
'@/components/GlobalHeader/ExtendRightContent'
;
import
{
actionCreators
}
from
'@/containers/App/store'
;
import
{
WEB_GIS_TYPE
}
from
'../constants'
;
import
SecurityLayout
from
'./SecurityLayout'
;
import
Site
from
'./Site'
;
import
layoutStyles
from
'./BasicLayout.less'
;
import
{
waterMark
}
from
'../utils/mark'
;
const
ArcgisMap
=
React
.
lazy
(()
=>
import
(
'../pages/map/arcgis'
));
const
AMap
=
React
.
lazy
(()
=>
import
(
'../pages/map/amap'
));
const
CesiumMap
=
React
.
lazy
(()
=>
import
(
'../pages/map/cesiumMap'
));
const
{
params
}
=
helpers
;
const
{
getParamsV1
}
=
params
;
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"
xmlns
=
"http://www.w3.org/1999/xlink"
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"
fill
=
{
fillColor
}
/
>
<
/svg
>
);
const
ArrowIcon
=
props
=>
<
Icon
component
=
{
arrowSvg
}
{...
props
}
/>
;
const
optionsWith
=
[{
label
:
'按站点'
,
value
:
'site'
},
{
label
:
'按城市'
,
value
:
'city'
}];
const
HOT
=
[
'HOT'
,
'县'
,
'市'
,
'New'
];
const
StationsItem
=
(
item
,
action
,
onChangeVisible
)
=>
{
const
changeGroup
=
(
event
,
data
)
=>
{
action
.
changeGroup
&&
action
.
changeGroup
(
event
,
data
,
onChangeVisible
);
};
return
(
<
li
key
=
{
item
.
groupID
}
style
=
{{
marginRight
:
`
${
item
.
style
.
marginRight
}
px`
}}
>
<
a
className
=
{
classNames
(
layoutStyles
.
city_select
,
layoutStyles
.
showTip
)}
title
=
{
item
.
city
}
index
=
{
item
.
promoteIndex
}
style
=
{{
fontSize
:
'13px'
}}
onClick
=
{
event
=>
changeGroup
(
event
,
item
)}
>
{
item
.
groupName
}
{
item
.
promoteTip
&&
HOT
.
includes
(
item
.
promoteTip
)
&&
<
div
title
=
{
`
${
item
.
promoteTip
}
`
}
>
{
item
.
promoteTip
}
<
/div>
}
<
/a
>
<
/li
>
);
};
const
Stations
=
props
=>
{
const
data
=
props
.
data
.
stations
;
const
[
targetOffset
,
setTargetOffset
]
=
useState
(
undefined
);
const
cityPane
=
useRef
(
null
);
const
cityContent
=
useRef
(
null
);
const
[
defaultTab
,
setDefaultTab
]
=
useState
(
'site'
);
useEffect
(()
=>
{
setTargetOffset
(
cityPane
.
current
.
clientHeight
/
2
);
},
[]);
const
handleClick
=
(
event
,
link
)
=>
{
event
.
preventDefault
();
};
const
handleTabChange
=
event
=>
{
setDefaultTab
(
event
.
target
.
value
);
};
return
(
<>
<
div
className
=
{
layoutStyles
.
focusStations
}
>
<
ul
>
{
Array
.
isArray
(
data
)
?
data
.
map
(
item
=>
StationsItem
(
item
,
props
.
action
,
props
.
setVisible
))
:
null
}
<
/ul
>
<
/div
>
<
Radio
.
Group
options
=
{
optionsWith
}
optionType
=
"button"
buttonStyle
=
"solid"
size
=
"small"
value
=
{
defaultTab
}
onChange
=
{
handleTabChange
}
style
=
{{
marginTop
:
'6px'
}}
/
>
<
div
style
=
{{
maxWidth
:
'520px'
,
position
:
'relative'
}}
>
{
defaultTab
===
'site'
?
(
<
div
className
=
{
classNames
(
layoutStyles
.
city_pane
,
layoutStyles
.
station_container
)}
ref
=
{
cityPane
}
>
<
Anchor
affix
=
{
false
}
onClick
=
{
handleClick
}
targetOffset
=
{
targetOffset
}
getContainer
=
{()
=>
cityContent
.
current
}
>
<
ul
className
=
{
layoutStyles
.
py
}
>
{
props
.
data
&&
props
.
data
.
siteCityList
&&
props
.
data
.
siteCityList
.
letters
}
<
/ul
>
<
div
className
=
{
layoutStyles
.
cityContent
}
style
=
{{
height
:
'335px'
}}
ref
=
{
cityContent
}
>
{
props
.
data
&&
props
.
data
.
siteCityList
&&
props
.
data
.
siteCityList
.
content
}
<
/div
>
<
/Anchor
>
<
/div
>
)
:
(
<
div
className
=
"city_pane city_container"
>
{
props
.
data
.
citySelector
}
<
/div
>
)}
<
Spin
spinning
=
{
props
.
loading
}
tip
=
"加载中"
/>
<
/div
>
<
/
>
);
};
const
renderSite
=
({
data
,
config
,
loading
,
setLoading
,
action
})
=>
{
const
[
visible
,
setVisible
]
=
useState
(
false
);
let
loaded
=
!!
((
data
&&
!
data
.
stations
)
||
(
Array
.
isArray
(
data
.
weathers
)
&&
data
.
weathers
.
length
===
0
));
if
(
config
&&
config
.
userInfo
&&
config
.
userInfo
.
site
===
''
)
{
loaded
=
false
;
}
return
(
<>
<
Spin
indicator
=
{
antIcon
}
spinning
=
{
loaded
}
size
=
"small"
style
=
{{
marginLeft
:
'10px'
}}
tip
=
""
wrapperClassName
=
{
layoutStyles
.
spinLoadding
}
>
<>
<
Popover
placement
=
"bottomLeft"
trigger
=
"click"
visible
=
{
visible
}
content
=
{
<
Stations
data
=
{
data
}
loading
=
{
loading
}
setLoading
=
{
setLoading
}
setVisible
=
{
setVisible
}
action
=
{
action
}
/
>
}
arrowPointAtCenter
overlayClassName
=
{
classNames
(
layoutStyles
.
stationsWrapper
,
layoutStyles
.
stationsTop
)}
onVisibleChange
=
{
visible
=>
setVisible
(
visible
)}
>
{
Array
.
isArray
(
data
.
stations
)
?
(
<
div
className
=
{
layoutStyles
.
toggleSite
}
>
<
img
src
=
{
require
(
'../assets/basic/site.png'
)}
className
=
{
layoutStyles
.
site
}
/
>
<
span
className
=
{
layoutStyles
.
name
}
>
{
data
.
currentStationName
}
<
/span
>
<
ArrowIcon
className
=
{
layoutStyles
.
arrow
}
fillColor
=
"#fff"
style
=
{{
transform
:
!
visible
?
`rotate(0deg)`
:
`rotate(180deg)`
,
}}
/
>
<
/div
>
)
:
null
}
<
/Popover
>
<
/
>
<
/Spin
>
{
data
.
weathers
&&
Object
.
keys
(
data
.
weathers
).
length
>
0
?
(
<
span
className
=
{
layoutStyles
.
weatcher
}
style
=
{{
borderLeft
:
data
.
stations
.
length
===
0
?
'0px'
:
'1px solid rgba(256, 256, 256, 0.3)'
,
}}
>
<
img
src
=
{
data
.
weathers
&&
data
.
weathers
.
icon
}
className
=
{
layoutStyles
.
icon
}
/
>
<
span
className
=
{
layoutStyles
.
text
}
>
{
data
.
weathers
&&
data
.
weathers
.
text
}
<
/span
>
<
/span
>
)
:
null
}
<
/
>
);
};
const
Layout
=
props
=>
{
const
[
collapse
,
setCollapse
]
=
useState
(
false
);
const
[
cityData
,
setCityData
]
=
useState
({});
const
[
siteLoading
,
setSiteLoading
]
=
useState
(
false
);
const
[
mapMode
,
setMapMode
]
=
useState
(
WEB_GIS_TYPE
.
ARCGIS
);
const
[
siteAction
,
setSiteAction
]
=
useState
(()
=>
new
Site
(
props
,
setSiteLoading
));
// const basename = getBaseName();
const
history
=
useHistory
();
useEffect
(()
=>
{
siteAction
.
setGlobalConfig
(
props
.
global
);
const
tk
=
Cookies
.
get
(
'token'
)
||
props
.
global
.
token
;
const
isLogin
=
tk
!==
null
&&
tk
!==
'undefined'
&&
tk
!==
(
void
0
);
if
(
!
isLogin
)
{
let
client
=
props
.
global
&&
props
.
global
.
hasOwnProperty
(
'client'
)
?
props
.
global
.
get
(
'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
]);
useEffect
(()
=>
{
if
(
props
.
global
&&
props
.
global
.
userInfo
&&
props
.
global
.
userInfo
.
token
!==
null
&&
props
.
global
.
userInfo
.
loginName
&&
Object
.
keys
(
cityData
).
length
===
0
)
{
siteAction
.
getCityStationsForUser
().
then
(
res
=>
{
setCityData
(
res
);
});
}
},
[
cityData
,
props
.
global
,
props
.
global
.
userInfo
,
siteAction
]);
const
handlerPageChange
=
()
=>
{
const
params
=
getParamsV1
(
props
.
location
.
pathname
);
if
(
params
.
hasOwnProperty
(
'mapType'
)
&&
params
.
mapType
===
WEB_GIS_TYPE
.
AMAP
)
{
AMapLoader
.
reset
();
setMapMode
(
WEB_GIS_TYPE
.
AMAP
);
}
else
if
(
!
/civweb4/
.
test
(
location
.
pathname
))
{
AMapLoader
.
reset
();
setMapMode
(
WEB_GIS_TYPE
.
ARCGIS
);
}
};
useEffect
(()
=>
{
window
.
share
.
event
.
on
(
'updateSite'
,
res
=>
{
setCityData
(
res
);
});
return
()
=>
{
window
.
share
.
event
.
removeAllListeners
(
'updateSite'
);
};
},
[]);
useEffect
(()
=>
{
const
needMark
=
()
=>
(
props
.
global
.
isHaveMark
||
window
.
location
.
origin
.
replace
(
/^
(
http|https
)
:
\/\/
/
,
''
)
===
'panda-water.cn'
)
&&
document
.
querySelectorAll
(
'.pandawatermark_mask_div'
).
length
<=
0
&&
props
.
global
.
userInfo
if
(
needMark
())
{
waterMark
({
watermark_txt
:
`
${
props
.
global
.
userInfo
.
fullName
}
(
${
props
.
global
.
userInfo
.
loginName
}
)`
});
}
},
[
props
.
global
,
props
.
global
.
userInfo
]);
const
handleUpdateCurrentIndex
=
index
=>
{
props
.
updateCurrentIndex
(
index
);
window
.
share
&&
window
.
share
.
event
.
emit
(
'trigger:updateMenuIndex'
,
index
);
store
.
set
(
'updateMenuIndex'
,
index
);
};
const
handlerIndustry
=
event
=>
{
props
.
global
.
get
(
'userInfo.site'
)
?
history
.
push
(
`/industry`
)
:
void
0
;
};
const
handlerCollapsed
=
()
=>
{
setCollapse
(
!
collapse
);
};
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'
))
:
defaultSetting
.
logo
;
return
(
<
SecurityLayout
loading
{...
props
}
>
<
BasicLayout
route
=
{
props
.
route
}
title
=
{
props
.
global
.
title
}
logo
=
{
logo
}
config
=
{
props
.
global
}
collapsed
=
{
collapse
}
onCollapse
=
{
handlerCollapsed
}
currentMenuIndex
=
{
props
.
currentMenuIndex
}
onHeaderLogo
=
{
handlerIndustry
}
onPageChange
=
{
handlerPageChange
}
onMenuPanelItemClick
=
{
handleUpdateCurrentIndex
}
headerContentRender
=
{()
=>
<
RightContent
/>
}
headerSiteRender
=
{()
=>
renderSite
({
data
:
cityData
,
config
:
props
.
global
,
loading
:
siteLoading
,
setLoading
:
setSiteLoading
,
action
:
siteAction
,
})
}
>
<>
<
Suspense
fallback
=
{
<><
/>}
>
{
/* {window.location.pathname.startsWith('/civbase/civ_3d') ? ( */
}
{
/* <KeepAlive> */
}
{
/* <CesiumMap /> */
}
{
/* </KeepAlive> */
}
{
/* ) : window.location.pathname.startsWith('/civbase/civ_webgis') ? ( */
}
{
/* mapMode === 'AMap' ? ( */
}
{
/* <AMap /> */
}
{
/* ) : ( */
}
{
/* <ArcgisMap options={{ type: 'ArcgisMap' }} /> */
}
{
/* ) */
}
{
/* ) : null} */
}
{(
window
.
location
.
pathname
.
startsWith
(
'/civbase/civ_3d/map'
)
||
window
.
location
.
pathname
.
startsWith
(
'/civbase/civ_drainage/map'
))
?
(
<
KeepAlive
>
<
CesiumMap
/>
<
/KeepAlive
>
)
:
(
window
.
location
.
pathname
.
startsWith
(
'/civbase/civ_webgis'
)
&&
null
)}
<
/Suspense
>
<
div
id
=
"micro-container"
className
=
"subapp-container"
>
{
props
.
children
}
<
/div
>
<
/
>
<
/BasicLayout
>
<
/SecurityLayout
>
);
};
const
mapStateToProps
=
state
=>
({
global
:
state
.
getIn
([
'global'
,
'globalConfig'
]),
settings
:
state
.
getIn
([
'global'
,
'defaultSetting'
]),
collapsed
:
state
.
getIn
([
'global'
,
'collapsed'
]),
menu
:
state
.
getIn
([
'global'
,
'menu'
]),
currentMenuIndex
:
state
.
getIn
([
'global'
,
'currentMenuIndex'
]),
flatMenu
:
state
.
getIn
([
'global'
,
'flatMenu'
]),
authValidate
:
state
.
getIn
([
'global'
,
'authValidate'
]),
pathname
:
state
.
getIn
([
'global'
,
'pathname'
]),
selectedKeys
:
state
.
getIn
([
'global'
,
'selectedKeys'
]),
openKeys
:
state
.
getIn
([
'global'
,
'openKeys'
]),
complexConfig
:
state
.
getIn
([
'global'
,
'complexConfig'
]),
complexPathName
:
state
.
getIn
([
'global'
,
'complexPathName'
]),
microMounted
:
state
.
getIn
([
'global'
,
'microMounted'
]),
});
const
mapDispatchToProps
=
dispatch
=>
({
updageSetting
(
setting
)
{
dispatch
(
actionCreators
.
updageSetting
(
setting
));
},
updateConfig
(
config
)
{
dispatch
(
actionCreators
.
getConfig
(
config
));
},
updateCurrentIndex
(
index
)
{
dispatch
(
actionCreators
.
updateCurrentIndex
(
index
));
},
updateCollapsed
(
collapsed
)
{
dispatch
(
actionCreators
.
updateCollapsed
(
collapsed
));
},
updateAuthValidate
(
auth
)
{
dispatch
(
actionCreators
.
updateAuthValidate
(
auth
));
},
updatePathname
(
pathname
)
{
dispatch
(
actionCreators
.
updatePathname
(
pathname
));
},
updateSelectedKeys
(
keys
)
{
dispatch
(
actionCreators
.
updateSelectedKeys
(
keys
));
},
updateOpenKeys
(
keys
)
{
dispatch
(
actionCreators
.
updateOpenKeys
(
keys
));
},
updateComplexConfig
(
config
)
{
dispatch
(
actionCreators
.
updateComplexConfig
(
config
));
},
updateComplexPathName
(
pathname
)
{
dispatch
(
actionCreators
.
updateComplexPathName
(
pathname
));
},
logout
()
{
dispatch
(
actionCreators
.
logout
());
},
});
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
,
)(
Layout
);
src/layouts/HN.less
deleted
100644 → 0
View file @
eb3b68a5
@import '~~antd/es/style/variable.less';
@hn-greenColor: #00b278;
:global{
.@{ant-prefix}-drawer-left.@{ant-prefix}-drawer-open{
display: none;
}
.ant-drawer-left.ant-drawer-open{
display: none;
}
}
.hnlayout {
:global {
.@{ant-prefix}-menu-dark.@{ant-prefix}-menu-dark:not(.@{ant-prefix}-menu-horizontal) .@{ant-prefix}-menu-item-selected{
background: transparent!important;
}
.@{ant-prefix}-global-page-header-header {
padding-left: 0;
}
.@{ant-prefix}-global-page-header-header-logo {
width: 140px;
padding-left: 0;
& > img {
width: auto !important;
height: 36px;
margin: 0 auto;
}
}
.@{ant-prefix}-global-page-header {
background-color: @hn-greenColor;
& > img {
display: none;
}
}
.@{ant-prefix}-layout-slider {
flex: 0 0 140px;
width: 140px;
min-width: 140px;
max-width: 140px;
overflow: hidden;
background-color: #fff;
}
.ant-layout-slider {
flex: 0 0 140px;
width: 140px;
min-width: 140px;
max-width: 140px;
overflow: hidden;
background-color: #fff;
}
.@{ant-prefix}-pro-sider .@{ant-prefix}-menu{
background: transparent!important;
}
.@{ant-prefix}-pro-sider ul.@{ant-prefix}-menu{
max-height: calc(100vh - 46px);
overflow: auto;
}
.ant-menu.ant-menu-dark .ant-menu-sub {
background-color: #fff !important;
}
.ant-menu.ant-menu-dark {
background-color: #fff !important;
padding:10px 0!important;
}
.ant-pro-sider-links{
display: none!important;
}
.@{ant-prefix}-pro-sider-links{
display: none!important;
}
.@{ant-prefix}-menu-inline > .@{ant-prefix}-menu-item{
height: 40px;
line-height: 40px;
padding: 0 10px!important;
margin-top: 0!important;
margin-bottom: 0!important;
}
.ant-menu-inline > .ant-menu-item{
height: 40px;
line-height: 40px;
padding: 0 10px!important;
line-height: 40px;
text-overflow: ellipsis;
margin-top: 0!important;
margin-bottom: 0!important;
}
.ant-menu-inline .ant-menu-submenu-title{
height: 40px;
line-height: 40px;
}
.ant-pro-sider-logo {
display: none;
}
.ant-layout-sider{
background-color: #fff;
}
.ant-layout-slider-pro-sider-links{
display: none;
}
.ant-layout{
min-height:100%!important;
}
.@{ant-prefix}-layout-slider-menu-item-active {
background-color: @hn-greenColor;
.@{ant-prefix}-layout-slider-menu-item-text {
color: #fff;
}
}
.ant-layout-slider-menu-item-active {
background-color: @hn-greenColor;
.ant-layout-slider-menu-item-text {
color: #fff;
}
}
.@{ant-prefix}-layout-slider-menu-item-text {
color: #7c7c7a;
}
.ant-layout-slider-menu-item-text {
color: #7c7c7a;
}
.@{ant-prefix}-divider-horizontal {
border: none !important;
}
.ant-divider-horizontal {
border: none !important;
}
.@{ant-prefix}-menu-item-children :global .@{ant-prefix}-tabs-tab:hover svg path,
.@{ant-prefix}-menu-item-children :global .@{ant-prefix}-tabs-tab:hover svg rect,
.@{ant-prefix}-menu-item-children :global .@{ant-prefix}-tabs-tab:hover svg circle {
fill: @hn-greenColor !important;
stroke: @hn-greenColor !important;
}
.@{ant-prefix}-menu-item-children :global .@{ant-prefix}-tabs-tab:hover img {
filter: drop-shadow(10px 0px @hn-greenColor);
}
.@{ant-prefix}-menu-item-children :global .@{ant-prefix}-tabs-tab:hover .menu-item-name {
color: @hn-greenColor;
}
.@{ant-prefix}-menu-item-children :global .@{ant-prefix}-tabs-tab:hover .@{ant-prefix}-tabs-tab-btn {
color: @hn-greenColor;
}
.@{ant-prefix}-menu-item-children
:global
.@{ant-prefix}-tabs-tab
.@{ant-prefix}-tabs-tab-btn
.@{ant-prefix}-dropdown-trigger
div
div {
width: 100%;
height: 100%;
}
.@{ant-prefix}-menu-item-children .menu-item {
float: left;
}
.@{ant-prefix}-menu-item-children :global(.@{ant-prefix}-tabs-tab) {
display: flex !important;
}
.@{ant-prefix}-menu-item-children :global(.@{ant-prefix}-tabs-tab-btn) {
position: relative;
display: flex;
align-items: center;
color: #737983;
transform: scale(0.92);
}
.@{ant-prefix}-menu-item-children
:global(.@{ant-prefix}-tabs-tab.@{ant-prefix}-tabs-tab-active .@{ant-prefix}-tabs-tab-btn) {
color: @hn-greenColor !important;
svg {
path,
rect,
circle,
.cls-1 {
// fill: hsla(0, 0%, 100%, 0.65) !important;
}
}
}
.@{ant-prefix}-menu-item-children :global(.@{ant-prefix}-tabs-tab-btn > div > div) {
display: flex;
position: absolute;
width: 26px;
height: 26px;
top: -4px;
left: -3px;
}
.@{ant-prefix}-menu-item-children :global(.@{ant-prefix}-tabs-nav::before) {
border-bottom: none !important;
}
.@{ant-prefix}-menu-item-children .menu-item-name {
margin-left: 8px;
color: #737983;
transition: border-color 0.3s, color 0.3s, padding 0.1s cubic-bezier(0.215, 0.61, 0.355, 1);
}
.ant-menu-item-children .menu-item-name {
margin-left: 8px;
color: #737983;
transition: border-color 0.3s, color 0.3s, padding 0.1s cubic-bezier(0.215, 0.61, 0.355, 1);
}
.ant-menu-item-children .menu-item-name:hover {
color: @hn-greenColor;
}
.@{ant-prefix}-menu-item-children .menu-item-name:hover {
color: @hn-greenColor;
}
.ant-menu-item-children .menu-item-name:hover {
color: @hn-greenColor;
}
.ant-menu-item-children :global .@{ant-prefix}-divider-vertical {
left: 20px;
margin: 0 1px !important;
}
.@{ant-prefix}-menu-item-children :global .@{ant-prefix}-tabs-nav-operations .ant-tabs-nav-more {
margin-right: 0px !important;
}
.@{ant-prefix}-menu-item-children :global(.@{ant-prefix}-tabs-ink-bar) {
background: @hn-greenColor !important;
}
.@{ant-prefix}-menu-item-children :global(.@{ant-prefix}-tabs-tab-active) {
color: @hn-greenColor !important;
}
.@{ant-prefix}-menu-item-children :global(.@{ant-prefix}-tabs-tab-active .menu-item-name) {
color: @hn-greenColor !important;
}
.@{ant-prefix}-menu-item-children :global .@{ant-prefix}-tabs-tab-active svg path,
.@{ant-prefix}-menu-item-children :global .@{ant-prefix}-tabs-tab-active svg rect,
.@{ant-prefix}-menu-item-children :global .@{ant-prefix}-tabs-tab-active svg circle {
fill: @hn-greenColor !important;
stroke: @hn-greenColor !important;
}
.@{ant-prefix}-menu-item-children :global .@{ant-prefix}-tabs-tab-active img {
filter: drop-shadow(10px 0px @hn-greenColor);
}
.@{ant-prefix}-panel-min-mainPane-visible {
background-color: #fff;
}
.@{ant-prefix}-panel-min-mainPane-main-left .menu-categories .categorie-name span {
color: #737983;
}
.@{ant-prefix}-panel-min-mainPane-main-left .menu-categories .categorie-name.btn:hover span {
color: #333;
}
.@{ant-prefix}-layout-slider-menu-item:hover span {
color: #333;
}
.@{ant-prefix}-panel-min-mainPane-main-left .menu-categories .categorie-name.active {
background: none;
span {
color: @hn-greenColor;
}
}
.@{ant-prefix}-pro-basicLayout-content {
margin: 0;
}
.@{ant-prefix}-pro-sider-links {
display: none;
position: fixed;
bottom: 0;
z-index: 999;
display: none;
width: 50px;
}
.@{ant-prefix}-layout-slider-pro-sider-links{
display: none;
}
.@{ant-prefix}-pro-sider-logo {
display: none;
}
.@{ant-prefix}-layout-sider {
background: #fff;
}
.@{ant-prefix}-layout-slider-menu-item {
height: 36px;
}
.@{ant-prefix}-layout-slider-menu-item a {
flex-direction: row;
width: 100%;
margin: 0 auto;
margin-top: 4px;
margin-right: 16px;
padding-left: 23px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
& > img {
width: 18px;
height: 18px;
margin-top: 4px;
opacity: 1;
}
& > span {
margin-left: 4px;
}
}
.@{ant-prefix}-menu {
ul {
.@{ant-prefix}-menu-item-only-child {
padding-left: 12px !important;
margin-top:0!important;
margin-bottom: 0!important;
.test-icon{
padding: 0 10px 0 18px;
}
.@{ant-prefix}-menu-title-content{
border-radius: 5px;
}
}
}
}
.ant-layout-slider-menu-item {
height: 36px;
}
.ant-layout-slider-menu-item a {
flex-direction: row;
width: 100%;
margin: 0 auto;
margin-top: 4px;
margin-right: 16px;
padding-left: 23px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
& > img {
width: 18px;
height: 18px;
margin-top: 4px;
opacity: 1;
}
& > span {
margin-left: 4px;
}
}
.ant-menu {
ul {
.ant-menu-item-only-child {
padding-left: 12px !important;
margin-top:0!important;
margin-bottom: 0!important;
.ant-menu-title-content{
border-radius: 5px;
}
.test-icon{
padding: 0 10px 0 18px;
}
}
}
}
.test-icon {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
padding: 0 10px;
color:#7a7a7a ;
.my-svg {
display: inline-block;
width: 26px;
height: 18px;
color: #7a7a7a;
svg {
path,
rect,
circle,
.cls-1 {
fill: #7a7a7a;
stroke: hsla(0, 0%, 100%, 0.65);
stroke-width: 0;
stroke-linecap: round;
stroke-miterlimit: 10;
}
}
}
.my-img {
display: inline-block;
width: 18px;
height: 18px;
& > img {
position: relative;
top: 3px;
width: 100%;
height: 100%;
vertical-align: baseline;
}
}
.my-desc {
margin-left: 2px;
color: #7c7c7a;
}
}
.test-icon:hover{
color: @hn-greenColor;
.my-desc {
color: @hn-greenColor;
}
svg path,
svg rect,
svg circle {
fill: @hn-greenColor !important;
stroke: @hn-greenColor !important;
}
}
.hight-active:hover{
color:#fff ;
.my-desc {
color: #fff;
}
svg path,
svg rect,
svg circle {
fill: #fff !important;
stroke: #fff !important;
}
}
.@{ant-prefix}-pro-menu-item-title {
display: inline-block;
overflow: hidden;
text-align: left;
text-overflow: ellipsis;
vertical-align: bottom;
}
.ant-pro-menu-item-title {
display: inline-block;
overflow: hidden;
text-align: left;
text-overflow: ellipsis;
vertical-align: bottom;
}
.@{ant-prefix}-menu-submenu-title{
padding-left: 10px!important;
padding-right: 10px!important;
}
.ant-menu-submenu-title{
padding-left: 10px!important;
padding-right: 10px!important;
}
.hight-active {
background: @hn-greenColor;
border-radius: 5px;
color:#fff ;
.my-desc{
color: #fff;
}
svg path,
svg rect,
svg circle {
fill: #fff !important;
stroke: #fff !important;
}
}
.@{ant-prefix}-menu.@{ant-prefix}-menu-dark
.@{ant-prefix}-menu-submenu-title
.@{ant-prefix}-menu-submenu-arrow::before {
background: #7a7a7a !important;
}
.@{ant-prefix}-menu.@{ant-prefix}-menu-dark
.@{ant-prefix}-menu-submenu-title
.@{ant-prefix}-menu-submenu-arrow::after {
background: #7a7a7a !important;
}
.ant-menu-submenu-arrow::before,.ant-menu-submenu-arrow::after {
background: #7a7a7a !important;
}
.@{ant-prefix}-menu-dark .@{ant-prefix}-menu-inline.@{ant-prefix}-menu-sub {
background: #fff;
}
.@{ant-prefix}-pro-sider {
background: #fff;
}
.ant-menu-submenu-vertical>.ant-menu-submenu-title .ant-menu-submenu-arrow,
.ant-menu-submenu-vertical-left>.ant-menu-submenu-title .ant-menu-submenu-arrow,
.ant-menu-submenu-vertical-right>.ant-menu-submenu-title .ant-menu-submenu-arrow,
.ant-menu-submenu-inline>.ant-menu-submenu-title .ant-menu-submenu-arrow {
position: absolute;
top: 50%;
right: 16px;
width: 10px;
transition: transform .3s cubic-bezier(.645, .045, .355, 1)
}
.ant-menu-submenu-vertical>.ant-menu-submenu-title .ant-menu-submenu-arrow::before,
.ant-menu-submenu-vertical-left>.ant-menu-submenu-title .ant-menu-submenu-arrow::before,
.ant-menu-submenu-vertical-right>.ant-menu-submenu-title .ant-menu-submenu-arrow::before,
.ant-menu-submenu-inline>.ant-menu-submenu-title .ant-menu-submenu-arrow::before,
.ant-menu-submenu-vertical>.ant-menu-submenu-title .ant-menu-submenu-arrow::after,
.ant-menu-submenu-vertical-left>.ant-menu-submenu-title .ant-menu-submenu-arrow::after,
.ant-menu-submenu-vertical-right>.ant-menu-submenu-title .ant-menu-submenu-arrow::after,
.ant-menu-submenu-inline>.ant-menu-submenu-title .ant-menu-submenu-arrow::after {
position: absolute;
width: 6px;
height: 1.5px;
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.85));
border-radius: 2px;
transition: background .3s cubic-bezier(.645, .045, .355, 1), transform .3s cubic-bezier(.645, .045, .355, 1), top .3s cubic-bezier(.645, .045, .355, 1);
content: ""
}
.ant-menu-submenu-vertical>.ant-menu-submenu-title .ant-menu-submenu-arrow::before,
.ant-menu-submenu-vertical-left>.ant-menu-submenu-title .ant-menu-submenu-arrow::before,
.ant-menu-submenu-vertical-right>.ant-menu-submenu-title .ant-menu-submenu-arrow::before,
.ant-menu-submenu-inline>.ant-menu-submenu-title .ant-menu-submenu-arrow::before {
transform: rotate(45deg) translateY(-2px)
}
.ant-menu-submenu-vertical>.ant-menu-submenu-title .ant-menu-submenu-arrow::after,
.ant-menu-submenu-vertical-left>.ant-menu-submenu-title .ant-menu-submenu-arrow::after,
.ant-menu-submenu-vertical-right>.ant-menu-submenu-title .ant-menu-submenu-arrow::after,
.ant-menu-submenu-inline>.ant-menu-submenu-title .ant-menu-submenu-arrow::after {
transform: rotate(-45deg) translateY(2px)
}
.ant-menu-submenu-vertical>.ant-menu-submenu-title:hover .ant-menu-submenu-arrow::after,
.ant-menu-submenu-vertical-left>.ant-menu-submenu-title:hover .ant-menu-submenu-arrow::after,
.ant-menu-submenu-vertical-right>.ant-menu-submenu-title:hover .ant-menu-submenu-arrow::after,
.ant-menu-submenu-inline>.ant-menu-submenu-title:hover .ant-menu-submenu-arrow::after,
.ant-menu-submenu-vertical>.ant-menu-submenu-title:hover .ant-menu-submenu-arrow::before,
.ant-menu-submenu-vertical-left>.ant-menu-submenu-title:hover .ant-menu-submenu-arrow::before,
.ant-menu-submenu-vertical-right>.ant-menu-submenu-title:hover .ant-menu-submenu-arrow::before,
.ant-menu-submenu-inline>.ant-menu-submenu-title:hover .ant-menu-submenu-arrow::before {
background: linear-gradient(to right, #13c2c2, #13c2c2)
}
.ant-menu-submenu-vertical>.ant-menu-submenu-title .ant-menu-submenu-arrow::before,
.ant-menu-submenu-vertical-left>.ant-menu-submenu-title .ant-menu-submenu-arrow::before,
.ant-menu-submenu-vertical-right>.ant-menu-submenu-title .ant-menu-submenu-arrow::before {
transform: rotate(45deg) translateY(-2px)
}
.ant-menu-submenu-vertical>.ant-menu-submenu-title .ant-menu-submenu-arrow::after,
.ant-menu-submenu-vertical-left>.ant-menu-submenu-title .ant-menu-submenu-arrow::after,
.ant-menu-submenu-vertical-right>.ant-menu-submenu-title .ant-menu-submenu-arrow::after {
transform: rotate(-45deg) translateY(2px)
}
.ant-menu-submenu-inline>.ant-menu-submenu-title .ant-menu-submenu-arrow::before {
transform: rotate(-45deg) translateX(2px)
}
.ant-menu-submenu-inline>.ant-menu-submenu-title .ant-menu-submenu-arrow::after {
transform: rotate(45deg) translateX(-2px)
}
.ant-menu-submenu-open.ant-menu-submenu-inline>.ant-menu-submenu-title .ant-menu-submenu-arrow {
transform: translateY(-2px)
}
.ant-menu-submenu-open.ant-menu-submenu-inline>.ant-menu-submenu-title .ant-menu-submenu-arrow::after {
transform: rotate(-45deg) translateX(-2px)
}
.ant-menu-submenu-open.ant-menu-submenu-inline>.ant-menu-submenu-title .ant-menu-submenu-arrow::before {
transform: rotate(45deg) translateX(2px)
}
.ant-menu-submenu-inline>.ant-menu-submenu-title{
position: relative;
}
.anticon-menu-fold{
display: none;
}
.ant-menu-hidden {
display: none
}
}
}
src/layouts/HNLayout.js
deleted
100644 → 0
View file @
eb3b68a5
import
React
,
{
useEffect
,
useRef
,
useState
,
Suspense
}
from
'react'
;
import
{
Anchor
,
Popover
,
Radio
,
Spin
}
from
'antd'
;
import
Icon
,
{
LoadingOutlined
}
from
'@ant-design/icons'
;
import
{
store
,
helpers
}
from
'@wisdom-utils/utils'
;
import
classNames
from
'classnames'
;
import
Cookies
from
'js-cookie'
;
import
{
connect
}
from
'react-redux'
;
import
{
useHistory
}
from
'@wisdom-utils/runtime'
;
import
KeepAlive
from
'react-activation'
;
import
AMapLoader
from
'@amap/amap-jsapi-loader'
;
import
RightContent
from
'@/components/GlobalHeader/HNRightContent'
;
import
defaultSetting
from
'@wisdom-utils/components/lib/AppLayout/layouts/defaultSettings'
;
import
{
actionCreators
}
from
'@/containers/App/store'
;
import
BasicLayout
from
'./AppLayout/layouts/BasicLayout'
;
import
{
WEB_GIS_TYPE
}
from
'../constants'
;
import
SecurityLayout
from
'./SecurityLayout'
;
import
Site
from
'./Site'
;
import
layoutStyles
from
'./BasicLayout.less'
;
import
styls
from
'./HN.less'
;
const
ArcgisMap
=
React
.
lazy
(()
=>
import
(
'../pages/map/arcgis'
));
const
AMap
=
React
.
lazy
(()
=>
import
(
'../pages/map/amap'
));
const
CesiumMap
=
React
.
lazy
(()
=>
import
(
'../pages/map/cesiumMap'
));
const
{
params
}
=
helpers
;
const
{
getParamsV1
}
=
params
;
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"
xmlns
=
"http://www.w3.org/1999/xlink"
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"
fill
=
{
fillColor
}
/
>
<
/svg
>
);
const
ArrowIcon
=
props
=>
<
Icon
component
=
{
arrowSvg
}
{...
props
}
/>
;
const
optionsWith
=
[{
label
:
'按站点'
,
value
:
'site'
},
{
label
:
'按城市'
,
value
:
'city'
}];
const
HOT
=
[
'HOT'
,
'县'
,
'市'
,
'New'
];
const
StationsItem
=
(
item
,
action
,
onChangeVisible
)
=>
{
const
changeGroup
=
(
event
,
data
)
=>
{
action
.
changeGroup
&&
action
.
changeGroup
(
event
,
data
,
onChangeVisible
);
};
return
(
<
li
key
=
{
item
.
groupID
}
style
=
{{
marginRight
:
`
${
item
.
style
.
marginRight
}
px`
}}
>
<
a
className
=
{
classNames
(
layoutStyles
.
city_select
,
layoutStyles
.
showTip
)}
title
=
{
item
.
city
}
index
=
{
item
.
promoteIndex
}
style
=
{{
fontSize
:
'13px'
}}
onClick
=
{
event
=>
changeGroup
(
event
,
item
)}
>
{
item
.
groupName
}
{
item
.
promoteTip
&&
HOT
.
includes
(
item
.
promoteTip
)
&&
<
div
title
=
{
`
${
item
.
promoteTip
}
`
}
>
{
item
.
promoteTip
}
<
/div>
}
<
/a
>
<
/li
>
);
};
const
Stations
=
props
=>
{
const
data
=
props
.
data
.
stations
;
const
[
targetOffset
,
setTargetOffset
]
=
useState
(
undefined
);
const
cityPane
=
useRef
(
null
);
const
cityContent
=
useRef
(
null
);
const
[
defaultTab
,
setDefaultTab
]
=
useState
(
'site'
);
useEffect
(()
=>
{
setTargetOffset
(
cityPane
.
current
.
clientHeight
/
2
);
},
[]);
const
handleClick
=
(
event
,
link
)
=>
{
event
.
preventDefault
();
};
const
handleTabChange
=
event
=>
{
setDefaultTab
(
event
.
target
.
value
);
};
return
(
<>
<
div
className
=
{
layoutStyles
.
focusStations
}
>
<
ul
>
{
Array
.
isArray
(
data
)
?
data
.
map
(
item
=>
StationsItem
(
item
,
props
.
action
,
props
.
setVisible
))
:
null
}
<
/ul
>
<
/div
>
<
Radio
.
Group
options
=
{
optionsWith
}
optionType
=
"button"
buttonStyle
=
"solid"
size
=
"small"
value
=
{
defaultTab
}
onChange
=
{
handleTabChange
}
style
=
{{
marginTop
:
'6px'
}}
/
>
<
div
style
=
{{
maxWidth
:
'520px'
,
position
:
'relative'
}}
>
{
defaultTab
===
'site'
?
(
<
div
className
=
{
classNames
(
layoutStyles
.
city_pane
,
layoutStyles
.
station_container
)}
ref
=
{
cityPane
}
>
<
Anchor
affix
=
{
false
}
onClick
=
{
handleClick
}
targetOffset
=
{
targetOffset
}
getContainer
=
{()
=>
cityContent
.
current
}
>
<
ul
className
=
{
layoutStyles
.
py
}
>
{
props
.
data
&&
props
.
data
.
siteCityList
&&
props
.
data
.
siteCityList
.
letters
}
<
/ul
>
<
div
className
=
{
layoutStyles
.
cityContent
}
style
=
{{
height
:
'335px'
}}
ref
=
{
cityContent
}
>
{
props
.
data
&&
props
.
data
.
siteCityList
&&
props
.
data
.
siteCityList
.
content
}
<
/div
>
<
/Anchor
>
<
/div
>
)
:
(
<
div
className
=
"city_pane city_container"
>
{
props
.
data
.
citySelector
}
<
/div
>
)}
<
Spin
spinning
=
{
props
.
loading
}
tip
=
"加载中"
/>
<
/div
>
<
/
>
);
};
const
renderSite
=
({
data
,
config
,
loading
,
setLoading
,
action
})
=>
{
const
[
visible
,
setVisible
]
=
useState
(
false
);
let
loaded
=
!!
((
data
&&
!
data
.
stations
)
||
(
Array
.
isArray
(
data
.
weathers
)
&&
data
.
weathers
.
length
===
0
));
if
(
config
&&
config
.
userInfo
&&
config
.
userInfo
.
site
===
''
)
{
loaded
=
false
;
}
return
(
<>
<
Spin
indicator
=
{
antIcon
}
spinning
=
{
loaded
}
size
=
"small"
style
=
{{
marginLeft
:
'10px'
}}
tip
=
""
wrapperClassName
=
{
layoutStyles
.
spinLoadding
}
>
<>
<
Popover
placement
=
"bottomLeft"
trigger
=
"click"
visible
=
{
visible
}
content
=
{
<
Stations
data
=
{
data
}
loading
=
{
loading
}
setLoading
=
{
setLoading
}
setVisible
=
{
setVisible
}
action
=
{
action
}
/
>
}
arrowPointAtCenter
overlayClassName
=
{
classNames
(
layoutStyles
.
stationsWrapper
,
layoutStyles
.
stationsTop
)}
onVisibleChange
=
{
visible
=>
setVisible
(
visible
)}
>
{
Array
.
isArray
(
data
.
stations
)
?
(
<
div
className
=
{
layoutStyles
.
toggleSite
}
>
<
img
src
=
{
require
(
'../assets/basic/site.png'
)}
className
=
{
layoutStyles
.
site
}
/
>
<
span
className
=
{
layoutStyles
.
name
}
>
{
data
.
currentStationName
}
<
/span
>
<
ArrowIcon
className
=
{
layoutStyles
.
arrow
}
fillColor
=
"#fff"
style
=
{{
transform
:
!
visible
?
`rotate(0deg)`
:
`rotate(180deg)`
,
}}
/
>
<
/div
>
)
:
null
}
<
/Popover
>
<
/
>
<
/Spin
>
{
data
.
weathers
&&
Object
.
keys
(
data
.
weathers
).
length
>
0
?
(
<
span
className
=
{
layoutStyles
.
weatcher
}
style
=
{{
borderLeft
:
data
.
stations
.
length
===
0
?
'0px'
:
'1px solid rgba(256, 256, 256, 0.3)'
,
}}
>
<
img
src
=
{
data
.
weathers
&&
data
.
weathers
.
icon
}
className
=
{
layoutStyles
.
icon
}
/
>
<
span
className
=
{
layoutStyles
.
text
}
>
{
data
.
weathers
&&
data
.
weathers
.
text
}
<
/span
>
<
/span
>
)
:
null
}
<
/
>
);
};
const
Layout
=
props
=>
{
const
[
collapse
,
setCollapse
]
=
useState
(
false
);
const
[
cityData
,
setCityData
]
=
useState
({});
const
[
siteLoading
,
setSiteLoading
]
=
useState
(
false
);
const
[
mapMode
,
setMapMode
]
=
useState
(
WEB_GIS_TYPE
.
ARCGIS
);
const
[
siteAction
,
setSiteAction
]
=
useState
(()
=>
new
Site
(
props
,
setSiteLoading
));
// const basename = getBaseName();
const
history
=
useHistory
();
useEffect
(()
=>
{
siteAction
.
setGlobalConfig
(
props
.
global
);
const
tk
=
Cookies
.
get
(
'token'
)
||
props
.
global
.
token
;
const
isLogin
=
tk
!==
null
&&
tk
!==
'undefined'
&&
tk
!==
(
void
0
);
if
(
!
isLogin
)
{
let
client
=
props
.
global
&&
props
.
global
.
hasOwnProperty
(
'client'
)
?
props
.
global
.
get
(
'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
();
return
;
}
if
(
props
.
global
&&
props
.
global
.
userInfo
&&
props
.
global
.
userInfo
.
token
!==
null
&&
props
.
global
.
userInfo
.
loginName
&&
Object
.
keys
(
cityData
).
length
===
0
)
{
siteAction
.
getCityStationsForUser
().
then
(
res
=>
{
setCityData
(
res
);
});
}
},
[
cityData
,
history
,
props
,
props
.
global
,
siteAction
]);
const
handlerPageChange
=
()
=>
{
const
params
=
getParamsV1
(
props
.
location
.
pathname
);
if
(
params
.
hasOwnProperty
(
'mapType'
)
&&
params
.
mapType
===
WEB_GIS_TYPE
.
AMAP
)
{
AMapLoader
.
reset
();
setMapMode
(
WEB_GIS_TYPE
.
AMAP
);
}
else
if
(
!
/civweb4/
.
test
(
location
.
pathname
))
{
AMapLoader
.
reset
();
setMapMode
(
WEB_GIS_TYPE
.
ARCGIS
);
}
};
useEffect
(()
=>
{
window
.
share
.
event
.
on
(
'updateSite'
,
res
=>
setCityData
(
res
));
return
()
=>
{
window
.
share
.
event
.
removeAllListeners
(
'updateSite'
);
};
},
[]);
const
handleUpdateCurrentIndex
=
index
=>
{
props
.
updateCurrentIndex
(
index
);
window
.
share
&&
window
.
share
.
event
.
emit
(
'trigger:updateMenuIndex'
,
index
);
store
.
set
(
'updateMenuIndex'
,
index
);
};
const
handlerIndustry
=
event
=>
{
props
.
global
.
get
(
'userInfo.site'
)
?
history
.
push
(
`/industry`
)
:
void
0
;
};
const
handlerCollapsed
=
()
=>
{
setCollapse
(
!
collapse
);
};
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'
))
:
defaultSetting
.
logo
;
return
(
<
SecurityLayout
loading
{...
props
}
>
<
div
className
=
{
styls
.
hnlayout
}
>
<
BasicLayout
route
=
{
props
.
route
}
title
=
{
props
.
global
.
title
}
siderWidth
=
{
140
}
logo
=
{
logo
}
// logo={require('@/assets/basic/HN-logo.png')}
config
=
{
props
.
global
}
currentMenuIndex
=
{
props
.
currentMenuIndex
}
onHeaderLogo
=
{
handlerIndustry
}
onPageChange
=
{
handlerPageChange
}
onMenuPanelItemClick
=
{
handleUpdateCurrentIndex
}
// subMenuItemRender={()=> <RightContent />}
headerContentRender
=
{()
=>
<
RightContent
/>
}
headerSiteRender
=
{()
=>
renderSite
({
data
:
cityData
,
config
:
props
.
global
,
loading
:
siteLoading
,
setLoading
:
setSiteLoading
,
action
:
siteAction
,
})
}
>
<>
<
Suspense
fallback
=
{
<><
/>}
>
{
window
.
location
.
pathname
.
startsWith
(
'/civbase/civ_3d'
)
||
window
.
location
.
pathname
.
startsWith
(
'/civbase/civ_drainage'
)
?
(
<
KeepAlive
>
<
CesiumMap
/>
<
/KeepAlive
>
)
:
window
.
location
.
pathname
.
startsWith
(
'/civbase/civ_webgis'
)
?
(
mapMode
===
'AMap'
?
(
<
AMap
/>
)
:
(
<
ArcgisMap
options
=
{{
type
:
'ArcgisMap'
}}
/
>
)
)
:
null
}
<
/Suspense
>
<
div
id
=
"micro-container"
className
=
"subapp-container"
>
{
props
.
children
}
<
/div
>
<
/
>
<
/BasicLayout
>
<
/div
>
<
/SecurityLayout
>
);
};
const
mapStateToProps
=
state
=>
({
global
:
state
.
getIn
([
'global'
,
'globalConfig'
]),
settings
:
state
.
getIn
([
'global'
,
'defaultSetting'
]),
collapsed
:
state
.
getIn
([
'global'
,
'collapsed'
]),
menu
:
state
.
getIn
([
'global'
,
'menu'
]),
currentMenuIndex
:
state
.
getIn
([
'global'
,
'currentMenuIndex'
]),
flatMenu
:
state
.
getIn
([
'global'
,
'flatMenu'
]),
authValidate
:
state
.
getIn
([
'global'
,
'authValidate'
]),
pathname
:
state
.
getIn
([
'global'
,
'pathname'
]),
selectedKeys
:
state
.
getIn
([
'global'
,
'selectedKeys'
]),
openKeys
:
state
.
getIn
([
'global'
,
'openKeys'
]),
complexConfig
:
state
.
getIn
([
'global'
,
'complexConfig'
]),
complexPathName
:
state
.
getIn
([
'global'
,
'complexPathName'
]),
microMounted
:
state
.
getIn
([
'global'
,
'microMounted'
]),
});
const
mapDispatchToProps
=
dispatch
=>
({
updageSetting
(
setting
)
{
dispatch
(
actionCreators
.
updageSetting
(
setting
));
},
updateConfig
(
config
)
{
dispatch
(
actionCreators
.
getConfig
(
config
));
},
updateCurrentIndex
(
index
)
{
dispatch
(
actionCreators
.
updateCurrentIndex
(
index
));
},
updateCollapsed
(
collapsed
)
{
dispatch
(
actionCreators
.
updateCollapsed
(
collapsed
));
},
updateAuthValidate
(
auth
)
{
dispatch
(
actionCreators
.
updateAuthValidate
(
auth
));
},
updatePathname
(
pathname
)
{
dispatch
(
actionCreators
.
updatePathname
(
pathname
));
},
updateSelectedKeys
(
keys
)
{
dispatch
(
actionCreators
.
updateSelectedKeys
(
keys
));
},
updateOpenKeys
(
keys
)
{
dispatch
(
actionCreators
.
updateOpenKeys
(
keys
));
},
updateComplexConfig
(
config
)
{
dispatch
(
actionCreators
.
updateComplexConfig
(
config
));
},
updateComplexPathName
(
pathname
)
{
dispatch
(
actionCreators
.
updateComplexPathName
(
pathname
));
},
logout
()
{
dispatch
(
actionCreators
.
logout
());
},
});
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
,
)(
Layout
);
src/pages/user/login/index.js
View file @
6a5e9f34
...
...
@@ -6,54 +6,53 @@
* @FilePath: \CivWeb\src\pages\user\login\index.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import
React
,
{
useEffect
,
Suspense
}
from
'react'
;
import
{
AppInitState
}
from
'../../../render'
;
import
React
,
{
useEffect
}
from
'react'
;
import
BaseLogin
from
'./template/baseLogin'
;
import
ChangShuiJiChang
from
'./template/changShuiJiChang'
;
import
NewYear
from
'./template/newYear'
;
import
baseLoginNewYear
from
'./template/baseLoginNewYear'
;
import
InfoLogin
from
'./template/infoLogin'
;
import
Yulin
from
'./template/yulin'
;
// import { useParams } from '@wisdom-utils/runtime';
import
EnergyQuota
from
'./template/energy_quota/index'
;
import
drainageXindu
from
'./template/drainage_xindu/index'
;
import
EnergGz
from
'./template/energy_GZ/index'
;
import
EnergGzV2
from
'./template/energy_GZV2/index'
;
// 广州单点登录跳转
import
EnergJS2
from
'./template/energy_JS2/index'
;
import
DarkNoEffect
from
'./template/noEffect/DarkNoEffect'
;
import
CloudLogin
from
'./template/cloud'
;
import
CloudNewLogin
from
'./template/cloudNew'
;
import
WaterLogin
from
'./template/water'
;
import
JSZHLogin
from
'./template/project/JSZH'
;
import
ChengmaiLogin
from
'./template/project/chengmai'
;
import
HuhehaoteLogin
from
'./template/project/huhehaote'
;
import
XinganLogin
from
'./template/project/xingan'
;
import
LvchengLogin
from
'./template/project/lvcheng'
;
import
PukouLogin
from
'./template/project/pukou'
;
import
JiLinDaXueLogin
from
'./template/project/JiLinDaXue'
;
import
ErlianhaoteLogin
from
'./template/project/erlianhaote'
;
import
YixianLogin
from
'./template/project/yixian'
;
import
LixianLogin
from
'./template/project/lixian'
;
import
DazuLogin
from
'./template/project/dazu'
;
import
WeixinLogin
from
'./template/project/weixin'
;
import
PanoramaLogin
from
'./template/panorama'
;
import
JiangXi
from
'./template/project/jiangxi'
;
import
JiangXiNew
from
'./template/project/jiangxiNew'
;
const
BaseLogin
=
React
.
lazy
(()
=>
import
(
'./template/baseLogin'
));
const
ChangShuiJiChang
=
React
.
lazy
(()
=>
import
(
'./template/changShuiJiChang'
));
const
NewYear
=
React
.
lazy
(()
=>
import
(
'./template/newYear'
));
const
baseLoginNewYear
=
React
.
lazy
(()
=>
import
(
'./template/baseLoginNewYear'
));
const
InfoLogin
=
React
.
lazy
(()
=>
import
(
'./template/infoLogin'
));
const
Yulin
=
React
.
lazy
(()
=>
import
(
'./template/yulin'
));
const
EnergyQuota
=
React
.
lazy
(()
=>
import
(
'./template/energy_quota/index'
));
const
drainageXindu
=
React
.
lazy
(()
=>
import
(
'./template/drainage_xindu/index'
));
const
EnergGz
=
React
.
lazy
(()
=>
import
(
'./template/energy_GZ/index'
));
const
EnergGzV2
=
React
.
lazy
(()
=>
import
(
'./template/energy_GZV2/index'
));
// 广州单点登录跳转
const
EnergJS2
=
React
.
lazy
(()
=>
import
(
'./template/energy_JS2/index'
));
const
DarkNoEffect
=
React
.
lazy
(()
=>
import
(
'./template/noEffect/DarkNoEffect'
));
const
CloudLogin
=
React
.
lazy
(()
=>
import
(
'./template/cloud'
));
const
CloudNewLogin
=
React
.
lazy
(()
=>
import
(
'./template/cloudNew'
));
const
WaterLogin
=
React
.
lazy
(()
=>
import
(
'./template/water'
));
const
JSZHLogin
=
React
.
lazy
(()
=>
import
(
'./template/project/JSZH'
));
const
ChengmaiLogin
=
React
.
lazy
(()
=>
import
(
'./template/project/chengmai'
));
const
HuhehaoteLogin
=
React
.
lazy
(()
=>
import
(
'./template/project/huhehaote'
));
const
XinganLogin
=
React
.
lazy
(()
=>
import
(
'./template/project/xingan'
));
const
LvchengLogin
=
React
.
lazy
(()
=>
import
(
'./template/project/lvcheng'
));
const
PukouLogin
=
React
.
lazy
(()
=>
import
(
'./template/project/pukou'
));
const
JiLinDaXueLogin
=
React
.
lazy
(()
=>
import
(
'./template/project/JiLinDaXue'
));
const
ErlianhaoteLogin
=
React
.
lazy
(()
=>
import
(
'./template/project/erlianhaote'
));
const
YixianLogin
=
React
.
lazy
(()
=>
import
(
'./template/project/yixian'
));
const
LixianLogin
=
React
.
lazy
(()
=>
import
(
'./template/project/lixian'
));
const
DazuLogin
=
React
.
lazy
(()
=>
import
(
'./template/project/dazu'
));
const
WeixinLogin
=
React
.
lazy
(()
=>
import
(
'./template/project/weixin'
));
const
JiangXi
=
React
.
lazy
(()
=>
import
(
'./template/project/jiangxi'
));
const
Queshan
=
React
.
lazy
(()
=>
import
(
'./template/project/queshan'
));
const
Queshansl
=
React
.
lazy
(()
=>
import
(
'./template/project/queshansl'
));
const
PiZhouLogin
=
React
.
lazy
(()
=>
import
(
'./template/project/pizhou'
));
const
JieshouLogin
=
React
.
lazy
(()
=>
import
(
'./template/project/jieshou'
));
const
YongjiLogin
=
React
.
lazy
(()
=>
import
(
'./template/project/yongji'
));
const
DanlingLogin
=
React
.
lazy
(()
=>
import
(
'./template/project/danling'
));
const
PulandianLogin
=
React
.
lazy
(()
=>
import
(
'./template/project/pulandian'
));
const
HeilongjiangzhixiaoLogin
=
React
.
lazy
(()
=>
import
(
'./template/project/heilongjiang'
));
const
GaoyaoLogin
=
React
.
lazy
(()
=>
import
(
'./template/project/gaoyao'
));
const
JianzhaLogin
=
React
.
lazy
(()
=>
import
(
'./template/project/jianzha'
));
const
ChinaShuiwu
=
React
.
lazy
(()
=>
import
(
'./template/project/chinaShuiwu'
));
const
current
=
React
.
lazy
(()
=>
import
(
'./template/current/index'
));
const
Linyou
=
React
.
lazy
(()
=>
import
(
'./template/project/linyou'
));
const
FengqiuLogin
=
React
.
lazy
(()
=>
import
(
'./template/project/fengqiu'
));
import
Queshan
from
'./template/project/queshan'
;
import
Queshansl
from
'./template/project/queshansl'
;
import
PiZhouLogin
from
'./template/project/pizhou'
;
import
JieshouLogin
from
'./template/project/jieshou'
;
import
YongjiLogin
from
'./template/project/yongji'
;
import
DanlingLogin
from
'./template/project/danling'
;
import
PulandianLogin
from
'./template/project/pulandian'
;
import
HeilongjiangzhixiaoLogin
from
'./template/project/heilongjiang'
;
import
GaoyaoLogin
from
'./template/project/gaoyao'
;
import
JianzhaLogin
from
'./template/project/jianzha'
;
import
ChinaShuiwu
from
'./template/project/chinaShuiwu'
;
import
current
from
'./template/current/index'
;
import
Linyou
from
'./template/project/linyou'
;
import
FengqiuLogin
from
'./template/project/fengqiu'
;
import
{
AppInitState
}
from
'../../../render'
;
const
LoginTemplate
=
{
'新春.html'
:
baseLoginNewYear
,
'新春 - 智联.html'
:
NewYear
,
...
...
@@ -128,9 +127,5 @@ export default props => {
template
+=
'.html'
;
}
const
RenderComponent
=
LoginTemplate
[
template
]
?
LoginTemplate
[
template
]
:
LoginTemplate
[
'default'
];
return
(
<
Suspense
fallback
=
{
<><
/>}
>
<
RenderComponent
{...
props
}
loginParams
=
{
loginParams
}
/
>
<
/Suspense
>
)
return
<
RenderComponent
{...
props
}
loginParams
=
{
loginParams
}
/>
;
};
src/routes/config.js
View file @
6a5e9f34
...
...
@@ -10,7 +10,6 @@ import UsingAnalysis from '../pages/cloud/analysis/using';
import
NewProducts
from
'../pages/cloud/introduction/newproducts'
;
import
CommonMenu
from
'../pages/commonMenu'
;
import
Iframe
from
'../pages/iframe'
;
import
Login
from
'../pages/user/login'
;
import
NoSecret
from
'../pages/user/login/noSecret'
;
import
Notifications
from
'../pages/system/notifications'
;
import
TabIframe
from
'../pages/system/iframe/TabWidget'
;
...
...
@@ -20,6 +19,7 @@ import IntegratedLoginPage from '../pages/integratedLogin'; // 集成登录管
import
ThirdParty
from
'../pages/thirdParty'
;
// 集成登录自定义跳转
import
PrevieView
from
'../pages/system/previews/preview'
;
const
Login
=
React
.
lazy
(()
=>
import
(
'../pages/user/login'
));
export
const
dyRoutes
=
(
routes
,
layout
,
theme
)
=>
{
// eslint-disable-next-line no-shadow
const
dyRoutes
=
routes
||
[];
...
...
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