戴艳蓉 3 năm trước cách đây
mục cha
commit
06f3bb2905

+ 1 - 1
.gitignore

@@ -1,6 +1,6 @@
 .DS_Store
 node_modules/
-# dist/
+dist/
 npm-debug.log*
 yarn-debug.log*
 yarn-error.log*

+ 14 - 0
babel.config.js

@@ -0,0 +1,14 @@
+module.exports = {
+  presets: [
+    // https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app
+    '@vue/cli-plugin-babel/preset'
+  ],
+  'env': {
+    'development': {
+      // babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require().
+      // This plugin can significantly increase the speed of hot updates, when you have a large number of pages.
+      // https://panjiachen.github.io/vue-element-admin-site/guide/advanced/lazy-loading.html
+      'plugins': ['dynamic-import-node']
+    }
+  }
+}

+ 24 - 0
jest.config.js

@@ -0,0 +1,24 @@
+module.exports = {
+  moduleFileExtensions: ['js', 'jsx', 'json', 'vue'],
+  transform: {
+    '^.+\\.vue$': 'vue-jest',
+    '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$':
+      'jest-transform-stub',
+    '^.+\\.jsx?$': 'babel-jest'
+  },
+  moduleNameMapper: {
+    '^@/(.*)$': '<rootDir>/src/$1'
+  },
+  snapshotSerializers: ['jest-serializer-vue'],
+  testMatch: [
+    '**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)'
+  ],
+  collectCoverageFrom: ['src/utils/**/*.{js,vue}', '!src/utils/auth.js', '!src/utils/request.js', 'src/components/**/*.{js,vue}'],
+  coverageDirectory: '<rootDir>/tests/unit/coverage',
+  // 'collectCoverage': true,
+  'coverageReporters': [
+    'lcov',
+    'text-summary'
+  ],
+  testURL: 'http://localhost/'
+}

+ 2 - 0
src/components/globalComponents/Breadcrumb/index.js

@@ -0,0 +1,2 @@
+import Main from './main.vue'
+export default Main

+ 93 - 0
src/components/globalComponents/Breadcrumb/main.vue

