路由修改

Lvtianfang
杜函宇 2 years ago
parent d0f29210dd
commit d4867874a7

@ -1,4 +1,4 @@
<template> <!-- TODO:标签页 --> <template>
<div id="tags-view-container" class="tags-view-container"> <div id="tags-view-container" class="tags-view-container">
<scroll-pane <scroll-pane
ref="scrollPane" ref="scrollPane"
@ -26,7 +26,7 @@
</div> </div>
</router-link> </router-link>
</scroll-pane> </scroll-pane>
<!-- <el-dropdown class="avatar-container" trigger="click"> <el-dropdown class="avatar-container" trigger="click">
<div class="avatar-wrapper"> <div class="avatar-wrapper">
<span class="user-name" style="margin-right: 3px">操作</span> <span class="user-name" style="margin-right: 3px">操作</span>
<i class="el-icon-caret-bottom" /> <i class="el-icon-caret-bottom" />
@ -39,7 +39,7 @@
<span>关闭当前</span> <span>关闭当前</span>
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> --> </el-dropdown>
<!-- <ul <!-- <ul
v-show="visible" v-show="visible"
:style="{ left: left + 'px', top: top + 'px' }" :style="{ left: left + 'px', top: top + 'px' }"

@ -16,19 +16,11 @@ const whiteList = [
"/login", "/login",
"/register", "/register",
"/index", "/index",
"/netWorkStat", '/drugArchives',
"/censor", '/cosmeticsArchives',
"/personalData", '/health',
"/changePassword", '/productInfo',
"/statistics", '/cosmeticsDetail'
"/administrative",
"/A/enterpriseMsg",
'/productsMsg/drugArchives',
'/productsMsg/cosmeticsArchives',
'/productsMsg/health',
'/productsMsg/productInfo',
'/B/logout'
]; ];
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
NProgress.start(); NProgress.start();

