Ant Design Pro 2(动态路由和菜单)

相关资料

Ant Design Pro 2 官方地址
https://pro.antdv.com/
官方源码git地址
https://github.com/vueComponent/ant-design-vue-pro.git

前言

基于Ant Design Pro 2改造时间为2021年5月,所以跟之前的版本有区别,跟之后的版本也会有区别, 因为官方给的案例实在模糊,特别是动态路由和菜单的地方,不得已只能修改其generatorDynamicRouter等相关方法

本地开发环境,会有误差

node v15.14.0
yarn v1.22.0
@vue/cli v4.5.12
ant-design-vue v1.7.2
vue-antd-pro v3.0.0
package.json详细信息我会整个房源放出来

vue-antd-pro源码大概解析,必须要理解

  • vue-antd-pro本地运行后,默认走的是本地数据mock,路由、菜单、用户基本信息、权限都是走的写死的数据,这只能提供参考,追踪代码看看怎么实现,如果需要改造成从服务端接口取相关数据,还得有得折腾。
  • 直接走代码,看登录后怎么实现菜单路由数据互交的,登录成功后走next方法,触发D:\WWW\ant-design-vue-pro\src\permission.js文件中的router.beforeEach事件,官方文档称为路由守卫,上代码。
  • 这里很容易出错,修改时要小心,毕竟在for循环中,一不小心就死循环了,这里调用了GetInfo方法,去查询写死的用户信息(里面包含了权限),然后在去查询GenerateRoutes方法,这个方法很重要,官方提供了两个文件,一个是给mock使用D:\WWW\ant-design-vue-pro\src\store\modules\permission.js,一个是给动态化接口读取使用D:\WWW\ant-design-vue-pro\src\store\modules\async-router.js,写法页略有不同
router.beforeEach((to, from, next) => {
  NProgress.start() // start progress bar
  to.meta && (typeof to.meta.title !== 'undefined' && setDocumentTitle(`${i18nRender(to.meta.title)} - ${domTitle}`))
  /* has token */
  if (storage.get(ACCESS_TOKEN)) {
    if (to.path === loginRoutePath) {
      next({ path: defaultRoutePath })
      NProgress.done()
    } else {
      // check login user.roles is null
      if (store.getters.roles.length === 0) {
        // request login userInfo
        store
          .dispatch('GetInfo')
          .then(res => {
            const roles = res.result && res.result.role
            // generate dynamic router
            store.dispatch('GenerateRoutes', { roles }).then(() => {
              // 根据roles权限生成可访问的路由表
              // 动态添加可访问路由表
              router.addRoutes(store.getters.addRouters)
              // 请求带有 redirect 重定向时,登录自动重定向到该地址
              const redirect = decodeURIComponent(from.query.redirect || to.path)
              if (to.path === redirect) {
                // set the replace: true so the navigation will not leave a history record
                next({ ...to, replace: true })
              } else {
                // 跳转到目的路由
                next({ path: redirect })
              }
            })
          })
          .catch(() => {
            notification.error({
              message: '错误',
              description: '请求用户信息失败,请重试'
            })
            // 失败时,获取用户信息失败时,调用登出,来清空历史保留信息
            store.dispatch('Logout').then(() => {
              next({ path: loginRoutePath, query: { redirect: to.fullPath } })
            })
          })
      } else {
        next()
      }
    }
  } else {
    if (allowList.includes(to.name)) {
      // 在免登录名单,直接进入
      next()
    } else {
      next({ path: loginRoutePath, query: { redirect: to.fullPath } })
      NProgress.done() // if current page is login will not trigger afterEach hook, so manually handle it
    }
  }
})
D:\WWW\ant-design-vue-pro\src\store\modules\permission.js的GenerateRoutes 方法
actions: {
    GenerateRoutes ({ commit }, data) {
      return new Promise(resolve => {
        const { roles } = data
        const accessedRouters = filterAsyncRouter(asyncRouterMap, roles)
        commit('SET_ROUTERS', accessedRouters)
        resolve()
      })
    }
  }
D:\WWW\ant-design-vue-pro\src\store\modules\async-router.js的GenerateRoutes 方法
actions: {
    GenerateRoutes ({ commit }, data) {
      return new Promise(resolve => {
        const { token } = data
        generatorDynamicRouter(token).then(routers => {
          commit('SET_ROUTERS', routers)
          resolve()
        })
      })
    }
  }
到这里就不在详细说明,可以自己走监听看看mock是怎么玩的,下面讲重点,怎么修改为由服务端接口提供权限、菜单给ant,并形成路由
1.修改api地址,仅供参考
D:\WWW\ant-design-vue-pro\src\utils\request.js
// 创建 axios 实例
const request = axios.create({
  // API 请求的默认前缀,如果不改,你请求的地址可能会带端口
  baseURL: 'http://localhost/api',
  timeout: 80000 // 请求超时时间,这里本地开发一定设置大一点,因为本地很慢,太慢超时接口会呗axios主动取消掉的
})
2.准备数据库表、相关接口,仅供参考
我用的yii2写的接口,重定向加路由会多一级,但是并不会影响,权限表可能需要根据文档形成格式才能返回,菜单直接返回即可