@@ -0,0 +1,93 @@
+<template>
+  <el-breadcrumb class="app-breadcrumb" separator="/">
+    <transition-group name="breadcrumb">
+      <el-breadcrumb-item v-for="(item, index) in levelList" :key="item.path">
+        <span
+          v-if="item.redirect === 'noRedirect' || index >0"
+          class="no-redirect"
+        >{{ item.meta.title }}</span>
+        <a v-else @click.prevent="handleLink(item)">{{ item.meta.title }}</a>
+      </el-breadcrumb-item>
+    </transition-group>
+  </el-breadcrumb>
+</template>
+
+<script>
+import pathToRegexp from 'path-to-regexp'
+
+export default {
+  name:'Breadcrumb',
+  data() {
+    return {
+      levelList: null
+    }
+  },
+  watch: {
+    $route(route) {
+      // if you go to the redirect page, do not update the breadcrumbs
+      if (route.path.startsWith('/redirect/')) {
+        return
+      }
+      this.getBreadcrumb()
+    }
+  },
+  created() {
+    this.getBreadcrumb()
+  },
+  methods: {
+    getBreadcrumb() {
+      // only show routes with meta.title
+      let matched = this.$route.matched.filter(
+        item => item.meta && item.meta.title
+      )
+      const first = matched[0]
+
+      if (!this.isDashboard(first)) {
+        matched = [{ path: '/welcome/dashboard', meta: { title: '首页' }}].concat(
+          matched
+        )
+      }
+
+      this.levelList = matched.filter(
+        item => item.meta && item.meta.title && item.meta.breadcrumb !== false
+      )
+    },
+    isDashboard(route) {
+      const name = route && route.name
+      if (!name) {
+        return false
+      }
+      return (
+        name.trim().toLocaleLowerCase() === 'Dashboard'.toLocaleLowerCase()
+      )
+    },
+    pathCompile(path) {
+      const { params } = this.$route
+      var toPath = pathToRegexp.compile(path)
+      return toPath(params)
+    },
+    handleLink(item) {
+      const { redirect, path } = item
+      if (redirect) {
+        window.vm.$router.push(redirect)
+        return
+      }
+      window.vm.$router.push(this.pathCompile(path))
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.app-breadcrumb.el-breadcrumb {
+  display: inline-block;
+  font-size: 14px;
+  line-height: 50px;
+  margin-left: 18px;
+
+  .no-redirect {
+    color: #97a8be;
+    cursor: text;
+  }
+}
+</style>

+ 34 - 0
src/components/globalComponents/Hamburger/main.vue

@@ -0,0 +1,34 @@
+<template>
+  <div style="padding: 0 15px;" @click="toggleClick">
+  <i :class="{'el-icon-s-fold':!isActive,'el-icon-s-unfold':isActive}" class="hamburger"></i>
+  
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'Hamburger',
+  props: {
+    isActive: {
+      type: Boolean,
+      default: false
+    }
+  },
+  methods: {
+    toggleClick() {
+      this.$emit('toggleClick')
+    }
+  }
+}
+</script>
+
+<style scoped>
+.hamburger {
+  display: inline-block;
+  vertical-align: middle;
+  font-size: 22px;
+
+}
+
+
+</style>

+ 6 - 4
src/layout/components/Navbar.vue

@@ -1,12 +1,14 @@
 <template>
   <div class="navbar">
-    <!-- <hamburger
+    <hamburger
       id="hamburger-container"
       :is-active="sidebar.opened"
       class="hamburger-container"
       @toggleClick="toggleSideBar"
-    /> -->
-    <mainMenu />
+    />
+    <!-- <mainMenu /> -->
+
+    <breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
 
     <div class="right-menu">
       <template v-if="device !== 'mobile'">
@@ -234,7 +236,7 @@ export default {
       }
     },
     toggleSideBar() {
-      this.$route.this.$store.dispatch("app/toggleSideBar");
+      this.$store.dispatch("app/toggleSideBar");
     },
     async logout() {
       await this.$store.dispatch("user/logout");

+ 41 - 0
src/layout/components/Sidebar/Item.vue

@@ -0,0 +1,41 @@
+<script>
+export default {
+  name: 'MenuItem',
+  functional: true,
+  props: {
+    icon: {
+      type: String,
+      default: ''
+    },
+    title: {
+      type: String,
+      default: ''
+    }
+  },
+  render(h, context) {
+    const { icon, title } = context.props
+    const vnodes = []
+
+    if (icon) {
+      if (icon.includes('el-icon')) {
+        vnodes.push(<i class={[icon, 'sub-el-icon']} />)
+      } else {
+        vnodes.push(<svg-icon icon-class={icon}/>)
+      }
+    }
+
+    if (title) {
+      vnodes.push(<span slot='title'>{(title)}</span>)
+    }
+    return vnodes
+  }
+}
+</script>
+
+<style scoped>
+.sub-el-icon {
+  color: currentColor;
+  width: 1em;
+  height: 1em;
+}
+</style>

+ 43 - 0
src/layout/components/Sidebar/Link.vue

@@ -0,0 +1,43 @@
+<template>
+  <component :is="type" v-bind="linkProps(to)">
+    <slot />
+  </component>
+</template>
+
+<script>
+import { isExternal } from '@/utils/validate'
+
+export default {
+  props: {
+    to: {
+      type: String,
+      required: true
+    }
+  },
+  computed: {
+    isExternal() {
+      return isExternal(this.to)
+    },
+    type() {
+      if (this.isExternal) {
+        return 'a'
+      }
+      return 'router-link'
+    }
+  },
+  methods: {
+    linkProps(to) {
+      if (this.isExternal) {
+        return {
+          href: to,
+          target: '_blank',
+          rel: 'noopener'
+        }
+      }
+      return {
+        to: to
+      }
+    }
+  }
+}
+</script>

+ 5 - 4
src/layout/components/Sidebar/Logo.vue

@@ -7,8 +7,8 @@
         class="sidebar-logo-link"
         to="/welcome/dashboard"
       >
-        <!-- <img v-if="logo" :src="logo" class="sidebar-logo" v-else > -->
-        <h1 class="sidebar-title">{{ title }}</h1>
+        <img v-if="logo" :src="logo" class="sidebar-logo"  >
+        <h1 v-else class="sidebar-title">{{ title }}</h1>
       </router-link>
       <router-link
         v-else
@@ -16,7 +16,7 @@
         class="sidebar-logo-link"
         to="/welcome/dashboard"
       >
-        <!-- <img v-if="logo" :src="logo" class="sidebar-logo"> -->
+        <img v-if="logo" :src="logo" class="sidebar-logo">
         <h1 class="sidebar-title">{{ title }}</h1>
       </router-link>
     </transition>
@@ -35,7 +35,8 @@ export default {
   data() {
     return {
       title: "采销平台订单系统",
-      logo: require("@/assets/img/logo.gif"),
+      logo:  'https://wpimg.wallstcn.com/69a1c46c-eb1c-4b46-8bd4-e9e686ef5251.png'
+      //require("@/assets/img/logo.gif"),
     };
   },
 };

+ 118 - 0
src/layout/components/Sidebar/SidebarItem.vue

@@ -0,0 +1,118 @@
+<template>
+  <div v-if="!item.hidden">
+    <template
+      v-if="
+        hasOneShowingChild(item.children, item) &&
+        (!onlyOneChild.children || onlyOneChild.noShowingChildren) &&
+        !item.alwaysShow
+      "
+    >
+      <!-- <div>{{ item.path }}</div> -->
+      <app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)">
+        <el-menu-item
+          :index="resolvePath(onlyOneChild.path)"
+          :class="{ 'submenu-title-noDropdown': !isNest }"
+        >
+          <item
+            :icon="onlyOneChild.meta.icon || (item.meta && item.meta.icon)"
+            :title="onlyOneChild.meta.title"
+          />
+        </el-menu-item>
+      </app-link>
+    </template>
+
+    <el-submenu
+      v-else
+      ref="subMenu"
+      :index="resolvePath(item.path)"
+      popper-append-to-body
+    >
+      <template slot="title">
+        <item
+          v-if="item.meta"
+          :icon="item.meta && item.meta.icon"
+          :title="item.meta.title"
+        />
+      </template>
+      <sidebar-item
+        v-for="child in item.children"
+        :key="child.path"
+        :is-nest="true"
+        :item="child"
+        :base-path="resolvePath(child.path)"
+        class="nest-menu"
+      />
+    </el-submenu>
+  </div>
+  <div v-else>{{ item }}</div>
+</template>
+
+<script>
+import path from "path";
+import { isExternal } from "@/utils/validate";
+import Item from "./Item";
+import AppLink from "./Link";
+import FixiOSBug from "./FixiOSBug";
+
+export default {
+  name: "SidebarItem",
+  components: { Item, AppLink },
+  mixins: [FixiOSBug],
+  props: {
+    // route object
+    item: {
+      type: Object,
+      required: true,
+    },
+    isNest: {
+      type: Boolean,
+      default: false,
+    },
+    basePath: {
+      type: String,
+      default: "",
+    },
+  },
+  data() {
+    // To fix https://github.com/PanJiaChen/vue-admin-template/issues/237
+    // TODO: refactor with render function
+    this.onlyOneChild = null;
+    return {};
+  },
+  methods: {
+    hasOneShowingChild(children = [], parent) {
+      const showingChildren = children.filter((item) => {
+        if (item.hidden) {
+          return false;
+        } else {
+          // Temp set(will be used if only has one showing child)
+          this.onlyOneChild = item;
+          return true;
+        }
+      });
+
+      // When there is only one child router, the child router is displayed by default
+      if (showingChildren.length === 1) {
+        return true;
+      }
+
+      // Show parent if there are no child router to display
+      if (showingChildren.length === 0) {
+        this.onlyOneChild = { ...parent, path: "", noShowingChildren: true };
+        return true;
+      }
+
+      return false;
+    },
+    resolvePath(routePath) {
+      if (isExternal(routePath)) {
+        return routePath;
+      }
+      if (isExternal(this.basePath)) {
+        return this.basePath;
+      }
+      return path.resolve(this.basePath, routePath);
+    },
+  },
+};
+</script>

+ 17 - 58
src/layout/components/Sidebar/index.vue

@@ -3,28 +3,21 @@
     <logo v-if="showLogo" :collapse="isCollapse" />
     <el-scrollbar wrap-class="scrollbar-wrapper">
       <el-menu
-        v-if="menuList && menuList.length > 0"
         :default-active="activeMenu"
         :collapse="isCollapse"
-        router
         :background-color="variables.menuBg"
         :text-color="variables.menuText"
-        :active-text-color="variables.menuActiveText"
         :unique-opened="false"
+        :active-text-color="variables.menuActiveText"
         :collapse-transition="false"
         mode="vertical"
       >
-        <template v-for="(route, index) in menuList">
-          <el-menu-item
-            v-if="!route.hidden"
-            :key="route.path + index"
-            :route="route.path"
-            :index="index + ''"
-          >
-            <i :class="route.meta.icon"></i>
-            <span slot="title">{{ route.meta.title }}</span>
-          </el-menu-item>
-        </template>
+        <sidebar-item
+          v-for="route in navList"
+          :key="route.path"
+          :item="route"
+          :base-path="route.path"
+        />
       </el-menu>
     </el-scrollbar>
   </div>
@@ -33,64 +26,30 @@
 <script>
 import { mapGetters } from "vuex";
 import Logo from "./Logo";
+import SidebarItem from "./SidebarItem";
 import variables from "@/styles/variables.scss";
 
 export default {
-  components: {
-    Logo,
-  },
-  data() {
-    return {
-      active: -1,
-      menuList: [],
-    };
-  },
+  components: { SidebarItem, Logo },
   computed: {
     ...mapGetters(["navList", "sidebar"]),
     activeMenu() {
       const route = this.$route;
-      const { path } = route;
-      let list = path.split("/");
-      return (
-        this.menuList.findIndex((v1) => v1.path === list[list.length - 1]) + ""
-      );
+      const { meta, path } = route;
+      // if set path, the sidebar will highlight the path you set
+      if (meta.activeMenu) {
+        return meta.activeMenu;
+      }
+      return path;
     },
     showLogo() {
-      return true;
+      return this.$store.state.settings.sidebarLogo;
     },
     variables() {
       return variables;
     },
     isCollapse() {
-      return !true;
-    },
-  },
-  watch: {
-    $route(route) {
-      if (route.path.startsWith("/redirect/")) {
-        return;
-      }
-      this.getBreadcrumb();
-    },
-  },
-  mounted() {
-    this.getBreadcrumb();
-  },
-  methods: {
-    getBreadcrumb() {
-      let matched = this.$route.matched.filter(
-        (item) => item.meta && item.meta.title
-      );
-
-      let index = -1;
-      if (matched.length > 1 && matched[0] && matched[0].path) {
-        const { path } = matched[0];
-        index = this.navList.findIndex((v1) => v1.path === path);
-      }
-      if (index !== this.active) {
-        this.menuList = this.navList[index].children;
-        this.active = index;
-      }
+      return !!this.sidebar.opened;
     },
   },
 };

+ 7 - 8
src/layout/index.vue

@@ -1,10 +1,10 @@
 <template>
   <div :class="classObj" class="app-wrapper">
-    <!-- <div
+    <div
       v-if="device === 'mobile' && sidebar.opened"
       class="drawer-bg"
       @click="handleClickOutside"
-    /> -->
+    />
     <sidebar class="sidebar-container" />
     <div :class="{ hasTagsView: needTagsView }" class="main-container">
       <div :class="{ 'fixed-header': fixedHeader }">
@@ -20,7 +20,7 @@
 </template>
 
 <script>
-import { AppMain, Navbar, Settings, Sidebar, TagsView } from "./components";
+import { AppMain, Navbar,  Sidebar, TagsView } from "./components";
 import ResizeMixin from "./mixin/ResizeHandler";
 import { mapState } from "vuex";
 
@@ -29,7 +29,7 @@ export default {
   components: {
     AppMain,
     Navbar,
-    Settings,
+    // Settings,
     Sidebar,
     TagsView,
   },
@@ -38,18 +38,17 @@ export default {
     ...mapState({
       sidebar: (state) => state.app.sidebar,
       device: (state) => state.app.device,
-      showSettings: (state) => state.settings.showSettings,
+      // showSettings: (state) => state.settings.showSettings,
       needTagsView: (state) => state.settings.tagsView,
       fixedHeader: (state) => state.settings.fixedHeader,
     }),
     classObj() {
       return {
         hideSidebar: false,
-        // !this.sidebar.opened,
+      openSidebar: this.sidebar.opened,
         openSidebar: this.sidebar.opened,
         withoutAnimation: this.sidebar.withoutAnimation,
-        mobile: false
-        //this.device === "mobile",
+        mobile: this.device === 'mobile'
       };
     },
   },

+ 40 - 4
src/settings.js

@@ -1,5 +1,41 @@
+// module.exports = {
+//   title: '采销平台订单系统',
+//   /**
+//    * @type {boolean} true | false
+//    * @description Whether show the settings right-panel
+//    */
+//   showSettings: true,
+
+//   /**
+//    * @type {boolean} true | false
+//    * @description Whether need tagsView
+//    */
+//   tagsView: true,
+
+//   /**
+//    * @type {boolean} true | false
+//    * @description Whether fix the header
+//    */
+//   fixedHeader: true,
+
+//   /**
+//    * @type {boolean} true | false
+//    * @description Whether show the logo in sidebar
+//    */
+//   sidebarLogo: true,
+
+//   /**
+//    * @type {string | array} 'production' | ['production', 'development']
+//    * @description Need show err logs component.
+//    * The default is only used in the production env
+//    * If you want to also use it in dev, you can pass ['production', 'development']
+//    */
+//   errorLog: 'production'
+// }
+
 module.exports = {
-  title: '采销平台订单系统',
+  title: 'Vue Element Admin',
+
   /**
    * @type {boolean} true | false
    * @description Whether show the settings right-panel
@@ -10,19 +46,19 @@ module.exports = {
    * @type {boolean} true | false
    * @description Whether need tagsView
    */
-  tagsView: false,
+  tagsView: true,
 
   /**
    * @type {boolean} true | false
    * @description Whether fix the header
    */
-  fixedHeader: true,
+  fixedHeader: false,
 
   /**
    * @type {boolean} true | false
    * @description Whether show the logo in sidebar
    */
-  sidebarLogo: true,
+  sidebarLogo: false,
 
   /**
    * @type {string | array} 'production' | ['production', 'development']

+ 158 - 25
src/store/modules/user.js

@@ -9,9 +9,9 @@ import {
   getBtn,
   setBtn,
   removeBtn,
-  getMainList,
-  setMainList,
-  removeMainList
+  // getMainList,
+  // setMainList,
+  // removeMainList
 } from '@/utils/auth'
 
 const state = {
@@ -22,7 +22,7 @@ const state = {
   roles: ['admin'],
   btnList: getBtn(),
   navList: getMenu(),
-  mainList: getMainList(),
+  // mainList: getMainList(),
 }
 
 const mutations = {
@@ -47,13 +47,13 @@ const mutations = {
   SET_ROLES: (state, roles) => {
     state.roles = roles
   },
-  mainListFn(state, val) {
-    if (!val) {
-      val = [];
-    }
-    state.mainList = val;
-    setMainList(val)
-  },
+  // mainListFn(state, val) {
+  //   if (!val) {
+  //     val = [];
+  //   }
+  //   state.mainList = val;
+  //   setMainList(val)
+  // },
   navListFn(state, val) {
     if (!val) {
       val = [];
@@ -120,25 +120,18 @@ const actions = {
           list = list.filter((item) => item.child && item.child.length > 0)
           let arrag = []
           let btnList = []
-          let mainMenu = []
+          console.log(list)
           list.forEach(v1 => {
             let pItem = {
               name: v1.menu_route,
               path: `/${v1.menu_route}`,
-              hidden: parseInt(v1.is_display + "") === 0,
               meta: {
                 title: v1.menu_name,
                 icon: v1.menu_img
               },
               children: []
             }
-            let mitem = Object.assign({ child: `/${v1.menu_route}/` }, pItem)
-            delete mitem['children']
-            mainMenu.push(mitem)
-            v1.child.forEach((v2, i2) => {
-              if (i2 === 0) {
-                mitem.child += v2.menu_route
-              }
+            v1.child.forEach(v2 => {
               let item = {
                 path: v2.menu_route,
                 name: v2.menu_route,
@@ -158,8 +151,8 @@ const actions = {
             })
             arrag.push(pItem)
           })
-          //生成主菜单
-          commit("mainListFn", mainMenu);
+          console.log(arrag);
+
           // 生成页面权限
           commit("navListFn", arrag);
           // 生成按钮权限
@@ -173,6 +166,68 @@ const actions = {
         } else {
           resolve(res)
         }
+
+
+
+        // let res = await menuList({})
+        // if (res.code === 0) {
+        //   let list = res.data
+        //   list = list.filter((item) => item.child && item.child.length > 0)
+        //   let arrag = []
+        //   let btnList = []
+        //   let mainMenu = []
+        //   list.forEach(v1 => {
+        //     let pItem = {
+        //       name: v1.menu_route,
+        //       path: `/${v1.menu_route}`,
+        //       hidden: parseInt(v1.is_display + "") === 0,
+        //       meta: {
+        //         title: v1.menu_name,
+        //         icon: v1.menu_img
+        //       },
+        //       children: []
+        //     }
+        //     let mitem = Object.assign({ child: `/${v1.menu_route}/` }, pItem)
+        //     delete mitem['children']
+        //     mainMenu.push(mitem)
+        //     v1.child.forEach((v2, i2) => {
+        //       if (i2 === 0) {
+        //         mitem.child += v2.menu_route
+        //       }
+        //       let item = {
+        //         path: v2.menu_route,
+        //         name: v2.menu_route,
+        //         hidden: parseInt(v2.is_display + "") === 0,
+        //         meta: {
+        //           title: v2.menu_name,
+        //           icon: v2.menu_img
+        //         },
+        //         url: v2.menu_url
+        //       }
+        //       let model = {
+        //         menu_route: v2.menu_route,
+        //         action: v2.action
+        //       }
+        //       btnList.push(model)
+        //       pItem.children.push(item)
+        //     })
+        //     arrag.push(pItem)
+        //   })
+        //   //生成主菜单
+        //   commit("mainListFn", mainMenu);
+        //   // 生成页面权限
+        //   commit("navListFn", arrag);
+        //   // 生成按钮权限
+        //   commit("btnListFn", btnList);
+        //   // 生成路由
+        //   initRouter(arrag, that);
+        //   // state.commit("loginInfoCommit", res.data);
+        //   resolve("success")
+        // } else if (res.code === 101 || res.code === 102) {
+        //   resolve("noToken")
+        // } else {
+        //   resolve(res)
+        // }
       }
     })
   },
@@ -190,7 +245,7 @@ const actions = {
 
       removeMenu()
       removeBtn()
-      removeMainList()
+      // removeMainList()
       // reset visited views and cached views
       // to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485
       dispatch('tagsView/delAllViews', null, { root: true })
@@ -211,8 +266,6 @@ const actions = {
 
 }
 
-
-
 function initRouter(arr) {
   const IndexRoute = [
 
@@ -293,6 +346,86 @@ function initRouter(arr) {
   window.vm.$router.addRoutes(IndexRoute);
 }
 
+// function initRouter(arr) {
+//   const IndexRoute = [
+
+//     // 个人信息
+//     {
+//       path: '/person',
+//       component: () => import('@/layout/index'),
+//       redirect: '/person/my-message',
+//       hidden: true,
+//       alwaysShow: true,
+//       meta: {
+//         title: '个人中心',
+//         icon: 'user'
+//       },
+//       children: [
+//         {
+//           path: 'my-message',
+//           component: () => import('@/views/person-infor/my-message'),
+//           name: 'MyMessage',
+//           alwaysShow: true,
+//           meta: { title: '我的信息', noCache: true, breadcrumb: true }
+//         },
+//         {
+//           path: 'change-phone',
+//           component: () => import('@/views/person-infor/change-phone'),
+//           name: 'ChangePhone',
+//           alwaysShow: true,
+//           meta: { title: '更换手机号', noCache: true, breadcrumb: true }
+//         },
+//         {
+//           path: 'change-password',
+//           component: () => import('@/views/person-infor/change-password'),
+//           name: 'ChangePassword',
+//           alwaysShow: true,
+//           meta: { title: '修改密码', noCache: true, breadcrumb: true }
+//         }
+//       ]
+//     },
+//     //欢迎页
+//     {
+//       path: '/welcome',
+//       component: () => import('@/layout/index'),
+//       redirect: '/welcome/dashboard',
+//       children: [
+//         {
+//           path: 'dashboard',
+//           component: () => import('@/views/dashboard/index'),
+//           name: 'Dashboard',
+//           meta: { title: '首页', icon: 'dashboard', affix: true }
+//         },
+//       ]
+//     },
+//   ];
+
+//   arr.map(v1 => {
+//     v1.component = (resolve) => require([`@/layout/index.vue`], resolve)
+//     if (v1.children && v1.children.length > 0) {
+//       v1.redirect = `/${v1.name}/${v1.children[0].name}`
+//       v1.children.map(v2 => {
+//         v2.component = (resolve) => require([`@/views/${v2.url}.vue`], resolve)
+//         return v2
+//       })
+//     }
+//     return v1
+//   })
+//   IndexRoute.push(...arr)
+//   IndexRoute.push({
+//     path: '404',
+//     component: () => import('@/views/error-page/404'),
+//     hidden: false,
+//     noCache: true
+//   })
+
+//   IndexRoute.push({
+//     path: "*",
+//     redirect: '/404',
+//   })
+//   window.vm.$router.addRoutes(IndexRoute);
+// }
+
 export default {
   namespaced: true,
   state,

+ 1 - 0
src/styles/sidebar.scss

@@ -72,6 +72,7 @@
       height: 100%;
       width: 100% !important;
     }
+    
 
     // menu hover
     .submenu-title-noDropdown,

+ 1 - 1
src/styles/variables.scss

@@ -21,7 +21,7 @@ $subMenuHover: #7ad3eb;
 
 
 
-$sideBarWidth: 200px;
+$sideBarWidth: 210px;
 
 // the :export directive is the magic sauce for webpack
 // https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass