研发图纸文件管理系统-前端项目
chenghongxing
2020-08-10 23cf2fab0b525c4737eeb14a571b863e3152882a
fix: the exception when using authorize inject function; :bug:
修复:使用权限校验注入功能时出现的异常;
2个文件已修改
9 ■■■■■ 已修改文件
src/plugins/authority-plugin.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/config.js 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/plugins/authority-plugin.js
@@ -31,7 +31,7 @@
const auth = function(authConfig, permission, role, permissions, roles) {
  const {check, type} = authConfig
  if (check && typeof check === 'function') {
    return check(permission, role, permissions, roles)
    return check.apply(this, [permission, role, permissions, roles])
  } else {
    if (type === 'permission') {
      return permission && permission.operation && permission.operation.indexOf(check) !== -1
@@ -96,7 +96,7 @@
                this.$options.methods[key] = function () {
                  //--auth-inject
                  if (this.$auth(check, type)) {
                    return method(...arguments)
                    return method.apply(this, arguments)
                  } else {
                    if (onFailure && typeof onFailure === 'function') {
                      this[`$${check}Failure`] = onFailure
@@ -128,7 +128,7 @@
          if (!type) {
            type = permission ? 'permission' : 'role'
          }
          return auth({check, type}, permission, role, permissions, roles)
          return auth.apply(this, [{check, type}, permission, role, permissions, roles])
        }
      }
    })
src/router/config.js
@@ -82,6 +82,9 @@
            {
              path: 'query',
              name: '查询表格',
              meta: {
                authority: 'queryForm',
              },
              component: () => import('@/pages/list/QueryList'),
            },
            {