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
3a39c1b5
Commit
3a39c1b5
authored
Jan 11, 2022
by
邓晓峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复首页加载逻辑
parent
e83f482c
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
7 deletions
+34
-7
micor.js
config/micor.js
+1
-1
reducer.js
src/containers/App/store/reducer.js
+2
-0
BasicLayout1.js
src/layouts/BasicLayout1.js
+1
-1
micro.js
src/micro.js
+6
-5
routes.js
src/utils/routes.js
+24
-0
No files found.
config/micor.js
View file @
3a39c1b5
...
...
@@ -17,7 +17,7 @@ export default {
// },
{
name
:
'civ_pandawork'
,
entry
:
`//
${
window
.
location
.
hostname
}
:808
1
/civ_pandawork`
,
entry
:
`//
${
window
.
location
.
hostname
}
:808
0
/civ_pandawork`
,
container
:
'#micro-container'
,
activeRule
:
'/civbase/civ_pandawork'
,
},
...
...
src/containers/App/store/reducer.js
View file @
3a39c1b5
...
...
@@ -7,6 +7,7 @@ import { Storage } from '@wisdom-utils/utils';
import
pkg
from
'../../../../package.json'
;
import
defaultSetting
from
'../../../../config/defaultSetting'
;
import
generRoutes
,
{
generFlatRoutes
}
from
'../../../utils/routes'
;
import
{
transformWidgets
}
from
'../../../utils/routes'
;
import
{
CLEAR_RCENT_KEYWORD
,
COMPLEX_CONFIG
,
...
...
@@ -105,6 +106,7 @@ const appReducer = (state = initialState, action) => {
window
.
globalConfig
&&
window
.
globalConfig
.
products
&&
Array
.
isArray
(
window
.
globalConfig
.
products
)
&&
window
.
globalConfig
.
products
.
map
(
item
=>
{
modulePkg
[
item
.
PackageName
]
=
item
;
});
config
.
widgets
=
transformWidgets
(
config
.
widgets
);
const
generMenu
=
generRoutes
(
config
.
widgets
||
[],
null
,
0
,
modulePkg
);
let
flatMenu
=
[];
if
(
generMenu
)
{
...
...
src/layouts/BasicLayout1.js
View file @
3a39c1b5
...
...
@@ -543,7 +543,7 @@ const BasicLayout = props => {
<
div
className
=
{
layoutStyles
.
splitLine
}
><
/div
>
<
ul
className
=
{
classNames
(
layoutStyles
.
menu
,
'menu-vertical'
)}
>
{
currentRoutes
&&
(
currentRoutes
.
routes
||
[]).
map
((
item
,
index
)
=>
{
currentRoutes
&&
(
currentRoutes
.
routes
||
[]).
filter
(
item
=>
!
item
.
hideInMenu
).
map
((
item
,
index
)
=>
{
return
(
<
React
.
Fragment
key
=
{
index
}
>
<
li
key
=
{
index
}
className
=
{
classNames
(
layoutStyles
[
'menu-item'
],
{
[
layoutStyles
[
'active'
]]:
index
===
selectIndex
})}
onClick
=
{()
=>
handlerSecond
(
item
,
index
)}
>
...
...
src/micro.js
View file @
3a39c1b5
...
...
@@ -17,6 +17,7 @@ import { actionCreators } from './containers/App/store';
import
{
FILTER_FOLER_REG
}
from
'./utils/constants'
;
import
loader
from
'./render'
;
import
store
from
'./stores'
;
// eslint-disable-next-line no-undef
const
Logger
=
logger
(
'micro'
);
const
MICRO_STATUS
=
{
...
...
@@ -221,12 +222,12 @@ export const defaultApp = () => {
// setDefaultMountApp(`/${pkg.name.toLocaleLowerCase()}/${basePath}${homepage}`);
// createStoreage.set('init_web4', true)
// }
if
(
/civweb4/
.
test
(
config
.
homepage
))
{
setDefaultMountApp
(
`/civbase/
${
config
.
homepage
.
replace
(
/^
\/
/
,
''
)}
`
);
}
else
{
setDefaultMountApp
(
`/civbase/
${
config
.
home
.
path
.
replace
(
/^
\/
/
,
''
)}
`
);
}
// if(/civweb4/.test(config.homepage)) {
// setDefaultMountApp(`/civbase/${config.homepage.replace(/^\//, '')}`);
// } else {
// setDefaultMountApp(`/civbase/${config.home.path.replace(/^\//, '')}`);
// }
//setDefaultMountApp(`/civbase/${config.homepage.replace(/^\//, '')}`);
if
(
config
.
homepage
.
indexOf
(
'civweb4'
)
>
-
1
)
createStoreage
.
set
(
'init_web4'
,
true
);
}
...
...
src/utils/routes.js
View file @
3a39c1b5
...
...
@@ -36,6 +36,7 @@ const getURL = url => {
};
const
generRotes
=
(
widgets
,
parent
,
level
=
0
)
=>
{
const
ret
=
[];
if
(
!
widgets
||
widgets
.
length
===
0
){
return
...
...
@@ -117,6 +118,29 @@ const generRotes = (widgets, parent, level = 0) => {
});
return
ret
;
};
export
const
transformWidgets
=
(
widgets
)
=>
{
if
(
!
widgets
||
widgets
.
length
===
0
)
{
return
[]
}
return
widgets
.
map
(
item
=>
{
const
widgets
=
item
.
widgets
;
const
homepage
=
window
.
globalConfig
.
homepage
;
const
homePageConvertArray
=
homepage
.
split
(
"/"
);
const
findIndex
=
widgets
&&
widgets
.
findIndex
(
item
=>
item
.
label
===
'系统菜单组'
);
if
(
findIndex
===
-
1
)
{
widgets
.
push
({
label
:
"系统菜单组"
,
icon
:
''
,
product
:
homePageConvertArray
[
0
],
shortName
:
"首页"
,
url
:
homePageConvertArray
.
slice
(
1
,
homePageConvertArray
.
length
).
join
(
"/"
)
});
item
.
widgets
=
widgets
;
}
return
item
;
});
}
export
function
simpleNormalizeChildren
(
children
)
{
for
(
let
i
=
0
;
i
<
children
.
length
;
i
++
)
{
if
(
Array
.
isArray
(
children
[
i
]))
{
...
...
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