Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ant-design-pro
Project
Project
Details
Activity
Releases
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thiago Borges
ant-design-pro
Commits
44d2c7bb
Commit
44d2c7bb
authored
Nov 16, 2017
by
nikogu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor inhuman code of nav.js
parent
5a47aa03
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
247 additions
and
287 deletions
+247
-287
nav.js
src/common/nav.js
+247
-287
No files found.
src/common/nav.js
View file @
44d2c7bb
import
dynamic
from
'dva/dynamic'
;
export
const
getNavData
=
app
=>
[{
component
:
dynamic
({
app
,
models
:
()
=>
[
import
(
'../models/user'
),
],
component
:
()
=>
import
(
'../layouts/BasicLayout'
),
}),
layout
:
'BasicLayout'
,
name
:
'首页'
,
// for breadcrumb
path
:
'/'
,
children
:
[{
name
:
'Dashboard'
,
icon
:
'dashboard'
,
path
:
'dashboard'
,
children
:
[{
name
:
'分析页'
,
path
:
'analysis'
,
component
:
dynamic
({
app
,
models
:
()
=>
[
import
(
'../models/chart'
),
],
component
:
()
=>
import
(
'../routes/Dashboard/Analysis'
),
}),
},
{
name
:
'监控页'
,
path
:
'monitor'
,
component
:
dynamic
({
app
,
models
:
()
=>
[
import
(
'../models/monitor'
),
],
component
:
()
=>
import
(
'../routes/Dashboard/Monitor'
),
}),
},
{
name
:
'工作台'
,
path
:
'workplace'
,
component
:
dynamic
({
app
,
models
:
()
=>
[
import
(
'../models/project'
),
import
(
'../models/activities'
),
import
(
'../models/chart'
),
],
component
:
()
=>
import
(
'../routes/Dashboard/Workplace'
),
}),
}],
},
{
name
:
'表单页'
,
path
:
'form'
,
icon
:
'form'
,
children
:
[{
name
:
'基础表单'
,
path
:
'basic-form'
,
component
:
dynamic
({
app
,
models
:
()
=>
[
import
(
'../models/form'
),
],
component
:
()
=>
import
(
'../routes/Forms/BasicForm'
),
}),
},
{
name
:
'分步表单'
,
path
:
'step-form'
,
component
:
dynamic
({
app
,
models
:
()
=>
[
import
(
'../models/form'
),
// models
import
UserModel
from
'../models/user'
;
import
ChartModel
from
'../models/chart'
;
import
MonitorModel
from
'../models/monitor'
;
import
ProjectModel
from
'../models/project'
;
import
ActivitiesModel
from
'../models/activities'
;
import
FormModel
from
'../models/form'
;
import
RuleModel
from
'../models/rule'
;
import
ListModel
from
'../models/list'
;
import
ProfileModel
from
'../models/profile'
;
import
LoginModel
from
'../models/login'
;
import
RegisterModel
from
'../models/register'
;
// components
import
BasicLayout
from
'../layouts/BasicLayout'
;
import
UserLayout
from
'../layouts/UserLayout'
;
import
BlankLayout
from
'../layouts/BlankLayout'
;
import
Analysis
from
'../routes/Dashboard/Analysis'
;
import
Monitor
from
'../routes/Dashboard/Monitor'
;
import
Workplace
from
'../routes/Dashboard/Workplace'
;
import
BasicForm
from
'../routes/Forms/BasicForm'
;
import
AdvancedForm
from
'../routes/Forms/AdvancedForm'
;
import
StepForm
from
'../routes/Forms/StepForm'
;
import
Step2
from
'../routes/Forms/StepForm/Step2'
;
import
Step3
from
'../routes/Forms/StepForm/Step3'
;
import
TableList
from
'../routes/List/TableList'
;
import
BasicList
from
'../routes/List/BasicList'
;
import
CardList
from
'../routes/List/CardList'
;
import
CoverCardList
from
'../routes/List/CoverCardList'
;
import
FilterCardList
from
'../routes/List/FilterCardList'
;
import
SearchList
from
'../routes/List/SearchList'
;
import
BasicProfile
from
'../routes/Profile/BasicProfile'
;
import
AdvancedProfile
from
'../routes/Profile/AdvancedProfile'
;
import
Success
from
'../routes/Result/Success'
;
import
Error
from
'../routes/Result/Error'
;
import
Exception403
from
'../routes/Exception/403'
;
import
Exception404
from
'../routes/Exception/404'
;
import
Exception500
from
'../routes/Exception/500'
;
import
Login
from
'../routes/User/Login'
;
import
Register
from
'../routes/User/Register'
;
import
RegisterResult
from
'../routes/User/RegisterResult'
;
// wrapper of dynamic
const
dy
=
(
app
,
models
,
component
)
=>
dynamic
({
app
,
models
:
()
=>
models
,
component
:
()
=>
component
,
});
// nav data
export
const
getNavData
=
app
=>
[
{
component
:
dy
(
app
,
[
UserModel
],
BasicLayout
),
layout
:
'BasicLayout'
,
name
:
'首页'
,
// for breadcrumb
path
:
'/'
,
children
:
[
{
name
:
'Dashboard'
,
icon
:
'dashboard'
,
path
:
'dashboard'
,
children
:
[
{
name
:
'分析页'
,
path
:
'analysis'
,
component
:
dy
(
app
,
[
ChartModel
],
Analysis
),
},
{
name
:
'监控页'
,
path
:
'monitor'
,
component
:
dy
(
app
,
[
MonitorModel
],
Monitor
),
},
{
name
:
'工作台'
,
path
:
'workplace'
,
component
:
dy
(
app
,
[
ProjectModel
,
ActivitiesModel
,
ChartModel
],
Workplace
),
},
],
},
{
name
:
'表单页'
,
path
:
'form'
,
icon
:
'form'
,
children
:
[
{
name
:
'基础表单'
,
path
:
'basic-form'
,
component
:
dy
(
app
,
[
FormModel
],
BasicForm
),
},
{
name
:
'分步表单'
,
path
:
'step-form'
,
component
:
dy
(
app
,
[
FormModel
],
StepForm
),
children
:
[
{
path
:
'confirm'
,
component
:
dy
(
app
,
[
FormModel
],
Step2
),
},
{
path
:
'result'
,
component
:
dy
(
app
,
[
FormModel
],
Step3
),
},
],
},
{
name
:
'高级表单'
,
path
:
'advanced-form'
,
component
:
dy
(
app
,
[
FormModel
],
AdvancedForm
),
},
],
component
:
()
=>
import
(
'../routes/Forms/StepForm'
),
}),
children
:
[{
path
:
'confirm'
,
component
:
dynamic
({
app
,
models
:
()
=>
[
import
(
'../models/form'
),
],
component
:
()
=>
import
(
'../routes/Forms/StepForm/Step2'
),
}),
},
{
name
:
'列表页'
,
path
:
'list'
,
icon
:
'table'
,
children
:
[
{
name
:
'查询表格'
,
path
:
'table-list'
,
component
:
dy
(
app
,
[
RuleModel
],
TableList
),
},
{
name
:
'标准列表'
,
path
:
'basic-list'
,
component
:
dy
(
app
,
[
ListModel
],
BasicList
),
},
{
name
:
'卡片列表'
,
path
:
'card-list'
,
component
:
dy
(
app
,
[
ListModel
],
CardList
),
},
{
name
:
'搜索列表(项目)'
,
path
:
'cover-card-list'
,
component
:
dy
(
app
,
[
ListModel
],
CoverCardList
),
},
{
name
:
'搜索列表(应用)'
,
path
:
'filter-card-list'
,
component
:
dy
(
app
,
[
ListModel
],
FilterCardList
),
},
{
name
:
'搜索列表(文章)'
,
path
:
'search'
,
component
:
dy
(
app
,
[
ListModel
],
SearchList
),
},
],
},
{
name
:
'详情页'
,
path
:
'profile'
,
icon
:
'profile'
,
children
:
[
{
name
:
'基础详情页'
,
path
:
'basic'
,
component
:
dy
(
app
,
[
ProfileModel
],
BasicProfile
),
},
{
name
:
'高级详情页'
,
path
:
'advanced'
,
component
:
dy
(
app
,
[
ProfileModel
],
AdvancedProfile
),
},
],
},
{
name
:
'结果'
,
path
:
'result'
,
component
:
dynamic
({
app
,
models
:
()
=>
[
import
(
'../models/form'
),
],
component
:
()
=>
import
(
'../routes/Forms/StepForm/Step3'
),
}),
}],
},
{
name
:
'高级表单'
,
path
:
'advanced-form'
,
component
:
dynamic
({
app
,
models
:
()
=>
[
import
(
'../models/form'
),
],
component
:
()
=>
import
(
'../routes/Forms/AdvancedForm'
),
}),
}],
},
{
name
:
'列表页'
,
path
:
'list'
,
icon
:
'table'
,
children
:
[{
name
:
'查询表格'
,
path
:
'table-list'
,
component
:
dynamic
({
app
,
models
:
()
=>
[
import
(
'../models/rule'
),
],
component
:
()
=>
import
(
'../routes/List/TableList'
),
}),
},
{
name
:
'标准列表'
,
path
:
'basic-list'
,
component
:
dynamic
({
app
,
models
:
()
=>
[
import
(
'../models/list'
),
],
component
:
()
=>
import
(
'../routes/List/BasicList'
),
}),
},
{
name
:
'卡片列表'
,
path
:
'card-list'
,
component
:
dynamic
({
app
,
models
:
()
=>
[
import
(
'../models/list'
),
],
component
:
()
=>
import
(
'../routes/List/CardList'
),
}),
},
{
name
:
'搜索列表(项目)'
,
path
:
'cover-card-list'
,
component
:
dynamic
({
app
,
models
:
()
=>
[
import
(
'../models/list'
),
],
component
:
()
=>
import
(
'../routes/List/CoverCardList'
),
}),
},
{
name
:
'搜索列表(应用)'
,
path
:
'filter-card-list'
,
component
:
dynamic
({
app
,
models
:
()
=>
[
import
(
'../models/list'
),
],
component
:
()
=>
import
(
'../routes/List/FilterCardList'
),
}),
},
{
name
:
'搜索列表(文章)'
,
path
:
'search'
,
component
:
dynamic
({
app
,
models
:
()
=>
[
import
(
'../models/list'
),
],
component
:
()
=>
import
(
'../routes/List/SearchList'
),
}),
}],
},
{
name
:
'详情页'
,
path
:
'profile'
,
icon
:
'profile'
,
children
:
[{
name
:
'基础详情页'
,
path
:
'basic'
,
component
:
dynamic
({
app
,
models
:
()
=>
[
import
(
'../models/profile'
),
],
component
:
()
=>
import
(
'../routes/Profile/BasicProfile'
),
}),
},
{
name
:
'高级详情页'
,
path
:
'advanced'
,
component
:
dynamic
({
app
,
models
:
()
=>
[
import
(
'../models/profile'
),
],
component
:
()
=>
import
(
'../routes/Profile/AdvancedProfile'
),
}),
}],
},
{
name
:
'结果'
,
path
:
'result'
,
icon
:
'check-circle-o'
,
children
:
[{
name
:
'成功'
,
path
:
'success'
,
component
:
dynamic
({
app
,
component
:
()
=>
import
(
'../routes/Result/Success'
),
}),
},
{
name
:
'失败'
,
path
:
'fail'
,
component
:
dynamic
({
app
,
component
:
()
=>
import
(
'../routes/Result/Error'
),
}),
}],
},
{
name
:
'异常'
,
path
:
'exception'
,
icon
:
'warning'
,
children
:
[{
name
:
'403'
,
path
:
'403'
,
component
:
dynamic
({
app
,
component
:
()
=>
import
(
'../routes/Exception/403'
),
}),
},
{
name
:
'404'
,
path
:
'404'
,
component
:
dynamic
({
app
,
component
:
()
=>
import
(
'../routes/Exception/404'
),
}),
},
{
name
:
'500'
,
path
:
'500'
,
component
:
dynamic
({
app
,
component
:
()
=>
import
(
'../routes/Exception/500'
),
}),
}],
}],
},
{
component
:
dynamic
({
app
,
component
:
()
=>
import
(
'../layouts/UserLayout'
),
}),
path
:
'/user'
,
layout
:
'UserLayout'
,
children
:
[{
name
:
'帐户'
,
icon
:
'user'
,
path
:
'user'
,
children
:
[{
name
:
'登录'
,
path
:
'login'
,
component
:
dynamic
({
app
,
models
:
()
=>
[
import
(
'../models/login'
),
],
component
:
()
=>
import
(
'../routes/User/Login'
),
}),
},
{
name
:
'注册'
,
path
:
'register'
,
component
:
dynamic
({
app
,
models
:
()
=>
[
import
(
'../models/register'
),
],
component
:
()
=>
import
(
'../routes/User/Register'
),
}),
},
{
name
:
'注册结果'
,
path
:
'register-result'
,
component
:
dynamic
({
app
,
component
:
()
=>
import
(
'../routes/User/RegisterResult'
),
}),
}],
}],
},
{
component
:
dynamic
({
app
,
component
:
()
=>
import
(
'../layouts/BlankLayout'
),
}),
layout
:
'BlankLayout'
,
children
:
{
name
:
'使用文档'
,
path
:
'http://pro.ant.design/docs/getting-started'
,
target
:
'_blank'
,
icon
:
'book'
,
icon
:
'check-circle-o'
,
children
:
[
{
name
:
'成功'
,
path
:
'success'
,
component
:
dy
(
app
,
[],
Success
),
},
{
name
:
'失败'
,
path
:
'fail'
,
component
:
dy
(
app
,
[],
Error
),
},
],
},
{
name
:
'异常'
,
path
:
'exception'
,
icon
:
'warning'
,
children
:
[
{
name
:
'403'
,
path
:
'403'
,
component
:
dy
(
app
,
[],
Exception403
),
},
{
name
:
'404'
,
path
:
'404'
,
component
:
dy
(
app
,
[],
Exception404
),
},
{
name
:
'500'
,
path
:
'500'
,
component
:
dy
(
app
,
[],
Exception500
),
},
],
},
],
},
{
component
:
dy
(
app
,
[],
UserLayout
),
path
:
'/user'
,
layout
:
'UserLayout'
,
children
:
[
{
name
:
'帐户'
,
icon
:
'user'
,
path
:
'user'
,
children
:
[
{
name
:
'登录'
,
path
:
'login'
,
component
:
dy
(
app
,
[
LoginModel
],
Login
),
},
{
name
:
'注册'
,
path
:
'register'
,
component
:
dy
(
app
,
[
RegisterModel
],
Register
),
},
{
name
:
'注册结果'
,
path
:
'register-result'
,
component
:
dy
(
app
,
[],
RegisterResult
),
},
],
},
],
},
{
component
:
dy
(
app
,
[],
BlankLayout
),
layout
:
'BlankLayout'
,
children
:
{
name
:
'使用文档'
,
path
:
'http://pro.ant.design/docs/getting-started'
,
target
:
'_blank'
,
icon
:
'book'
,
},
},
}
];
];
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