@ -61,87 +61,44 @@ export const constantRoutes = [
component: () => import("@/views/error/401"), component: () => import("@/views/error/401"),
hidden: true, hidden: true,
}, },
{ {
path: '', path: '',
component: () => import("@/views/index"), component: () => import("@/views/index"),
redirect: "/administrative",
isDiy: true,
children: [
{
path: "/administrative",
name: "行政审批",
icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/administrative/index"),
meta: { title: "行政审批", icon: "netWork" },
},
]
},
{
path: '/A',
component: () => import("@/views/index"),
redirect: "enterpriseMsg",
isDiy: true,
children: [
{
path: 'enterpriseMsg',
name: "企业档案",
icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/enterpriseMsg/index"),
meta: { title: "企业档案", icon: "netWork" },
},
]
},
{
path: '/B',
component: () => import("@/views/index"),
redirect: "logout",
isDiy: true,
children: [
{
path: "logout",
name: "依法注销",
icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/logout/index"),
meta: { title: "依法注销", icon: "netWork" },
},
]
},
{
path: '/productsMsg',
component: () => import("@/views/index"),
redirect: "drugArchives", redirect: "drugArchives",
isDiy: true, isDiy: true,
children: [ children: [
{ {
path: "drugArchives", path: "/drugArchives",
name: "药品档案", name: "药品档案",
icon: require("@/assets/images/tree4.svg"), icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/productsMsg/index.vue"), component: () => import("@/views/productsMsg/index.vue"),
meta: { title: "药品档案", icon: "netWork" }, meta: { title: "药品档案", icon: "netWork" },
}, },
{ {
path: "cosmeticsArchives", path: "/cosmeticsArchives",
name: "化妆品档案", name: "化妆品档案",
icon: require("@/assets/images/tree4.svg"), icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/productsMsg/components/cosmeticsArchives.vue"), component: () => import("@/views/productsMsg/components/cosmeticsArchives.vue"),
meta: { title: "化妆品档案", icon: "netWork" }, meta: { title: "化妆品档案", icon: "netWork" },
}, },
{ {
path: "cosmeticsDetail", path: "/cosmeticsDetail",
name: "化妆品详情", name: "化妆品详情",
icon: require("@/assets/images/tree4.svg"), icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/cosmeticsFile/detail.vue"), component: () => import("@/views/cosmeticsFile/detail.vue"),
meta: { title: "化妆品详情", icon: "netWork" }, meta: { title: "化妆品详情", icon: "netWork" },
}, },
{ {
path: "health", path: "/health",
name: "医疗器械档案", name: "医疗器械档案",
icon: require("@/assets/images/tree4.svg"), icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/productsMsg/components/health.vue"), component: () => import("@/views/productsMsg/components/health.vue"),
meta: { title: "医疗器械档案", icon: "netWork" }, meta: { title: "医疗器械档案", icon: "netWork" },
}, },
{ {
path: "productInfo", path: "/productInfo",
name: "productInfo", name: "productInfo",
component:() => import("@/views/productsMsg/components/productInfo.vue"), component:() => import("@/views/productsMsg/components/productInfo.vue"),
meta: { title: "产品档案", icon: "netWork" }, meta: { title: "产品档案", icon: "netWork" },

@ -3,7 +3,7 @@
<myHeader></myHeader> <myHeader></myHeader>
<div class="body-container"> <div class="body-container">
<div class="tree-menu"> <div class="tree-menu">
<!-- <router-link <router-link
tag="div" tag="div"
:to="{ path: item.path }" :to="{ path: item.path }"
v-for="(item, index) in myRouter" v-for="(item, index) in myRouter"
@ -11,54 +11,11 @@
active-class="routerActive" active-class="routerActive"
> >
<div class="view-child"> <div class="view-child">
<img :src="item.icon" alt="" class="router-icon" /> <img :src="item.icon" alt="" class="router-icon" />
{{ item.name }} {{ item.name }}
</div> </div>
<div></div> <div></div>
</router-link> --> </router-link>
<el-menu
:default-active="routerIndex"
class="el-menu-vertical-demo"
:router="true"
background-color="#465970"
text-color="#fff"
>
<div
:index="item.path"
v-for="(item, index) in routerList"
:key="index"
>
<div v-if="item.children && item.children.length > 0">
<el-submenu index="">
<template slot="title">
<img :src="item.icon" alt="" class="leftIcon" />
<span>{{ item.name }}</span>
</template>
<el-menu-item-group v-if="item.children">
<el-menu-item
:index="itemb.path + '66'"
v-for="(itemb, index) in item.children"
:key="index + '3'"
:route="itemb.path"
>{{ itemb.name }}</el-menu-item
>
</el-menu-item-group>
</el-submenu>
</div>
<div v-else>
<el-menu-item
:index="item.path + '2'"
:key="index"
:route="item.path"
>
<template slot="title">
<img :src="item.icon" alt="" class="leftIcon" />
<span>{{ item.name }}</span>
</template></el-menu-item
>
</div>
</div>
</el-menu>
</div> </div>
<div class="view-box"> <div class="view-box">
<tags-view ref="tagsView" /> <tags-view ref="tagsView" />
@ -78,81 +35,19 @@ export default {
components: { myHeader, TagsView }, components: { myHeader, TagsView },
data() { data() {
return { return {
routerIndex: "1-1",
routerList: [
{
path: "/administrative",
name: "行政审批",
icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/administrative/index"),
meta: { title: "行政审批", icon: "netWork" },
},
{
path: "/A/enterpriseMsg",
name: "企业档案",
icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/enterpriseMsg/index"),
meta: { title: "企业档案", icon: "netWork" },
},
{
path: "/productsMsg",
name: "产品档案",
icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/index"),
redirect: "drugArchives",
isDiy: true,
children: [
{
path: "/productsMsg/drugArchives",
name: "药品档案",
icon: require("@/assets/images/tree4.svg"),
component: () =>
import("@/views/productsMsg/components/drugArchives.vue"),
meta: { title: "药品档案", icon: "netWork" },
},
{
path: "/productsMsg/cosmeticsArchives",
name: "化妆品档案",
icon: require("@/assets/images/tree4.svg"),
component: () =>
import("@/views/productsMsg/components/cosmeticsArchives.vue"),
meta: { title: "化妆品档案", icon: "netWork" },
},
{
path: "/productsMsg/health",
name: "医疗器械档案",
icon: require("@/assets/images/tree4.svg"),
component: () =>
import("@/views/productsMsg/components/health.vue"),
meta: { title: "医疗器械档案", icon: "netWork" },
},
],
},
{
path: "/B/logout",
name: "依法注销",
icon: require("@/assets/images/tree4.svg"),
component: () => import("@/views/logout/index"),
meta: { title: "依法注销", icon: "netWork" },
},
],
}; };
}, },
computed: { computed: {
// //
myRouter() { myRouter() {
console.log(this.$router.options.routes); console.log(this.$router.options.routes);
console.log( this.$router.options.routes[5].children);
// let staticRouter = router.options.routes.filter( // let staticRouter = router.options.routes.filter(
// (item) => item.isDiy == true // (item) => item.isDiy == true
// )[0].children; // )[0].children;
// return staticRouter; // return staticRouter;
// return this.$store.state.myselfPermission.routerList; // return this.$store.state.myselfPermission.routerList;
console.log(this.$router.options.routes[6].children); return this.$router.options.routes[5].children;
return this.$router.options.routes[6].children;
},
get1(e) {
console.log(e);
}, },
}, },
created() {}, created() {},
@ -160,9 +55,6 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep .el-submenu {
margin-right: -1px;
}
.leftIcon { .leftIcon {
display: inline-block; display: inline-block;
height: 14px; height: 14px;

Loading…
Cancel
Save