CREATE TABLE `s_role_menus` (
  `menus_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '菜单ID',
  `menus_fid` int(11) DEFAULT '0' COMMENT '菜单父id',
  `menus_name` varchar(20) DEFAULT NULL COMMENT '路由名称',
  `component` varchar(10) DEFAULT NULL COMMENT '页面组件,一级菜单默认RouteView,其他菜单为空',
  `hide_children_in_menu` smallint(1) DEFAULT NULL COMMENT '强制菜单显示为Item而不是SubItem(配合 meta.hidden)',
  `redirect` varchar(100) DEFAULT NULL COMMENT '重定向地址',
  `index` int(2) DEFAULT NULL COMMENT '同级排序',
  `meta_title` varchar(20) DEFAULT NULL COMMENT '路由标题',
  `meta_icon` varchar(20) DEFAULT NULL COMMENT '图标',
  `meta_keep_alive` smallint(1) DEFAULT '1' COMMENT '缓存该路由 (开启 multi-tab 是默认值为 true)',
  `target` varchar(10) DEFAULT NULL COMMENT '打开方式,如果是外链a,_blank、_self、_parent、_top、framename',
  PRIMARY KEY (`menus_id`)
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8 COMMENT='菜单表';

INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('1', '0', 'Dashboard', 'RouteView', NULL, '/dashboard', '1', '仪表盘', 'dashboard', '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('2', '1', 'Analysis', NULL, NULL, '/dashboard/analysis', '1', '分析页', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('3', '0', 'AdminUser', 'RouteView', NULL, '/admin', '2', '用户管理', 'user', '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('4', '3', 'User', NULL, NULL, '/admin/user', '1', '后台用户', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('5', '3', 'Role', NULL, NULL, '/admin/role', '2', '角色', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('6', '3', 'Route', NULL, NULL, '/admin/route', '3', '路由管理', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('7', '0', 'ClientUser', 'RouteView', NULL, '/clientUser', '3', '客户端用户', 'user', '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('8', '7', 'Member', NULL, NULL, '/clientUser/member', '1', '会员管理', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('9', '7', 'WxOauth', NULL, NULL, '/clientUser/wxOauth', '2', '微信授权', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('10', '0', 'Articles', 'RouteView', NULL, '/articles', '4', '文章管理', 'form', '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('11', '10', 'Release', NULL, NULL, '/articles/release', '1', '发布', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('12', '10', 'Comment', NULL, NULL, '/articles/comment', '2', '评论', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('13', '10', 'Report', NULL, NULL, '/articles/report', '3', '投诉举报', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('14', '10', 'Feedback', NULL, NULL, '/articles/feedback', '4', '反馈建议', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('15', '10', 'Collection', NULL, NULL, '/articles/collection', '5', '收藏', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('16', '10', 'Likes', NULL, NULL, '/articles/likes', '6', '点赞', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('17', '10', 'Common', NULL, NULL, '/articles/common', '7', '公共内容', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('18', '0', 'Security', 'RouteView', NULL, '/monitoring', '5', '安全管理', 'table', '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('19', '18', 'MonitoringApi', NULL, NULL, '/monitoring/api', '1', '接口列表', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('20', '18', 'SafetyIp', NULL, NULL, '/monitoring/safetyIp', '2', '白名单', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('21', '18', 'RiskIp', NULL, NULL, '/monitoring/riskIp', '3', '黑名单', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('22', '0', 'System', 'RouteView', NULL, '/system', '6', '系统管理', 'profile', '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('23', '22', 'SettingUp', '', NULL, '/system/settingUp', '1', '参数设置', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('24', '22', 'Menus', '', NULL, '/system/menus', '2', '后台菜单', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('25', '22', 'Notice', '', NULL, '/system/notice', '3', '消息通知', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('26', '22', 'Areas', '', NULL, '/system/areas', '4', '地区管理', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('27', '22', 'PhoneVerity', '', NULL, '/system/phoneVerity', '5', '短信验证码', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('28', '0', 'Log', 'RouteView', NULL, '/log', '7', '日志管理', 'warning', '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('29', '28', 'OperationLog', NULL, NULL, '/log/operationLog', '1', '操作日志', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('30', '28', 'PayLog', NULL, NULL, '/log/payLog', '2', '支付日志', NULL, '1', NULL);
INSERT INTO `op`.`s_role_menus` (`menus_id`, `menus_fid`, `menus_name`, `component`, `hide_children_in_menu`, `redirect`, `index`, `meta_title`, `meta_icon`, `meta_keep_alive`, `target`) VALUES ('31', '28', 'WaiLian', NULL, NULL, 'https://v2-pro.ant.design/components/description-list-cn', '3', '外部链接', NULL, '1', '_blank');

CREATE TABLE `u_permission_groups` (
  `permission_groups_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '权限ID',
  `business_object_id` varchar(32) DEFAULT NULL COMMENT '是否是菜单,1是菜单2功能按钮',
  `menus_id` int(11) DEFAULT NULL COMMENT '所属菜单ID',
  `describe` varchar(255) DEFAULT NULL COMMENT '权限说明',
  `interfaceurl` text COMMENT '接口URL',
  `action` varchar(20) DEFAULT NULL COMMENT '权限标识,唯一,如果是菜单跟name一致',
  `created_at` int(11) unsigned DEFAULT NULL COMMENT '创建时间',
  `updated_at` int(11) unsigned DEFAULT NULL COMMENT '修改时间',
  `cuser_id` int(11) unsigned DEFAULT NULL COMMENT '创建人ID',
  `uuser_id` int(11) unsigned DEFAULT NULL COMMENT '更新人ID',
  PRIMARY KEY (`permission_groups_id`)
) ENGINE=InnoDB AUTO_INCREMENT=137 DEFAULT CHARSET=utf8 COMMENT='权限表';

INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('1', '1', '1', '仪表盘', NULL, 'Dashboard', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('2', '1', '2', '分析页', NULL, 'Analysis', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('3', '2', '2', '查询', NULL, 'qurey', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('4', '1', '3', '用户管理', NULL, 'AdminUser', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('5', '1', '4', '后台用户', NULL, 'User', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('6', '2', '4', '新增', NULL, 'add', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('7', '2', '4', '查询', NULL, 'query', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('8', '2', '4', '详情', NULL, 'get', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('9', '2', '4', '修改', NULL, 'update', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('10', '2', '4', '删除', NULL, 'delete', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('11', '2', '4', '重置密码', NULL, 'ResetPassword', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('12', '1', '5', '角色', NULL, 'Role', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('13', '2', '5', '新增', NULL, 'add', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('14', '2', '5', '查询', NULL, 'query', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('15', '2', '5', '详情', NULL, 'get', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('16', '2', '5', '修改', NULL, 'update', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('17', '2', '5', '删除', NULL, 'delete', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('18', '1', '6', '路由管理', NULL, 'Route', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('19', '2', '6', '新增', NULL, 'add', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('20', '2', '6', '查询', NULL, 'query', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('21', '2', '6', '详情', NULL, 'get', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('22', '2', '6', '修改', NULL, 'update', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('23', '2', '6', '删除', NULL, 'delete', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('24', '1', '7', '客户端用户', NULL, 'ClientUser', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('25', '1', '8', '会员管理', NULL, 'Member', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('26', '2', '8', '新增', NULL, 'add', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('27', '2', '8', '查询', NULL, 'query', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('28', '2', '8', '详情', NULL, 'get', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('29', '2', '8', '修改', NULL, 'update', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('30', '2', '8', '删除', NULL, 'delete', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('31', '1', '9', '微信授权', NULL, 'WxOauth', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('32', '2', '9', '查询', NULL, 'query', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('33', '2', '9', '详情', NULL, 'get', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('34', '2', '9', '删除', NULL, 'delete', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('35', '1', '10', '文章管理', NULL, 'Articles', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('36', '1', '11', '发布', NULL, 'Release', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('37', '2', '11', '新增', NULL, 'add', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('38', '2', '11', '查询', NULL, 'query', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('39', '2', '11', '详情', NULL, 'get', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('40', '2', '11', '修改', NULL, 'update', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('41', '2', '11', '删除', NULL, 'delete', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('42', '1', '12', '评论', NULL, 'Comment', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('43', '2', '12', '新增', NULL, 'add', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('44', '2', '12', '查询', NULL, 'query', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('45', '2', '12', '详情', NULL, 'get', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('46', '2', '12', '修改', NULL, 'update', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('47', '2', '12', '删除', NULL, 'delete', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('48', '1', '13', '投诉举报', NULL, 'Report', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('49', '2', '13', '新增', NULL, 'add', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('50', '2', '13', '查询', NULL, 'query', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('51', '2', '13', '详情', NULL, 'get', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('52', '2', '13', '修改', NULL, 'update', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('53', '2', '13', '删除', NULL, 'delete', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('54', '1', '14', '反馈建议', NULL, 'Feedback', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('55', '2', '14', '新增', NULL, 'add', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('56', '2', '14', '查询', NULL, 'query', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('57', '2', '14', '详情', NULL, 'get', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('58', '2', '14', '修改', NULL, 'update', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('59', '2', '14', '删除', NULL, 'delete', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('60', '1', '15', '收藏', NULL, 'Collection', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('61', '2', '15', '新增', NULL, 'add', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('62', '2', '15', '查询', NULL, 'query', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('63', '2', '15', '详情', NULL, 'get', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('64', '2', '15', '修改', NULL, 'update', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('65', '2', '15', '删除', NULL, 'delete', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('66', '1', '16', '点赞', NULL, 'Likes', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('67', '2', '16', '新增', NULL, 'add', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('68', '2', '16', '查询', NULL, 'query', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('69', '2', '16', '详情', NULL, 'get', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('70', '2', '16', '修改', NULL, 'update', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('71', '2', '16', '删除', NULL, 'delete', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('72', '1', '17', '公共内容', NULL, 'Common', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('73', '2', '17', '新增', NULL, 'add', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('74', '2', '17', '查询', NULL, 'query', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('75', '2', '17', '详情', NULL, 'get', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('76', '2', '17', '修改', NULL, 'update', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('77', '2', '17', '删除', NULL, 'delete', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('78', '1', '18', '安全管理', NULL, 'Security', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('79', '1', '19', '接口列表', NULL, 'MonitoringApi', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('80', '2', '19', '新增', NULL, 'add', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('81', '2', '19', '查询', NULL, 'query', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('82', '2', '19', '详情', NULL, 'get', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('83', '2', '19', '修改', NULL, 'update', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('84', '2', '19', '删除', NULL, 'delete', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('85', '1', '20', '白名单', NULL, 'SafetyIp', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('86', '2', '20', '新增', NULL, 'add', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('87', '2', '20', '查询', NULL, 'query', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('88', '2', '20', '详情', NULL, 'get', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('89', '2', '20', '修改', NULL, 'update', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('90', '2', '20', '删除', NULL, 'delete', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('91', '1', '21', '黑名单', NULL, 'RiskIp', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('92', '2', '21', '新增', NULL, 'add', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('93', '2', '21', '查询', NULL, 'query', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('94', '2', '21', '详情', NULL, 'get', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('95', '2', '21', '修改', NULL, 'update', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('96', '2', '21', '删除', NULL, 'delete', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('97', '1', '22', '系统管理', NULL, 'System', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('98', '1', '23', '参数设置', NULL, 'SettingUp', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('99', '2', '23', '新增', NULL, 'add', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('100', '2', '23', '查询', NULL, 'query', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('101', '2', '23', '详情', NULL, 'get', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('102', '2', '23', '修改', NULL, 'update', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('103', '2', '23', '删除', NULL, 'delete', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('104', '1', '24', '后台菜单', NULL, 'Menus', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('105', '2', '24', '新增', NULL, 'add', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('106', '2', '24', '查询', NULL, 'query', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('107', '2', '24', '详情', NULL, 'get', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('108', '2', '24', '修改', NULL, 'update', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('109', '2', '24', '删除', NULL, 'delete', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('110', '1', '25', '消息通知', NULL, 'Notice', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('111', '2', '25', '新增', NULL, 'add', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('112', '2', '25', '查询', NULL, 'query', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('113', '2', '25', '详情', NULL, 'get', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('114', '2', '25', '修改', NULL, 'update', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('115', '2', '25', '删除', NULL, 'delete', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('116', '1', '26', '地区管理', NULL, 'Areas', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('117', '2', '26', '新增', NULL, 'add', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('118', '2', '26', '查询', NULL, 'query', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('119', '2', '26', '详情', NULL, 'get', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('120', '2', '26', '修改', NULL, 'update', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('121', '2', '26', '删除', NULL, 'delete', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('122', '1', '27', '短信验证码', NULL, 'PhoneVerity', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('123', '2', '27', '新增', NULL, 'add', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('124', '2', '27', '查询', NULL, 'query', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('125', '2', '27', '详情', NULL, 'get', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('126', '2', '27', '修改', NULL, 'update', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('127', '2', '27', '删除', NULL, 'delete', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('128', '1', '28', '日志管理', NULL, 'log', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('129', '1', '29', '操作日志', NULL, 'OperationLog', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('130', '2', '29', '查询', NULL, 'query', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('131', '2', '29', '详情', NULL, 'get', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('132', '2', '29', '删除', NULL, 'delete', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('133', '1', '30', '支付日志', NULL, 'PayLog', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('134', '2', '30', '查询', NULL, 'query', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('135', '2', '30', '详情', NULL, 'get', NULL, NULL, NULL, NULL);
INSERT INTO `op`.`u_permission_groups` (`permission_groups_id`, `business_object_id`, `menus_id`, `describe`, `interfaceurl`, `action`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('136', '2', '30', '删除', NULL, 'delete', NULL, NULL, NULL, NULL);

CREATE TABLE `u_user_info` (
  `user_info_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
  `username` varchar(30) DEFAULT NULL COMMENT '登陆账号',
  `password` varchar(32) DEFAULT NULL COMMENT '密码',
  `staff_state` smallint(1) DEFAULT '1' COMMENT '是否启用,1:Y 0:N',
  `name` varchar(50) DEFAULT NULL COMMENT '姓名',
  `phone` varchar(100) DEFAULT NULL COMMENT '手机号',
  `role_info_id` int(11) unsigned DEFAULT NULL COMMENT '角色ID',
  `user_remarks` varchar(255) DEFAULT NULL COMMENT '备注',
  `created_at` int(11) unsigned DEFAULT NULL COMMENT '创建时间',
  `updated_at` int(11) unsigned DEFAULT NULL COMMENT '修改时间',
  `cuser_id` int(11) unsigned DEFAULT NULL COMMENT '创建人ID',
  `uuser_id` int(11) unsigned DEFAULT NULL COMMENT '更新人ID',
  `tables` smallint(2) unsigned DEFAULT '1' COMMENT '附件关联表',
  PRIMARY KEY (`user_info_id`),
  KEY `u_user_info` (`username`,`role_info_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='用户表';

INSERT INTO `op`.`u_user_info` (`user_info_id`, `username`, `password`, `staff_state`, `name`, `phone`, `role_info_id`, `user_remarks`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`, `tables`) VALUES ('1', 'admin', 'e10adc3949ba59abbe56e057f20f883e', '1', '超级管理员', '18855565555', '1', NULL, '1578898101', '1607583948', '1', '192', '10');

CREATE TABLE `u_role_info` (
  `role_info_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '角色ID',
  `role_info_code` varchar(20) DEFAULT NULL COMMENT '角色编码',
  `role_info_name_cn` varchar(100) DEFAULT NULL COMMENT '角色名称(中文)',
  `role_info_name_en` varchar(100) DEFAULT NULL COMMENT '角色名称(英文)',
  `role_type_id` smallint(4) DEFAULT NULL COMMENT '角色类型ID',
  `user_info_remarks` varchar(255) DEFAULT NULL COMMENT '描述',
  `created_at` int(11) unsigned DEFAULT NULL COMMENT '创建时间',
  `updated_at` int(11) unsigned DEFAULT NULL COMMENT '修改时间',
  `cuser_id` int(11) unsigned DEFAULT NULL COMMENT '创建人ID',
  `uuser_id` int(11) unsigned DEFAULT NULL COMMENT '更新人ID',
  PRIMARY KEY (`role_info_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='角色表';

INSERT INTO `op`.`u_role_info` (`role_info_id`, `role_info_code`, `role_info_name_cn`, `role_info_name_en`, `role_type_id`, `user_info_remarks`, `created_at`, `updated_at`, `cuser_id`, `uuser_id`) VALUES ('1', '1', '系统超级管理员', NULL, '1', '这是超级管理', '1498198552', '1594893556', '192', '192');

相关接口

//用户信息和权限
public static function userInfo()
    {
        $user_info_id = Yii::$app->getUser()->getIdentity()->user_info_id;
        $UserModel = UUserInfo::find()
            ->alias('u')
            ->joinWith(['s_middle_file'])
            ->where(['user_info_id' => $user_info_id])
            ->asArray()
            ->one();
        $is_oss_upload = WxapiToolLogic::getOneConfig(['is_oss_upload']);
        if ($UserModel['s_middle_file']) {
            $UserModel['img_url'] = WxapiToolLogic::overwritePicUrl($UserModel['s_middle_file']['photos']['url'], $is_oss_upload);
        }
        if ($UserModel) {
            $URoleInfo = URoleInfo::find()
                ->where(['role_info_id' => $UserModel['role_info_id'], 'role_type_id' => 1])->asArray()->one();
//role_type_id=1表示有所有权限,其他还没有实验
            if ($URoleInfo) {
                //超级管理员,直接查询所有权限
                $UPermissionGroups = UPermissionGroups::find()->asArray()->all();
            } else {
                //...
            }

            //只要提取二级菜单,一级菜单在二级菜单存在时就默认有了?
            $role = [];
            foreach ($UPermissionGroups as $item) {
                if ($item['business_object_id'] == 1) {
                    $li = [
                        'roleId' => $UserModel['role_info_id'],
                        'permissionId' => $item['action'],
                        'permissionName' => $item['describe'],
                        'actionEntitySet' => [],
                        'actionList' => null,
                        'dataAccess' => null
                    ];
                    foreach ($UPermissionGroups as $key) {
                        if ($key['menus_id'] == $item['menus_id'] && $key['business_object_id'] == 2 ) {
                            array_push($li['actionEntitySet'], [
                                'action' => $key['action'],
                                'describe' => $key['describe'],
                                'defaultCheck' => false
                            ]);
                        }
                    }
                    if(count($li['actionEntitySet'])>0){
                        array_push($role, $li);
                    }

                }
            }
            //处理权限结构
            $user_list = [
                'id' => $UserModel['user_info_id'],
                'name' => $UserModel['name'],
                'username' => $UserModel['username'],
                'avatar' => $UserModel['img_url'],
                'roleId' => $UserModel['role_info_id'],
                'role' => [
                    'roleId' => $UserModel['role_info_id'],
                    'name' => $URoleInfo['role_info_name_cn'],
                    'describe' => $URoleInfo['user_info_remarks'],
                    'role_type_id' => $URoleInfo['role_type_id'],
                    'permissions' => $role
                ]
            ];
        }
        return $user_list;
    }

  //菜单获取
    public static function getNav()
    {
        $MenusModel = SRoleMenus::find()->asArray()->all();
        foreach ($MenusModel as &$item) {
            $item['menus_id'] = floatval($item['menus_id']);
            $item['menus_fid'] = floatval($item['menus_fid']);
        }
        return $MenusModel;
    }

请求后返回的结果参数

请求接口需要的token什么的,根据实际情况来就好
localhost/api/auser/userinfo/info
{
    "status": 200,
    "code": 0,
    "message": "操作成功!",
    "data": {
        "id": "1",
        "name": "超级管理员",
        "username": "admin",
        "avatar": "http://localhost/op/upload\\m_member\\1\\1_1611730511_wZUB.png",
        "roleId": "1",
        "role": {
            "roleId": "1",
            "name": "系统超级管理员",
            "describe": "这是超级管理",
            "role_type_id": "1",
            "permissions": [
                {
                    "roleId": "1",
                    "permissionId": "Analysis",
                    "permissionName": "分析页",
                    "actionEntitySet": [
                        {
                            "action": "qurey",
                            "describe": "查询",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                },
                {
                    "roleId": "1",
                    "permissionId": "User",
                    "permissionName": "后台用户",
                    "actionEntitySet": [
                        {
                            "action": "add",
                            "describe": "新增",
                            "defaultCheck": false
                        },
                        {
                            "action": "query",
                            "describe": "查询",
                            "defaultCheck": false
                        },
                        {
                            "action": "get",
                            "describe": "详情",
                            "defaultCheck": false
                        },
                        {
                            "action": "update",
                            "describe": "修改",
                            "defaultCheck": false
                        },
                        {
                            "action": "delete",
                            "describe": "删除",
                            "defaultCheck": false
                        },
                        {
                            "action": "ResetPassword",
                            "describe": "重置密码",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                },
                {
                    "roleId": "1",
                    "permissionId": "Role",
                    "permissionName": "角色",
                    "actionEntitySet": [
                        {
                            "action": "add",
                            "describe": "新增",
                            "defaultCheck": false
                        },
                        {
                            "action": "query",
                            "describe": "查询",
                            "defaultCheck": false
                        },
                        {
                            "action": "get",
                            "describe": "详情",
                            "defaultCheck": false
                        },
                        {
                            "action": "update",
                            "describe": "修改",
                            "defaultCheck": false
                        },
                        {
                            "action": "delete",
                            "describe": "删除",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                },
                {
                    "roleId": "1",
                    "permissionId": "Route",
                    "permissionName": "路由管理",
                    "actionEntitySet": [
                        {
                            "action": "add",
                            "describe": "新增",
                            "defaultCheck": false
                        },
                        {
                            "action": "query",
                            "describe": "查询",
                            "defaultCheck": false
                        },
                        {
                            "action": "get",
                            "describe": "详情",
                            "defaultCheck": false
                        },
                        {
                            "action": "update",
                            "describe": "修改",
                            "defaultCheck": false
                        },
                        {
                            "action": "delete",
                            "describe": "删除",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                },
                {
                    "roleId": "1",
                    "permissionId": "Member",
                    "permissionName": "会员管理",
                    "actionEntitySet": [
                        {
                            "action": "add",
                            "describe": "新增",
                            "defaultCheck": false
                        },
                        {
                            "action": "query",
                            "describe": "查询",
                            "defaultCheck": false
                        },
                        {
                            "action": "get",
                            "describe": "详情",
                            "defaultCheck": false
                        },
                        {
                            "action": "update",
                            "describe": "修改",
                            "defaultCheck": false
                        },
                        {
                            "action": "delete",
                            "describe": "删除",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                },
                {
                    "roleId": "1",
                    "permissionId": "WxOauth",
                    "permissionName": "微信授权",
                    "actionEntitySet": [
                        {
                            "action": "query",
                            "describe": "查询",
                            "defaultCheck": false
                        },
                        {
                            "action": "get",
                            "describe": "详情",
                            "defaultCheck": false
                        },
                        {
                            "action": "delete",
                            "describe": "删除",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                },
                {
                    "roleId": "1",
                    "permissionId": "Release",
                    "permissionName": "发布",
                    "actionEntitySet": [
                        {
                            "action": "add",
                            "describe": "新增",
                            "defaultCheck": false
                        },
                        {
                            "action": "query",
                            "describe": "查询",
                            "defaultCheck": false
                        },
                        {
                            "action": "get",
                            "describe": "详情",
                            "defaultCheck": false
                        },
                        {
                            "action": "update",
                            "describe": "修改",
                            "defaultCheck": false
                        },
                        {
                            "action": "delete",
                            "describe": "删除",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                },
                {
                    "roleId": "1",
                    "permissionId": "Comment",
                    "permissionName": "评论",
                    "actionEntitySet": [
                        {
                            "action": "add",
                            "describe": "新增",
                            "defaultCheck": false
                        },
                        {
                            "action": "query",
                            "describe": "查询",
                            "defaultCheck": false
                        },
                        {
                            "action": "get",
                            "describe": "详情",
                            "defaultCheck": false
                        },
                        {
                            "action": "update",
                            "describe": "修改",
                            "defaultCheck": false
                        },
                        {
                            "action": "delete",
                            "describe": "删除",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                },
                {
                    "roleId": "1",
                    "permissionId": "Report",
                    "permissionName": "投诉举报",
                    "actionEntitySet": [
                        {
                            "action": "add",
                            "describe": "新增",
                            "defaultCheck": false
                        },
                        {
                            "action": "query",
                            "describe": "查询",
                            "defaultCheck": false
                        },
                        {
                            "action": "get",
                            "describe": "详情",
                            "defaultCheck": false
                        },
                        {
                            "action": "update",
                            "describe": "修改",
                            "defaultCheck": false
                        },
                        {
                            "action": "delete",
                            "describe": "删除",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                },
                {
                    "roleId": "1",
                    "permissionId": "Feedback",
                    "permissionName": "反馈建议",
                    "actionEntitySet": [
                        {
                            "action": "add",
                            "describe": "新增",
                            "defaultCheck": false
                        },
                        {
                            "action": "query",
                            "describe": "查询",
                            "defaultCheck": false
                        },
                        {
                            "action": "get",
                            "describe": "详情",
                            "defaultCheck": false
                        },
                        {
                            "action": "update",
                            "describe": "修改",
                            "defaultCheck": false
                        },
                        {
                            "action": "delete",
                            "describe": "删除",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                },
                {
                    "roleId": "1",
                    "permissionId": "Collection",
                    "permissionName": "收藏",
                    "actionEntitySet": [
                        {
                            "action": "add",
                            "describe": "新增",
                            "defaultCheck": false
                        },
                        {
                            "action": "query",
                            "describe": "查询",
                            "defaultCheck": false
                        },
                        {
                            "action": "get",
                            "describe": "详情",
                            "defaultCheck": false
                        },
                        {
                            "action": "update",
                            "describe": "修改",
                            "defaultCheck": false
                        },
                        {
                            "action": "delete",
                            "describe": "删除",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                },
                {
                    "roleId": "1",
                    "permissionId": "Likes",
                    "permissionName": "点赞",
                    "actionEntitySet": [
                        {
                            "action": "add",
                            "describe": "新增",
                            "defaultCheck": false
                        },
                        {
                            "action": "query",
                            "describe": "查询",
                            "defaultCheck": false
                        },
                        {
                            "action": "get",
                            "describe": "详情",
                            "defaultCheck": false
                        },
                        {
                            "action": "update",
                            "describe": "修改",
                            "defaultCheck": false
                        },
                        {
                            "action": "delete",
                            "describe": "删除",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                },
                {
                    "roleId": "1",
                    "permissionId": "Common",
                    "permissionName": "公共内容",
                    "actionEntitySet": [
                        {
                            "action": "add",
                            "describe": "新增",
                            "defaultCheck": false
                        },
                        {
                            "action": "query",
                            "describe": "查询",
                            "defaultCheck": false
                        },
                        {
                            "action": "get",
                            "describe": "详情",
                            "defaultCheck": false
                        },
                        {
                            "action": "update",
                            "describe": "修改",
                            "defaultCheck": false
                        },
                        {
                            "action": "delete",
                            "describe": "删除",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                },
                {
                    "roleId": "1",
                    "permissionId": "MonitoringApi",
                    "permissionName": "接口列表",
                    "actionEntitySet": [
                        {
                            "action": "add",
                            "describe": "新增",
                            "defaultCheck": false
                        },
                        {
                            "action": "query",
                            "describe": "查询",
                            "defaultCheck": false
                        },
                        {
                            "action": "get",
                            "describe": "详情",
                            "defaultCheck": false
                        },
                        {
                            "action": "update",
                            "describe": "修改",
                            "defaultCheck": false
                        },
                        {
                            "action": "delete",
                            "describe": "删除",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                },
                {
                    "roleId": "1",
                    "permissionId": "SafetyIp",
                    "permissionName": "白名单",
                    "actionEntitySet": [
                        {
                            "action": "add",
                            "describe": "新增",
                            "defaultCheck": false
                        },
                        {
                            "action": "query",
                            "describe": "查询",
                            "defaultCheck": false
                        },
                        {
                            "action": "get",
                            "describe": "详情",
                            "defaultCheck": false
                        },
                        {
                            "action": "update",
                            "describe": "修改",
                            "defaultCheck": false
                        },
                        {
                            "action": "delete",
                            "describe": "删除",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                },
                {
                    "roleId": "1",
                    "permissionId": "RiskIp",
                    "permissionName": "黑名单",
                    "actionEntitySet": [
                        {
                            "action": "add",
                            "describe": "新增",
                            "defaultCheck": false
                        },
                        {
                            "action": "query",
                            "describe": "查询",
                            "defaultCheck": false
                        },
                        {
                            "action": "get",
                            "describe": "详情",
                            "defaultCheck": false
                        },
                        {
                            "action": "update",
                            "describe": "修改",
                            "defaultCheck": false
                        },
                        {
                            "action": "delete",
                            "describe": "删除",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                },
                {
                    "roleId": "1",
                    "permissionId": "SettingUp",
                    "permissionName": "参数设置",
                    "actionEntitySet": [
                        {
                            "action": "add",
                            "describe": "新增",
                            "defaultCheck": false
                        },
                        {
                            "action": "query",
                            "describe": "查询",
                            "defaultCheck": false
                        },
                        {
                            "action": "get",
                            "describe": "详情",
                            "defaultCheck": false
                        },
                        {
                            "action": "update",
                            "describe": "修改",
                            "defaultCheck": false
                        },
                        {
                            "action": "delete",
                            "describe": "删除",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                },
                {
                    "roleId": "1",
                    "permissionId": "Menus",
                    "permissionName": "后台菜单",
                    "actionEntitySet": [
                        {
                            "action": "add",
                            "describe": "新增",
                            "defaultCheck": false
                        },
                        {
                            "action": "query",
                            "describe": "查询",
                            "defaultCheck": false
                        },
                        {
                            "action": "get",
                            "describe": "详情",
                            "defaultCheck": false
                        },
                        {
                            "action": "update",
                            "describe": "修改",
                            "defaultCheck": false
                        },
                        {
                            "action": "delete",
                            "describe": "删除",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                },
                {
                    "roleId": "1",
                    "permissionId": "Notice",
                    "permissionName": "消息通知",
                    "actionEntitySet": [
                        {
                            "action": "add",
                            "describe": "新增",
                            "defaultCheck": false
                        },
                        {
                            "action": "query",
                            "describe": "查询",
                            "defaultCheck": false
                        },
                        {
                            "action": "get",
                            "describe": "详情",
                            "defaultCheck": false
                        },
                        {
                            "action": "update",
                            "describe": "修改",
                            "defaultCheck": false
                        },
                        {
                            "action": "delete",
                            "describe": "删除",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                },
                {
                    "roleId": "1",
                    "permissionId": "Areas",
                    "permissionName": "地区管理",
                    "actionEntitySet": [
                        {
                            "action": "add",
                            "describe": "新增",
                            "defaultCheck": false
                        },
                        {
                            "action": "query",
                            "describe": "查询",
                            "defaultCheck": false
                        },
                        {
                            "action": "get",
                            "describe": "详情",
                            "defaultCheck": false
                        },
                        {
                            "action": "update",
                            "describe": "修改",
                            "defaultCheck": false
                        },
                        {
                            "action": "delete",
                            "describe": "删除",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                },
                {
                    "roleId": "1",
                    "permissionId": "PhoneVerity",
                    "permissionName": "短信验证码",
                    "actionEntitySet": [
                        {
                            "action": "add",
                            "describe": "新增",
                            "defaultCheck": false
                        },
                        {
                            "action": "query",
                            "describe": "查询",
                            "defaultCheck": false
                        },
                        {
                            "action": "get",
                            "describe": "详情",
                            "defaultCheck": false
                        },
                        {
                            "action": "update",
                            "describe": "修改",
                            "defaultCheck": false
                        },
                        {
                            "action": "delete",
                            "describe": "删除",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                },
                {
                    "roleId": "1",
                    "permissionId": "OperationLog",
                    "permissionName": "操作日志",
                    "actionEntitySet": [
                        {
                            "action": "query",
                            "describe": "查询",
                            "defaultCheck": false
                        },
                        {
                            "action": "get",
                            "describe": "详情",
                            "defaultCheck": false
                        },
                        {
                            "action": "delete",
                            "describe": "删除",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                },
                {
                    "roleId": "1",
                    "permissionId": "PayLog",
                    "permissionName": "支付日志",
                    "actionEntitySet": [
                        {
                            "action": "query",
                            "describe": "查询",
                            "defaultCheck": false
                        },
                        {
                            "action": "get",
                            "describe": "详情",
                            "defaultCheck": false
                        },
                        {
                            "action": "delete",
                            "describe": "删除",
                            "defaultCheck": false
                        }
                    ],
                    "actionList": null,
                    "dataAccess": null
                }
            ]
        }
    }
}

localhost/api/auser/userinfo/nav
{
    "status": 200,
    "code": 0,
    "message": "操作成功!",
    "data": [
        {
            "menus_id": 1,
            "menus_fid": 0,
            "menus_name": "Dashboard",
            "component": "RouteView",
            "hide_children_in_menu": null,
            "redirect": "/dashboard",
            "index": "1",
            "meta_title": "仪表盘",
            "meta_icon": "dashboard",
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 2,
            "menus_fid": 1,
            "menus_name": "Analysis",
            "component": null,
            "hide_children_in_menu": null,
            "redirect": "/dashboard/analysis",
            "index": "1",
            "meta_title": "分析页",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 3,
            "menus_fid": 0,
            "menus_name": "AdminUser",
            "component": "RouteView",
            "hide_children_in_menu": null,
            "redirect": "/admin",
            "index": "2",
            "meta_title": "用户管理",
            "meta_icon": "user",
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 4,
            "menus_fid": 3,
            "menus_name": "User",
            "component": null,
            "hide_children_in_menu": null,
            "redirect": "/admin/user",
            "index": "1",
            "meta_title": "后台用户",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 5,
            "menus_fid": 3,
            "menus_name": "Role",
            "component": null,
            "hide_children_in_menu": null,
            "redirect": "/admin/role",
            "index": "2",
            "meta_title": "角色",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 6,
            "menus_fid": 3,
            "menus_name": "Route",
            "component": null,
            "hide_children_in_menu": null,
            "redirect": "/admin/route",
            "index": "3",
            "meta_title": "路由管理",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 7,
            "menus_fid": 0,
            "menus_name": "ClientUser",
            "component": "RouteView",
            "hide_children_in_menu": null,
            "redirect": "/clientUser",
            "index": "3",
            "meta_title": "客户端用户",
            "meta_icon": "user",
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 8,
            "menus_fid": 7,
            "menus_name": "Member",
            "component": null,
            "hide_children_in_menu": null,
            "redirect": "/clientUser/member",
            "index": "1",
            "meta_title": "会员管理",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 9,
            "menus_fid": 7,
            "menus_name": "WxOauth",
            "component": null,
            "hide_children_in_menu": null,
            "redirect": "/clientUser/wxOauth",
            "index": "2",
            "meta_title": "微信授权",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 10,
            "menus_fid": 0,
            "menus_name": "Articles",
            "component": "RouteView",
            "hide_children_in_menu": null,
            "redirect": "/articles",
            "index": "4",
            "meta_title": "文章管理",
            "meta_icon": "form",
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 11,
            "menus_fid": 10,
            "menus_name": "Release",
            "component": null,
            "hide_children_in_menu": null,
            "redirect": "/articles/release",
            "index": "1",
            "meta_title": "发布",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 12,
            "menus_fid": 10,
            "menus_name": "Comment",
            "component": null,
            "hide_children_in_menu": null,
            "redirect": "/articles/comment",
            "index": "2",
            "meta_title": "评论",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 13,
            "menus_fid": 10,
            "menus_name": "Report",
            "component": null,
            "hide_children_in_menu": null,
            "redirect": "/articles/report",
            "index": "3",
            "meta_title": "投诉举报",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 14,
            "menus_fid": 10,
            "menus_name": "Feedback",
            "component": null,
            "hide_children_in_menu": null,
            "redirect": "/articles/feedback",
            "index": "4",
            "meta_title": "反馈建议",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 15,
            "menus_fid": 10,
            "menus_name": "Collection",
            "component": null,
            "hide_children_in_menu": null,
            "redirect": "/articles/collection",
            "index": "5",
            "meta_title": "收藏",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 16,
            "menus_fid": 10,
            "menus_name": "Likes",
            "component": null,
            "hide_children_in_menu": null,
            "redirect": "/articles/likes",
            "index": "6",
            "meta_title": "点赞",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 17,
            "menus_fid": 10,
            "menus_name": "Common",
            "component": null,
            "hide_children_in_menu": null,
            "redirect": "/articles/common",
            "index": "7",
            "meta_title": "公共内容",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 18,
            "menus_fid": 0,
            "menus_name": "Security",
            "component": "RouteView",
            "hide_children_in_menu": null,
            "redirect": "/monitoring",
            "index": "5",
            "meta_title": "安全管理",
            "meta_icon": "table",
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 19,
            "menus_fid": 18,
            "menus_name": "MonitoringApi",
            "component": null,
            "hide_children_in_menu": null,
            "redirect": "/monitoring/api",
            "index": "1",
            "meta_title": "接口列表",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 20,
            "menus_fid": 18,
            "menus_name": "SafetyIp",
            "component": null,
            "hide_children_in_menu": null,
            "redirect": "/monitoring/safetyIp",
            "index": "2",
            "meta_title": "白名单",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 21,
            "menus_fid": 18,
            "menus_name": "RiskIp",
            "component": null,
            "hide_children_in_menu": null,
            "redirect": "/monitoring/riskIp",
            "index": "3",
            "meta_title": "黑名单",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 22,
            "menus_fid": 0,
            "menus_name": "System",
            "component": "RouteView",
            "hide_children_in_menu": null,
            "redirect": "/system",
            "index": "6",
            "meta_title": "系统管理",
            "meta_icon": "profile",
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 23,
            "menus_fid": 22,
            "menus_name": "SettingUp",
            "component": "",
            "hide_children_in_menu": null,
            "redirect": "/system/settingUp",
            "index": "1",
            "meta_title": "参数设置",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 24,
            "menus_fid": 22,
            "menus_name": "Menus",
            "component": "",
            "hide_children_in_menu": null,
            "redirect": "/system/menus",
            "index": "2",
            "meta_title": "后台菜单",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 25,
            "menus_fid": 22,
            "menus_name": "Notice",
            "component": "",
            "hide_children_in_menu": null,
            "redirect": "/system/notice",
            "index": "3",
            "meta_title": "消息通知",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 26,
            "menus_fid": 22,
            "menus_name": "Areas",
            "component": "",
            "hide_children_in_menu": null,
            "redirect": "/system/areas",
            "index": "4",
            "meta_title": "地区管理",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 27,
            "menus_fid": 22,
            "menus_name": "PhoneVerity",
            "component": "",
            "hide_children_in_menu": null,
            "redirect": "/system/phoneVerity",
            "index": "5",
            "meta_title": "短信验证码",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 28,
            "menus_fid": 0,
            "menus_name": "Log",
            "component": "RouteView",
            "hide_children_in_menu": null,
            "redirect": "/log",
            "index": "7",
            "meta_title": "日志管理",
            "meta_icon": "warning",
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 29,
            "menus_fid": 28,
            "menus_name": "OperationLog",
            "component": null,
            "hide_children_in_menu": null,
            "redirect": "/log/operationLog",
            "index": "1",
            "meta_title": "操作日志",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 30,
            "menus_fid": 28,
            "menus_name": "PayLog",
            "component": null,
            "hide_children_in_menu": null,
            "redirect": "/log/payLog",
            "index": "2",
            "meta_title": "支付日志",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": null
        },
        {
            "menus_id": 31,
            "menus_fid": 28,
            "menus_name": "WaiLian",
            "component": null,
            "hide_children_in_menu": null,
            "redirect": "https://v2-pro.ant.design/components/description-list-cn",
            "index": "3",
            "meta_title": "外部链接",
            "meta_icon": null,
            "meta_keep_alive": "1",
            "target": "_blank"
        }
    ]
}
3.userApi修改
D:\WWW\ant-design-vue-pro\src\api\login.js
  // get my info
  UserInfo: '/auser/userinfo/info', // 用户信息
  UserMenu: '/auser/userinfo/nav' // 菜单信息
4.关闭mock
D:\WWW\ant-design-vue-pro\src\main.js
// import './mock' //注释掉
5.permission声明修改
D:\WWW\ant-design-vue-pro\src\store\index.js
import Vue from 'vue'
import Vuex from 'vuex'

import app from './modules/app'
import user from './modules/user'

// default router permission control
// import permission from './modules/permission' // 注释掉本行,不要走死数据方法

// dynamic router permission control (Experimental)
import permission from './modules/async-router'//动态路由菜单
import getters from './getters'
6.listToTree、generator方法修改
注意下,如果path是正确的路径,就不要在走一次重定向了redirect,会陷入死循环,直接内存溢出
/**
 * 数组转树形结构
 * @param list 源数组
 * @param tree 树
 * @param parentId 父ID
 */
const listToTree = (list, tree, parentId) => {
  list.forEach(item => {
    // 判断是否为父级菜单
    if (item.menus_fid === parentId) {
      // eslint-disable-next-line no-unused-vars
      let com = ''
      if (parentId === 0) {
        if (item.component === 'RouteView') {
          com = RouteView
        } else {
          com = BasicLayout
        }
      } else {
        if (!item.redirect.startsWith('http')) {
          com = () => import(`@/views${item.redirect}`)
        }
      }
      const child = {
        path: item.redirect,
        name: item.menus_name,
        children: [],
        component: com,
        meta: { title: item.meta_title, keepAlive: true, icon: item.meta_icon || '', permission: [ item.menus_name ] }
      }
      if (item.redirect.startsWith('http')) {
        child.meta.target = item.target
      }
      // 迭代 list, 找到当前菜单相符合的所有子菜单
      listToTree(list, child.children, item.menus_id)
      // 删掉不存在 children 值的属性
      if (child.children.length <= 0) {
        delete child.children
      }
      // 加入到树中
      tree.push(child)
    }
  })
}

/**
 * 格式化树形结构数据 生成 vue-router 层级路由表
 *
 * @param routerMap
 * @param parent
 * @returns {*}
 */
export const generator = (routerMap, parent) => {
  return routerMap.map(item => {
    const currentRouter = item
    // 是否设置了隐藏菜单
    if (item.show === false) {
      currentRouter.hidden = true
    }
    // 是否设置了隐藏子菜单
    if (item.hide_children_in_menu) {
      currentRouter.hideChildrenInMenu = true
      currentRouter.meta.hidden = true
    }
    // 为了防止出现后端返回结果不规范,处理有可能出现拼接出两个 反斜杠
    if (currentRouter.path.startsWith('http')) {
      currentRouter.path = currentRouter.path.replace('//', '/')
    }
    // 菜单缓存
    if (item.meta_keep_alive === '1') {
      currentRouter.meta.keepAlive = true
    } else {
      currentRouter.meta.keepAlive = false
    }
    // 是否有子菜单,并递归处理
    if (item.children && item.children.length > 0) {
      // Recursion
      currentRouter.children = generator(item.children, currentRouter)
    }
    return currentRouter
  })
}
7.去掉特殊的变量
D:\WWW\ant-design-vue-pro\src\config\router.config.js
asyncRouterMap变量中的
{
    path: '*',
    redirect: '/404',
    hidden: true
  }
这个要保留,前面路由可以注释掉
constantRouterMap 基础路由不要删除,不然你登录什么的都不见了。。
D:\WWW\ant-design-vue-pro\src\router\generator-routers.js中的constantRouterComponents,按照当前的写法,会暂时用不到

rootRouter这个需要改下
const rootRouter = {
  key: '',
  name: 'index',
  path: '/',//默认是空,需要给/
  component: BasicLayout,
  redirect: '/dashboard/analysis',//默认进的也随意
  meta: {
    title: '首页'
  },
  children: []
}

到了这里运行代码,登录是可以看到菜单了

其实如果大改ant的菜单路由方法,很快就可以改好,但是我还是想尽量用ant带的方法,也为后面升级减少麻烦,特别是路由菜单的一些属性,是可以用的,如果完全抛弃就有点浪费了,可以好好看看D:\WWW\ant-design-vue-pro\src\config\router.config.js方法里面的写死的路由菜单,把属性提取出来放数据库去管理也是可以的。还得是要跟项目实际配合,有一些功能还没有实验到,大家如果感兴趣可以自己拓展拓展,一旦形成公司基础框架,后面也会很少改动了。

image.png
image.png
image.png

最后

ant改动的这版我不会在单独维护,剩下就是跟项目耦合了,放出来也不怎么合适,源码在百度网盘
链接:https://pan.baidu.com/s/1-T9z0jSHknKUZUXGEn40Yg
提取码:ksy1

你可能感兴趣的:(Ant Design Pro 2(动态路由和菜单))