Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bkunyun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
Administrator
bkunyun
Commits
b51d512d
Commit
b51d512d
authored
Sep 01, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 项目列表展示当前用户对应项目的对应权限
parent
16ec17aa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
4 deletions
+32
-4
usePass.ts
src/hooks/usePass.ts
+7
-0
index.tsx
src/views/Project/components/ProjectListPopper/index.tsx
+25
-4
No files found.
src/hooks/usePass.ts
View file @
b51d512d
...
...
@@ -9,6 +9,13 @@ const roleList: any[] = [
{
OWNER
:
4
}
]
export
const
roleMap
=
{
VIEWER
:
'查看者'
,
USER
:
'研究员'
,
MANAGER
:
'管理员'
,
OWNER
:
'所有者'
,
}
const
usePass
=
()
=>
{
const
{
permissionStore
}
=
useStores
();
const
{
currentProjectStore
}
=
useStores
();
...
...
src/views/Project/components/ProjectListPopper/index.tsx
View file @
b51d512d
...
...
@@ -31,10 +31,31 @@ const ProjectListPopper = observer((props: any) => {
setName
(
e
.
target
.
value
);
};
const
getPower
=
(
projectRole
:
string
)
=>
{
if
(
projectRole
===
"VIEWER"
)
{
return
"查看者"
;
}
else
if
(
projectRole
===
"USER"
)
{
return
"研究员"
;
}
else
if
(
projectRole
===
"MANAGER"
)
{
return
"管理员"
;
}
else
if
(
projectRole
===
"OWNER"
)
{
return
"所有者"
;
}
else
{
return
""
;
}
};
const
list
=
useMemo
(()
=>
{
return
projectList
.
filter
((
item
:
any
)
=>
{
return
item
.
name
?.
indexOf
(
name
)
!==
-
1
;
});
return
projectList
.
filter
((
item
:
any
)
=>
{
return
item
.
name
?.
indexOf
(
name
)
!==
-
1
;
})
.
map
((
item
)
=>
{
return
{
...
item
,
power
:
getPower
(
item
.
projectRole
||
""
),
};
});
},
[
projectList
,
name
]);
console
.
log
(
list
);
...
...
@@ -105,7 +126,7 @@ const ProjectListPopper = observer((props: any) => {
<
div
className=
{
style
.
projectName
}
>
{
item
.
name
}
</
div
>
<
div
className=
{
style
.
projectOwnerTime
}
>
<
span
className=
{
style
.
projectOwner
}
title=
{
item
.
owner
}
>
{
item
.
own
er
}
{
item
.
pow
er
}
</
span
>
<
span
className=
{
style
.
projectTime
}
>
{
moment
(
item
.
createdAt
).
format
(
"YYYY-MM-DD"
)
}
...
...
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