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
034210fe
Commit
034210fe
authored
4 years ago
by
邓晓峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复左侧菜单栏初始化配置
parent
153bb209
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
88 additions
and
71 deletions
+88
-71
.eslintcache
.eslintcache
+0
-0
civbase.rar
civbase.rar
+0
-0
app.js
src/app.js
+2
-2
index.js
src/containers/App/index.js
+0
-1
actions.js
src/containers/App/store/actions.js
+8
-0
constants.js
src/containers/App/store/constants.js
+1
-0
reducer.js
src/containers/App/store/reducer.js
+6
-0
BasicLayout.js
src/layouts/BasicLayout.js
+37
-26
SecurityLayout.js
src/layouts/SecurityLayout.js
+1
-7
micro.js
src/micro.js
+32
-32
index.js
src/pages/user/login/index.js
+1
-2
config.js
src/routes/config.js
+0
-1
No files found.
.eslintcache
View file @
034210fe
This source diff could not be displayed because it is too large. You can
view the blob
instead.
This diff is collapsed.
Click to expand it.
civbase.rar
0 → 100644
View file @
034210fe
File added
This diff is collapsed.
Click to expand it.
src/app.js
View file @
034210fe
...
...
@@ -132,7 +132,7 @@ const initGlobalConfig = () => {
(
async
()
=>
{
(
await
(
Cookies
.
get
(
'token'
)
&&
window
.
globalConfig
&&
window
.
globalConfig
.
token
))
&&
initMicroApps
(
loader
);
window
.
globalConfig
.
token
))
&&
initMicroApps
(
loader
,
store
);
})();
},
true
,
...
...
@@ -159,7 +159,7 @@ initLocale();
window
.
share
&&
window
.
share
.
event
&&
window
.
share
.
event
.
on
(
'triggerMicro'
,
()
=>
{
initMicroApps
(
loader
);
initMicroApps
(
loader
,
store
);
});
window
.
share
&&
window
.
share
.
event
&&
...
...
This diff is collapsed.
Click to expand it.
src/containers/App/index.js
View file @
034210fe
...
...
@@ -7,7 +7,6 @@ import defaultSetting from '../../../config/defaultSetting';
import
{
dyRoutes
}
from
'../../routes/config'
;
function
App
(
props
)
{
debugger
return
(
<>
<
Helmet
...
...
This diff is collapsed.
Click to expand it.
src/containers/App/store/actions.js
View file @
034210fe
...
...
@@ -18,6 +18,7 @@ import {
SELECT_MENU_KEY
,
SLIDER_MENU_MODE
,
VALIDATE_AUTH
,
GET_MICRO_MOUNTED_STATUS
,
}
from
'./constants'
;
export
function
getConfig
(
data
)
{
...
...
@@ -150,3 +151,10 @@ export function updateComplexPathName(data) {
data
,
};
}
export
function
updateMicroMounted
(
data
)
{
return
{
type
:
GET_MICRO_MOUNTED_STATUS
,
data
,
};
}
This diff is collapsed.
Click to expand it.
src/containers/App/store/constants.js
View file @
034210fe
...
...
@@ -17,3 +17,4 @@ export const SELECT_MENU_KEY = 'App/SELECT_MENU_KEY';
export
const
EXTEND_OPEN_KEY
=
'App/EXTEND_OPEN_KEY'
;
export
const
COMPLEX_CONFIG
=
'App/COMPLEX_CONFIG'
;
export
const
COMPLEX_PATHNAME
=
'App/COMPLEX_PATHNAME'
;
export
const
GET_MICRO_MOUNTED_STATUS
=
'App/GET_MICRO_MOUNTED_STATUS'
;
This diff is collapsed.
Click to expand it.
src/containers/App/store/reducer.js
View file @
034210fe
...
...
@@ -25,6 +25,7 @@ import {
SELECT_MENU_KEY
,
SLIDER_MENU_MODE
,
VALIDATE_AUTH
,
GET_MICRO_MOUNTED_STATUS
,
}
from
'./constants'
;
const
keywordStorage
=
new
Storage
(
...
...
@@ -61,6 +62,7 @@ export const initialState = fromJS({
openKeys
:
[],
complexConfig
:
{},
complexPathName
:
null
,
microMounted
:
true
,
});
/* eslint-disable default-case, no-param-reassign */
...
...
@@ -173,6 +175,10 @@ const appReducer = (state = initialState, action) => {
return
state
.
merge
({
complexPathName
:
action
.
data
,
});
case
GET_MICRO_MOUNTED_STATUS
:
return
state
.
merge
({
microMounted
:
action
.
data
,
});
default
:
return
state
;
}
...
...
This diff is collapsed.
Click to expand it.
src/layouts/BasicLayout.js
View file @
034210fe
...
...
@@ -11,11 +11,15 @@ import { Anchor, Button, Popover, Radio, Result, Spin } from 'antd';
import
classNames
from
'classnames'
;
import
{
dom
}
from
'kit_utils'
;
import
{
connect
}
from
'react-redux'
;
import
{
renderRoutes
}
from
'react-router-config'
;
//
import { renderRoutes } from 'react-router-config';
import
{
useHistory
}
from
'react-router-dom'
;
import
{
useMountedState
}
from
'react-use'
;
import
{
LeftOutlined
,
MenuFoldOutlined
,
LoadingOutlined
}
from
'@ant-design/icons'
;
import
{
LeftOutlined
,
MenuFoldOutlined
,
LoadingOutlined
,
}
from
'@ant-design/icons'
;
import
ProLayout
,
{
getPageTitle
}
from
'@ant-design/pro-layout'
;
import
{
getMatchMenu
}
from
'@umijs/route-utils'
;
import
pkg
from
'../../package.json'
;
...
...
@@ -326,9 +330,9 @@ const BasicLayout = props => {
()
=>
new
Site
(
props
,
setSiteLoading
),
);
useEffect
(()
=>
{
setCurrentRoutes
(
props
.
route
.
routes
[
props
.
currentMenuIndex
]);
},
[
props
.
route
]);
//
useEffect(() => {
//
setCurrentRoutes(props.route.routes[props.currentMenuIndex]);
// }, [props.route, props.currentMenuIndex
]);
useEffect
(()
=>
{
props
.
updatePathname
(
props
.
location
.
pathname
);
...
...
@@ -336,12 +340,12 @@ const BasicLayout = props => {
const
extraRender
=
menuExtraRender
(
currentRoutes
);
let
clearTime
=
null
;
useEffect
(()
=>
{
setTimeout
(()
=>
{
if
(
isMounted
)
setPageLoading
(
!
pageLoading
);
},
2000
);
},
[]);
//
//
useEffect(() => {
//
setTimeout(() => {
//
if (isMounted) setPageLoading(!pageLoading);
//
}, 2000);
//
}, []);
useEffect
(()
=>
{
const
config
=
findPathByLeafId
(
...
...
@@ -373,16 +377,22 @@ const BasicLayout = props => {
},
[
props
.
location
.
pathname
]);
useEffect
(()
=>
{
props
.
menu
.
length
===
0
?
setLoading
(
true
):
(
setLoading
(
false
));
const
menu
=
props
.
menu
.
filter
(
item
=>
!
item
.
hideInMenu
);
if
(
menu
.
length
===
0
)
{
setLoading
(
true
);
}
props
.
route
&&
(
props
.
route
.
routes
.
filter
(
item
=>
!
item
.
hideInMenu
||
item
.
path
!==
'/404'
||
item
.
path
!==
'/500'
)).
length
===
0
&&
setLoading
(
true
);
if
(
menu
.
length
>
0
&&
props
.
route
&&
props
.
route
.
routes
.
length
>
0
)
{
setCurrentRoutes
(
props
.
route
.
routes
[
props
.
currentMenuIndex
]);
setLoading
(
false
);
}
},
[
props
.
route
,
props
.
menu
]);
clearTime
=
setTimeout
(()
=>
{
if
(
props
.
menu
.
length
>
0
&&
(
props
.
route
&&
props
.
route
.
routes
.
length
>
0
))
{
setCurrentRoutes
(
props
.
route
.
routes
[
props
.
currentMenuIndex
]);
setLoading
(
false
);
}
},
400
);
// return () => clearTimeout && clearTimeout(clearTime);
},
[
props
.
currentMenuIndex
,
props
.
route
,
props
.
menu
]);
useEffect
(()
=>
{
setLoading
(
true
);
clearTime
=
setTimeout
(()
=>
(
setCurrentRoutes
(
props
.
route
.
routes
[
props
.
currentMenuIndex
]),
setLoading
(
false
)),
400
);
return
()
=>
clearTimeout
&&
clearTimeout
(
clearTime
);
},
[
props
.
currentMenuIndex
])
useEffect
(()
=>
{
siteAction
.
setGlobalConfig
(
props
.
global
);
...
...
@@ -396,11 +406,11 @@ const BasicLayout = props => {
});
}
},
[
props
.
global
]);
useEffect
(()
=>
{
window
.
share
.
event
.
on
(
'updateSite'
,
res
=>
setCityData
(
res
));
return
()
=>
window
.
share
.
event
.
removeAllListeners
(
'updateSite'
)
},
[])
},
[]);
useMemo
(()
=>
{
window
.
share
.
event
.
on
(
'listenerRemoveTab'
,
()
=>
{
...
...
@@ -582,7 +592,7 @@ const BasicLayout = props => {
navTheme
=
"light"
siderWidth
=
{
transformComplexSideWidth
()}
style
=
{{
height
:
'400px'
,
height
:
'400px'
}}
>
{
complexConfig
&&
Object
.
keys
(
complexConfig
).
length
>
0
?
(
...
...
@@ -658,6 +668,7 @@ const BasicLayout = props => {
);
};
const
{
openKeys
}
=
props
;
// const filterMenu = props.menu.filter(item => !item.hideInMenu)
return
(
<
SecurityLayout
loading
updateCurrentIndex
=
{
props
.
updateCurrentIndex
}
>
<
ProLayout
...
...
@@ -764,10 +775,8 @@ const BasicLayout = props => {
settings
=
{
defaultSetting
}
{...
others
}
>
{
/*{renderRoutes(props.route.routes)}*/
}
<
Spin
spinning
=
{
p
ageLoading
}
spinning
=
{
p
rops
.
microMounted
}
size
=
"large"
wrapperClassName
=
{
styles
.
loadding
}
>
...
...
@@ -798,6 +807,7 @@ const BasicLayout = props => {
publicPath={`/${basename}/theme`}
/> */
}
<
/ProLayout
>
{
/*<div id="micro-container" className="subapp-container" />*/
}
<
/SecurityLayout
>
);
};
...
...
@@ -814,6 +824,7 @@ const mapStateToProps = state => ({
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
)
{
...
...
This diff is collapsed.
Click to expand it.
src/layouts/SecurityLayout.js
View file @
034210fe
...
...
@@ -2,7 +2,7 @@ import React from 'react';
import
Cookies
from
'js-cookie'
;
import
{
connect
}
from
'react-redux'
;
import
{
Redirect
}
from
'react-router-dom'
;
import
PageLoading
from
'@ant-design/pro-layout'
;
import
{
PageLoading
}
from
'@ant-design/pro-layout'
;
import
{
stringify
}
from
'querystring'
;
import
{
getBaseName
}
from
'../utils/utils'
;
...
...
@@ -26,12 +26,6 @@ class SecurityLayout extends React.Component {
redirect
:
window
.
location
.
href
,
});
// eslint-disable-next-line no-undef
// if(Cookie.get("token")==="") {
// return (
// <Redirect to={`/user/login?client=${global.client}`} />
// );
// }
if
((
!
isLogin
&&
loading
)
||
!
isReady
)
{
return
<
PageLoading
/>
;
}
...
...
This diff is collapsed.
Click to expand it.
src/micro.js
View file @
034210fe
...
...
@@ -10,6 +10,7 @@ import 'kit_logger';
import
micorConfig
from
'../config/micor'
;
import
pkg
from
'../package.json'
;
import
{
FILTER_FOLER_REG
}
from
'./utils/constants'
;
import
{
actionCreators
}
from
'./containers/App/store'
;
// eslint-disable-next-line no-undef
const
Logger
=
logger
(
'micro'
);
const
MICRO_STATUS
=
{
...
...
@@ -26,37 +27,8 @@ const MICRO_STATUS = {
SKIP_BECAUSE_BROKEN
:
'SKIP_BECAUSE_BROKEN'
,
LOAD_ERROR
:
'LOAD_ERROR'
,
};
const
excludeAssetFilter
=
[
'framework/amap/AMap.UI'
,
'framework/amap/init.js'
,
'configuration/js'
,
'framework/three.js'
,
'threedimensional/frameworkthree'
,
'iframe/Civ3DLLab/js'
,
'framework/jquery/gridify-min.js'
,
'framework/jquery/gridify.qrcode.js'
,
'echarts'
,
'lbs.amap.com'
,
'restapi.amap.com'
,
'lbs.amap.com'
,
'restapi.amap.com'
,
'webapi.amap.com'
,
'webapi.amap.com/count'
,
'api.map.baidu.com'
,
'map.baidu.com'
,
'pv.sohu.com'
,
'mt0.google.cn'
,
'mt1.google.cn'
,
'mt2.google.cn'
,
'mt3.google.cn'
,
'hm.baidu.com'
,
'https://maponline0.bdimg.com'
,
'https://maponline1.bdimg.com'
,
'https://maponline2.bdimg.com'
,
'https://maponline3.bdimg.com'
,
'https://api.map.baidu.com/getscript'
,
];
export
const
initMicroApps
=
loader
=>
{
export
const
initMicroApps
=
(
loader
,
store
)
=>
{
const
entrys
=
process
.
env
.
NODE_ENV
!==
'production'
?
micorConfig
.
dev
:
micorConfig
.
prod
;
...
...
@@ -75,6 +47,7 @@ export const initMicroApps = loader => {
{
beforeLoad
:
[
app
=>
{
store
.
dispatch
(
actionCreators
.
updateMicroMounted
(
true
));
Logger
.
info
(
'[LifeCycle] before load %c%s'
);
},
],
...
...
@@ -85,6 +58,7 @@ export const initMicroApps = loader => {
],
afterMount
:
[
app
=>
{
store
.
dispatch
(
actionCreators
.
updateMicroMounted
(
false
));
Logger
.
info
(
`[LifeCycle] after mount %c%s
${
app
.
name
}
`
);
},
],
...
...
@@ -115,7 +89,33 @@ export const initMicroApps = loader => {
// prefetch: 'all',
// eslint-disable-next-line no-underscore-dangle
getPublicPath
:
window
.
__INJECTED_PUBLIC_PATH_BY_QIANKUN__
,
excludeAssetFilter
:
url
=>
excludeAssetFilter
.
includes
(
url
),
excludeAssetFilter
:
url
=>
url
.
indexOf
(
'framework/amap/AMap.UI'
)
!==
-
1
||
url
.
indexOf
(
'framework/amap/init.js'
)
!==
-
1
||
url
.
indexOf
(
'configuration/js'
)
!==
-
1
||
url
.
indexOf
(
'framework/three.js'
)
!==
-
1
||
url
.
indexOf
(
'threedimensional/frameworkthree'
)
!==
-
1
||
url
.
indexOf
(
'iframe/Civ3DLLab/js'
)
!==
-
1
||
url
.
indexOf
(
'framework/jquery/gridify-min.js'
)
!==
-
1
||
url
.
indexOf
(
'framework/jquery/gridify.qrcode.js'
)
!==
-
1
||
url
.
indexOf
(
'echarts'
)
!==
-
1
||
url
.
indexOf
(
'lbs.amap.com'
)
!==
-
1
||
url
.
indexOf
(
'restapi.amap.com'
)
!==
-
1
||
url
.
indexOf
(
'webapi.amap.com'
)
!==
-
1
||
url
.
indexOf
(
'webapi.amap.com/count'
)
!==
-
1
||
url
.
indexOf
(
'api.map.baidu.com'
)
!==
-
1
||
url
.
indexOf
(
'map.baidu.com'
)
!==
-
1
||
url
.
indexOf
(
'pv.sohu.com'
)
!==
-
1
||
url
.
indexOf
(
'mt0.google.cn'
)
!==
-
1
||
url
.
indexOf
(
'mt1.google.cn'
)
!==
-
1
||
url
.
indexOf
(
'mt2.google.cn'
)
!==
-
1
||
url
.
indexOf
(
'mt3.google.cn'
)
!==
-
1
||
url
.
indexOf
(
'hm.baidu.com'
)
!==
-
1
||
url
.
indexOf
(
'https://maponline0.bdimg.com'
)
!==
-
1
||
url
.
indexOf
(
'https://maponline1.bdimg.com'
)
!==
-
1
||
url
.
indexOf
(
'https://maponline2.bdimg.com'
)
!==
-
1
||
url
.
indexOf
(
'https://maponline3.bdimg.com'
)
!==
-
1
||
url
.
indexOf
(
'https://api.map.baidu.com/getscript'
)
!==
-
1
,
});
runAfterFirstMounted
(()
=>
{
Logger
.
info
(
'[MainApp] first app mounted'
);
...
...
This diff is collapsed.
Click to expand it.
src/pages/user/login/index.js
View file @
034210fe
...
...
@@ -17,8 +17,7 @@ import WxLogin from './components/WxLogin';
import
LoginAction
from
'./login'
;
import
styles
from
'./style.less'
;
import
i18n
from
'../../../utils/share'
;
import
defaultSetting
from
'../../../../config/defaultSetting'
import
{
PageLoading
}
from
'@ant-design/pro-layout'
;
import
defaultSetting
from
'../../../../config/defaultSetting'
;
const
{
UserName
,
Password
,
Mobile
,
Captcha
,
Submit
}
=
LoginForm
;
const
Display
=
{
Account
:
'Account'
,
...
...
This diff is collapsed.
Click to expand it.
src/routes/config.js
View file @
034210fe
...
...
@@ -25,7 +25,6 @@ export const dyRoutes = routes => {
{
path
:
'/industry'
,
component
:
BootPage
,
name
:
'industry'
,
},
{
path
:
'/'
,
...
...
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