新建角色菜单

DAY DAY UP 2021年05月07日 250次浏览

1.添加数据库

role
menu
role_menu
user
role_user

  1. 前端登入页、路由、侧边栏路由调整

修改 page/index/sidebar/index.vue

created() {
      if(this.nowTagValue == '/wel/index' || this.nowTagValue == '/admin/index' || this.nowTagValue == "/dataCenter/index" || this.nowTagValue =="/operationAndMaintenanceBackground"){
      this.handleMenu(this.menuType);
    }

修改 page/index/index.vue

crumb(){
      const {
        $route,
      } = this;
      const {
        path,
        meta,
      } = $route;
      if (["/", "/wel/index", "/admin/index","/operationAndMaintenanceBackground","/dataCenter/index","/formPortrait/formDataFillOverview/index"].includes(path)) {
        return [];
      }

修改 login/userlogin.vue

if (arr[i].role_name == "superAdmin") {
                        //设置跳转路由
                        website.setFistPage("/operationAndMaintenanceBackground");
                        this.$router.push({ path: "/operationAndMaintenanceBackground" });
                      }

修改 router/page/index.js

{
        path: "/operationAndMaintenanceBackground",
        component: Layout,
        //没有首页直接重定向
        redirect: "/operationAndMaintenanceBackground/systemManage/roleManage/index",
        children: [
          /*{
            path: "index",
            name: "角色管理",//没有首页 直接进入第一个菜单
            component: () => import(/!* webpackChunkName: "views" *!/ "@/views/operationAndMaintenanceBackground/systemManage/roleManage/index")
          }*/
        ]
      },
      {
        path: "/operationAndMaintenanceBackground/systemManage/roleManage",
        component: Viewlayout,
        children: [
          {
            path: "index",
            name: "角色管理",
            component: () => import("@/views/operationAndMaintenanceBackground/systemManage/roleManage")
          }
        ]
      },