Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
najiu-frontend
najiu-admin-template
Commits
76a5f87c
Commit
76a5f87c
authored
Jun 30, 2021
by
无木
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: `hasPermission` not work in `ROLE` Mode
parent
49e72a8e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
CHANGELOG.zh_CN.md
CHANGELOG.zh_CN.md
+3
-0
usePermission.ts
src/hooks/web/usePermission.ts
+6
-9
No files found.
CHANGELOG.zh_CN.md
View file @
76a5f87c
### ✨ Features
-
**Axios**
新增
`withToken`
配置,用于控制请求是否携带 token
-
**BasicUpload**
新增在预览
`Modal`
中删除文件时触发
`preview-delete`
事件
### 🐛 Bug Fixes
...
...
@@ -14,6 +15,8 @@
-
**LockScreen**
修复锁屏功能可以通过刷新页面或复制 URL 打开新的浏览器标签来跳过锁定状态的问题
-
修复多个窗口同时打开页面时,
`Token`
不会同步的问题
-
**Menu**
修复路由映射模式下,单级菜单刷新不会激活
-
修复
`ROLE`
权限模式下
`hasPermission`
不工作的问题
-
**Table**
修复启用
`clickToRowSelect`
时,点击行不会触发
`selection-change`
事件的问题
## 2.5.2(2021-06-27)
...
...
src/hooks/web/usePermission.ts
View file @
76a5f87c
...
...
@@ -57,13 +57,14 @@ export function usePermission() {
* Determine whether there is permission
*/
function
hasPermission
(
value
?:
RoleEnum
|
RoleEnum
[]
|
string
|
string
[],
def
=
true
):
boolean
{
// Visible by default
if
(
!
value
)
{
return
def
;
}
const
permMode
=
projectSetting
.
permissionMode
;
if
(
PermissionModeEnum
.
ROUTE_MAPPING
===
permMode
)
{
// Visible by default
if
(
!
value
)
{
return
def
;
}
if
([
PermissionModeEnum
.
ROUTE_MAPPING
,
PermissionModeEnum
.
ROLE
].
includes
(
permMode
))
{
if
(
!
isArray
(
value
))
{
return
userStore
.
getRoleList
?.
includes
(
value
as
RoleEnum
);
}
...
...
@@ -71,10 +72,6 @@ export function usePermission() {
}
if
(
PermissionModeEnum
.
BACK
===
permMode
)
{
// Visible by default
if
(
!
value
)
{
return
def
;
}
const
allCodeList
=
permissionStore
.
getPermCodeList
as
string
[];
if
(
!
isArray
(
value
))
{
return
allCodeList
.
includes
(
value
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment