Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
3b2f0085
Commit
3b2f0085
authored
May 23, 2019
by
ιεΈ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix pageHeader error
parent
bdbf9cff
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
85 deletions
+33
-85
scripts/fetch-block.js
scripts/fetch-block.js
+8
-5
scripts/router.config.js
scripts/router.config.js
+6
-68
src/layouts/BasicLayout.tsx
src/layouts/BasicLayout.tsx
+19
-12
No files found.
scripts/fetch-block.js
View file @
3b2f0085
...
...
@@ -37,11 +37,14 @@ const findAllInstallRouter = router => {
return
routers
;
};
const
filterParentRouter
=
router
=>
{
const
filterParentRouter
=
(
router
,
layout
)
=>
{
return
[...
router
]
.
map
(
item
=>
{
if
(
item
.
routes
)
{
return
{
...
item
,
routes
:
filterParentRouter
(
item
.
routes
)
};
if
(
item
.
routes
&&
(
!
router
.
component
||
layout
))
{
return
{
...
item
,
routes
:
filterParentRouter
(
item
.
routes
,
false
)
};
}
if
(
item
.
redirect
)
{
return
item
;
}
return
null
;
})
...
...
@@ -70,7 +73,7 @@ const execCmd = shell => {
};
// replace router config
const
parentRouter
=
filterParentRouter
(
router
);
const
parentRouter
=
filterParentRouter
(
router
,
true
);
const
{
routesPath
,
code
}
=
getNewRouteCode
(
relativePath
,
parentRouter
);
// write ParentRouter
fs
.
writeFileSync
(
routesPath
,
code
);
...
...
@@ -89,7 +92,7 @@ const installBlock = async () => {
if
(
gitFiles
.
find
(
file
=>
file
.
path
===
gitPath
))
{
console
.
log
(
'
install
'
+
chalk
.
green
(
item
.
name
)
+
'
to:
'
+
chalk
.
yellow
(
item
.
path
));
gitFiles
=
gitFiles
.
filter
(
file
=>
file
.
path
!==
gitPath
);
const
cmd
=
`umi block add https://github.com/ant-design/pro-blocks/tree/master/
${
gitPath
}
--path=
${
const
cmd
=
`umi block add https://github.com/ant-design/pro-blocks/tree/master/
${
gitPath
}
--
npm-client=cnpm --
path=
${
item
.
path
}
`
;
try
{
...
...
scripts/router.config.js
View file @
3b2f0085
...
...
@@ -4,7 +4,6 @@ module.exports = [
path
:
'
/user
'
,
component
:
'
../layouts/UserLayout
'
,
routes
:
[
{
path
:
'
/user
'
,
redirect
:
'
/user/login
'
},
{
path
:
'
/user/login
'
,
name
:
'
login
'
,
component
:
'
./User/Login
'
},
{
path
:
'
/user/register
'
,
name
:
'
register
'
,
component
:
'
./User/Register
'
},
{
...
...
@@ -12,6 +11,7 @@ module.exports = [
name
:
'
register.result
'
,
component
:
'
./User/RegisterResult
'
,
},
{
path
:
'
/user
'
,
redirect
:
'
/user/login
'
},
{
component
:
'
404
'
,
},
...
...
@@ -25,7 +25,6 @@ module.exports = [
authority
:
[
'
admin
'
,
'
user
'
],
routes
:
[
// dashboard
{
path
:
'
/
'
,
redirect
:
'
/dashboard/analysis
'
,
authority
:
[
'
admin
'
,
'
user
'
]
},
{
path
:
'
/dashboard
'
,
name
:
'
dashboard
'
,
...
...
@@ -63,28 +62,6 @@ module.exports = [
path
:
'
/form/step-form
'
,
name
:
'
stepform
'
,
component
:
'
./Form/StepForm
'
,
hideChildrenInMenu
:
true
,
// routes: [
// {
// path: '/form/step-form',
// redirect: '/form/step-form/info',
// },
// {
// path: '/form/step-form/info',
// name: 'info',
// component: './Form/StepForm/Step1',
// },
// {
// path: '/form/step-form/confirm',
// name: 'confirm',
// component: './Form/StepForm/Step2',
// },
// {
// path: '/form/step-form/result',
// name: 'result',
// component: './Form/StepForm/Step3',
// },
// ],
},
{
path
:
'
/form/advanced-form
'
,
...
...
@@ -120,10 +97,6 @@ module.exports = [
name
:
'
search-list
'
,
component
:
'
./list/search
'
,
routes
:
[
{
path
:
'
/list/search
'
,
redirect
:
'
/list/search/articles
'
,
},
{
path
:
'
/list/search/articles
'
,
name
:
'
articles
'
,
...
...
@@ -139,6 +112,10 @@ module.exports = [
name
:
'
applications
'
,
component
:
'
./list/Applications
'
,
},
{
path
:
'
/list/search
'
,
redirect
:
'
/list/search/articles
'
,
},
],
},
],
...
...
@@ -213,51 +190,11 @@ module.exports = [
path
:
'
/account/center
'
,
name
:
'
center
'
,
component
:
'
./Account/Center/Center
'
,
// routes: [
// {
// path: '/account/center',
// redirect: '/account/center/articles',
// },
// {
// path: '/account/center/articles',
// component: './Account/Center/Articles',
// },
// {
// path: '/account/center/applications',
// component: './Account/Center/Applications',
// },
// {
// path: '/account/center/projects',
// component: './Account/Center/Projects',
// },
// ],
},
{
path
:
'
/account/settings
'
,
name
:
'
settings
'
,
component
:
'
./Account/Settings/Info
'
,
// routes: [
// {
// path: '/account/settings',
// redirect: '/account/settings/base',
// },
// {
// path: '/account/settings/base',
// component: './Account/Settings/BaseView',
// },
// {
// path: '/account/settings/security',
// component: './Account/Settings/SecurityView',
// },
// {
// path: '/account/settings/binding',
// component: './Account/Settings/BindingView',
// },
// {
// path: '/account/settings/notification',
// component: './Account/Settings/NotificationView',
// },
// ],
},
],
},
...
...
@@ -284,6 +221,7 @@ module.exports = [
},
],
},
{
path
:
'
/
'
,
redirect
:
'
/dashboard/analysis
'
,
authority
:
[
'
admin
'
,
'
user
'
]
},
{
component
:
'
404
'
,
},
...
...
src/layouts/BasicLayout.tsx
View file @
3b2f0085
...
...
@@ -25,17 +25,13 @@ export type BasicLayoutContext = { [K in 'location']: BasicLayoutProps[K] } & {
};
/**
*
default menuLocal
*
use Authorized check all menu item
*/
const
filterMenuData
=
(
menuList
:
MenuDataItem
[],
locale
:
boolean
):
MenuDataItem
[]
=>
{
const
menuDataRender
=
(
menuList
:
MenuDataItem
[]
):
MenuDataItem
[]
=>
{
return
menuList
.
map
(
item
=>
{
const
localItem
=
{
...
item
,
name
:
item
.
locale
&&
locale
?
formatMessage
({
id
:
item
.
locale
,
defaultMessage
:
item
.
name
})
:
item
.
name
,
children
:
item
.
children
?
filterMenuData
(
item
.
children
,
locale
)
:
[],
children
:
item
.
children
?
menuDataRender
(
item
.
children
)
:
[],
};
return
Authorized
.
check
(
item
.
authority
,
localItem
,
null
)
as
MenuDataItem
;
...
...
@@ -56,9 +52,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = props => {
*/
const
handleMenuCollapse
=
(
payload
:
boolean
)
=>
dispatch
!
({
type
:
'
global/changeLayoutCollapsed
'
,
payload
});
const
{
menu
:
{
locale
},
}
=
settings
;
return
(
<>
<
BasicLayoutComponents
...
...
@@ -67,7 +61,20 @@ const BasicLayout: React.FC<BasicLayoutProps> = props => {
menuItemRender
=
{
(
menuItemProps
,
defaultDom
)
=>
{
return
<
Link
to
=
{
menuItemProps
.
path
}
>
{
defaultDom
}
</
Link
>;
}
}
filterMenuData
=
{
menuList
=>
filterMenuData
(
menuList
,
locale
)
}
breadcrumbRender
=
{
(
routers
=
[])
=>
{
return
[
{
path
:
'
/
'
,
breadcrumbName
:
formatMessage
({
id
:
'
menu.home
'
,
defaultMessage
:
'
Home
'
,
}),
},
...
routers
,
];
}
}
menuDataRender
=
{
menuDataRender
}
formatMessage
=
{
formatMessage
}
rightContentRender
=
{
rightProps
=>
<
RightContent
{
...
rightProps
}
/>
}
{
...
props
}
{
...
settings
}
...
...
@@ -85,7 +92,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = props => {
}
/>
)
}
<
CopyBlock
url
=
{
location
.
pathname
}
/>
<
CopyBlock
url
=
{
location
!
.
pathname
}
/>
</>
);
};
...
...
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