Commit 9287779ac911857f66b0149df2da33126b59af0a

Authored by Andy
1 parent 00e29fae

add 官网嵌入车主平台 架构

src/components/SvgIcon/index.vue
1 1 <template>
2   - <div v-if="isExternal" :style="styleExternalIcon" class="svg-external-icon svg-icon" v-on="$listeners" />
3   - <svg v-else :class="svgClass" aria-hidden="true" v-on="$listeners">
  2 + <svg :class="svgClass" aria-hidden="true" v-on="$listeners">
4 3 <use :xlink:href="iconName" />
5 4 </svg>
6 5 </template>
7 6  
8 7 <script>
9   -// doc: https://panjiachen.github.io/vue-element-admin-site/feature/component/svg-icon.html#usage
10   -import { isExternal } from '@/utils/validate'
11   -
12   -export default {
13   - name: 'SvgIcon',
14   - props: {
15   - iconClass: {
16   - type: String,
17   - required: true
18   - },
19   - className: {
20   - type: String,
21   - default: ''
22   - }
23   - },
24   - computed: {
25   - isExternal() {
26   - return isExternal(this.iconClass)
27   - },
28   - iconName() {
29   - return `#icon-${this.iconClass}`
30   - },
31   - svgClass() {
32   - if (this.className) {
33   - return 'svg-icon ' + this.className
34   - } else {
35   - return 'svg-icon'
  8 + export default {
  9 + name: 'SvgIcon',
  10 + props: {
  11 + iconClass: {
  12 + type: String,
  13 + required: true
  14 + },
  15 + className: {
  16 + type: String,
  17 + default: ''
36 18 }
37 19 },
38   - styleExternalIcon() {
39   - return {
40   - mask: `url(${this.iconClass}) no-repeat 50% 50%`,
41   - '-webkit-mask': `url(${this.iconClass}) no-repeat 50% 50%`
  20 + computed: {
  21 + iconName() {
  22 + return `#icon-${this.iconClass}`
  23 + },
  24 + svgClass() {
  25 + if (this.className) {
  26 + return 'svg-icon ' + this.className
  27 + } else {
  28 + return 'svg-icon'
  29 + }
42 30 }
43 31 }
44 32 }
45   -}
46 33 </script>
47 34  
48 35 <style scoped>
49   -.svg-icon {
50   - width: 1em;
51   - height: 1em;
52   - vertical-align: -0.15em;
53   - fill: currentColor;
54   - overflow: hidden;
55   -}
56   -
57   -.svg-external-icon {
58   - background-color: currentColor;
59   - mask-size: cover!important;
60   - display: inline-block;
61   -}
  36 + .svg-icon {
  37 + width: 1em;
  38 + height: 1em;
  39 + vertical-align: -0.15em;
  40 + fill: currentColor;
  41 + overflow: hidden;
  42 + }
62 43 </style>
... ...
src/components/VHeader.vue
... ... @@ -38,7 +38,7 @@ export default {
38 38 }
39 39 </script>
40 40  
41   -<style scoped lang="scss">
  41 +<style lang="scss">
42 42 /* http://meyerweb.com/eric/tools/css/reset/
43 43 v4.0 | 20180602
44 44 License: none (public domain)
... ...
src/components/config.js deleted
1   -let config = {
2   - "entity": null,
3   - "childs": [
4   - {
5   - "entity": {
6   - "id": 1, //id标识
7   - "title": "中心首页", //菜单标题
8   - "icon": "el-icon-s-home",//菜单logo
9   - "url": "/views/dashboard",//菜单路径
10   - },
11   - },
12   - {
13   - "entity": {
14   - "id": 2,
15   - "title": "我的钱包",
16   - "icon": "el-icon-bank-card",
17   - "url": "example",
18   - },
19   - "childs": [
20   - {
21   - "entity": {
22   - "id": 2-1,
23   - "title": "我的账户",
24   - "url": "account",
25   - },
26   - "childs": null
27   - },
28   - {
29   - "entity": {
30   - "id": 2-2,
31   - "title": "我的卡券",
32   - "url": "cardticket",
33   - }
34   - },
35   - ]
36   - },
37   - {
38   - "entity": {
39   - "id": 3,
40   - "title": "我的订单",
41   - "icon": "el-icon-tickets",
42   - "url": "order",
43   - },
44   -
45   - },
46   - {
47   - "entity": {
48   - "id": 4,
49   - "title": "欠费补缴",
50   - "icon": "el-icon-document-checked",
51   - "url": "payback",
52   - }
53   - },
54   - {
55   - "entity": {
56   - "id": 5,
57   - "title": "我的车辆",
58   - "icon": "el-icon-truck",
59   - "url": "mycar",
60   - }
61   - },
62   - {
63   - "entity": {
64   - "id": 6,
65   - "title": "个人中心",
66   - "icon": "el-icon-s-custom",
67   - "url": "mycar",
68   - },
69   - "childs": [
70   - {
71   - "entity": {
72   - "id": 6-1,
73   - "title": "个人资料",
74   - "url": "information",
75   - },
76   - "childs": null
77   - },
78   - {
79   - "entity": {
80   - "id": 6-2,
81   - "title": "我的评价",
82   - "url": "myevaluate",
83   - }
84   - },
85   - ]
86   - },
87   - ]
88   -}
89   -export default config
src/layout/components/Navbar.vue
... ... @@ -2,7 +2,7 @@
2 2 <div class="navbar">
3 3 <hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
4 4  
5   - <!--<breadcrumb class="breadcrumb-container" />-->
  5 + <breadcrumb class="breadcrumb-container" />
6 6  
7 7 <div class="right-menu">
8 8 <el-dropdown class="avatar-container" trigger="click">
... ... @@ -11,9 +11,19 @@
11 11 <i class="el-icon-caret-bottom" />
12 12 </div>
13 13 <el-dropdown-menu slot="dropdown" class="user-dropdown">
14   -
  14 + <router-link to="/">
  15 + <el-dropdown-item>
  16 + Home
  17 + </el-dropdown-item>
  18 + </router-link>
  19 + <a target="_blank" href="https://github.com/PanJiaChen/vue-admin-template/">
  20 + <el-dropdown-item>Github</el-dropdown-item>
  21 + </a>
  22 + <a target="_blank" href="https://panjiachen.github.io/vue-element-admin-site/#/">
  23 + <el-dropdown-item>Docs</el-dropdown-item>
  24 + </a>
15 25 <el-dropdown-item divided>
16   - <span style="display:block;" @click="logout">退出</span>
  26 + <span style="display:block;" @click="logout">Log Out</span>
17 27 </el-dropdown-item>
18 28 </el-dropdown-menu>
19 29 </el-dropdown>
... ... @@ -23,12 +33,12 @@
23 33  
24 34 <script>
25 35 import { mapGetters } from 'vuex'
26   -// import Breadcrumb from '@/components/Breadcrumb'
  36 +import Breadcrumb from '@/components/Breadcrumb'
27 37 import Hamburger from '@/components/Hamburger'
28 38  
29 39 export default {
30 40 components: {
31   - // Breadcrumb,
  41 + Breadcrumb,
32 42 Hamburger
33 43 },
34 44 computed: {
... ...
src/layout/components/Sidebar/index.vue
... ... @@ -12,7 +12,7 @@
12 12 :collapse-transition="false"
13 13 mode="vertical"
14 14 >
15   - <sidebar-item v-for="route in routes" :key="route.path" :item="route" :base-path="route.path" />
  15 + <sidebar-item v-for="route in totalList" :key="route.path" :item="route" :base-path="route.path" />
16 16 </el-menu>
17 17 </el-scrollbar>
18 18 </div>
... ... @@ -51,6 +51,9 @@ export default {
51 51 isCollapse() {
52 52 return !this.sidebar.opened
53 53 }
54   - }
  54 + },
  55 + created(){
  56 + this.totalList = config.children
  57 + },
55 58 }
56 59 </script>
... ...
src/main.js
... ... @@ -4,7 +4,7 @@ import &#39;normalize.css/normalize.css&#39; // A modern alternative to CSS resets
4 4  
5 5 import ElementUI from 'element-ui'
6 6 import 'element-ui/lib/theme-chalk/index.css'
7   -import locale from 'element-ui/lib/locale/lang/en' // lang i18n
  7 +// import locale from 'element-ui/lib/locale/lang/en' // lang i18n
8 8  
9 9 import '@/styles/index.scss' // global css
10 10  
... ... @@ -34,7 +34,7 @@ Object.keys(filters).forEach(key =&gt; {
34 34 Vue.filter(key, filters[key])
35 35 })
36 36 // set ElementUI lang to EN
37   -Vue.use(ElementUI, { locale })
  37 +Vue.use(ElementUI)
38 38  
39 39 Vue.config.productionTip = false
40 40  
... ...
src/router/index.js
... ... @@ -4,7 +4,6 @@ import Router from &#39;vue-router&#39;
4 4 import Layout from '@/layout'
5 5 import home from '@/views/home'
6 6 // 引用 news 子路由配置文件
7   -import parkservice from './parkservice.js'
8 7 Vue.use(Router)
9 8  
10 9 /* Layout */
... ... @@ -56,12 +55,59 @@ export const constantRoutes = [
56 55 },
57 56 {
58 57 path: '/service',
59   - component: Layout,
  58 + redirect:'/dashboard',
  59 + component: () => import('@/views/service'),
60 60 meta: {
61 61 title: '停车服务'
62 62  
63 63 },
64   - children: parkservice
  64 + children:[
  65 + {
  66 + path: '/dashboard',
  67 + component: () => import('@/views/dashboard/index'),
  68 + meta: { title: '服务首页', icon: 'dashboard' }
  69 + },
  70 +
  71 + {
  72 + path: '/account',
  73 + component: () => import('@/views/account/index'),
  74 + meta: { title: '我的账户',icon: 'money' }
  75 +
  76 + },
  77 + {
  78 + path: '/cardticket',
  79 + component: () => import('@/views/cardticket/index'),
  80 + meta: { title: '我的卡券', icon: 'card' }
  81 + },
  82 +
  83 + {
  84 + path: '/order',
  85 + component: () => import('@/views/order/index'),
  86 + meta: { title: '我的订单', icon: 'form' }
  87 + },
  88 + {
  89 + path: '/payback',
  90 + component: () => import('@/views/payback/index'),
  91 + meta: { title: '欠费补缴', icon: 'nested' }
  92 + },
  93 +
  94 + {
  95 + path: '/mycar',
  96 + component: () => import('@/views/mycar/index'),
  97 + meta: { title: '我的车辆', icon: 'car' }
  98 +
  99 + },
  100 + {
  101 + path: '/information',
  102 + component: () => import('@/views/information/index'),
  103 + meta: { title: '个人资料' ,icon: 'people'}
  104 + },
  105 + {
  106 + path: '/myevaluate',
  107 + component: () => import('@/views/myevaluate/index'),
  108 + meta: { title: '我的评价',icon: 'skill' }
  109 + }
  110 + ]
65 111 },
66 112 {
67 113 path: '/center',
... ...
src/router/parkservice.js deleted
1   -
2   -
3   -export default [
4   -
5   - {
6   - path: '/dashboard',
7   - component: () => import('@/views/dashboard/index'),
8   - meta: { title: '服务首页', icon: 'dashboard' }
9   - },
10   -
11   - {
12   - path: '/account',
13   - component: () => import('@/views/account/index'),
14   - meta: { title: '我的账户',icon: 'money' }
15   -
16   - },
17   - {
18   - path: 'cardticket',
19   - component: () => import('@/views/cardticket/index'),
20   - meta: { title: '我的卡券', icon: 'card' }
21   - },
22   -
23   - {
24   - path: '/order',
25   - component: () => import('@/views/order/index'),
26   - meta: { title: '我的订单', icon: 'form' }
27   - },
28   - {
29   - path: '/payback',
30   - component: () => import('@/views/payback/index'),
31   - meta: { title: '欠费补缴', icon: 'nested' }
32   - },
33   -
34   - {
35   - path: '/mycar',
36   - component: () => import('@/views/mycar/index'),
37   - meta: { title: '我的车辆', icon: 'car' }
38   -
39   - },
40   - {
41   - path: '/information',
42   - component: () => import('@/views/information/index'),
43   - meta: { title: '个人资料' ,icon: 'people'}
44   - },
45   - {
46   - path: '/myevaluate',
47   - component: () => import('@/views/myevaluate/index'),
48   - meta: { title: '我的评价',icon: 'skill' }
49   - }
50   -]
51   -
src/styles/element-ui.scss
1 1 // cover some element-ui styles
2   -
  2 +@import url("//unpkg.com/element-ui@2.10.1/lib/theme-chalk/index.css");
3 3 .el-breadcrumb__inner,
4 4 .el-breadcrumb__inner a {
5 5 font-weight: 400 !important;
... ...
src/views/service.vue
  1 +
  2 +<template>
  3 + <div >
  4 + <el-container style="min-height: 550px">
  5 + <el-aside width="210px" style="background-color: rgb(84, 92, 100);">
  6 + <!--左侧菜单组件-->
  7 + <el-menu
  8 + default-active="2"
  9 + class="el-menu-vertical-demo"
  10 + @open="handleOpen"
  11 + @close="handleClose"
  12 + background-color="#545c64"
  13 + text-color="#fff"
  14 + active-text-color="#409eff" router>
  15 + <el-menu-item index="/dashboard" class="is-active">
  16 + <i class="el-icon-menu "></i>
  17 + <span slot="title">服务首页</span>
  18 + </el-menu-item>
  19 + <el-submenu index="1">
  20 + <template slot="title">
  21 + <i class="el-icon-bank-card"></i>
  22 + <span>我的钱包</span>
  23 + </template>
  24 + <el-menu-item index="/account">我的账户</el-menu-item>
  25 + <el-menu-item index="/cardticket">我的卡券</el-menu-item>
  26 + </el-submenu>
  27 + <el-menu-item index="/order">
  28 + <i class="el-icon-tickets"></i>
  29 + <span slot="title">我的订单</span>
  30 + </el-menu-item>
  31 + <el-menu-item index="/payback">
  32 + <i class="el-icon-finished"></i>
  33 + <span slot="title">欠费补缴</span>
  34 + </el-menu-item>
  35 + <el-menu-item index="/mycar">
  36 + <i class="el-icon-truck"></i>
  37 + <span slot="title">我的车辆</span>
  38 + </el-menu-item>
  39 + <el-submenu index="2">
  40 + <template slot="title">
  41 + <i class="el-icon-user-solid"></i>
  42 + <span>个人中心</span>
  43 + </template>
  44 + <el-menu-item index="/information">个人资料</el-menu-item>
  45 + <el-menu-item index="/myevaluate">我的评价</el-menu-item>
  46 + </el-submenu>
  47 + </el-menu>
  48 + </el-aside>
  49 +
  50 + <el-main class="app-container">
  51 + <router-view :key="key" />
  52 + </el-main>
  53 + </el-container>
  54 +
  55 + </div>
  56 +
  57 +</template>
  58 +
  59 +<script>
  60 + export default {
  61 + computed: {
  62 + key() {
  63 + return this.index
  64 + }
  65 + },
  66 + methods: {
  67 + handleOpen(key, keyPath) {
  68 + console.log(key, keyPath);
  69 + },
  70 + handleClose(key, keyPath) {
  71 + console.log(key, keyPath);
  72 + }
  73 + }
  74 + }
  75 +
  76 +</script>
  77 +<style scoped>
  78 +
  79 +</style>
... ...