nav.js 5.93 KB
Newer Older
WhatAKitty's avatar
WhatAKitty committed
1
import dynamic from 'dva/dynamic';
2

nikogu's avatar
nikogu committed
3
// wrapper of dynamic
nikogu's avatar
nikogu committed
4
const dynamicWrapper = (app, models, component) => dynamic({
nikogu's avatar
nikogu committed
5
  app,
nikogu's avatar
nikogu committed
6
  models: () => models.map(m => import(`../models/${m}.js`)),
nikogu's avatar
nikogu committed
7 8 9 10 11 12
  component: () => component,
});

// nav data
export const getNavData = app => [
  {
nikogu's avatar
nikogu committed
13
    component: dynamicWrapper(app, ['user'], import('../layouts/BasicLayout')),
nikogu's avatar
nikogu committed
14 15 16 17 18 19 20 21 22 23 24 25
    layout: 'BasicLayout',
    name: '首页', // for breadcrumb
    path: '/',
    children: [
      {
        name: 'Dashboard',
        icon: 'dashboard',
        path: 'dashboard',
        children: [
          {
            name: '分析页',
            path: 'analysis',
nikogu's avatar
nikogu committed
26
            component: dynamicWrapper(app, ['chart'], import('../routes/Dashboard/Analysis')),
nikogu's avatar
nikogu committed
27 28 29 30
          },
          {
            name: '监控页',
            path: 'monitor',
nikogu's avatar
nikogu committed
31
            component: dynamicWrapper(app, ['monitor'], import('../routes/Dashboard/Monitor')),
nikogu's avatar
nikogu committed
32 33 34 35
          },
          {
            name: '工作台',
            path: 'workplace',
nikogu's avatar
nikogu committed
36
            component: dynamicWrapper(app, ['project', 'activities', 'chart'], import('../routes/Dashboard/Workplace')),
nikogu's avatar
nikogu committed
37 38 39 40 41 42 43 44 45 46 47
          },
        ],
      },
      {
        name: '表单页',
        path: 'form',
        icon: 'form',
        children: [
          {
            name: '基础表单',
            path: 'basic-form',
nikogu's avatar
nikogu committed
48
            component: dynamicWrapper(app, ['form'], import('../routes/Forms/BasicForm')),
nikogu's avatar
nikogu committed
49 50 51 52
          },
          {
            name: '分步表单',
            path: 'step-form',
nikogu's avatar
nikogu committed
53
            component: dynamicWrapper(app, ['form'], import('../routes/Forms/StepForm')),
nikogu's avatar
nikogu committed
54 55 56
            children: [
              {
                path: 'confirm',
nikogu's avatar
nikogu committed
57
                component: dynamicWrapper(app, ['form'], import('../routes/Forms/StepForm/Step2')),
nikogu's avatar
nikogu committed
58 59 60
              },
              {
                path: 'result',
nikogu's avatar
nikogu committed
61
                component: dynamicWrapper(app, ['form'], import('../routes/Forms/StepForm/Step3')),
nikogu's avatar
nikogu committed
62 63 64 65 66 67
              },
            ],
          },
          {
            name: '高级表单',
            path: 'advanced-form',
nikogu's avatar
nikogu committed
68
            component: dynamicWrapper(app, ['form'], import('../routes/Forms/AdvancedForm')),
nikogu's avatar
nikogu committed
69
          },
WhatAKitty's avatar
WhatAKitty committed
70
        ],
nikogu's avatar
nikogu committed
71 72
      },
      {
nikogu's avatar
nikogu committed
73 74 75 76 77 78 79
        name: '列表页',
        path: 'list',
        icon: 'table',
        children: [
          {
            name: '查询表格',
            path: 'table-list',
nikogu's avatar
nikogu committed
80
            component: dynamicWrapper(app, ['rule'], import('../routes/List/TableList')),
nikogu's avatar
nikogu committed
81 82 83 84
          },
          {
            name: '标准列表',
            path: 'basic-list',
nikogu's avatar
nikogu committed
85
            component: dynamicWrapper(app, ['list'], import('../routes/List/BasicList')),
nikogu's avatar
nikogu committed
86 87 88 89
          },
          {
            name: '卡片列表',
            path: 'card-list',
nikogu's avatar
nikogu committed
90
            component: dynamicWrapper(app, ['list'], import('../routes/List/CardList')),
nikogu's avatar
nikogu committed
91 92 93 94
          },
          {
            name: '搜索列表(项目)',
            path: 'cover-card-list',
nikogu's avatar
nikogu committed
95
            component: dynamicWrapper(app, ['list'], import('../routes/List/CoverCardList')),
nikogu's avatar
nikogu committed
96 97 98 99
          },
          {
            name: '搜索列表(应用)',
            path: 'filter-card-list',
nikogu's avatar
nikogu committed
100
            component: dynamicWrapper(app, ['list'], import('../routes/List/FilterCardList')),
nikogu's avatar
nikogu committed
101 102 103 104
          },
          {
            name: '搜索列表(文章)',
            path: 'search',
nikogu's avatar
nikogu committed
105
            component: dynamicWrapper(app, ['list'], import('../routes/List/SearchList')),
nikogu's avatar
nikogu committed
106 107 108 109 110 111 112 113 114 115 116
          },
        ],
      },
      {
        name: '详情页',
        path: 'profile',
        icon: 'profile',
        children: [
          {
            name: '基础详情页',
            path: 'basic',
nikogu's avatar
nikogu committed
117
            component: dynamicWrapper(app, ['profile'], import('../routes/Profile/BasicProfile')),
nikogu's avatar
nikogu committed
118 119 120 121
          },
          {
            name: '高级详情页',
            path: 'advanced',
nikogu's avatar
nikogu committed
122
            component: dynamicWrapper(app, ['profile'], import('../routes/Profile/AdvancedProfile')),
nikogu's avatar
nikogu committed
123 124 125 126 127
          },
        ],
      },
      {
        name: '结果',
afc163's avatar
afc163 committed
128
        path: 'result',
nikogu's avatar
nikogu committed
129 130 131 132 133
        icon: 'check-circle-o',
        children: [
          {
            name: '成功',
            path: 'success',
nikogu's avatar
nikogu committed
134
            component: dynamicWrapper(app, [], import('../routes/Result/Success')),
nikogu's avatar
nikogu committed
135 136 137 138
          },
          {
            name: '失败',
            path: 'fail',
nikogu's avatar
nikogu committed
139
            component: dynamicWrapper(app, [], import('../routes/Result/Error')),
nikogu's avatar
nikogu committed
140 141 142 143 144 145 146 147 148 149 150
          },
        ],
      },
      {
        name: '异常',
        path: 'exception',
        icon: 'warning',
        children: [
          {
            name: '403',
            path: '403',
nikogu's avatar
nikogu committed
151
            component: dynamicWrapper(app, [], import('../routes/Exception/403')),
nikogu's avatar
nikogu committed
152 153 154 155
          },
          {
            name: '404',
            path: '404',
nikogu's avatar
nikogu committed
156
            component: dynamicWrapper(app, [], import('../routes/Exception/404')),
nikogu's avatar
nikogu committed
157 158 159 160
          },
          {
            name: '500',
            path: '500',
nikogu's avatar
nikogu committed
161
            component: dynamicWrapper(app, [], import('../routes/Exception/500')),
nikogu's avatar
nikogu committed
162 163 164 165 166 167
          },
        ],
      },
    ],
  },
  {
nikogu's avatar
nikogu committed
168
    component: dynamicWrapper(app, [], import('../layouts/UserLayout')),
nikogu's avatar
nikogu committed
169 170 171 172 173 174 175 176 177 178 179
    path: '/user',
    layout: 'UserLayout',
    children: [
      {
        name: '帐户',
        icon: 'user',
        path: 'user',
        children: [
          {
            name: '登录',
            path: 'login',
nikogu's avatar
nikogu committed
180
            component: dynamicWrapper(app, ['login'], import('../routes/User/Login')),
nikogu's avatar
nikogu committed
181 182 183 184
          },
          {
            name: '注册',
            path: 'register',
nikogu's avatar
nikogu committed
185
            component: dynamicWrapper(app, ['register'], import('../routes/User/Register')),
nikogu's avatar
nikogu committed
186 187 188 189
          },
          {
            name: '注册结果',
            path: 'register-result',
nikogu's avatar
nikogu committed
190
            component: dynamicWrapper(app, [], import('../routes/User/RegisterResult')),
nikogu's avatar
nikogu committed
191 192 193 194 195 196
          },
        ],
      },
    ],
  },
  {
nikogu's avatar
nikogu committed
197
    component: dynamicWrapper(app, [], import('../layouts/BlankLayout')),
nikogu's avatar
nikogu committed
198 199 200 201 202 203 204
    layout: 'BlankLayout',
    children: {
      name: '使用文档',
      path: 'http://pro.ant.design/docs/getting-started',
      target: '_blank',
      icon: 'book',
    },
afc163's avatar
afc163 committed
205
  },
nikogu's avatar
nikogu committed
206
];