diff --git a/src/components/dashboard/Dashboard.vue b/src/components/dashboard/Dashboard.vue index bd2b07e..6e926fc 100644 --- a/src/components/dashboard/Dashboard.vue +++ b/src/components/dashboard/Dashboard.vue @@ -123,7 +123,6 @@ import RankingList from '../chart/RankingList' import HotSearch from '../analysis/HotSearch' import SalesData from '../analysis/SalesData' - const rankList = [] for (let i = 0; i < 8; i++) { diff --git a/src/components/exception/403.vue b/src/components/exception/403.vue new file mode 100644 index 0000000..e209577 --- /dev/null +++ b/src/components/exception/403.vue @@ -0,0 +1,14 @@ + + + + + diff --git a/src/components/exception/404.vue b/src/components/exception/404.vue new file mode 100644 index 0000000..2ca74ec --- /dev/null +++ b/src/components/exception/404.vue @@ -0,0 +1,14 @@ + + + + + diff --git a/src/components/exception/500.vue b/src/components/exception/500.vue new file mode 100644 index 0000000..4bb36a4 --- /dev/null +++ b/src/components/exception/500.vue @@ -0,0 +1,14 @@ + + + + + diff --git a/src/components/exception/Exception.vue b/src/components/exception/Exception.vue new file mode 100644 index 0000000..c56b813 --- /dev/null +++ b/src/components/exception/Exception.vue @@ -0,0 +1,13 @@ + + + + + diff --git a/src/components/exception/ExceptionPage.vue b/src/components/exception/ExceptionPage.vue new file mode 100644 index 0000000..a88bc39 --- /dev/null +++ b/src/components/exception/ExceptionPage.vue @@ -0,0 +1,68 @@ + + + + + diff --git a/src/components/exception/typeConfig.js b/src/components/exception/typeConfig.js new file mode 100644 index 0000000..e37bbe1 --- /dev/null +++ b/src/components/exception/typeConfig.js @@ -0,0 +1,19 @@ +const config = { + 403: { + img: 'https://gw.alipayobjects.com/zos/rmsportal/wZcnGqRDyhPOEYFcZDnb.svg', + title: '403', + desc: '抱歉,你无权访问该页面' + }, + 404: { + img: 'https://gw.alipayobjects.com/zos/rmsportal/KpnpchXsobRgLElEozzI.svg', + title: '404', + desc: '抱歉,你访问的页面不存在或仍在开发中' + }, + 500: { + img: 'https://gw.alipayobjects.com/zos/rmsportal/RVRUAYdCGeYNBWoKiIwB.svg', + title: '500', + desc: '抱歉,服务器出错了' + } +} + +export default config diff --git a/src/components/layout/GloablLayout.vue b/src/components/layout/GloablLayout.vue index 99fc506..d365217 100644 --- a/src/components/layout/GloablLayout.vue +++ b/src/components/layout/GloablLayout.vue @@ -33,33 +33,7 @@ const ALayoutContent = ALayout.Content const ALayoutFooter = ALayout.Footer const minHeight = window.innerHeight - 64 - 48 -const menuData = [ - { - title: '统计分析', - path: '/dashboard' - }, - { - title: '图表', - path: '/chart', - icon: 'line-chart' - }, - { - title: '报表系统' - }, - { - title: '日志', - children: [ - { - title: '日志分析', - icon: 'none' - }, - { - title: '数据分析', - icon: 'none' - } - ] - } -] +let menuData = [] export default { name: 'GloablLayout', @@ -84,6 +58,9 @@ export default { toggleCollapse () { this.collapsed = !this.collapsed } + }, + beforeCreate () { + menuData = this.$router.options.routes } } diff --git a/src/components/menu/menu.js b/src/components/menu/menu.js index 6431708..d335767 100644 --- a/src/components/menu/menu.js +++ b/src/components/menu/menu.js @@ -65,7 +65,7 @@ export default { {attrs: {href: '#' + menu.path}}, [ this.renderIcon(h, menu.icon), - h('span', [menu.title]) + h('span', [menu.name]) ] ) ] @@ -77,7 +77,7 @@ export default { {slot: 'title'}, [ this.renderIcon(h, menu.icon), - h('span', [menu.title]) + h('span', [menu.name]) ] )] var itemArr = [] diff --git a/src/router/index.js b/src/router/index.js index 10321a9..74753c9 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,26 +1,144 @@ import Vue from 'vue' import Router from 'vue-router' import Dashboard from '@/components/dashboard/Dashboard' -import MiniArea from '@/components/chart/MiniArea' +import Exception from '@/components/exception/Exception' +import NotFound from '@/components/exception/404' +import NotPermit from '@/components/exception/403' +import ServerError from '@/components/exception/500' Vue.use(Router) export default new Router({ routes: [ { - path: '/', - name: 'hello', - component: Dashboard + path: '/dashboard', + name: 'Dashboard', + component: Dashboard, + icon: 'dashboard' }, { - path: '/dashboard', - name: 'dashboard', - component: Dashboard + path: '/form', + name: '表单页', + component: Exception, + icon: 'form', + children: [ + { + path: '/form/basic', + name: '基础表单', + component: NotFound, + icon: 'none' + }, + { + path: '/form/step', + name: '分步表单', + component: NotFound, + icon: 'none' + }, + { + path: '/form/advanced', + name: '高级表单', + component: NotFound, + icon: 'none' + } + ] + }, + { + path: '/list', + name: '列表页', + component: Exception, + icon: 'table', + children: [ + { + path: '/form/query', + name: '查询表格', + component: NotFound, + icon: 'none' + }, + { + path: '/form/primary', + name: '标准表格', + component: NotFound, + icon: 'none' + }, + { + path: '/form/card', + name: '卡片表格', + component: NotFound, + icon: 'none' + }, + { + path: '/form/search', + name: '搜索表格', + component: NotFound, + icon: 'none' + } + ] + }, + { + path: '/detail', + name: '详情页', + icon: 'profile', + component: Exception, + children: [ + { + path: '/detail/basic', + name: '基础详情页', + icon: 'none', + component: NotFound + }, + { + path: '/detail/advanced', + name: '高级详情页', + icon: 'none', + component: NotFound + } + ] + }, + { + path: '/result', + name: '详情页', + icon: 'check-circle-o', + component: Exception, + children: [ + { + path: '/result/success', + name: '成功', + icon: 'none', + component: NotFound + }, + { + path: '/result/failure', + name: '失败', + icon: 'none', + component: NotFound + } + ] }, { - path: '/chart', - name: 'chart', - component: MiniArea + path: '/exception', + name: '异常页', + icon: 'warning', + component: Exception, + children: [ + { + path: '/exception/404', + name: '404', + icon: 'none', + component: NotFound + }, + { + path: '/exception/403', + name: '403', + icon: 'none', + component: NotPermit + }, + { + path: '/exception/500', + name: '500', + icon: 'none', + component: ServerError + } + ] } ] })