Commit ad1480db by 林家欣

新增首页和机构概况路由

parent f0f430bf
This source diff could not be displayed because it is too large. You can view the blob instead.
<template>
<el-menu router :default-active="$route.path">
<template>
<div class="menu-logo">
<!-- <router-link :to="{name:'home'}" class="span"> -->
<span><img src="../../assets/image/icon-menu-logo.png" alt="">链通万家</span>
<!-- </router-link> -->
</div>
<div class="menu-title">常用菜单</div>
<el-menu-item v-for="item in menu" :key="item.meta.name" :index="item.path">
<span>{{item.meta.name}}</span>
<i :class="item.meta.icon"></i>
</el-menu-item>
</template>
</el-menu>
</template>
<script>
import router from "@/router/index.js"
import {
mapState
} from "vuex"
export default {
data() {
return {
collapse: false,
menu: [],
roleId:[],
}
},
computed: {
...mapState({
userMenus: state => state.user.userMenus
})
},
methods: {
routerList(data){
const menuRoutes = data.filter(item => { return item.meta && item.meta.icon })
return menuRoutes.filter(item => {
const isInMenu = this.userMenus.some(auth => { return auth.path === item.path })
return isInMenu
})
}
},
mounted() {
this.menu = this.routerList(router.options.routes)
},
created() {
},
}
</script>
<style>
</style>
<template> <template>
<el-container class="layout"> <el-container class="layout">
<el-aside width="180px">
<Sidebar></Sidebar>
</el-aside>
<el-container> <el-container>
<el-header height="65px"> <el-header height="65px">
<Header></Header> <Header></Header>
...@@ -10,9 +7,9 @@ ...@@ -10,9 +7,9 @@
<el-main> <el-main>
<router-view></router-view> <router-view></router-view>
</el-main> </el-main>
<!-- <el-footer> <el-footer>
<Footer></Footer> <Footer></Footer>
</el-footer> --> </el-footer>
</el-container> </el-container>
</el-container> </el-container>
</template> </template>
...@@ -20,11 +17,9 @@ ...@@ -20,11 +17,9 @@
<script> <script>
import Header from "./layout/header.vue" import Header from "./layout/header.vue"
// import Footer from "./layout/footer.vue" // import Footer from "./layout/footer.vue"
import Sidebar from "./layout/sidebar.vue"
export default { export default {
components: { components: {
Header, Header,
Sidebar
}, },
data() { data() {
return { return {
......
...@@ -12,6 +12,28 @@ VueRouter.prototype.push = function push (to) { ...@@ -12,6 +12,28 @@ VueRouter.prototype.push = function push (to) {
const routes = [ const routes = [
{ {
path: "/Home",
name: "Home",
component: main,
meta: {
name: "首页"
},
children: [
{
path: "/",
component: () => import("@/views/Home/index")
},
{
path: "/Org",
name: "Org",
meta: {
name: "机构概况",
},
component: () => import("@/views/Org/index")
}
]
},
{
path: "/", path: "/",
redirect: "/login" redirect: "/login"
}, },
......
<template> <template>
<div></div> <div>
</template>
</div>
</template>
<script> <script>
export default {
data() {
return {
}
},
created() {
console.log(this.$route, 'this.$route');
},
}
</script> </script>
<style lang="scss" scoped>
<style lang="scss">
</style> </style>
\ No newline at end of file
<template> <template>
<div></div> <div>
ORG
</div>
</template> </template>
<script> <script>
export default {
data() {
return {
}
},
created() {
console.log(this.$route, 'this.$route');
},
}
</script> </script>
<style lang="scss" scoped>
<style lang="scss">
</style> </style>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment