From 339d760771ec679cf92560b170e560b6f2db6d96 Mon Sep 17 00:00:00 2001 From: Pan Date: Fri, 17 Nov 2017 14:57:39 +0800 Subject: [PATCH] refactor:format code --- src/App.vue | 4 +- src/filters/index.js | 1 + src/icons/svg/documentation.svg | 1 + src/lang/en.js | 1 + src/lang/index.js | 8 ++-- src/lang/zh.js | 1 + src/mock/index.js | 1 + src/router/index.js | 33 ++++++++-------- src/styles/index.scss | 2 +- .../dashboard/admin/components/BarChart.vue | 2 +- .../dashboard/admin/components/BoxCard.vue | 2 +- src/views/dashboard/admin/index.vue | 8 ++-- src/views/documentation/index.vue | 39 +++++++++++++++++++ src/views/introduction/index.vue | 26 ------------- src/views/permission/index.vue | 3 +- src/views/svg-icons/index.vue | 1 + src/views/theme/index.vue | 2 +- 17 files changed, 77 insertions(+), 58 deletions(-) create mode 100644 src/icons/svg/documentation.svg create mode 100644 src/views/documentation/index.vue delete mode 100644 src/views/introduction/index.vue diff --git a/src/App.vue b/src/App.vue index 440937a9..1bfd3d5f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -11,6 +11,6 @@ diff --git a/src/filters/index.js b/src/filters/index.js index 224b7d2c..285a314b 100644 --- a/src/filters/index.js +++ b/src/filters/index.js @@ -4,6 +4,7 @@ function pluralize(time, label) { } return time + label + 's' } + export function timeAgo(time) { const between = Date.now() / 1000 - Number(time) if (between < 3600) { diff --git a/src/icons/svg/documentation.svg b/src/icons/svg/documentation.svg new file mode 100644 index 00000000..caf68ddb --- /dev/null +++ b/src/icons/svg/documentation.svg @@ -0,0 +1 @@ + diff --git a/src/lang/en.js b/src/lang/en.js index 7d5386a7..7b1e6094 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -2,6 +2,7 @@ export default { route: { dashboard: 'Dashboard', introduction: 'Introduction', + documentation: 'Documentation', permission: 'Permission', icons: 'Icons', components: 'Components', diff --git a/src/lang/index.js b/src/lang/index.js index 2c55ddc3..12b9cacb 100644 --- a/src/lang/index.js +++ b/src/lang/index.js @@ -1,10 +1,10 @@ import Vue from 'vue' -import elementEnLocale from 'element-ui/lib/locale/lang/en' -import elementZhLocale from 'element-ui/lib/locale/lang/zh-CN' -import enLocale from './en' -import zhLocale from './zh' import VueI18n from 'vue-i18n' import Cookies from 'js-cookie' +import elementEnLocale from 'element-ui/lib/locale/lang/en' // element-ui lang +import elementZhLocale from 'element-ui/lib/locale/lang/zh-CN'// element-ui lang +import enLocale from './en' +import zhLocale from './zh' Vue.use(VueI18n) diff --git a/src/lang/zh.js b/src/lang/zh.js index 37e5d65d..070d673f 100644 --- a/src/lang/zh.js +++ b/src/lang/zh.js @@ -2,6 +2,7 @@ export default { route: { dashboard: '首页', introduction: '简述', + documentation: '文档', permission: '权限测试页', icons: '图标', components: '组件', diff --git a/src/mock/index.js b/src/mock/index.js index 951c80d5..c2fbb7f0 100644 --- a/src/mock/index.js +++ b/src/mock/index.js @@ -23,4 +23,5 @@ Mock.mock(/\/search\/user/, 'get', remoteSearchAPI.searchUser) // 账单相关 Mock.mock(/\/transaction\/list/, 'get', transactionAPI.getList) + export default Mock diff --git a/src/router/index.js b/src/router/index.js index 52011bd6..926eea46 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,30 +1,30 @@ import Vue from 'vue' import Router from 'vue-router' const _import = require('./_import_' + process.env.NODE_ENV) -// in development env not use Lazy Loading,because Lazy Loading too many pages will cause webpack hot update too slow.so only in production use Lazy Loading +// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading; +// detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading Vue.use(Router) -/* layout */ +/* Layout */ import Layout from '../views/layout/Layout' /** -* hidden: true if `hidden:true` will not show in the sidebar(default is false) -* redirect: noredirect if `redirect:noredirect` will no redirct in the levelbar +* hidden: true if `hidden:true` will not show in the sidebar(default is false) +* redirect: noredirect if `redirect:noredirect` will no redirct in the breadcrumb +* name:'router-name' the name is used by (must set!!!) * meta : { - role: ['admin'] will control the page role - title: 'title' the name show in submenu and levelbar - icon: 'svg-name' the icon show in the sidebar, - noCache: true if fasle ,the page will no be cached(default is false) + role: ['admin','editor'] will control the page role (you can set multiple roles) + title: 'title' the name show in submenu and breadcrumb (recommend set) + icon: 'svg-name' the icon show in the sidebar, + noCache: true if fasle ,the page will no be cached(default is false) } **/ - export const constantRouterMap = [ { path: '/login', component: _import('login/index'), hidden: true }, { path: '/authredirect', component: _import('login/authredirect'), hidden: true }, { path: '/404', component: _import('errorPage/404'), hidden: true }, { path: '/401', component: _import('errorPage/401'), hidden: true }, - { path: '', component: Layout, @@ -36,16 +36,15 @@ export const constantRouterMap = [ meta: { title: 'dashboard', icon: 'dashboard' } }] }, - { - path: '/introduction', + path: '/documentation', component: Layout, - redirect: '/introduction/index', + redirect: '/documentation/index', children: [{ path: 'index', - component: _import('introduction/index'), - name: 'introduction', - meta: { title: 'introduction', icon: 'people' } + component: _import('documentation/index'), + name: 'documentation', + meta: { title: 'documentation', icon: 'documentation', noCache: true } }] } ] @@ -81,7 +80,7 @@ export const asyncRouterMap = [ path: 'index', component: _import('svg-icons/index'), name: 'icons', - meta: { title: 'icons', icon: 'icon' } + meta: { title: 'icons', icon: 'icon', noCache: true } }] }, diff --git a/src/styles/index.scss b/src/styles/index.scss index 4c9fa845..01b167b6 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,8 +1,8 @@ @import './mixin.scss'; @import './transition.scss'; -@import './btn.scss'; @import './element-ui.scss'; @import './sidebar.scss'; +@import './btn.scss'; body { height: 100%; diff --git a/src/views/dashboard/admin/components/BarChart.vue b/src/views/dashboard/admin/components/BarChart.vue index 34f32c88..5719aebf 100644 --- a/src/views/dashboard/admin/components/BarChart.vue +++ b/src/views/dashboard/admin/components/BarChart.vue @@ -7,7 +7,7 @@ import echarts from 'echarts' require('echarts/theme/macarons') // echarts 主题 import { debounce } from '@/utils' -const animationDuration = 3000 +const animationDuration = 6000 export default { props: { className: { diff --git a/src/views/dashboard/admin/components/BoxCard.vue b/src/views/dashboard/admin/components/BoxCard.vue index 3e92e9e8..6b8f37c7 100644 --- a/src/views/dashboard/admin/components/BoxCard.vue +++ b/src/views/dashboard/admin/components/BoxCard.vue @@ -93,7 +93,7 @@ export default { z-index: 100; height: 70px!important; width: 70px!important; - position: absolute; + position: absolute!important; top: -45px; left: 0px; border: 5px solid #ffffff; diff --git a/src/views/dashboard/admin/index.vue b/src/views/dashboard/admin/index.vue index ac146d7a..65285418 100644 --- a/src/views/dashboard/admin/index.vue +++ b/src/views/dashboard/admin/index.vue @@ -21,7 +21,7 @@
Messages
- +
@@ -32,7 +32,7 @@
Purchases
- +
@@ -43,7 +43,7 @@
Shoppings
- +
@@ -104,7 +104,7 @@ const lineChartData = { }, messages: { expectedData: [200, 192, 120, 144, 160, 130, 140], - actualData: [180, 160, 101, 106, 145, 150, 130] + actualData: [180, 160, 151, 106, 145, 150, 130] }, purchases: { expectedData: [80, 100, 121, 104, 105, 90, 100], diff --git a/src/views/documentation/index.vue b/src/views/documentation/index.vue new file mode 100644 index 00000000..25aa2e9d --- /dev/null +++ b/src/views/documentation/index.vue @@ -0,0 +1,39 @@ + + + + diff --git a/src/views/introduction/index.vue b/src/views/introduction/index.vue deleted file mode 100644 index 798bba3f..00000000 --- a/src/views/introduction/index.vue +++ /dev/null @@ -1,26 +0,0 @@ - - - diff --git a/src/views/permission/index.vue b/src/views/permission/index.vue index 5fdc28c9..df040deb 100644 --- a/src/views/permission/index.vue +++ b/src/views/permission/index.vue @@ -1,6 +1,6 @@